/**
  * Clone a configuration and put it on the tmp list if it is not already a saved configuration and
  * not already on the tmp list.
  *
  * @param p project
  * @param oldId the id of the old configuration to clone
  * @param cfgd the configuration descriptor for the clone
  * @return true if the configuration is already saved, false otherwise
  */
 public synchronized boolean cloneCfg(IProject p, String oldId, ICConfigurationDescription cfgd) {
   if (isConfigurationAlreadySaved(p, cfgd)) return true;
   Map<String, IAConfiguration> tmpList = getTmpConfigs(p);
   String newId = cfgd.getId();
   // Don't bother if the new configuration is already on the tmp list
   IAConfiguration cfg = tmpList.get(newId);
   if (cfg != null) return false;
   // Otherwise, try and find the old id to copy the configuration from
   // or punt if not found
   IAConfiguration oldCfg = null;
   Map<String, IAConfiguration> savedList = getSavedConfigs(p);
   if (savedList != null) oldCfg = savedList.get(oldId);
   if (oldCfg != null) {
     IAConfiguration newCfg = oldCfg.copy(cfgd.getId());
     tmpList.put(cfgd.getId(), newCfg);
     // Check to see if the new configuration is already stored as part of the project description.
     // If yes, it should already be saved.  This can occur if the configuration was added as part
     // of
     // another CDT Property page and the Autotools Property page was never opened.
     if (CoreModel.getDefault().getProjectDescription(p).getConfigurationById(newId) != null) {
       addConfiguration(p, newCfg);
       return true;
     }
   }
   return false;
 }
 public synchronized IAConfiguration getTmpConfiguration(
     IProject p, ICConfigurationDescription cfgd) {
   Map<String, IAConfiguration> list = getTmpConfigs(p);
   IAConfiguration acfg = list.get(cfgd.getId());
   if (acfg != null) {
     return acfg;
   }
   IAConfiguration oldCfg = getConfiguration(p, cfgd.getId(), false);
   list.put(cfgd.getId(), oldCfg);
   return oldCfg;
 }
Пример #3
0
    public void setConfiguration(ICConfigurationDescription cfg) {
      if (cfg.getProjectDescription() != CProjectDescription.this)
        throw new IllegalArgumentException();

      if (cfg.getId().equals(getId())) return;

      fCfg = cfg;
      fId = cfg.getId();
      fIsCfgModified = true;
      fNeedsPersistance = true;
    }
Пример #4
0
  /**
   * Check if all configuration descriptions are present in the internal array of configuration
   * descriptions.
   *
   * @param cfgs
   * @return true if all present, false otherwise
   */
  private static boolean areCfgsStillThere(ICConfigurationDescription[] cfgs) {
    if (cfgs == null || cfgDescs == null) return false;

    for (ICConfigurationDescription multiCfg : cfgs) {
      boolean foundOne = false;
      for (ICConfigurationDescription cfgDesc : cfgDescs) {
        if (multiCfg.getId().equals(cfgDesc.getId())) {
          foundOne = true;
          break;
        }
      }
      if (!foundOne) {
        return false;
      }
    }
    return true;
  }
