/**
   * If modified, also modify the method {@link ModelManager#getDefaultOptionsNoInitialization()}
   */
  @Override
  public void initializeDefaultPreferences() {
    // Get options names set
    HashSet<String> optionNames = ModelManager.getModelManager().optionNames;

    Map<String, String> defaultOptionsMap = new HashMap<String, String>();

    // DLTKCore settings
    defaultOptionsMap.put(DLTKCore.CORE_INCOMPLETE_BUILDPATH, DLTKCore.ERROR);
    defaultOptionsMap.put(DLTKCore.CORE_CIRCULAR_BUILDPATH, DLTKCore.ERROR);
    defaultOptionsMap.put(DLTKCore.CORE_ENABLE_BUILDPATH_EXCLUSION_PATTERNS, DLTKCore.ENABLED);
    defaultOptionsMap.put(DLTKCore.INDEXER_ENABLED, DLTKCore.ENABLED);
    defaultOptionsMap.put(DLTKCore.BUILDER_ENABLED, DLTKCore.ENABLED);
    defaultOptionsMap.put(DLTKCore.CODEASSIST_CAMEL_CASE_MATCH, DLTKCore.ENABLED);

    // encoding setting comes from resource plug-in
    optionNames.add(DLTKCore.CORE_ENCODING);

    // project-specific options
    optionNames.add(DLTKCore.PROJECT_SOURCE_PARSER_ID);

    // Store default values to default preferences
    IEclipsePreferences defaultPreferences = new DefaultScope().getNode(DLTKCore.PLUGIN_ID);
    for (Map.Entry<String, String> entry : defaultOptionsMap.entrySet()) {
      String optionName = entry.getKey();
      defaultPreferences.put(optionName, entry.getValue());
      optionNames.add(optionName);
    }
  }
  public synchronized void cleanUp(IProgressMonitor monitor) throws CoreException {
    DeltaProcessingState state = ModelManager.getModelManager().deltaState;
    HashMap roots = state.roots;
    // HashMap sourceAttachments = state.sourceAttachments;
    if (roots == null /* && sourceAttachments == null */) return;
    HashMap knownFolders = getFolders();
    Iterator iterator = knownFolders.keySet().iterator();
    while (iterator.hasNext()) {
      IPath path = (IPath) iterator.next();
      if ((roots != null && !roots.containsKey(path))
      /*
       * & (sourceAttachments != null && !sourceAttachments
       * .containsKey(path))
       */ ) {
        IFolder folder = (IFolder) knownFolders.get(path);
        if (folder != null) folder.delete(true, monitor);
      }
    }
    IProject project = getExternalFoldersProject();
    if (project.isAccessible() && project.members().length == 1 /*
																	 * remaining
																	 * member is
																	 * .project
																	 */) project.delete(true, monitor);
  }
Ejemplo n.º 3
0
 /** Creates a SearchableEnvironment on the given project */
 public SearchableEnvironment(ScriptProject project, WorkingCopyOwner owner)
     throws ModelException {
   this(
       project,
       owner == null
           ? null
           : ModelManager.getModelManager().getWorkingCopies(owner, true)); // add primary WCs
 }
Ejemplo n.º 4
0
 public ISourceModule[] getSourceModules(WorkingCopyOwner owner) {
   ISourceModule[] workingCopies =
       ModelManager.getModelManager().getWorkingCopies(owner, false /* don't add primary */);
   if (workingCopies == null) return ModelManager.NO_WORKING_COPY;
   int length = workingCopies.length;
   ISourceModule[] result = new ISourceModule[length];
   int index = 0;
   for (int i = 0; i < length; i++) {
     ISourceModule wc = workingCopies[i];
     IResource res = wc.getResource();
     boolean valid;
     if (res != null) valid = Util.isValidSourceModule(this, res);
     else valid = Util.isValidSourceModule(this, wc.getPath());
     if (equals(wc.getParent()) && !Util.isExcluded(wc) && valid) {
       result[index++] = wc;
     }
   }
   if (index != length) {
     System.arraycopy(result, 0, result = new ISourceModule[index], 0, index);
   }
   return result;
 }
Ejemplo n.º 5
0
  public boolean refreshSourceFields() throws ModelException {
    if (jstType == null || !jstType.hasMixins()) { // only refresh types
      // with mixins
      return false;
    }

    ModelManager manager = ModelManager.getModelManager();

    // mixin types maybe changed, refresh the member fields
    try {
      final String natureId = getNatureId();
      final VjoSourceElementParser parser =
          (VjoSourceElementParser) getSourceElementParser(natureId);
      HashMap newElements = new HashMap();
      JSSourceModuleElementInfo info = (JSSourceModuleElementInfo) createElementInfo();

      final VjoSourceModuleStructureRequestor requestor =
          new VjoSourceModuleStructureRequestor(this, info, newElements);

      if (!isReadOnly()) {
        ((ISourceElementParserExtension) parser).setScriptProject(this.getScriptProject());
      }

      parser.setRequestor(requestor);

      final AccumulatingProblemReporter problemReporter = getAccumulatingProblemReporter();
      parser.setReporter(problemReporter);

      SourceParserUtil.parseSourceModule(this, parser);

      manager.putInfos(this, newElements);

      return true;
    } catch (CoreException e) {
      throw new ModelException(e);
    }
  }