Exemple #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;
    }
Exemple #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()]);
  }
  /** 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));
    }
  }