Package org.eclipse.cdt.core.settings.model

Examples of org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager


        boolean defaults,
        boolean onFinish,
        IProgressMonitor monitor)
      throws CoreException
    {
        ICProjectDescriptionManager mngr =
          CoreModel.getDefault().getProjectDescriptionManager();
        ICProjectDescription des =
          mngr.createProjectDescription(project, false, !onFinish);
        ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
        ManagedProject mProj = new ManagedProject(des);
        info.setManagedProject(mProj);
        monitor.worked(20);
        cfgs = CfgHolder.unique(getCfgItems(false));
        cfgs = CfgHolder.reorder(cfgs);
        int work = 50 / cfgs.length;
        for (int i = 0; i < cfgs.length; i++) {
          String s = (cfgs[i].getToolChain() == null) ?
            "0" : ((ToolChain)(cfgs[i].getToolChain())).getId()//$NON-NLS-1$
          Configuration cfg = new Configuration(
              mProj,
              (ToolChain)cfgs[i].getToolChain(),
              ManagedBuildManager.calculateChildId(s, null),
              cfgs[i].getName());
          cfgs[i].setConfiguration(cfg);
          IBuilder bld = cfg.getEditableBuilder();
          if (bld != null) {
            if(bld.isInternalBuilder()){
              IConfiguration prefCfg =
                ManagedBuildManager.getPreferenceConfiguration(false);
              IBuilder prefBuilder = prefCfg.getBuilder();
              cfg.changeBuilder(
                  prefBuilder,
                  ManagedBuildManager.calculateChildId(cfg.getId(), null),
                  prefBuilder.getName());
              bld = cfg.getEditableBuilder();
              bld.setBuildPath(null);
            }
            bld.setManagedBuildOn(false);
          }
          cfg.setArtifactName(mProj.getDefaultArtifactName());
          CConfigurationData data = cfg.getConfigurationData();
          des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
          monitor.worked(work);
        }
        mngr.setProjectDescription(project, des);
    }
View Full Code Here


    if(errors.size() > 0){
      return errors;
    }

    // FIXME: force load of file from disk
    ICProjectDescriptionManager manager =
      CoreModel.getDefault().getProjectDescriptionManager();
    //manager.updateProjectDescriptions(new IProject[]{project}, null);

    ICProjectDescription desc = manager.getProjectDescription(project, false);

    ICConfigurationDescription config = desc.getDefaultSettingConfiguration();
    PathEntryTranslator.PathEntryCollector cr =
      PathEntryTranslator.collectEntries(project, config);
View Full Code Here

     *            The path to add to the include folders
     * @see addLibraryDependency {@link #addLibraryDependency(IProject, IProject)}
     */
    public static void addIncludeFolder(IProject project, IPath IncludePath) {
  // find all languages
  ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
  ICProjectDescription projectDescription = mngr.getProjectDescription(project, true);
  ICConfigurationDescription configurationDescription = projectDescription.getDefaultSettingConfiguration();
  addIncludeFolder(configurationDescription, IncludePath);

  projectDescription.setActiveConfiguration(configurationDescription);
  projectDescription.setCdtProjectCreated();
  try {
      mngr.setProjectDescription(project, projectDescription, true, null);
  } catch (CoreException e) {
      Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Could not add folder " + IncludePath.toOSString()
        + " to includepoth in project" + project.getName(), e));
  }

View Full Code Here

  }
  return true;
    }

    private void importLibs(String PathVarName, TreeItem[] AllItems) {
  ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
  ICProjectDescription projectDescription = mngr.getProjectDescription(myProject, true);
  ICConfigurationDescription configurationDescriptions[] = projectDescription.getConfigurations();

  for (TreeItem CurItem : AllItems) {
      if (CurItem.getChecked()) {
    try {
        ArduinoHelpers.addCodeFolder(myProject, PathVarName, CurItem.getText(), ArduinoConst.WORKSPACE_LIB_FOLDER + CurItem.getText(),
          configurationDescriptions);
    } catch (CoreException e) {
        Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Failed to import library ", e));
    }
      }

      try {
    // projectDescription.(configurationDescription);
    mngr.setProjectDescription(myProject, projectDescription, true, null);
      } catch (CoreException e) {
    e.printStackTrace();
      }
  }
    }
