Ejemplo n.º 1
0
 private PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> getParentObjectStorage() {
   if (fParentObjectStorage == null) {
     fParentObjectStorage =
         TcModificationUtil.createParentObjectsRealToolToPathSet((FolderInfo) getResourceInfo());
   }
   return fParentObjectStorage;
 }
Ejemplo n.º 2
0
  @Override
  protected Set<Tool> getExtensionConflictToolSet(Tool tool, Tool[] tools) {
    String exts[] = tool.getPrimaryInputExtensions();
    Set<String> extsSet = new HashSet<String>(Arrays.asList(exts));
    Set<Tool> conflictsSet = null;
    for (int i = 0; i < tools.length; i++) {
      Tool t = tools[i];
      if (t == tool) continue;
      if (TcModificationUtil.containCommonEntries(extsSet, t.getPrimaryInputExtensions())) {
        if (conflictsSet == null) conflictsSet = new HashSet<Tool>();

        conflictsSet.add(t);
      }
    }

    if (conflictsSet == null) conflictsSet = Collections.emptySet();
    return conflictsSet;
  }
Ejemplo n.º 3
0
  private void applyToolChain(ToolChain newNonRealTc) {
    ToolChain newRealTc = (ToolChain) ManagedBuildManager.getRealToolChain(newNonRealTc);

    ToolChainApplicabilityPaths tcApplicability = getToolChainApplicabilityPaths();
    PerTypeMapStorage<? extends IRealBuildObjectAssociation, Set<IPath>> storage =
        getCompleteObjectStore();

    @SuppressWarnings("unchecked")
    Map<ToolChain, Set<IPath>> tcMap =
        (Map<ToolChain, Set<IPath>>)
            storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
    @SuppressWarnings("unchecked")
    Map<Tool, Set<IPath>> toolMap =
        (Map<Tool, Set<IPath>>) storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);

    TcModificationUtil.removePaths(tcMap, fRealToolChain, tcApplicability.fFolderInfoPaths);
    TcModificationUtil.addPaths(tcMap, newRealTc, tcApplicability.fFolderInfoPaths);
    Tool[] newTools = (Tool[]) newNonRealTc.getTools();

    for (int i = 0; i < newTools.length; i++) {
      newTools[i] = (Tool) ManagedBuildManager.getRealTool(newTools[i]);
    }

    Set<Entry<Tool, Set<IPath>>> entrySet = tcApplicability.fToolPathMap.entrySet();
    for (Iterator<Entry<Tool, Set<IPath>>> iter = entrySet.iterator(); iter.hasNext(); ) {
      Map.Entry<Tool, Set<IPath>> entry = iter.next();
      Tool tool = entry.getKey();
      Set<IPath> pathSet = entry.getValue();

      TcModificationUtil.removePaths(toolMap, tool, pathSet);
    }

    for (int i = 0; i < newTools.length; i++) {
      TcModificationUtil.addPaths(toolMap, newTools[i], tcApplicability.fFolderInfoPaths);
    }

    if (tcApplicability.fFileInfoPaths.size() != 0) {
      FolderInfo foInfo = (FolderInfo) getResourceInfo();
      IManagedProject mProj = foInfo.getParent().getManagedProject();
      IProject project = mProj.getOwner().getProject();
      Tool[] filtered = (Tool[]) foInfo.filterTools(newTools, mProj);
      if (filtered.length != 0) {
        for (IPath p : tcApplicability.fFileInfoPaths) {
          boolean found = false;
          String ext = p.getFileExtension();
          if (ext == null) ext = ""; // $NON-NLS-1$
          for (int i = 0; i < filtered.length; i++) {
            if (filtered[i].buildsFileType(ext, project)) {
              TcModificationUtil.addPath(toolMap, filtered[i], p);
              found = true;
              break;
            }
          }

          if (!found) {
            if (DbgTcmUtil.DEBUG) {
              DbgTcmUtil.println("no tools found for path " + p); // $NON-NLS-1$
            }
          }
        }

      } else if (DbgTcmUtil.DEBUG) {
        DbgTcmUtil.println("no filtered tools"); // $NON-NLS-1$
      }
    }
  }
Ejemplo n.º 4
0
 @Override
 protected boolean canAdd(Tool tool) {
   return !TcModificationUtil.containCommonEntries(
       getInputExtsSet(), tool.getPrimaryInputExtensions());
 }