Пример #5
0
  /** @see IncrementalProjectBuilder#build */
  @Override
  protected IProject[] build(
      int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
      throws CoreException {
    if (DEBUG_EVENTS) {
      @SuppressWarnings("unchecked")
      Map<String, String> argsMap = args;
      printEvent(kind, argsMap);
    }

    // If auto discovery is disabled, do nothing
    //		boolean autodiscoveryEnabled;
    //		boolean autodiscoveryEnabled2;
    //		IScannerConfigBuilderInfo2 buildInfo2 = null;
    //		IConfiguration cfg = ScannerConfigUtil.getActiveConfiguration(getProject());
    IManagedBuildInfo bInfo = ManagedBuildManager.getBuildInfo(getProject());
    if (bInfo != null) {
      IConfiguration cfgs[] = bInfo.getManagedProject().getConfigurations();
      if (cfgs.length != 0) {
        if (!needAllConfigBuild()) {
          ICProjectDescription des =
              CoreModel.getDefault().getProjectDescription(getProject(), false);
          IConfiguration cfg = null;
          if (des != null) {
            ICConfigurationDescription settingCfgDes = des.getDefaultSettingConfiguration();
            if (settingCfgDes != null) {
              for (int i = 0; i < cfgs.length; i++) {
                if (settingCfgDes.getId().equals(cfgs[i].getId())) {
                  cfg = cfgs[i];
                  break;
                }
              }
            }
          }
          if (cfg != null) {
            cfgs = new IConfiguration[] {cfg};
          } else {
            cfgs = new IConfiguration[0];
          }
        }
        int numWork = cfgs.length;
        if (numWork > 0) {
          monitor.beginTask(
              MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"),
              numWork); //$NON-NLS-1$
          for (int i = 0; i < cfgs.length; i++) {
            build(cfgs[i], 0, new SubProgressMonitor(monitor, 1));
          }
        }
      }

      CfgDiscoveredPathManager.getInstance().updateCoreSettings(getProject(), cfgs);
    }

    return getProject().getReferencedProjects();
  }
Пример #6
0
    public void configurationRemoved(ICConfigurationDescription cfg) {
      if (cfg.getProjectDescription() != CProjectDescription.this)
        throw new IllegalArgumentException();

      if (!cfg.getId().equals(getId())) return;

      fIsCfgModified = true;
      fCfg = null;
      getConfiguration();
    }
Пример #7
0
 /**
  * Find index of configuration description in the internal array of configuration descriptions.
  *
  * @param cfgd
  * @return index of found configuration description or index of active configuration.
  */
 private static int getCfgIndex(ICConfigurationDescription cfgd) {
   int index = 0;
   for (int i = 0; i < cfgDescs.length; ++i) {
     if (cfgd != null) {
       if (cfgd.getId().equals(cfgDescs[i].getId())) {
         return i;
       }
     } else if (cfgDescs[i].isActive()) {
       index = i;
     }
   }
   return index;
 }
Пример #8
0
 @Override
 protected void performOK() {
   ICConfigurationDescription[] cfgs = page.getCfgsEditable();
   AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage) page;
   Map<String, IAConfiguration> cfgList = new HashMap<>();
   for (int i = 0; i < cfgs.length; ++i) {
     ICConfigurationDescription cd = cfgs[i];
     IAConfiguration acfg = ap.getConfiguration(cd);
     cfgList.put(cd.getId(), acfg);
   }
   IProject project = page.getProject();
   AutotoolsConfigurationManager.getInstance()
       .replaceProjectConfigurations(project, cfgList, cfgs);
   AutotoolsConfigurationManager.getInstance().clearTmpConfigurations(project);
 }
