Пример #1
0
 @Override
 public void setContainer(ICOptionContainer container) {
   super.setContainer(container);
   if (getContainer().getProject() != null) {
     try {
       fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), fBuilderID);
     } catch (CoreException e) {
     }
   } else {
     fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
   }
 }
Пример #2
0
  @Override
  public void performDefaults() {
    // Missing builder info
    if (fBuildInfo == null) {
      return;
    }
    IMakeBuilderInfo info;
    if (getContainer().getProject() != null) {
      info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, false);
    } else {
      info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, true);
    }
    if (info.isStopOnError()) stopOnErrorButton.setSelection(true);
    else stopOnErrorButton.setSelection(false);
    if (info.getBuildCommand() != null) {
      StringBuffer cmd = new StringBuffer(info.getBuildCommand().toOSString());
      if (!info.isDefaultBuildCmd()) {
        String args = info.getBuildArguments();
        if (args != null && !args.equals("")) { // $NON-NLS-1$
          cmd.append(" "); // $NON-NLS-1$
          cmd.append(args);
        }
      }
      buildCommand.setText(cmd.toString());
    }
    if (info.isDefaultBuildCmd()) {
      buildCommand.setEnabled(false);
      argumentVariablesButton.setEnabled(false);
      stopOnErrorButton.setEnabled(true);
    } else {
      buildCommand.setEnabled(true);
      argumentVariablesButton.setEnabled(true);
      stopOnErrorButton.setEnabled(false);
    }

    defButton.setSelection(info.isDefaultBuildCmd());

    autoButton.setSelection(info.isAutoBuildEnable());
    autoVariableButton.setEnabled(info.isAutoBuildEnable());
    targetAuto.setEnabled(info.isAutoBuildEnable());
    targetAuto.setText(info.getAutoBuildTarget());
    incrButton.setSelection(info.isIncrementalBuildEnabled());
    incrVariableButton.setEnabled(info.isIncrementalBuildEnabled());
    targetIncr.setText(info.getIncrementalBuildTarget());
    targetIncr.setEnabled(info.isIncrementalBuildEnabled());
    cleanButton.setSelection(info.isCleanBuildEnabled());
    cleanVariableButton.setEnabled(info.isCleanBuildEnabled());
    targetClean.setText(info.getCleanBuildTarget());
    targetClean.setEnabled(info.isCleanBuildEnabled());
  }
Пример #3
0
  @Override
  protected void buttonSelected(Button button, int index) {
    try {
      switch (index) {
        case ADD_TARGET:
          {
            MakeTargetDialog dialog = new MakeTargetDialog(getControl().getShell(), fContainer);
            dialog.open();
          }
          break;
        case REMOVE_TARGET:
          IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
          manager.removeTarget(
              (IMakeTarget) ((IStructuredSelection) getViewer().getSelection()).getFirstElement());
          break;
        case EDIT_TARGET:
          {
            MakeTargetDialog dialog =
                new MakeTargetDialog(
                    getControl().getShell(),
                    (IMakeTarget)
                        ((IStructuredSelection) getViewer().getSelection()).getFirstElement());
            dialog.open();
          }

          break;
      }
    } catch (CoreException e) {
      MakeUIPlugin.errorDialog(
          getControl().getShell(),
          MakeUIPlugin.getResourceString("TargetListViewer.exception.error"), // $NON-NLS-1$
          MakeUIPlugin.getResourceString("TargetListViewer.exception.message"), // $NON-NLS-1$
          e);
    }
  }
