示例#1
0
  public ResourceConfiguration(ResourceConfiguration baseInfo, IPath path, String id, String name) {
    super(baseInfo, path, id, name);

    isExtensionResourceConfig = false;
    setResourceData(new BuildFileData(this));

    setManagedBuildRevision(baseInfo.getManagedBuildRevision());

    //  Copy the remaining attributes
    toolsToInvoke = baseInfo.toolsToInvoke;

    rcbsApplicability = new Integer(KIND_DISABLE_RCBS_TOOL);

    // Clone the resource configuration's tool children
    if (baseInfo.toolList != null) {
      for (ITool toolChild : baseInfo.getToolList()) {
        ITool superTool = toolChild.getSuperClass();
        String baseId = superTool != null ? superTool.getId() : toolChild.getId();
        String subId = ManagedBuildManager.calculateChildId(baseId, null);
        String subName = toolChild.getName();

        Tool newTool = new Tool(this, superTool, subId, subName, (Tool) toolChild);
        addTool(newTool);
      }
    }

    setDirty(true);
    setRebuildState(true);
  }
 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) {
         }
       }
     }
   }
 }
示例#3
0
  public ResourceConfiguration(
      FolderInfo folderInfo, ITool baseTool, String id, String resourceName, IPath path) {
    super(folderInfo, path, id, resourceName);
    //		setParentFolder(folderInfo);
    //		setParentFolderId(folderInfo.getId());

    isExtensionResourceConfig = folderInfo.isExtensionElement();
    if (!isExtensionResourceConfig) setResourceData(new BuildFileData(this));

    if (folderInfo.getParent() != null)
      setManagedBuildRevision(folderInfo.getParent().getManagedBuildRevision());

    setDirty(false);
    toolsToInvoke = EMPTY_STRING;
    rcbsApplicability = new Integer(KIND_DISABLE_RCBS_TOOL);

    //	Get file extension.
    String extString = path.getFileExtension();
    if (baseTool != null) {
      if (baseTool.getParentResourceInfo() != folderInfo) baseTool = null;
    }
    // Add the resource specific tools to this resource.
    ITool tools[] = folderInfo.getFilteredTools();
    String subId = new String();
    for (int i = 0; i < tools.length; i++) {
      if (tools[i].buildsFileType(extString)) {
        baseTool = tools[i];
        break;
      }
    }

    if (baseTool != null) {
      subId = ManagedBuildManager.calculateChildId(baseTool.getId(), null);
      createTool(baseTool, subId, baseTool.getName(), false);
      setRebuildState(true);
    }
  }