Пример #9
0
  /*
   * Event Handlers
   */
  private void handleConfigSelection() {
    // If there is nothing in config selection widget just bail
    if (configSelector.getItemCount() == 0) return;
    int selectionIndex = configSelector.getSelectionIndex();
    if (selectionIndex == -1) return;
    if (cfgDescs == null || cfgDescs.length == 0) return;

    // Check if the user has selected the "all / multiple" configuration
    if (selectionIndex >= cfgDescs.length) {
      if (selectionIndex == cfgDescs.length) { // all
        multiCfgs = cfgDescs;
      } else { // multiple
        // Check previous state of variables figuring out if need to pop up selection dialog
        // areCfgsStillThere() covers deletions by a user in Manage Configurations dialog
        boolean enterMultiCfgsDialog =
            (multiCfgs == null) || (multiCfgs == cfgDescs) || !areCfgsStillThere(multiCfgs);
        if (enterMultiCfgsDialog) {
          ICConfigurationDescription[] mcfgs =
              ConfigMultiSelectionDialog.select(cfgDescs, parentComposite.getShell());
          if (mcfgs == null || mcfgs.length == 0) {
            // return back to previous selection
            int cfgIndex = -1;
            if (multiCfgs == cfgDescs) { // return to choice "All"
              cfgIndex = cfgDescs.length;
            } else {
              cfgIndex = getCfgIndex(lastSelectedCfg);
            }
            configSelector.select(cfgIndex);
            return;
          }
          multiCfgs = mcfgs;
        }
      }
      lastSelectedCfg = null;

      cfgChanged(MultiItemsHolder.createCDescription(multiCfgs));
      return;
    }
    multiCfgs = null;

    String id1 = getResDesc() == null ? null : getResDesc().getId();
    lastSelectedCfg = cfgDescs[selectionIndex];
    String id2 = lastSelectedCfg.getId();
    if (id2 != null && !id2.equals(id1)) {
      cfgChanged(lastSelectedCfg);
    }
  }
  /**
   * Notify the ExternalSettingManager that there's been a change in the configuration which may
   * require referencing configs to update their cache of the external settings
   */
  public void handleEvent(CProjectDescriptionEvent event) {
    switch (event.getEventType()) {
      case CProjectDescriptionEvent.LOADED:
        {
          // Bug 312575 on Project load, event.getProjectDelta() == null => report all configs as
          // potentially changed
          // Referencing projects should be reconciled and potentially updated.
          String projName = event.getProject().getName();
          ICConfigurationDescription[] descs =
              event.getNewCProjectDescription().getConfigurations();
          CExternalSettingsContainerChangeInfo[] changeInfos =
              new CExternalSettingsContainerChangeInfo[descs.length + 1];
          int i = 0;
          for (ICConfigurationDescription desc :
              event.getNewCProjectDescription().getConfigurations())
            changeInfos[i++] =
                new CExternalSettingsContainerChangeInfo(
                    CExternalSettingsContainerChangeInfo.CONTAINER_CONTENTS,
                    new CContainerRef(FACTORY_ID, createId(projName, desc.getId())),
                    null);
          // Active configuration too
          changeInfos[i] =
              new CExternalSettingsContainerChangeInfo(
                  CExternalSettingsContainerChangeInfo.CONTAINER_CONTENTS,
                  new CContainerRef(FACTORY_ID, createId(projName, ACTIVE_CONFIG_ID)),
                  null);
          notifySettingsChange(null, null, changeInfos);
          break;
        }
      case CProjectDescriptionEvent.APPLIED:
        String[] ids = getContainerIds(event.getProjectDelta());
        if (ids.length != 0) {
          CExternalSettingsContainerChangeInfo[] changeInfos =
              new CExternalSettingsContainerChangeInfo[ids.length];

          for (int i = 0; i < changeInfos.length; i++) {
            changeInfos[i] =
                new CExternalSettingsContainerChangeInfo(
                    CExternalSettingsContainerChangeInfo.CONTAINER_CONTENTS,
                    new CContainerRef(FACTORY_ID, ids[i]),
                    null);
          }
          notifySettingsChange(null, null, changeInfos);
        }
    }
  }
  /** @deprecated Not intended to be public - do not use */
  @Deprecated
  public String getDefaultDebugger(final ILaunchConfiguration config) throws CoreException {
    // Mostly from CDebbuggerTab
    String defaultDebugger = null;

    String projectName =
        config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
    if (projectName.length() > 0) {
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
      if (projDesc != null) {
        ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
        String configId = configDesc.getId();
        ICDebugConfiguration[] debugConfigs =
            CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
        outer:
        for (int i = 0; i < debugConfigs.length; ++i) {
          ICDebugConfiguration debugConfig = debugConfigs[i];
          String[] patterns = debugConfig.getSupportedBuildConfigPatterns();
          if (patterns != null) {
            for (int j = 0; j < patterns.length; ++j) {
              if (configId.matches(patterns[j])) {
                defaultDebugger = debugConfig.getID();
                break outer;
              }
            }
          }
        }
      }
    }

    if (defaultDebugger == null) {
      ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
      if (dc != null) {
        defaultDebugger = dc.getID();
      }
    }

    return defaultDebugger;
  }
  @Override
  public void handleEvent(ILanguageSettingsChangeEvent event) {
    IWorkspaceRoot wspRoot = ResourcesPlugin.getWorkspace().getRoot();
    IProject project = wspRoot.getProject(event.getProjectName());

    if (project != null) {
      ICProjectDescription prjDescription =
          CCorePlugin.getDefault().getProjectDescription(project, false);
      if (prjDescription != null) {
        // cfgDescription being indexed
        ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
        String indexedId = cfgDescription.getId();

        for (String id : event.getConfigurationDescriptionIds()) {
          if (id.equals(indexedId)) {
            reindex(id, event);
            return;
          }
        }
      }
    }
  }
 private void syncNameField(ICConfigurationDescription cfgd) {
   IConfiguration icfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
   String id = cfgd.getId();
   if (icfg != null) {
     IToolChain toolchain = icfg.getToolChain();
     ITool[] tools = toolchain.getTools();
     for (int j = 0; j < tools.length; ++j) {
       ITool tool = tools[j];
       if (tool.getName().equals("configure")) { // $NON-NLS-1$
         IOption option =
             tool.getOptionBySuperClassId(
                 "org.eclipse.linuxtools.cdt.autotools.core.option.configure.name"); // $NON-NLS-1$
         IHoldsOptions h = tool;
         try {
           IOption optionToSet = h.getOptionToSet(option, false);
           optionToSet.setValue(id);
         } catch (BuildException e) {
         }
       }
     }
   }
 }
  @Override
  protected ISerializeInfo getSerializeInfo(Object context) {
    ISerializeInfo serializeInfo = null;

    if (context instanceof ICConfigurationDescription) {
      final ICConfigurationDescription cfg = (ICConfigurationDescription) context;
      final String name = cfg.getId();
      if (name != null)
        serializeInfo =
            new ISerializeInfo() {
              @Override
              public Preferences getNode() {
                return getConfigurationNode(cfg.getProjectDescription());
              }

              @Override
              public String getPrefName() {
                return name;
              }
            };
    } else if (context == null || context instanceof IWorkspace) {
      final Preferences prefs = getWorkspaceNode();
      final String name = PREFNAME_WORKSPACE;
      if (prefs != null)
        serializeInfo =
            new ISerializeInfo() {
              @Override
              public Preferences getNode() {
                return prefs;
              }

              @Override
              public String getPrefName() {
                return name;
              }
            };
    }
    return serializeInfo;
  }
Пример #15
0
 /**
  * Searches in the prj for the config description with the same ID as for given cfg. If there's no
  * such cfgd, it will be created.
  *
  * @param prj - project description where we'll search (or create) config description
  * @param cfg - config description belonging to another project description, it is a sample for
  *     search and base for possile creation of resulting configuration description.
  * @return the configuration description (found or created) or null in case of error
  */
 private ICConfigurationDescription findCfg(
     ICProjectDescription prj, ICConfigurationDescription cfg) {
   String id = cfg.getId();
   // find config with the same ID as original one
   ICConfigurationDescription c = prj.getConfigurationById(id);
   // if there's no cfg found, try to create it
   if (c == null) {
     try {
       c = prj.createConfiguration(id, cfg.getName(), cfg);
       c.setDescription(cfg.getDescription());
     } catch (CoreException e) {
       /* do nothing: c is already null */
     }
   }
   // if creation failed, report an error and return null
   if (c == null) {
     MessageBox mb = new MessageBox(getShell());
     mb.setMessage(Messages.AbstractPage_3);
     mb.open();
   }
   return c;
 }
  // Perform apply of configuration changes.  This rewrites out the current known list of
  // configurations
  // with any changes currently that have been made to them.  If a configuration has been renamed,
  // but this
  // has not yet been confirmed by the end-user, then only the changes to the configuration are
  // made.  The
  // name currently remains the same in the output file.
  public synchronized void applyConfigs(String projectName, ICConfigurationDescription[] cfgds) {
    try {
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
      IResource res = root.findMember(projectName, false);
      if (res == null || res.getType() != IResource.PROJECT) {
        AutotoolsPlugin.logErrorMessage(
            ConfigureMessages.getFormattedString(CFG_CANT_SAVE, new String[] {projectName}));
        return;
      }
      IProject project = (IProject) res;
      IPath output = project.getLocation().append(CFG_FILE_NAME);
      File f = output.toFile();
      if (!f.exists()) f.createNewFile();
      if (f.exists()) {
        try (PrintWriter p = new PrintWriter(new BufferedWriter(new FileWriter(f)))) {
          Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
          if (cfgs == null) return;
          p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); // $NON-NLS-1$
          p.println("<configurations>"); // $NON-NLS-1$
          Option[] optionList = AutotoolsConfiguration.getOptionList();
          HashSet<String> savedIds = new HashSet<>();
          setSyncing(true);
          for (int x = 0; x < cfgds.length; ++x) {
            ICConfigurationDescription cfgd = cfgds[x];
            @SuppressWarnings("unused")
            CConfigurationData data = cfgd.getConfigurationData();
            String id = cfgd.getId();
            savedIds.add(id);
            IAConfiguration cfg = getTmpConfiguration(project, cfgd);
            cfgs.put(
                id,
                cfg); // add to list in case we have a new configuration not yet added to Project
                      // Description
            p.println("<configuration id=\"" + id + "\">"); // $NON-NLS-1$ //$NON-NLS-2$
            for (int j = 0; j < optionList.length; ++j) {
              Option option = optionList[j];
              IConfigureOption opt = cfg.getOption(option.getName());
              if (!opt.isCategory())
                p.println(
                    "<option id=\""
                        + option.getName()
                        + "\" value=\""
                        + opt.getValue()
                        + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-3$
            }
            p.println("</configuration>"); // $NON-NLS-1$
            syncNameField(cfgd);
          }
          setSyncing(false);

          // Put all the remaining configurations already saved back into the file.
          // These represent deleted configurations, but confirmation has not occurred.
          for (Entry<String, IAConfiguration> i : cfgs.entrySet()) {
            String id = i.getKey();
            // A remaining id won't appear in our savedIds list.
            if (!savedIds.contains(id)) {
              IAConfiguration cfg = i.getValue();
              p.println("<configuration id=\"" + id + "\">"); // $NON-NLS-1$ //$NON-NLS-2$
              for (int j = 0; j < optionList.length; ++j) {
                Option option = optionList[j];
                IConfigureOption opt = cfg.getOption(option.getName());
                if (!opt.isCategory())
                  p.println(
                      "<option id=\""
                          + option.getName()
                          + "\" value=\""
                          + opt.getValue()
                          + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-3$
              }
              p.println("</configuration>"); // $NON-NLS-1$
            }
          }
          p.println("</configurations>");
        }
      }
    } catch (IOException e) {
      AutotoolsPlugin.log(e);
    }
  }
 private void saveConfigs(IProject project, ICConfigurationDescription[] cfgds) {
   try {
     String projectName = project.getName();
     IPath output = project.getLocation().append(CFG_FILE_NAME);
     File f = output.toFile();
     if (!f.exists()) f.createNewFile();
     if (f.exists()) {
       try (PrintWriter p = new PrintWriter(new BufferedWriter(new FileWriter(f)))) {
         Map<String, IAConfiguration> cfgs = configs.get(projectName);
         p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); // $NON-NLS-1$
         p.println("<configurations>"); // $NON-NLS-1$
         Option[] optionList = AutotoolsConfiguration.getOptionList();
         // Before saving, force any cloning to occur via the option
         // value handler.
         setSyncing(true);
         for (int i = 0; i < cfgds.length; ++i) {
           @SuppressWarnings("unused")
           CConfigurationData data = cfgds[i].getConfigurationData();
         }
         setSyncing(false);
         for (int i = 0; i < cfgds.length; ++i) {
           ICConfigurationDescription cfgd = cfgds[i];
           String id = cfgd.getId();
           IAConfiguration cfg = cfgs.get(id);
           if (cfg == null) {
             cfg = createDefaultConfiguration(id);
           }
           p.println("<configuration id=\"" + cfg.getId() + "\">"); // $NON-NLS-1$ //$NON-NLS-2$
           for (int j = 0; j < optionList.length; ++j) {
             Option option = optionList[j];
             IConfigureOption opt = cfg.getOption(option.getName());
             if (opt.isFlag()) {
               p.println(
                   "<flag id=\""
                       + option.getName()
                       + "\" value=\"" //$NON-NLS-1$ //$NON-NLS-2$
                       + xmlEscape(option.getDefaultValue())
                       + "\">"); //$NON-NLS-1$
               FlagConfigureOption fco = (FlagConfigureOption) opt;
               List<String> children = fco.getChildren();
               for (int k = 0; k < children.size(); ++k) {
                 String childName = children.get(k);
                 IConfigureOption childopt = cfg.getOption(childName);
                 p.println(
                     "<flagvalue id=\""
                         + childopt.getName()
                         + "\" value=\"" //$NON-NLS-1$ //$NON-NLS-2$
                         + xmlEscape(childopt.getValue())
                         + "\"/>"); // $NON-NLS-3$
               }
               p.println("</flag>"); // $NON-NLS-1$
             } else if (!opt.isCategory() && !opt.isFlagValue())
               p.println(
                   "<option id=\""
                       + option.getName()
                       + "\" value=\""
                       + xmlEscape(opt.getValue()) // $NON-NLS-1$ //$NON-NLS-2$
                       + "\"/>"); // $NON-NLS-3$
           }
           p.println("</configuration>"); // $NON-NLS-1$
           // Sync name field as this configuration is now
           // officially saved
           syncNameField(cfgd);
         }
         p.println("</configurations>");
       }
     }
   } catch (IOException e) {
     AutotoolsPlugin.log(e);
   }
 }