Пример #4
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
  */
 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
   if (this.viewer == null) {
     MakeCorePlugin.getDefault().getTargetManager().addListener(this);
   }
   this.viewer = (StructuredViewer) viewer;
   IWorkspace oldWorkspace = null;
   IWorkspace newWorkspace = null;
   if (oldInput instanceof IWorkspace) {
     oldWorkspace = (IWorkspace) oldInput;
   } else if (oldInput instanceof IContainer) {
     oldWorkspace = ((IContainer) oldInput).getWorkspace();
   } else if (oldInput instanceof TargetSourceContainer) {
     oldWorkspace = ((TargetSourceContainer) oldInput).getContainer().getWorkspace();
   }
   if (newInput instanceof IWorkspace) {
     newWorkspace = (IWorkspace) newInput;
   } else if (newInput instanceof IContainer) {
     newWorkspace = ((IContainer) newInput).getWorkspace();
   } else if (newInput instanceof TargetSourceContainer) {
     newWorkspace = ((TargetSourceContainer) newInput).getContainer().getWorkspace();
   }
   if (oldWorkspace != newWorkspace) {
     ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
     if (oldWorkspace != null) {
       InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).removePreferenceChangeListener(this);
       mngr.removeCProjectDescriptionListener(this);
       oldWorkspace.removeResourceChangeListener(this);
     }
     if (newWorkspace != null) {
       newWorkspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
       mngr.addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED);
       InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).addPreferenceChangeListener(this);
     }
   }
 }
Пример #5
0
  /**
   * Create {@code MakeTarget} from basic data elements available during copy/paste or drag/drop
   * operations. The other data will be set to default.
   *
   * @param name - name of make target being created.
   * @param targetStr - build target.
   * @param command - make command. ("make" by default).
   * @param container - container where to place the target.
   * @return newly created {@link IMakeTarget}.
   * @throws CoreException if there was a problem creating new make target.
   */
  public static IMakeTarget createMakeTarget(
      String name, String targetStr, String command, IContainer container) throws CoreException {
    IMakeTargetManager makeTargetManager = MakeCorePlugin.getDefault().getTargetManager();

    IProject project = container.getProject();
    String[] ids = makeTargetManager.getTargetBuilders(project);
    String builderId = ids[0];

    // IMakeTarget attributes
    IMakeTarget newMakeTarget = makeTargetManager.createTarget(project, name, builderId);
    if (targetStr != null) {
      newMakeTarget.setBuildAttribute(IMakeTarget.BUILD_TARGET, targetStr);
    }

    // IMakeCommonBuildInfo attributes
    String projectBuildCommand = getProjectBuildCommand(project);
    if (command != null && command.length() > 0 && !command.equals(projectBuildCommand)) {
      newMakeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, command);
      newMakeTarget.setUseDefaultBuildCmd(false);
    } else {
      newMakeTarget.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, projectBuildCommand);
      newMakeTarget.setUseDefaultBuildCmd(true);
    }

    return newMakeTarget;
  }
Пример #6
0
  /**
   * Generate a new unique non-existent name of the kind of "Copy (2) of name".
   *
   * @param targetName - name from where generate unique name.
   * @param container - container where the target belongs.
   * @return generated name.
   * @throws CoreException if {@code findTarget} having a problem.
   */
  private static String generateUniqueName(String targetName, IContainer container)
      throws CoreException {
    IMakeTargetManager makeTargetManager = MakeCorePlugin.getDefault().getTargetManager();
    // Try "name"
    String newName = targetName;
    if (makeTargetManager.findTarget(container, newName) == null) {
      return newName;
    }

    // Try "Copy of name"
    newName =
        MessageFormat.format(
            MakeUIPlugin.getResourceString("MakeTargetDnD.copyOf.uniqueName"), // $NON-NLS-1$
            new Object[] {targetName});
    if (makeTargetManager.findTarget(container, newName) == null) {
      return newName;
    }

    // Try "Copy (2) of name"
    for (int counter = 1; ; counter++) {
      newName =
          MessageFormat.format(
              MakeUIPlugin.getResourceString(
                  "MakeTargetDnD.countedCopyOf.uniqueName"), //$NON-NLS-1$
              new Object[] {counter, targetName});
      if (makeTargetManager.findTarget(container, newName) == null) {
        return newName;
      }
    }
  }
