|
|
|
Re: Ruby module in DLTK [message #24759 is a reply to message #24640] |
Fri, 30 May 2008 08:12 |
Andrei Sobolev 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 |
Felix L J Mayer 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
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.02292 seconds