public static void dumpStorage( PerTypeMapStorage<? extends IRealBuildObjectAssociation, Set<IPath>> storage) { println("starting storage dump.."); // $NON-NLS-1$ int[] types = ObjectTypeBasedStorage.getSupportedObjectTypes(); for (int i = 0; i < types.length; i++) { int type = types[i]; MatchObjectElement.TypeToStringAssociation assoc = MatchObjectElement.TypeToStringAssociation.getAssociation(type); if (assoc == null) continue; println(" dumping for type " + assoc.getString()); // $NON-NLS-1$ @SuppressWarnings("unchecked") Map<IRealBuildObjectAssociation, Set<IPath>> map = (Map<IRealBuildObjectAssociation, Set<IPath>>) storage.getMap(type, false); if (map != null) { Set<Entry<IRealBuildObjectAssociation, Set<IPath>>> entrySet = map.entrySet(); for (Entry<IRealBuildObjectAssociation, Set<IPath>> entry : entrySet) { IRealBuildObjectAssociation obj = entry.getKey(); println( " dumping " + assoc.getString() + " " + obj.getUniqueRealName()); // $NON-NLS-1$ //$NON-NLS-2$ Set<IPath> set = entry.getValue(); if (set != null) { for (IPath path : set) { println(" path \"" + path + "\""); // $NON-NLS-1$ //$NON-NLS-2$ } } println(" end dumping " + obj.getUniqueRealName()); // $NON-NLS-1$ } } println(" end type " + assoc.getString()); // $NON-NLS-1$ } println("end storage dump"); // $NON-NLS-1$ }
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$ } } }
public static void fail(String msg) { println(msg); throw new DbgException(msg); }