Пример #7
0
  protected static void doProjectUpdate(IProgressMonitor monitor, IProject[] project)
      throws CoreException {
    monitor.beginTask(
        MakeUIPlugin.getResourceString("UpdateMakeProjectAction.monitor.update"),
        project.length * 4); // $NON-NLS-1$
    try {
      for (int i = 0; i < project.length; i++) {
        // remove old builder
        project[i].refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(monitor, 1));
        MakeProjectNature.removeFromBuildSpec(
            project[i], MakeCorePlugin.OLD_BUILDER_ID, new SubProgressMonitor(monitor, 1));

        // convert .cdtproject
        CCorePlugin.getDefault().mapCProjectOwner(project[i], MakeCorePlugin.MAKE_PROJECT_ID, true);
        // add new nature
        MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));

        // move existing build properties to new
        IMakeBuilderInfo newInfo =
            MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
        final int LOCATION = 0, FULL_ARGS = 1, INC_ARGS = 2, STOP_ERORR = 3, USE_DEFAULT = 4;
        QualifiedName[] qName = new QualifiedName[USE_DEFAULT + 1];
        qName[LOCATION] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation"); // $NON-NLS-1$
        qName[FULL_ARGS] =
            new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments"); // $NON-NLS-1$
        qName[INC_ARGS] =
            new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments"); // $NON-NLS-1$
        qName[STOP_ERORR] = new QualifiedName(CCorePlugin.PLUGIN_ID, "stopOnError"); // $NON-NLS-1$
        qName[USE_DEFAULT] =
            new QualifiedName(CCorePlugin.PLUGIN_ID, "useDefaultBuildCmd"); // $NON-NLS-1$

        String property = project[i].getPersistentProperty(qName[LOCATION]);
        if (property != null) {
          newInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, property);
        }
        property = project[i].getPersistentProperty(qName[FULL_ARGS]);
        if (property != null) {
          newInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, property);
        }
        property = project[i].getPersistentProperty(qName[STOP_ERORR]);
        if (property != null) {
          newInfo.setStopOnError(Boolean.valueOf(property).booleanValue());
        }
        property = project[i].getPersistentProperty(qName[USE_DEFAULT]);
        if (property != null) {
          newInfo.setUseDefaultBuildCmd(Boolean.valueOf(property).booleanValue());
        }
        for (int j = 0; j < qName.length; j++) {
          project[i].setPersistentProperty(qName[j], null);
        }

        IProgressMonitor subMon =
            new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
        project[i].accept(new TargetConvertVisitor(subMon), 0);
        monitor.worked(1);
      }
    } finally {
      monitor.done();
    }
  }
Пример #8
0
  /**
   * @param project - project where to get build command from
   * @return build command from project settings.
   */
  public static String getProjectBuildCommand(IProject project) {
    IMakeTargetManager targetManager = MakeCorePlugin.getDefault().getTargetManager();
    String[] targetBuilders = targetManager.getTargetBuilders(project);
    if (targetBuilders == null || targetBuilders.length == 0) {
      return DEFAULT_BUILD_COMMAND;
    }

    String builderId = targetManager.getBuilderID(targetBuilders[0]);
    String buildCommand = DEFAULT_BUILD_COMMAND;
    try {
      IMakeBuilderInfo buildInfo = MakeCorePlugin.createBuildInfo(project, builderId);
      buildCommand = buildInfo.getBuildCommand().toString().trim();
    } catch (CoreException e) {
      // keep default value
    }
    return buildCommand;
  }
