*/
protected IDLTKSearchScope getScope(String scope, int type, IProject project)
throws Exception
{
boolean includeInterpreterEnvironment = false;
DLTKSearchScopeFactory factory = DLTKSearchScopeFactory.getInstance();
IDLTKLanguageToolkit toolkit = null;
ProjectManager manager = ProjectManagement.getProjectManager(getNature());
if(manager instanceof DltkProjectManager){
DltkProjectManager dltkManager = (DltkProjectManager)manager;
toolkit = dltkManager.getLanguageToolkit(dltkManager.getNatureId());
}
if (toolkit == null && project != null){
for(String nature : ProjectManagement.getProjectManagerNatures()){
if(project.hasNature(nature)){
manager = ProjectManagement.getProjectManager(nature);
if(manager instanceof DltkProjectManager){
DltkProjectManager dltkManager = (DltkProjectManager)manager;
toolkit = dltkManager.getLanguageToolkit(dltkManager.getNatureId());
break;
}
}
}
}
IDLTKSearchScope searchScope = null;
if (SCOPE_PROJECT.equals(scope)){
String[] names = new String[]{project.getName()};
searchScope = factory.createProjectSearchScope(
names, includeInterpreterEnvironment, toolkit);
}else{ // workspace
searchScope = factory.createWorkspaceScope(
includeInterpreterEnvironment, toolkit);
}
return searchScope;
}