示例#4
0
  /**
   * Create a new resource configuration based on one already defined.
   *
   * @param cfg The <code>IConfiguration</code> the resource configuration will be added to.
   * @param cloneConfig The <code>ResourceConfiguration</code> to copy the settings from.
   * @param id A unique ID for the new resource configuration.
   */
  public ResourceConfiguration(
      IConfiguration cfg,
      ResourceConfiguration cloneConfig,
      String id,
      Map<IPath, Map<String, String>> superClassIdMap,
      boolean cloneChildren) {
    super(cfg, cloneConfig, id);

    isExtensionResourceConfig = cfg.isExtensionElement();
    if (!cloneConfig.isExtensionResourceConfig) cloneChildren = true;

    if (!isExtensionResourceConfig) setResourceData(new BuildFileData(this));

    setManagedBuildRevision(cloneConfig.getManagedBuildRevision());

    //  Copy the remaining attributes
    if (cloneConfig.toolsToInvoke != null) {
      toolsToInvoke = new String(cloneConfig.toolsToInvoke);
    }
    if (cloneConfig.rcbsApplicability != null) {
      rcbsApplicability = new Integer(cloneConfig.rcbsApplicability.intValue());
    }

    boolean copyIds = cloneChildren && id.equals(cloneConfig.id);
    // Clone the resource configuration's tool children
    if (cloneConfig.toolList != null) {
      for (ITool toolChild : cloneConfig.getToolList()) {
        String subId = null;
        String subName;

        Map<String, String> curIdMap = superClassIdMap.get(cloneConfig.getPath());
        ITool extTool = ManagedBuildManager.getExtensionTool(toolChild);
        if (curIdMap != null) {
          if (extTool != null) {
            subId = curIdMap.get(extTool.getId());
          }
        }

        subName = toolChild.getName();

        if (subId == null) {
          if (extTool != null) {
            subId =
                copyIds
                    ? toolChild.getId()
                    : ManagedBuildManager.calculateChildId(extTool.getId(), null);
            //					subName = toolChild.getSuperClass().getName();
          } else {
            subId =
                copyIds
                    ? toolChild.getId()
                    : ManagedBuildManager.calculateChildId(toolChild.getId(), null);
            //					subName = toolChild.getName();
          }
        }

        //  The superclass for the cloned tool is not the same as the one from the tool being
        // cloned.
        //  The superclasses reside in different configurations.
        ITool toolSuperClass = null;
        String superId = null;
        //  Search for the tool in this configuration that has the same grand-superClass as the
        //  tool being cloned
        ITool otherSuperTool = toolChild.getSuperClass();
        if (otherSuperTool != null) {
          if (otherSuperTool.isExtensionElement()) {
            toolSuperClass = otherSuperTool;
          } else {
            IResourceInfo otherRcInfo = otherSuperTool.getParentResourceInfo();
            IResourceInfo thisRcInfo = cfg.getResourceInfo(otherRcInfo.getPath(), true);
            ITool otherExtTool = ManagedBuildManager.getExtensionTool(otherSuperTool);
            if (otherExtTool != null) {
              if (thisRcInfo != null) {
                ITool tools[] = thisRcInfo.getTools();
                for (int i = 0; i < tools.length; i++) {
                  ITool thisExtTool = ManagedBuildManager.getExtensionTool(tools[i]);
                  if (otherExtTool.equals(thisExtTool)) {
                    toolSuperClass = tools[i];
                    superId = toolSuperClass.getId();
                    break;
                  }
                }
              } else {
                superId =
                    copyIds
                        ? otherSuperTool.getId()
                        : ManagedBuildManager.calculateChildId(otherExtTool.getId(), null);
                Map<String, String> idMap = superClassIdMap.get(otherRcInfo.getPath());
                if (idMap == null) {
                  idMap = new HashMap<String, String>();
                  superClassIdMap.put(otherRcInfo.getPath(), idMap);
                }
                idMap.put(otherExtTool.getId(), superId);
              }
            }
          }
        }
        //				IToolChain tCh = cloneConfig.getBaseToolChain();
        //				if(tCh != null){
        //					if(!tCh.isExtensionElement()){
        //						IFolderInfo fo = tCh.getParentFolderInfo();
        //						IPath path = fo.getPath();
        //						IResourceInfo baseFo = cfg.getResourceInfo(path, false);
        //						if(baseFo instanceof IFileInfo)
        //							baseFo = cfg.getResourceInfo(path.removeLastSegments(1), false);
        //						tCh = ((IFolderInfo)baseFo).getToolChain();
        //
        //					}
        //					ITool[] tools = tCh.getTools();
        //					for (int i=0; i<tools.length; i++) {
        //					    ITool configTool = tools[i];
        //					    if (toolChild.getSuperClass() != null
        //					    		&& configTool.getSuperClass() == toolChild.getSuperClass().getSuperClass())
        //					    {
        //					        toolSuperClass = configTool;
        //					        break;
        //					    }
        //					}
        //				} else {
        //					//TODO:
        //				}

        Tool newTool = null;
        if (toolSuperClass != null)
          newTool = new Tool(this, toolSuperClass, subId, subName, (Tool) toolChild);
        else newTool = new Tool(this, superId, subId, subName, (Tool) toolChild);

        addTool(newTool);
      }
    }

    if (copyIds) {
      isDirty = cloneConfig.isDirty;
      needsRebuild = cloneConfig.needsRebuild;
    } else {
      setDirty(true);
      setRebuildState(true);
    }
  }