Пример #9
0
  /**
   * Copy/move one make target to the specified container.
   *
   * @param makeTarget - make target.
   * @param container - container to copy/move to.
   * @param operation - copying operation. Should be one of {@link org.eclipse.swt.dnd.DND}
   *     operations.
   * @param shell - shell to display user warnings.
   * @param offerOverwriteDialog - whether overwrite dialog is provided.
   * @throws CoreException on the failure of {@link IMakeTargetManager} or {@link IMakeTarget}
   *     operation.
   * @see DND#DROP_NONE
   * @see DND#DROP_COPY
   * @see DND#DROP_MOVE
   * @see DND#DROP_LINK
   * @see DND#DROP_DEFAULT
   */
  public static void copyOneTarget(
      IMakeTarget makeTarget,
      IContainer container,
      final int operation,
      Shell shell,
      boolean offerOverwriteDialog)
      throws CoreException {

    IMakeTargetManager makeTargetManager = MakeCorePlugin.getDefault().getTargetManager();
    IMakeTarget exists = makeTargetManager.findTarget(container, makeTarget.getName());
    if (exists != null) {
      int userAnswer = IDialogConstants.CANCEL_ID;
      if (offerOverwriteDialog) {
        userAnswer = overwriteMakeTargetDialog(makeTarget.getName(), shell);
      } else {
        userAnswer = RENAME_ID;
      }
      if (userAnswer == IDialogConstants.YES_ID || userAnswer == IDialogConstants.YES_TO_ALL_ID) {
        copyTargetData(makeTarget, exists);
        if (operation == DND.DROP_MOVE) {
          makeTargetManager.removeTarget(makeTarget);
        }
      } else if (userAnswer == RENAME_ID || userAnswer == RENAME_TO_ALL_ID) {
        String name = generateUniqueName(makeTarget.getName(), container);
        IMakeTarget newMakeTarget = cloneTarget(name, makeTarget, container.getProject());
        newMakeTarget.setContainer(container);
        int dialogReturnCode = Window.OK;
        if (userAnswer == RENAME_ID) {
          MakeTargetDialog dialog;
          try {
            dialog = new MakeTargetDialog(shell, newMakeTarget);
            dialogReturnCode = dialog.open();
          } catch (CoreException e) {
            MakeUIPlugin.errorDialog(
                shell,
                MakeUIPlugin.getResourceString("AddBuildTargetAction.exception.internal"),
                e.toString(),
                e); //$NON-NLS-1$
          }
        } else if (userAnswer == RENAME_TO_ALL_ID) {
          makeTargetManager.addTarget(container, newMakeTarget);
        }
        if (operation == DND.DROP_MOVE && dialogReturnCode != Window.CANCEL) {
          makeTargetManager.removeTarget(makeTarget);
        }
      }
    } else {
      makeTargetManager.addTarget(
          container, cloneTarget(makeTarget.getName(), makeTarget, container.getProject()));
      if (operation == DND.DROP_MOVE) {
        makeTargetManager.removeTarget(makeTarget);
      }
    }
  }
Пример #10
0
  /**
   * Creating a copy of IMakeTarget in a different project.
   *
   * @param name - name of new target.
   * @param makeTarget - make target.
   * @param project - project where to assign the make target.
   * @return newly created make target.
   * @throws CoreException if there is a problem with creating or copying the target.
   */
  private static IMakeTarget cloneTarget(String name, IMakeTarget makeTarget, IProject project)
      throws CoreException {
    IMakeTargetManager makeTargetManager = MakeCorePlugin.getDefault().getTargetManager();
    String[] ids = makeTargetManager.getTargetBuilders(project);
    String builderId = ids[0];

    IMakeTarget newMakeTarget = makeTargetManager.createTarget(project, name, builderId);
    copyTargetData(makeTarget, newMakeTarget);
    if (makeTarget
        .getName()
        .equals(makeTarget.getBuildAttribute(IMakeTarget.BUILD_TARGET, ""))) { // $NON-NLS-1$
      newMakeTarget.setBuildAttribute(IMakeTarget.BUILD_TARGET, name);
    }
    return newMakeTarget;
  }
 protected void collectFiles(IContainer parent, List result) {
   try {
     IResource[] resources = parent.members();
     for (int i = 0; i < resources.length; i++) {
       IResource resource = resources[i];
       if (resource instanceof IFile) {
         result.add(resource);
       } else if (resource instanceof IContainer) {
         collectFiles((IContainer) resource, result);
       }
     }
   } catch (CoreException e) {
     MakeCorePlugin.log(e.getStatus());
   }
 }
Пример #12
0
 @Override
 public boolean visit(IResourceProxy proxy) throws CoreException {
   try {
     if (proxy.getType() != IResource.FOLDER && proxy.getType() != IResource.PROJECT) {
       return false;
     }
     IContainer container = (IContainer) proxy.requestResource();
     monitor.subTask(container.getProjectRelativePath().toString());
     QualifiedName qName =
         new QualifiedName("org.eclipse.cdt.make", "goals"); // $NON-NLS-1$ //$NON-NLS-2$
     String goal = container.getPersistentProperty(qName);
     if (goal != null) {
       goal = goal.trim();
       IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
       String[] builder = manager.getTargetBuilders(container.getProject());
       IMakeTarget target = manager.createTarget(container.getProject(), goal, builder[0]);
       target.setBuildAttribute(IMakeTarget.BUILD_TARGET, goal);
       manager.addTarget(container, target);
       container.setPersistentProperty(qName, null);
     }
     return true;
   } finally {
     if (--nextProgress <= 0) {
       // we have exhausted the current increment, so report progress
       monitor.worked(1);
       worked++;
       if (worked >= halfWay) {
         // we have passed the current halfway point, so double the
         // increment and reset the halfway point.
         currentIncrement *= 2;
         halfWay += (TOTAL_WORK - halfWay) / 2;
       }
       // reset the progress counter to another full increment
       nextProgress = currentIncrement;
     }
   }
 }
Пример #13
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
   */
  public Object[] getChildren(Object obj) {
    if (obj instanceof IWorkspaceRoot) {
      try {
        return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects();
      } catch (CoreException e) {
        MakeCorePlugin.log(e);
      }
    } else if (obj instanceof IContainer) {
      IContainer container = (IContainer) obj;
      ArrayList<Object> children = new ArrayList<Object>();

      boolean isAddingSourceRoots =
          !bFlatten
              && (container instanceof IProject)
              && CCorePlugin.showSourceRootsAtTopOfProject();

      // add source roots if necessary
      if (isAddingSourceRoots) {
        IProject project = (IProject) container;
        ICSourceEntry[] srcEntries = getSourceEntries(project);
        for (ICSourceEntry srcEntry : srcEntries) {
          if (!srcEntry.getFullPath().equals(project.getFullPath())) {
            children.add(new TargetSourceContainer(srcEntry));
          }
        }
      }

      // add regular folders
      try {
        IResource[] resources = container.members();
        for (IResource rc : resources) {
          if (rc instanceof IContainer) {
            if (!(isAddingSourceRoots && isSourceEntry(rc))) {
              children.add(rc);
            }
          }
        }
      } catch (CoreException e) {
        MakeCorePlugin.log(e);
      }

      // finally add targets
      try {
        IMakeTarget[] targets =
            MakeCorePlugin.getDefault().getTargetManager().getTargets(container);
        children.addAll(Arrays.asList(targets));
      } catch (CoreException e) {
        MakeCorePlugin.log(e);
      }
      return children.toArray();

    } else if (obj instanceof TargetSourceContainer) {
      ArrayList<Object> children = new ArrayList<Object>();
      try {
        IContainer container = ((TargetSourceContainer) obj).getContainer();
        IResource[] resources = container.members();
        for (IResource rc : resources) {
          if (rc instanceof IContainer) {
            children.add(rc);
          }
        }
        children.addAll(
            Arrays.asList(MakeCorePlugin.getDefault().getTargetManager().getTargets(container)));
      } catch (CoreException e) {
        MakeCorePlugin.log(e);
      }
      return children.toArray();
    }
    return new Object[0];
  }
Пример #14
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IContentProvider#dispose()
  */
 public void dispose() {
   if (viewer != null) {
     MakeCorePlugin.getDefault().getTargetManager().removeListener(this);
   }
 }
