[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.technology.dltk] Re: Ruby module in DLTK
|
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
>
>