mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
bug 319512: Missing type arguments on managedbuilder.core
This commit is contained in:
parent
a24bb7ea72
commit
de6703334b
8 changed files with 197 additions and 173 deletions
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificat
|
|||
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatchSet;
|
||||
import org.eclipse.cdt.managedbuilder.tcmodification.CompatibilityStatus;
|
||||
import org.eclipse.cdt.managedbuilder.tcmodification.IConfigurationModification;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
public class ConfigurationModification extends FolderInfoModification implements
|
||||
|
@ -104,8 +105,8 @@ public class ConfigurationModification extends FolderInfoModification implements
|
|||
|
||||
private ConflictMatchSet getParentConflictMatchSet(){
|
||||
if(fConflicts == null){
|
||||
PerTypeMapStorage storage = getCompleteObjectStore();
|
||||
Object restore = TcModificationUtil.removeBuilderInfo(storage, fRealBuilder);
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = getCompleteObjectStore();
|
||||
Set<IPath> restore = TcModificationUtil.removeBuilderInfo(storage, fRealBuilder);
|
||||
try {
|
||||
fConflicts = ToolChainModificationManager.getInstance().getConflictInfo(IRealBuildObjectAssociation.OBJECT_BUILDER, storage);
|
||||
} finally {
|
||||
|
@ -187,7 +188,7 @@ public class ConfigurationModification extends FolderInfoModification implements
|
|||
fRealBuilder = realBuilder;
|
||||
fCompletePathMapStorage = null;
|
||||
|
||||
PerTypeMapStorage storage = getCompleteObjectStore();
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = getCompleteObjectStore();
|
||||
TcModificationUtil.applyBuilder(storage, getResourceInfo().getPath(), fSelectedBuilder);
|
||||
|
||||
clearBuilderCompatibilityInfo();
|
||||
|
|
|
@ -30,13 +30,13 @@ public class ConflictSet {
|
|||
|
||||
private PerTypeMapStorage<IRealBuildObjectAssociation, Conflict> fConflictStorage;
|
||||
private List<ConflictMatch> fConflictMatchList;
|
||||
private Set<? extends IRealBuildObjectAssociation> fExtConflictSet;
|
||||
private IRealBuildObjectAssociation fRealObj;
|
||||
// private Set<IRealBuildObjectAssociation> fExtConflictSet;
|
||||
// private IRealBuildObjectAssociation fRealObj;
|
||||
|
||||
public ConflictSet(IRealBuildObjectAssociation realObj, List<ConflictMatch> conflictMatchList, Set<? extends IRealBuildObjectAssociation> extConflictSet){
|
||||
fConflictMatchList = conflictMatchList;
|
||||
fExtConflictSet = extConflictSet;
|
||||
fRealObj = realObj;
|
||||
// fExtConflictSet = (Set<IRealBuildObjectAssociation>) extConflictSet;
|
||||
// fRealObj = realObj;
|
||||
}
|
||||
|
||||
private void init(){
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
||||
import org.eclipse.cdt.managedbuilder.internal.tcmodification.extension.MatchObjectElement;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
public class DbgTcmUtil {
|
||||
private static final PrintStream OUT = System.out;
|
||||
|
@ -67,7 +68,7 @@ public class DbgTcmUtil {
|
|||
throw e;
|
||||
}
|
||||
|
||||
public static void dumpStorage(PerTypeMapStorage storage){
|
||||
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++){
|
||||
|
@ -78,16 +79,17 @@ public class DbgTcmUtil {
|
|||
|
||||
println(" dumping for type " + assoc.getString()); //$NON-NLS-1$
|
||||
|
||||
Map map = storage.getMap(type, false);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = (Map<IRealBuildObjectAssociation, Set<IPath>>) storage.getMap(type, false);
|
||||
if(map != null){
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
IRealBuildObjectAssociation obj = (IRealBuildObjectAssociation)entry.getKey();
|
||||
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 set = (Set)entry.getValue();
|
||||
Set<IPath> set = entry.getValue();
|
||||
if(set != null){
|
||||
for(Iterator setIter = set.iterator(); setIter.hasNext(); ){
|
||||
println(" path \"" + setIter.next() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
for (IPath path : set) {
|
||||
println(" path \"" + path + "\""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
println(" end dumping " + obj.getUniqueRealName()); //$NON-NLS-1$
|
||||
|
|
|
@ -307,9 +307,9 @@ public class FolderInfoModification extends ToolListModification implements IFol
|
|||
ToolChainApplicabilityPaths tcApplicabilityPaths = new ToolChainApplicabilityPaths();
|
||||
IPath path = getResourceInfo().getPath();
|
||||
|
||||
TreeMap<IPath, PerTypeSetStorage> pathMap = getCompletePathMapStorage();
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> pathMap = getCompletePathMapStorage();
|
||||
|
||||
PerTypeSetStorage oSet = pathMap.get(path);
|
||||
PerTypeSetStorage<? extends IRealBuildObjectAssociation> oSet = pathMap.get(path);
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<Tool> toolSet = (Set<Tool>) oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -356,11 +356,11 @@ public class FolderInfoModification extends ToolListModification implements IFol
|
|||
}
|
||||
}
|
||||
|
||||
private static void calculateChildPaths(TreeMap<IPath, PerTypeSetStorage> pathMap, IPath path, ToolChain tc, Set<IPath> tcPaths, Map<Tool,Set<IPath>> toolPathsMap, Set<IPath> fileInfoPaths){
|
||||
SortedMap<IPath, PerTypeSetStorage> directCMap = PathComparator.getDirectChildPathMap(pathMap, path);
|
||||
Set<Entry<IPath, PerTypeSetStorage>> entrySet = directCMap.entrySet();
|
||||
for (Entry<IPath, PerTypeSetStorage> entry : entrySet) {
|
||||
PerTypeSetStorage cst = entry.getValue();
|
||||
private static void calculateChildPaths(TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> pathMap, IPath path, ToolChain tc, Set<IPath> tcPaths, Map<Tool,Set<IPath>> toolPathsMap, Set<IPath> fileInfoPaths){
|
||||
SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> directCMap = PathComparator.getDirectChildPathMap(pathMap, path);
|
||||
Set<Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>> entrySet = directCMap.entrySet();
|
||||
for (Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> entry : entrySet) {
|
||||
PerTypeSetStorage<? extends IRealBuildObjectAssociation> cst = entry.getValue();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<ToolChain> ctc = (Set<ToolChain>) cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
|
||||
|
@ -389,7 +389,9 @@ public class FolderInfoModification extends ToolListModification implements IFol
|
|||
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);
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.SortedSet;
|
|||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
public class PathComparator implements Comparator<IPath> {
|
||||
|
@ -69,12 +70,12 @@ public class PathComparator implements Comparator<IPath> {
|
|||
return path.append("\0"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static SortedMap<IPath, PerTypeSetStorage> getChildPathMap(SortedMap<IPath, PerTypeSetStorage> map, IPath path, boolean includeThis, boolean copy){
|
||||
public static SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> getChildPathMap(SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> map, IPath path, boolean includeThis, boolean copy){
|
||||
IPath start = includeThis ? path : getFirstChild(path);
|
||||
IPath next = getNext(path);
|
||||
SortedMap<IPath, PerTypeSetStorage> result = next != null ? map.subMap(start, next) : map.tailMap(start);
|
||||
SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = next != null ? map.subMap(start, next) : map.tailMap(start);
|
||||
if(copy)
|
||||
result = new TreeMap<IPath, PerTypeSetStorage>(result);
|
||||
result = new TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -99,12 +100,12 @@ public class PathComparator implements Comparator<IPath> {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static SortedMap<IPath,PerTypeSetStorage> getDirectChildPathMap(SortedMap<IPath, PerTypeSetStorage> map, IPath path){
|
||||
public static SortedMap<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>> getDirectChildPathMap(SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> map, IPath path){
|
||||
//all children
|
||||
SortedMap<IPath,PerTypeSetStorage> children = getChildPathMap(map, path, false, false);
|
||||
SortedMap<IPath,PerTypeSetStorage> result = new TreeMap<IPath, PerTypeSetStorage>(INSTANCE);
|
||||
for(Iterator<Map.Entry<IPath,PerTypeSetStorage>> iter = children.entrySet().iterator(); iter.hasNext(); iter = children.entrySet().iterator()){
|
||||
Map.Entry<IPath,PerTypeSetStorage> entry = iter.next();
|
||||
SortedMap<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>> children = getChildPathMap(map, path, false, false);
|
||||
SortedMap<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>(INSTANCE);
|
||||
for(Iterator<Map.Entry<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>>> iter = children.entrySet().iterator(); iter.hasNext(); iter = children.entrySet().iterator()){
|
||||
Map.Entry<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>> entry = iter.next();
|
||||
IPath childPath = entry.getKey();
|
||||
result.put(childPath, entry.getValue());
|
||||
|
||||
|
|
|
@ -15,6 +15,13 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
||||
|
||||
/**
|
||||
* The class implements the storage of maps (Map<K, V>) organized by types extending
|
||||
* {@link IRealBuildObjectAssociation}.
|
||||
*
|
||||
* @param <K> - the type of keys of the map
|
||||
* @param <V> - the type of values in the map
|
||||
*/
|
||||
public class PerTypeMapStorage<K extends IRealBuildObjectAssociation, V> implements Cloneable {
|
||||
private ObjectTypeBasedStorage<Map<K, V>> fStorage = new ObjectTypeBasedStorage<Map<K, V>>();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -43,7 +42,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
public class TcModificationUtil {
|
||||
|
||||
private static void processFolderInfoChildren(FolderInfo foInfo, PerTypeMapStorage storage, IToolChain rtc, Map tcMap, Map toolMap, boolean addSkipInfo){
|
||||
private static void processFolderInfoChildren(FolderInfo foInfo, PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, IToolChain rtc, Map<IRealBuildObjectAssociation, Set<IPath>> tcMap, Map<IRealBuildObjectAssociation, Set<IPath>> toolMap, boolean addSkipInfo){
|
||||
IResourceInfo rcInfos[] = foInfo.getDirectChildResourceInfos();
|
||||
for(int i = 0; i < rcInfos.length; i++){
|
||||
IResourceInfo rc = rcInfos[i];
|
||||
|
@ -69,8 +68,8 @@ public class TcModificationUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static PerTypeMapStorage createChildObjectsRealToolToPathSet(FolderInfo foInfo, Map toolChainMap, Map toolsMap, boolean addSkipPaths){
|
||||
PerTypeMapStorage storage = new PerTypeMapStorage();
|
||||
public static PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> createChildObjectsRealToolToPathSet(FolderInfo foInfo, Map<IRealBuildObjectAssociation, Set<IPath>> toolChainMap, Map<IRealBuildObjectAssociation, Set<IPath>> toolsMap, boolean addSkipPaths){
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = new PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>>();
|
||||
|
||||
IToolChain tc = foInfo.getToolChain();
|
||||
IToolChain rTc = ManagedBuildManager.getRealToolChain(tc);
|
||||
|
@ -80,7 +79,7 @@ public class TcModificationUtil {
|
|||
toolChainMap.clear();
|
||||
|
||||
for(int i = 0; i < tools.length; i++){
|
||||
toolsMap.put(ManagedBuildManager.getRealTool(tools[i]), null);
|
||||
toolsMap.put((Tool)ManagedBuildManager.getRealTool(tools[i]), null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,29 +88,28 @@ public class TcModificationUtil {
|
|||
return storage;
|
||||
}
|
||||
|
||||
public static PerTypeMapStorage createParentObjectsRealToolToPathSet(final FolderInfo foInfo){
|
||||
PerTypeMapStorage storage = new PerTypeMapStorage();
|
||||
public static PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> createParentObjectsRealToolToPathSet(final FolderInfo foInfo){
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = new PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>>();
|
||||
IConfiguration cfg = foInfo.getParent();
|
||||
FolderInfo rf = (FolderInfo)cfg.getRootFolderInfo();
|
||||
IPath p = rf.getPath();
|
||||
|
||||
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
|
||||
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
Set<IPath> pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
|
||||
pathSet.add(p);
|
||||
map.put(realBuilder, pathSet);
|
||||
map.put((Builder)realBuilder, pathSet);
|
||||
|
||||
IRealBuildObjectAssociation realCfg = ((Configuration)cfg).getRealBuildObject();
|
||||
map = storage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, true);
|
||||
pathSet = new TreeSet(PathComparator.INSTANCE);
|
||||
pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
|
||||
pathSet.add(p);
|
||||
map.put(realCfg, pathSet);
|
||||
|
||||
if(!foInfo.isRoot()){
|
||||
Set allRcInfos = new HashSet(Arrays.asList(cfg.getResourceInfos()));
|
||||
Set<IResourceInfo> allRcInfos = new HashSet<IResourceInfo>(Arrays.asList(cfg.getResourceInfos()));
|
||||
allRcInfos.removeAll(foInfo.getChildResourceInfoList(true));
|
||||
for(Iterator iter = allRcInfos.iterator(); iter.hasNext(); ){
|
||||
Object rc = iter.next();
|
||||
for (IResourceInfo rc : allRcInfos) {
|
||||
if(rc instanceof ResourceConfiguration){
|
||||
processFileInfo(storage, (ResourceConfiguration)rc, null, false);
|
||||
} else {
|
||||
|
@ -123,15 +121,19 @@ public class TcModificationUtil {
|
|||
return storage;
|
||||
}
|
||||
|
||||
public static PerTypeMapStorage cloneRealToolToPathSet(PerTypeMapStorage storage){
|
||||
storage = (PerTypeMapStorage)storage.clone();
|
||||
public static PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> cloneRealToolToPathSet(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage){
|
||||
@SuppressWarnings("unchecked")
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> cloneStorage = (PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>>)storage.clone();
|
||||
storage = cloneStorage;
|
||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
Map map = storage.getMap(types[i], false);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(types[i], false);
|
||||
if(map != null){
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
entry.setValue(((TreeSet)entry.getValue()).clone());
|
||||
Set<Entry<IRealBuildObjectAssociation, Set<IPath>>> entrySet = map.entrySet();
|
||||
for (Entry<IRealBuildObjectAssociation, Set<IPath>> entry : entrySet) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<IPath> clone = (Set<IPath>) ((TreeSet<IPath>)entry.getValue()).clone();
|
||||
entry.setValue(clone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,12 +141,12 @@ public class TcModificationUtil {
|
|||
return storage;
|
||||
}
|
||||
|
||||
public static PerTypeMapStorage createRealToolToPathSet(IConfiguration cfg, PerTypeMapStorage skipMapStorage, boolean addSkipPaths){
|
||||
PerTypeMapStorage storage = new PerTypeMapStorage();
|
||||
public static PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> createRealToolToPathSet(IConfiguration cfg, PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> skipMapStorage, boolean addSkipPaths){
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = new PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>>();
|
||||
FolderInfo rf = (FolderInfo)cfg.getRootFolderInfo();
|
||||
IPath p = rf.getPath();
|
||||
|
||||
Map skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, false) : null;
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, false) : null;
|
||||
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
|
||||
if(skipMap != null && skipMap.containsKey(realBuilder)){
|
||||
if(addSkipPaths){
|
||||
|
@ -152,10 +154,10 @@ public class TcModificationUtil {
|
|||
set.add(p);
|
||||
}
|
||||
} else {
|
||||
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
Set<IPath> pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
|
||||
pathSet.add(p);
|
||||
map.put(realBuilder, pathSet);
|
||||
map.put((Builder)realBuilder, pathSet);
|
||||
}
|
||||
|
||||
skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, false) : null;
|
||||
|
@ -166,7 +168,7 @@ public class TcModificationUtil {
|
|||
set.add(p);
|
||||
}
|
||||
} else {
|
||||
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, true);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, true);
|
||||
Set<IPath> pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
|
||||
pathSet.add(p);
|
||||
map.put(realCfg, pathSet);
|
||||
|
@ -186,43 +188,45 @@ public class TcModificationUtil {
|
|||
return storage;
|
||||
}
|
||||
|
||||
public static TreeMap<IPath, PerTypeSetStorage> createResultingChangesMap(TreeMap<IPath, PerTypeSetStorage> resultingMap, TreeMap<IPath, PerTypeSetStorage> initialMap){
|
||||
public static TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> createResultingChangesMap(TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> resultingMap, TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> initialMap){
|
||||
int[] types = new int []{
|
||||
IRealBuildObjectAssociation.OBJECT_TOOLCHAIN,
|
||||
IRealBuildObjectAssociation.OBJECT_BUILDER,
|
||||
IRealBuildObjectAssociation.OBJECT_TOOL,
|
||||
};
|
||||
|
||||
TreeMap<IPath, PerTypeSetStorage> result = new TreeMap<IPath, PerTypeSetStorage>(PathComparator.INSTANCE);
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>(PathComparator.INSTANCE);
|
||||
@SuppressWarnings("unchecked")
|
||||
TreeMap<IPath, PerTypeSetStorage> clone = (TreeMap<IPath, PerTypeSetStorage>)initialMap.clone();
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> clone = (TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>)initialMap.clone();
|
||||
initialMap = clone;
|
||||
|
||||
for (Entry<IPath, PerTypeSetStorage> entry : resultingMap.entrySet()) {
|
||||
for (Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> entry : resultingMap.entrySet()) {
|
||||
IPath oPath = entry.getKey();
|
||||
|
||||
PerTypeSetStorage resStorage = entry.getValue();
|
||||
PerTypeSetStorage initStorage = initialMap.remove(oPath);
|
||||
PerTypeSetStorage storage;
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> resStorage = entry.getValue();
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> initStorage = initialMap.remove(oPath);
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> storage;
|
||||
|
||||
if(initStorage == null || initStorage.isEmpty(true)){
|
||||
if(resStorage != null && !resStorage.isEmpty(true)){
|
||||
storage = (PerTypeSetStorage)resStorage.clone();
|
||||
@SuppressWarnings("unchecked")
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> clone2 = (PerTypeSetStorage<IRealBuildObjectAssociation>)resStorage.clone();
|
||||
storage = clone2;
|
||||
} else {
|
||||
storage = new PerTypeSetStorage();
|
||||
storage = new PerTypeSetStorage<IRealBuildObjectAssociation>();
|
||||
}
|
||||
} else if(resStorage == null || resStorage.isEmpty(true)){
|
||||
storage = new PerTypeSetStorage();
|
||||
storage = new PerTypeSetStorage<IRealBuildObjectAssociation>();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
Set set = initStorage.getSet(types[i], false);
|
||||
Set<IRealBuildObjectAssociation> set = initStorage.getSet(types[i], false);
|
||||
if(set != null && set.size() != 0){
|
||||
storage.getSet(types[i], true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Set tcInitSet, resSet, setToStore;
|
||||
Set bInitSet = null, tInitSet = null;
|
||||
storage = new PerTypeSetStorage();
|
||||
Set<IRealBuildObjectAssociation> tcInitSet, resSet, setToStore;
|
||||
Set<IRealBuildObjectAssociation> bInitSet = null, tInitSet = null;
|
||||
storage = new PerTypeSetStorage<IRealBuildObjectAssociation>();
|
||||
|
||||
tcInitSet = initStorage.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
|
||||
resSet = resStorage.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
|
||||
|
@ -239,19 +243,19 @@ public class TcModificationUtil {
|
|||
|
||||
IPath path = oPath;
|
||||
if(tc != null){
|
||||
tInitSet = new LinkedHashSet();
|
||||
tInitSet = new LinkedHashSet<IRealBuildObjectAssociation>();
|
||||
TcModificationUtil.getRealObjectsSet((Tool[])tc.getTools(), tInitSet);
|
||||
if(path.segmentCount() == 0){
|
||||
bInitSet = new LinkedHashSet();
|
||||
bInitSet = new LinkedHashSet<IRealBuildObjectAssociation>();
|
||||
IBuilder builder = tc.getBuilder();
|
||||
if(builder != null){
|
||||
bInitSet.add(ManagedBuildManager.getRealBuilder(builder));
|
||||
bInitSet.add((Builder)ManagedBuildManager.getRealBuilder(builder));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tcInitSet = Collections.EMPTY_SET;
|
||||
tcInitSet = Collections.emptySet();
|
||||
if(path.segmentCount() == 0){
|
||||
bInitSet = Collections.EMPTY_SET;
|
||||
bInitSet = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,17 +285,17 @@ public class TcModificationUtil {
|
|||
}
|
||||
|
||||
if(initialMap.size() != 0){
|
||||
for(Iterator iter = initialMap.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
IPath oPath = (IPath) entry.getKey();
|
||||
Set<Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>> entrySet = initialMap.entrySet();
|
||||
for (Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> entry : entrySet) {
|
||||
IPath oPath = entry.getKey();
|
||||
|
||||
PerTypeSetStorage initStorage = (PerTypeSetStorage)entry.getValue();
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> initStorage = entry.getValue();
|
||||
|
||||
if(!initStorage.isEmpty(true)){
|
||||
PerTypeSetStorage storage = new PerTypeSetStorage();
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> storage = new PerTypeSetStorage<IRealBuildObjectAssociation>();
|
||||
|
||||
for(int i = 0; i < types.length; i++){
|
||||
Set set = initStorage.getSet(types[i], false);
|
||||
Set<IRealBuildObjectAssociation> set = initStorage.getSet(types[i], false);
|
||||
if(set != null && set.size() != 0){
|
||||
storage.getSet(types[i], true).addAll(set);
|
||||
}
|
||||
|
@ -310,14 +314,14 @@ public class TcModificationUtil {
|
|||
return result;
|
||||
}
|
||||
|
||||
private static Set compareSets(Set resSet, Set initSet){
|
||||
Set result = null;
|
||||
private static Set<IRealBuildObjectAssociation> compareSets(Set<IRealBuildObjectAssociation> resSet, Set<IRealBuildObjectAssociation> initSet){
|
||||
Set<IRealBuildObjectAssociation> result = null;
|
||||
if(initSet == null || initSet.isEmpty()){
|
||||
if(resSet != null && !resSet.isEmpty()){
|
||||
result = resSet;
|
||||
}
|
||||
} else if (resSet == null || resSet.isEmpty()){
|
||||
result = Collections.EMPTY_SET;
|
||||
result = Collections.emptySet();
|
||||
} else {
|
||||
if(!initSet.equals(resSet)){
|
||||
result = resSet;
|
||||
|
@ -327,17 +331,17 @@ public class TcModificationUtil {
|
|||
return result;
|
||||
}
|
||||
|
||||
private static void processFolderInfo(PerTypeMapStorage storage, FolderInfo info, PerTypeMapStorage skipMapStorage, boolean addSkipPaths){
|
||||
private static void processFolderInfo(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, FolderInfo info, PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> skipMapStorage, boolean addSkipPaths){
|
||||
IPath p = info.getPath();
|
||||
IToolChain rtc = ManagedBuildManager.getRealToolChain(info.getToolChain());
|
||||
Map skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false) : null;
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false) : null;
|
||||
if(skipMap != null && skipMap.containsKey(rtc)){
|
||||
if(addSkipPaths){
|
||||
Set<IPath> set = getPathTreeSet(skipMap, (ToolChain)rtc);
|
||||
set.add(p);
|
||||
}
|
||||
} else {
|
||||
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, true);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, true);
|
||||
Set<IPath> set = getPathTreeSet(map, (ToolChain)rtc);
|
||||
set.add(p);
|
||||
}
|
||||
|
@ -346,18 +350,18 @@ public class TcModificationUtil {
|
|||
processTools(storage, p, tools, skipMapStorage, addSkipPaths);
|
||||
}
|
||||
|
||||
public static IRealBuildObjectAssociation[] getRealObjects(IRealBuildObjectAssociation[] objs, Class clazz){
|
||||
LinkedHashSet set = new LinkedHashSet();
|
||||
for(int i = 0; i < objs.length; i++){
|
||||
set.add(objs[i].getRealBuildObject());
|
||||
}
|
||||
Object[] array = (Object[])Array.newInstance(clazz, set.size());
|
||||
return (IRealBuildObjectAssociation[])set.toArray(array);
|
||||
}
|
||||
// public static IRealBuildObjectAssociation[] getRealObjects(IRealBuildObjectAssociation[] objs, Class clazz){
|
||||
// LinkedHashSet set = new LinkedHashSet();
|
||||
// for(int i = 0; i < objs.length; i++){
|
||||
// set.add(objs[i].getRealBuildObject());
|
||||
// }
|
||||
// Object[] array = (Object[])Array.newInstance(clazz, set.size());
|
||||
// return (IRealBuildObjectAssociation[])set.toArray(array);
|
||||
// }
|
||||
|
||||
public static Set getRealObjectsSet(IRealBuildObjectAssociation[] objs, Set set){
|
||||
public static Set<IRealBuildObjectAssociation> getRealObjectsSet(IRealBuildObjectAssociation[] objs, Set<IRealBuildObjectAssociation> set){
|
||||
if(set == null)
|
||||
set = new LinkedHashSet();
|
||||
set = new LinkedHashSet<IRealBuildObjectAssociation>();
|
||||
for(int i = 0; i < objs.length; i++){
|
||||
set.add(objs[i].getRealBuildObject());
|
||||
}
|
||||
|
@ -373,20 +377,20 @@ public class TcModificationUtil {
|
|||
return map;
|
||||
}
|
||||
|
||||
private static void processFileInfo(PerTypeMapStorage storage, ResourceConfiguration info, PerTypeMapStorage skipMapStorage, boolean addSkipPaths){
|
||||
private static void processFileInfo(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, ResourceConfiguration info, PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> skipMapStorage, boolean addSkipPaths){
|
||||
IPath p = info.getPath();
|
||||
ITool[] tools = info.getTools();
|
||||
processTools(storage, p, tools, skipMapStorage, addSkipPaths);
|
||||
}
|
||||
|
||||
private static void processTools(PerTypeMapStorage storage, IPath path, ITool[] tools, PerTypeMapStorage skipMapStorage, boolean addSkipPaths){
|
||||
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true);
|
||||
Map skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false) : null;
|
||||
private static void processTools(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, IPath path, ITool[] tools, PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> skipMapStorage, boolean addSkipPaths){
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false) : null;
|
||||
|
||||
processTools(map, path, tools, skipMap, addSkipPaths);
|
||||
}
|
||||
|
||||
private static void processTools(Map storageMap, IPath path, ITool[] tools, Map skipMap, boolean addSkipPaths){
|
||||
private static void processTools(Map<IRealBuildObjectAssociation, Set<IPath>> storageMap, IPath path, ITool[] tools, Map<IRealBuildObjectAssociation, Set<IPath>> skipMap, boolean addSkipPaths){
|
||||
for(int i = 0; i < tools.length; i++){
|
||||
ITool rt = ManagedBuildManager.getRealTool(tools[i]);
|
||||
if(skipMap != null && skipMap.containsKey(rt)){
|
||||
|
@ -420,12 +424,12 @@ public class TcModificationUtil {
|
|||
return list;
|
||||
}
|
||||
|
||||
public static Object removeBuilderInfo(PerTypeMapStorage storage, IBuilder builder){
|
||||
public static Set<IPath> removeBuilderInfo(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, IBuilder builder){
|
||||
return storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true).remove(builder);
|
||||
}
|
||||
|
||||
public static void restoreBuilderInfo(PerTypeMapStorage storage, IBuilder builder, Object obj){
|
||||
storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true).put(builder, obj);
|
||||
public static void restoreBuilderInfo(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, IBuilder builder, Set<IPath> obj){
|
||||
storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true).put((Builder)builder, obj);
|
||||
}
|
||||
|
||||
// public static boolean removeToolInfo(PerTypeMapStorage storage, IPath path, ITool tool){
|
||||
|
@ -502,31 +506,31 @@ public class TcModificationUtil {
|
|||
objPaths.add(path);
|
||||
}
|
||||
|
||||
public static void applyBuilder(PerTypeMapStorage storage, IPath path, IBuilder builder){
|
||||
Map bMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
public static void applyBuilder(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, IPath path, IBuilder builder){
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> bMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
bMap.clear();
|
||||
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(builder);
|
||||
Set<IPath> set = getPathTreeSet(bMap, (Builder)realBuilder);
|
||||
set.add(path);
|
||||
}
|
||||
|
||||
public static void applyBuilder(TreeMap pathMap, IPath path, IBuilder builder){
|
||||
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(builder);
|
||||
PerTypeSetStorage storage = (PerTypeSetStorage)pathMap.get(path);
|
||||
Set set = storage.getSet(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
set.clear();
|
||||
set.add(realBuilder);
|
||||
}
|
||||
// public static void applyBuilder(TreeMap pathMap, IPath path, IBuilder builder){
|
||||
// IBuilder realBuilder = ManagedBuildManager.getRealBuilder(builder);
|
||||
// PerTypeSetStorage storage = (PerTypeSetStorage)pathMap.get(path);
|
||||
// Set set = storage.getSet(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
|
||||
// set.clear();
|
||||
// set.add(realBuilder);
|
||||
// }
|
||||
|
||||
public static TreeMap<IPath, PerTypeSetStorage> createPathMap(IConfiguration cfg){
|
||||
public static TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> createPathMap(IConfiguration cfg){
|
||||
//TODO: optimize to calculate the map directly
|
||||
PerTypeMapStorage storage = createRealToolToPathSet(cfg, null, false);
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = createRealToolToPathSet(cfg, null, false);
|
||||
return createPathMap(storage);
|
||||
}
|
||||
|
||||
public static TreeMap<IPath,PerTypeSetStorage> createPathMap(PerTypeMapStorage storage){
|
||||
public static TreeMap<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>> createPathMap(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage){
|
||||
int[] types = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
TreeMap<IPath,PerTypeSetStorage> result = new TreeMap<IPath,PerTypeSetStorage>(PathComparator.INSTANCE);
|
||||
TreeMap<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<IPath,PerTypeSetStorage<IRealBuildObjectAssociation>>(PathComparator.INSTANCE);
|
||||
for(int i = 0; i < types.length; i++){
|
||||
int type = types[i];
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(type, false);
|
||||
|
@ -538,13 +542,12 @@ public class TcModificationUtil {
|
|||
IRealBuildObjectAssociation pathKey = entry.getKey();
|
||||
Set<IPath> pathSet = entry.getValue();
|
||||
for (IPath path : pathSet) {
|
||||
PerTypeSetStorage oset = result.get(path);
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> oset = result.get(path);
|
||||
if(oset == null){
|
||||
oset = new PerTypeSetStorage();
|
||||
oset = new PerTypeSetStorage<IRealBuildObjectAssociation>();
|
||||
result.put(path, oset);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<IRealBuildObjectAssociation> set = oset.getSet(type, true);
|
||||
set.add(pathKey);
|
||||
}
|
||||
|
@ -554,58 +557,58 @@ public class TcModificationUtil {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static TreeMap clonePathMap(TreeMap map){
|
||||
map = (TreeMap)map.clone();
|
||||
// public static TreeMap clonePathMap(TreeMap map){
|
||||
// map = (TreeMap)map.clone();
|
||||
//
|
||||
// for(Iterator iter = map.entrySet().iterator(); iter.hasNext(); ){
|
||||
// Map.Entry entry = (Map.Entry)iter.next();
|
||||
// entry.setValue(((PerTypeSetStorage)entry.getValue()).clone());
|
||||
// }
|
||||
//
|
||||
// return map;
|
||||
// }
|
||||
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
entry.setValue(((PerTypeSetStorage)entry.getValue()).clone());
|
||||
}
|
||||
// private static boolean pathContainsObjects(PerTypeMapStorage storage, IPath path, int type){
|
||||
// Map map = storage.getMap(type, false);
|
||||
// if(map == null)
|
||||
// return false;
|
||||
//
|
||||
// for(Iterator iter = map.values().iterator(); iter.hasNext(); ){
|
||||
// SortedSet set = (SortedSet)iter.next();
|
||||
// if(set.contains(path))
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return map;
|
||||
}
|
||||
public static SortedSet<IPath> getDirectChildUsagePaths(PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage, IPath path, IRealBuildObjectAssociation obj, SortedSet<IPath> inclusionPaths){
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> objMap = storage.getMap(obj.getType(), false);
|
||||
|
||||
private static boolean pathContainsObjects(PerTypeMapStorage storage, IPath path, int type){
|
||||
Map map = storage.getMap(type, false);
|
||||
if(map == null)
|
||||
return false;
|
||||
|
||||
for(Iterator iter = map.values().iterator(); iter.hasNext(); ){
|
||||
SortedSet set = (SortedSet)iter.next();
|
||||
if(set.contains(path))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static SortedSet getDirectChildUsagePaths(PerTypeMapStorage storage, IPath path, IRealBuildObjectAssociation obj, SortedSet inclusionPaths){
|
||||
Map objMap = storage.getMap(obj.getType(), false);
|
||||
|
||||
SortedSet objPaths = (SortedSet)objMap.get(obj);
|
||||
SortedSet<IPath> objPaths = (SortedSet<IPath>)objMap.get(obj);
|
||||
if(DbgTcmUtil.DEBUG){
|
||||
if(!objPaths.contains(path)){
|
||||
DbgTcmUtil.fail();
|
||||
}
|
||||
}
|
||||
|
||||
SortedSet objChildPaths = PathComparator.getChildPathSet(objPaths, path, false, true);
|
||||
SortedSet<IPath> objChildPaths = PathComparator.getChildPathSet(objPaths, path, false, true);
|
||||
if(inclusionPaths != null) {
|
||||
objChildPaths.retainAll(inclusionPaths);
|
||||
}
|
||||
|
||||
for(Iterator iter = objMap.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
Object cur = entry.getKey();
|
||||
for(Iterator<Entry<IRealBuildObjectAssociation, Set<IPath>>> iter = objMap.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry<IRealBuildObjectAssociation, Set<IPath>> entry = iter.next();
|
||||
IRealBuildObjectAssociation cur = entry.getKey();
|
||||
if(obj == cur)
|
||||
continue;
|
||||
|
||||
SortedSet curPaths = (SortedSet)entry.getValue();
|
||||
SortedSet<IPath> curPaths = (SortedSet<IPath>)entry.getValue();
|
||||
|
||||
curPaths = PathComparator.getChildPathSet(curPaths, path, false, false);
|
||||
|
||||
for(Iterator pathIter = objChildPaths.iterator(); pathIter.hasNext(); ){
|
||||
SortedSet sub = curPaths.tailSet(pathIter.next());
|
||||
for (IPath childPath : objChildPaths) {
|
||||
SortedSet<IPath> sub = curPaths.tailSet(childPath);
|
||||
if(sub.size() != 0)
|
||||
iter.remove();
|
||||
}
|
||||
|
@ -617,7 +620,7 @@ public class TcModificationUtil {
|
|||
}
|
||||
|
||||
|
||||
public static boolean containCommonEntries(Set set, Object[] objs){
|
||||
public static boolean containCommonEntries(Set<String> set, String[] objs){
|
||||
for(int i = 0; i < objs.length; i++){
|
||||
if(set.contains(objs[i]))
|
||||
return true;
|
||||
|
|
|
@ -59,8 +59,8 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
private HashSet<ITool> fFilteredOutSysTools;
|
||||
// private LinkedHashMap fRealToToolMap = new LinkedHashMap();
|
||||
// private boolean fSysInfoMapInited;
|
||||
private PerTypeMapStorage fCompleteObjectStorage;
|
||||
protected TreeMap<IPath, PerTypeSetStorage> fCompletePathMapStorage;
|
||||
private PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> fCompleteObjectStorage;
|
||||
protected TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> fCompletePathMapStorage;
|
||||
private HashSet<Tool> fAddCapableTools;
|
||||
private Map<Tool, Tool> fFilteredOutTools;
|
||||
|
||||
|
@ -164,10 +164,11 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
if(DbgTcmUtil.DEBUG)
|
||||
DbgTcmUtil.println("calculating compatibility for tool " + fRealTool.getUniqueRealName()); //$NON-NLS-1$
|
||||
|
||||
PerTypeMapStorage storage = getCompleteObjectStore();
|
||||
PerTypeMapStorage<? extends IRealBuildObjectAssociation, Set<IPath>> storage = getCompleteObjectStore();
|
||||
Tool tool = fRealTool;
|
||||
Set<IPath> rmSet = getToolApplicabilityPathSet(tool, true);
|
||||
Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, Set<IPath>> toolMap = (Map<Tool, Set<IPath>>) storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
|
||||
try {
|
||||
if(rmSet != null && rmSet.size() != 0)
|
||||
TcModificationUtil.removePaths(toolMap, tool, rmSet);
|
||||
|
@ -175,11 +176,13 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
if(DbgTcmUtil.DEBUG)
|
||||
DbgTcmUtil.dumpStorage(storage);
|
||||
|
||||
ConflictMatchSet conflicts = ToolChainModificationManager.getInstance().getConflictInfo(IRealBuildObjectAssociation.OBJECT_TOOL, storage);
|
||||
@SuppressWarnings("unchecked")
|
||||
ConflictMatchSet conflicts = ToolChainModificationManager.getInstance().getConflictInfo(IRealBuildObjectAssociation.OBJECT_TOOL, (PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>>) storage);
|
||||
|
||||
fCompatibleTools = new HashMap<Tool, ToolCompatibilityInfoElement>();
|
||||
fInCompatibleTools = new HashMap<Tool, ToolCompatibilityInfoElement>();
|
||||
Tool sysTools[] = getTools(false, true);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, List<ConflictMatch>> conflictMap = (Map<Tool, List<ConflictMatch>>) conflicts.fObjToConflictListMap;
|
||||
for(int i = 0; i < sysTools.length; i++){
|
||||
Tool t = sysTools[i];
|
||||
|
@ -368,7 +371,7 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
private Set<Tool> getAddCompatibleSysTools(){
|
||||
if(fAddCapableTools == null){
|
||||
fAddCapableTools = new HashSet<Tool>(Arrays.asList(getAllSysTools()));
|
||||
PerTypeMapStorage storage = getCompleteObjectStore();
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage = getCompleteObjectStore();
|
||||
ConflictMatchSet conflicts = ToolChainModificationManager.getInstance().getConflictInfo(IRealBuildObjectAssociation.OBJECT_TOOL, storage);
|
||||
fAddCapableTools.removeAll(conflicts.fObjToConflictListMap.keySet());
|
||||
}
|
||||
|
@ -383,8 +386,10 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
public ToolListModification(ResourceInfo rcInfo, ToolListModification base){
|
||||
fRcInfo = rcInfo;
|
||||
Tool[] initialTools = (Tool[])rcInfo.getTools();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, Tool> initRealToToolMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(initialTools, null);
|
||||
Tool[] updatedTools = base.getTools(true, false);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, Tool> updatedRealToToolMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(updatedTools, null);
|
||||
Set<Entry<Tool, Tool>> entrySet = updatedRealToToolMap.entrySet();
|
||||
for (Entry<Tool, Tool> entry : entrySet) {
|
||||
|
@ -502,13 +507,13 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
}
|
||||
|
||||
public final void apply() throws CoreException {
|
||||
TreeMap<IPath, PerTypeSetStorage> initialMap = TcModificationUtil.createPathMap(fRcInfo.getParent());
|
||||
TreeMap<IPath, PerTypeSetStorage> cur = getCompletePathMapStorage();
|
||||
TreeMap<IPath, PerTypeSetStorage> result = TcModificationUtil.createResultingChangesMap(cur, initialMap);
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> initialMap = TcModificationUtil.createPathMap(fRcInfo.getParent());
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> cur = getCompletePathMapStorage();
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = TcModificationUtil.createResultingChangesMap(cur, initialMap);
|
||||
apply(result);
|
||||
}
|
||||
|
||||
private void apply(TreeMap<IPath, PerTypeSetStorage> resultingChangeMap) throws CoreException {
|
||||
private void apply(TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> resultingChangeMap) throws CoreException {
|
||||
//the order matters here: we first should process tool-chain than a builder and then tools
|
||||
int types[] = new int[]{
|
||||
IRealBuildObjectAssociation.OBJECT_TOOLCHAIN,
|
||||
|
@ -518,17 +523,17 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
|
||||
int type;
|
||||
IConfiguration cfg = fRcInfo.getParent();
|
||||
Set<Entry<IPath, PerTypeSetStorage>> entrySet = resultingChangeMap.entrySet();
|
||||
for (Entry<IPath, PerTypeSetStorage> entry : entrySet) {
|
||||
Set<Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>> entrySet = resultingChangeMap.entrySet();
|
||||
for (Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> entry : entrySet) {
|
||||
IPath path = entry.getKey();
|
||||
ResourceInfo rcInfo = (ResourceInfo)cfg.getResourceInfo(path, true);
|
||||
if(rcInfo == null){
|
||||
rcInfo = (FolderInfo)cfg.createFolderInfo(path);
|
||||
}
|
||||
PerTypeSetStorage storage = entry.getValue();
|
||||
PerTypeSetStorage<IRealBuildObjectAssociation> storage = entry.getValue();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
type = types[i];
|
||||
Set<? extends IRealBuildObjectAssociation> set = storage.getSet(type, false);
|
||||
Set<IRealBuildObjectAssociation> set = storage.getSet(type, false);
|
||||
if(set != null){
|
||||
apply(rcInfo, type, set);
|
||||
}
|
||||
|
@ -654,8 +659,9 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
list.addAll(map.values());
|
||||
clearToolInfo(map.values().toArray(new Tool[map.size()]));
|
||||
|
||||
PerTypeMapStorage storage = getCompleteObjectStore();
|
||||
Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true);
|
||||
PerTypeMapStorage<? extends IRealBuildObjectAssociation, Set<IPath>> storage = getCompleteObjectStore();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, Set<IPath>> toolMap = (Map<Tool, Set<IPath>>) storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true);
|
||||
if(rmSet != null)
|
||||
TcModificationUtil.removePaths(toolMap, realRemoved, rmSet);
|
||||
if(addSet != null)
|
||||
|
@ -700,7 +706,9 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
}
|
||||
|
||||
filteredTools = filterTools(allTools);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, Tool> filteredMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(filteredTools, null);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Tool, Tool> allMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(allTools, null);
|
||||
allMap.keySet().removeAll(filteredMap.keySet());
|
||||
fFilteredOutTools = allMap;
|
||||
|
@ -728,7 +736,7 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
fCompletePathMapStorage = null;
|
||||
}
|
||||
|
||||
protected PerTypeMapStorage getCompleteObjectStore(){
|
||||
protected PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> getCompleteObjectStore(){
|
||||
if(fCompleteObjectStorage == null){
|
||||
fCompleteObjectStorage = TcModificationUtil.createRealToolToPathSet(fRcInfo.getParent(), null, false);
|
||||
if(DbgTcmUtil.DEBUG){
|
||||
|
@ -739,7 +747,7 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
return fCompleteObjectStorage;
|
||||
}
|
||||
|
||||
protected TreeMap<IPath, PerTypeSetStorage> getCompletePathMapStorage(){
|
||||
protected TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> getCompletePathMapStorage(){
|
||||
if(fCompletePathMapStorage == null){
|
||||
fCompletePathMapStorage = TcModificationUtil.createPathMap(getCompleteObjectStore());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue