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
  public String generateCommand(IOption optionCmd, IVariableSubstitutor macroSubstitutor) {

    String allValue = "";
    String[] optionList = null;

    String command = optionCmd.getCommand();
    Object optionListArg = optionCmd.getValue();
    String optionRefId = optionCmd.getBaseId();
    IHoldsOptions optionHolder = optionCmd.getOptionHolder();

    // If cache is defined then it already contains the cdt path.
    optionRefId = optionRefId.substring(0, optionRefId.lastIndexOf("."));
    IOption optionCached = optionHolder.getOptionBySuperClassId(optionRefId + ".cache");
    try {
      if (optionCached.getStringListValue().length != 0) {
        return "";
      }
    } catch (BuildException e) {
    }

    if (!(optionListArg instanceof ArrayList<?>)) {
      return "";
    }
    ((ArrayList<String>) (optionListArg)).trimToSize();
    optionList = ((ArrayList<String>) (optionListArg)).toArray(new String[0]);

    if (optionList.length != 0) {
      for (String argValue : optionList) {
        allValue += command + '"' + stripRelative(argValue, macroSubstitutor) + '"' + " ";
      }
      allValue = allValue.trim();
      return allValue;
    }
    return "";
  }
Ejemplo n.º 3
0
 private IOption setOption(IBuildObject cfg, IHoldsOptions holder, String id, String value) {
   return setOption(cfg, holder, holder.getOptionBySuperClassId(id), value);
 }