示例#1
0
 protected ISourceModuleFactory getSourceModuleFactory(String moduleName) {
   IPath modulePath = path.append(moduleName);
   IDLTKLanguageToolkit toolkit = DLTKLanguageManager.findToolkit(modulePath);
   ISourceModuleFactory factory = null;
   if (toolkit != null) {
     String natureId = toolkit.getNatureId();
     factory = DLTKLanguageManager.getSourceModuleFactory(natureId);
   }
   return factory;
 }
    protected String resolve(TemplateContext context) {
      String name = null;
      ISourceModule module = getSourceModule(context);
      IDLTKLanguageToolkit toolkit = DLTKLanguageManager.getLanguageToolkit(module);

      name = toolkit.getLanguageName();

      return name;
    }
示例#3
0
  public IScriptProject[] getScriptProjects(String nature) throws ModelException {
    final List list = getChildrenOfType(SCRIPT_PROJECT);
    final List result = new ArrayList();
    for (int i = 0; i < list.size(); i++) {
      IScriptProject project = (IScriptProject) list.get(i);
      IDLTKLanguageToolkit toolkit = DLTKLanguageManager.getLanguageToolkit(project);
      if (toolkit.getNatureId().equals(nature)) {
        result.add(project);
      }
    }

    return (IScriptProject[]) result.toArray(new IScriptProject[result.size()]);
  }
示例#4
0
  /** Creates a SearchableEnvironment on the given project */
  public SearchableEnvironment(
      ScriptProject project, org.eclipse.dltk.mod.core.ISourceModule[] workingCopies)
      throws ModelException {

    this.project = project;
    this.checkAccessRestrictions =
        !DLTKCore.IGNORE.equals(project.getOption(DLTKCore.COMPILER_PB_FORBIDDEN_REFERENCE, true))
            || !DLTKCore.IGNORE.equals(
                project.getOption(DLTKCore.COMPILER_PB_DISCOURAGED_REFERENCE, true));

    this.workingCopies = workingCopies;

    this.nameLookup = project.newNameLookup(workingCopies);

    // Create search scope with visible entry on the project's buildpath
    if (this.checkAccessRestrictions) {
      this.searchScope = BasicSearchEngine.createSearchScope(project);
    } else {
      this.searchScope =
          BasicSearchEngine.createSearchScope(
              this.nameLookup.projectFragments, DLTKLanguageManager.getLanguageToolkit(project));
    }
  }