Пример #15
0
/**
 * Provider of both user specified and discovered scanner info
 *
 * @deprecated as of CDT 4.0.
 * @author vhirsl
 * @noextend This class is not intended to be subclassed by clients.
 * @noinstantiate This class is not intended to be instantiated by clients.
 */
@Deprecated
public class DiscoveredScannerInfoProvider extends ScannerProvider {

  // This is the id of the IScannerInfoProvider extension point entry
  public static final String INTERFACE_IDENTITY =
      MakeCorePlugin.getUniqueIdentifier() + ".DiscoveredScannerInfoProvider"; // $NON-NLS-1$

  // Name we will use to store build property with the project
  private static final QualifiedName scannerInfoProperty =
      new QualifiedName(
          MakeCorePlugin.getUniqueIdentifier(), "discoveredMakeBuildInfo"); // $NON-NLS-1$

  // Singleton
  private static DiscoveredScannerInfoProvider instance;

  public static DiscoveredScannerInfoProvider getDefault() {
    if (instance == null) {
      instance = new DiscoveredScannerInfoProvider();
    }
    return instance;
  }

  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
   */
  @Override
  public IScannerInfo getScannerInformation(IResource resource) {
    try {
      getDiscoveredScannerInfo(resource.getProject(), true);
    } catch (CoreException e) {
    }
    return super.getScannerInformation(resource);
  }

  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#subscribe(org.eclipse.core.resources.IResource,
   *      org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
   */
  @Override
  public void subscribe(IResource resource, IScannerInfoChangeListener listener) {
    super.subscribe(resource, listener);
  }

  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#unsubscribe(org.eclipse.core.resources.IResource,
   *      org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
   */
  @Override
  public void unsubscribe(IResource resource, IScannerInfoChangeListener listener) {
    super.unsubscribe(resource, listener);
  }

  public DiscoveredScannerInfo getDiscoveredScannerInfo(IProject project, boolean cacheInfo)
      throws CoreException {
    DiscoveredScannerInfo scannerInfo = null;
    // See if there's already one associated with the resource for this
    // session
    scannerInfo = (DiscoveredScannerInfo) project.getSessionProperty(scannerInfoProperty);

    if (scannerInfo == null) {
      scannerInfo = new DiscoveredScannerInfo(project);
      // this will convert user info
      org.eclipse.cdt.make.core.MakeScannerInfo makeScannerInfo =
          org.eclipse.cdt.make.core.MakeScannerProvider.getDefault()
              .getMakeScannerInfo(project, cacheInfo);
      scannerInfo.setUserScannerInfo(makeScannerInfo);

      // migrate to new C Path Entries
      IContainerEntry container = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
      ICProject cProject = CoreModel.getDefault().create(project);
      if (cProject != null) {
        IPathEntry[] entries = cProject.getRawPathEntries();
        List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries));
        if (!newEntries.contains(container)) {
          newEntries.add(container);
          cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), null);
        }
      }
      ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
      descriptor.remove(
          CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); // remove scanner provider which will fallback to
      // default
      // cpath provider.
      // place holder to that we don't convert again.
      project.setSessionProperty(scannerInfoProperty, scannerInfo);
    }
    return scannerInfo;
  }

  /**
   * The build model manager for standard builds only caches the build information for a resource on
   * a per-session basis. This method allows clients of the build model manager to programmatically
   * remove the association between the resource and the information while the reource is still open
   * or in the workspace. The Eclipse core will take care of removing it if a resource is closed or
   * deleted.
   */
  public static void removeScannerInfo(IResource resource) {
    try {
      resource.getProject().setSessionProperty(scannerInfoProperty, null);
    } catch (CoreException e) {
    }
  }

  /**
   * Persists build-specific information in the build file. Build information for standard make
   * projects consists of preprocessor symbols and includes paths. Other project-related information
   * is stored in the persistent properties of the project.
   */
  static void updateScannerInfo(DiscoveredScannerInfo scannerInfo) throws CoreException {
    //		 no longer supported!
  }
}