Example #1
0
  public void setToolChain(IToolChain tc, boolean force) {
    if (tc == fSelectedToolChain && !force) return;

    applyToolChain((ToolChain) tc);

    fSelectedToolChain = (ToolChain) tc;
    IToolChain newReal = ManagedBuildManager.getRealToolChain(tc);
    if (newReal == fRealToolChain && !force) return;

    fRealToolChain = (ToolChain) newReal;

    //		setProjectTools(tc.getTools());
    //		applyToolChain(fSelectedToolChain);
    clearToolInfo(tc.getTools());
    fCurrentCompatibilityInfo = null;
  }
Example #2
0
 public FolderInfoModification(FolderInfo foInfo) {
   super(foInfo, foInfo.getTools());
   fSelectedToolChain = (ToolChain) foInfo.getToolChain();
   fRealToolChain = (ToolChain) ManagedBuildManager.getRealToolChain(fSelectedToolChain);
 }
Example #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$
      }
    }
  }