Пример #18
0
 void configurationCreated(ICConfigurationDescription des) {
   fCfgMap.put(des.getId(), des);
 }
 private Map<String, IAConfiguration> getSavedConfigs(IProject project) {
   String projectName = project.getName();
   Map<String, IAConfiguration> list = configs.get(projectName);
   if (list == null) {
     try {
       IPath fileLocation = project.getLocation().append(CFG_FILE_NAME);
       File dirFile = fileLocation.toFile();
       Map<String, IAConfiguration> cfgList = new HashMap<>();
       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       DocumentBuilder db = dbf.newDocumentBuilder();
       if (dirFile.exists()) {
         Document d = db.parse(dirFile);
         Element e = d.getDocumentElement();
         // Get the stored configuration data
         NodeList cfgs = e.getElementsByTagName("configuration"); // $NON-NLS-1$
         for (int x = 0; x < cfgs.getLength(); ++x) {
           Node n = cfgs.item(x);
           NamedNodeMap attrs = n.getAttributes();
           // Originally we used the configuration name, but now we use
           // the ConfigurationDescription id which is unique.  Check for
           // id first, but fall back to name for older .autotools files.
           Node nameNode = attrs.getNamedItem("name"); // $NON-NLS-1$
           Node cfgIdNode = attrs.getNamedItem("id"); // $NON-NLS-1$
           String cfgId = null;
           if (cfgIdNode != null) cfgId = cfgIdNode.getNodeValue();
           else if (nameNode != null) {
             String cfgName = nameNode.getNodeValue();
             ICConfigurationDescription cfgd =
                 CoreModel.getDefault()
                     .getProjectDescription(project)
                     .getConfigurationByName(cfgName);
             if (cfgd != null) cfgId = cfgd.getId();
             else continue; // have to punt, this doesn't map to real cfg
           }
           IAConfiguration cfg = new AutotoolsConfiguration(cfgId);
           NodeList l = n.getChildNodes();
           for (int y = 0; y < l.getLength(); ++y) {
             Node child = l.item(y);
             if (child.getNodeName().equals("option")) { // $NON-NLS-1$
               NamedNodeMap optionAttrs = child.getAttributes();
               Node id = optionAttrs.getNamedItem("id"); // $NON-NLS-1$
               Node value = optionAttrs.getNamedItem("value"); // $NON-NLS-1$
               if (id != null && value != null)
                 cfg.setOption(id.getNodeValue(), value.getNodeValue());
             } else if (child.getNodeName().equals("flag")) { // $NON-NLS-1$
               // read in flag values
               NamedNodeMap optionAttrs = child.getAttributes();
               Node id = optionAttrs.getNamedItem("id"); // $NON-NLS-1$
               String idValue = id.getNodeValue();
               IConfigureOption opt = cfg.getOption(idValue);
               if (opt instanceof FlagConfigureOption) {
                 NodeList l2 = child.getChildNodes();
                 for (int z = 0; z < l2.getLength(); ++z) {
                   Node flagChild = l2.item(z);
                   if (flagChild.getNodeName().equals("flagvalue")) { // $NON-NLS-1$
                     NamedNodeMap optionAttrs2 = flagChild.getAttributes();
                     Node id2 = optionAttrs2.getNamedItem("id"); // $NON-NLS-1$
                     Node value = optionAttrs2.getNamedItem("value"); // $NON-NLS-1$
                     cfg.setOption(id2.getNodeValue(), value.getNodeValue());
                   }
                 }
               }
             }
           }
           cfg.setDirty(false);
           cfgList.put(cfg.getId(), cfg);
         }
         if (cfgList.size() > 0) {
           configs.put(projectName, cfgList);
           list = cfgList;
         }
       }
     } catch (ParserConfigurationException | SAXException | IOException e) {
       e.printStackTrace();
     }
   }
   return list;
 }
 public synchronized boolean isConfigurationAlreadySaved(
     IProject project, ICConfigurationDescription cfgd) {
   Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
   if (cfgs != null) return cfgs.get(cfgd.getId()) != null;
   return false;
 }