View Full Code Here

     * @throws CoreException
     */
    public static void setCProjectDescription(IProject project, ArrayList<ConfigurationDescriptor> alCfgs, boolean isManagedBuild,
      IProgressMonitor monitor) throws CoreException {

  ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
  ICProjectDescription des = mngr.createProjectDescription(project, false, false);
  ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
  ManagedProject mProj = new ManagedProject(des);
  info.setManagedProject(mProj);
  monitor.worked(20);

  // String s = "it.baeyens.arduino.core.toolChain.release";
  // IToolChain tcs = ManagedBuildManager.getExtensionToolChain(s);
  //
  // Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(s, null), "Release");
  // IBuilder bld = cfg.getEditableBuilder();
  // if (bld != null) {
  // if (bld.isInternalBuilder()) {
  // IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
  // IBuilder prefBuilder = prefCfg.getBuilder();
  // cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
  // bld = cfg.getEditableBuilder();
  // bld.setBuildPath(null);
  // }
  // bld.setManagedBuildOn(isManagedBuild);
  // } else {
  // System.out.println("Messages.StdProjectTypeHandler_3");
  // }
  // cfg.setArtifactName(mProj.getDefaultArtifactName());
  // CConfigurationData data = cfg.getConfigurationData();
  // ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
  //
  // ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDes);

  // Iterate across the configurations
  for (int i = 0; i < alCfgs.size(); i++) {
      IToolChain tcs = ManagedBuildManager.getExtensionToolChain(alCfgs.get(i).ToolchainID);

      Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(alCfgs.get(i).ToolchainID, null),
        alCfgs.get(i).Name);
      IBuilder bld = cfg.getEditableBuilder();
      if (bld != null) {
    // if (bld.isInternalBuilder()) {
    // IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
    // IBuilder prefBuilder = prefCfg.getBuilder();
    // String name = prefBuilder.getName();
    // cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), name);
    // bld = cfg.getEditableBuilder();
    // bld.setBuildPath(null);
    // }
    bld.setManagedBuildOn(isManagedBuild);
    cfg.setArtifactName("${ProjName}");
      } else {
    System.out.println("Messages.StdProjectTypeHandler_3");
      }
      CConfigurationData data = cfg.getConfigurationData();
      ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);

      setDefaultLanguageSettingsProviders(project, alCfgs.get(i), cfg, cfgDes);
  }
  monitor.worked(50);
  mngr.setProjectDescription(project, des);

    }
View Full Code Here

     * to do so we loop through all languages of all configuration descriptions of all projects
     */
    @Override
    public Change perform(IProgressMonitor pm) throws CoreException {

  ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
  IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
  for (int curProject = 0; curProject < projects.length; curProject++) {
      ICProjectDescription projectDescription = mngr.getProjectDescription(projects[curProject], true);
      if (projectDescription != null) { // if the description is null it probably is not a cdt project
    ICConfigurationDescription configurationDescriptions[] = projectDescription.getConfigurations();
    boolean projectDescriptionChanged = false;
    for (int curConfigDescription = 0; curConfigDescription < configurationDescriptions.length; curConfigDescription++) {

        ICFolderDescription folderDescription = configurationDescriptions[curConfigDescription].getRootFolderDescription();
        ICLanguageSetting[] languageSettings = folderDescription.getLanguageSettings();

        // Add include path to all languages
        for (int idx = 0; idx < languageSettings.length; idx++) {
      ICLanguageSetting lang = languageSettings[idx];
      String LangID = lang.getLanguageId();
      if (LangID != null) {
          if (LangID.startsWith("org.eclipse.cdt.")) { //$NON-NLS-1$
        boolean languageChanged = false;
        ICLanguageSettingEntry[] IncludeEntries = lang.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
        for (int curIncludeEntry = 0; curIncludeEntry < IncludeEntries.length; curIncludeEntry++) {
            if (IncludeEntries[curIncludeEntry].getName().startsWith(myOldName)) {
          String newValue = IncludeEntries[curIncludeEntry].getName().replace(myOldName, myNewName);
          languageChanged = true;
          projectDescriptionChanged = true;
          IncludeEntries[curIncludeEntry] = new CIncludePathEntry(newValue, ICSettingEntry.VALUE_WORKSPACE_PATH);
            }
        }
        if (languageChanged) {
            lang.setSettingEntries(ICSettingEntry.INCLUDE_PATH, IncludeEntries);
        }
          }
      }
        }
    }
    if (projectDescriptionChanged) {
        mngr.setProjectDescription(projects[curProject], projectDescription);
    }
      }
  }
  return null;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.