Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Ruby module in DLTK
Ruby module in DLTK [message #24640] Thu, 29 May 2008 18:51 Go to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I am writing some code that looks at the Ruby ITypes within an
ISourceModule. I guess it makes makes (but is a little confusing) that a
Ruby module becomes an IType, but is there any way to easily distinguish
Ruby modules from Ruby classes?

Another issue I have is that IScriptProject.findType(String,
IProgressMonitor) does not find the above Ruby module when I use
IType.getFullyQualifiedName() as the first parameters. What am I doing
wrong?

Thanks, Felix
Re: Ruby module in DLTK [message #24681 is a reply to message #24640] Thu, 29 May 2008 20:00 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Never mind the second question, this simply hasn't been implemented in DLTK
1.0RC1.

"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:g1mtvo$n7e$1@build.eclipse.org...
>I am writing some code that looks at the Ruby ITypes within an
>ISourceModule. I guess it makes makes (but is a little confusing) that a
>Ruby module becomes an IType, but is there any way to easily distinguish
>Ruby modules from Ruby classes?
>
> Another issue I have is that IScriptProject.findType(String,
> IProgressMonitor) does not find the above Ruby module when I use
> IType.getFullyQualifiedName() as the first parameters. What am I doing
> wrong?
>
> Thanks, Felix
>
Re: Ruby module in DLTK [message #24721 is a reply to message #24640] Fri, 30 May 2008 05:15 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Felix,

You can distinguish them by class:
org.eclipse.dltk.ruby.ast.RubyModuleDeclaration
org.eclipse.dltk.ruby.ast.RubyClassDeclaration

Regards,
Alex


Felix L J Mayer wrote:
> I am writing some code that looks at the Ruby ITypes within an
> ISourceModule. I guess it makes makes (but is a little confusing) that a
> Ruby module becomes an IType, but is there any way to easily distinguish
> Ruby modules from Ruby classes?
Re: Ruby module in DLTK [message #24759 is a reply to message #24640] Fri, 30 May 2008 08:12 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Felix,

> I am writing some code that looks at the Ruby ITypes within an
> ISourceModule. I guess it makes makes (but is a little confusing) that a
> Ruby module becomes an IType, but is there any way to easily distinguish
> Ruby modules from Ruby classes?

For this purpose you need to call IType.getFlags() method and check for Modifiers.AccModule flag. It it is set then
IType is a module. If not set then it is class.
>
> Another issue I have is that IScriptProject.findType(String,
> IProgressMonitor) does not find the above Ruby module when I use
> IType.getFullyQualifiedName() as the first parameters. What am I doing
> wrong?

To find types you should use SearchEngine.searchAllTypeNames() methods.

Example of using it to search types by name:

IProject prj = myProject;
IScriptProject project = DLTKCore.create(prj);
String patternString = "myClass*";

// Requestor will accept matches
TypeNameMatchRequestor requestor = myRequestor;
IDLTKSearchScope scope = SearchEngine.createSearchScope(project);
try {
SearchEngine engine = new SearchEngine();
engine.searchAllTypeNames(null, 0, patternString.toCharArray(),
SearchPattern.R_EXACT_MATCH | SearchPattern.R_PATTERN_MATCH,
IDLTKSearchConstants.TYPE, scope, requestor,
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
} catch (CoreException e) {
e.printStackTrace();
}


For more information about search you could look at SearchTests class from org.eclipse.dltk.tcl.core.tests plugin.
>
> Thanks, Felix
>
>
Re: Ruby module in DLTK [message #25013 is a reply to message #24759] Wed, 04 June 2008 19:14 Go to previous message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Thanks for the helpful answers. Is there also a way to search within the
context of a IType? I would like to find the ITypes that correspond to an
ITypes superclass names. The original IType will typically have imports and
such that uniquely define the superclasses, but the search engine might find
additional ITypes that have the right name.


"Andrei Sobolev" <haiodo@xored.com> wrote in message
news:g1oct5$ifi$1@build.eclipse.org...
> Hi Felix,
>
>> I am writing some code that looks at the Ruby ITypes within an
>> ISourceModule. I guess it makes makes (but is a little confusing) that a
>> Ruby module becomes an IType, but is there any way to easily distinguish
>> Ruby modules from Ruby classes?
>
> For this purpose you need to call IType.getFlags() method and check for
> Modifiers.AccModule flag. It it is set then
> IType is a module. If not set then it is class.
>>
>> Another issue I have is that IScriptProject.findType(String,
>> IProgressMonitor) does not find the above Ruby module when I use
>> IType.getFullyQualifiedName() as the first parameters. What am I doing
>> wrong?
>
> To find types you should use SearchEngine.searchAllTypeNames() methods.
>
> Example of using it to search types by name:
>
> IProject prj = myProject;
> IScriptProject project = DLTKCore.create(prj);
> String patternString = "myClass*";
>
> // Requestor will accept matches
> TypeNameMatchRequestor requestor = myRequestor;
> IDLTKSearchScope scope = SearchEngine.createSearchScope(project);
> try {
> SearchEngine engine = new SearchEngine();
> engine.searchAllTypeNames(null, 0, patternString.toCharArray(),
> SearchPattern.R_EXACT_MATCH | SearchPattern.R_PATTERN_MATCH,
> IDLTKSearchConstants.TYPE, scope, requestor,
> IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
> } catch (CoreException e) {
> e.printStackTrace();
> }
>
>
> For more information about search you could look at SearchTests class from
> org.eclipse.dltk.tcl.core.tests plugin.
>>
>> Thanks, Felix
>>
>>
Previous Topic:RSE plugin integration with dltk
Next Topic:FieldDeclaration not included in Outline view
Goto Forum:
  


Current Time: Fri Apr 26 00:10:37 GMT 2024

Powered by FUDForum. Page generated in 0.03755 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top