wlu: adjusted resouce src file name if there is plugin rename involved
diff --git a/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/LibraryImportManager.java b/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/LibraryImportManager.java
index a0668b1..9dde5d8 100644
--- a/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/LibraryImportManager.java
+++ b/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/LibraryImportManager.java
@@ -69,6 +69,7 @@
*/
public class LibraryImportManager {
+ private Map<String, String> renamePluginMap = new HashMap<String, String>();
private Map renameElementMap = new HashMap();
private Map setElementMap = null;
@@ -182,7 +183,7 @@
// create the resource scanner
resScanner = new ResourceScanner(
LibraryUtil.getLibraryRootPath(importingLibrary),
- LibraryUtil.getLibraryRootPath(baseLibrary));
+ LibraryUtil.getLibraryRootPath(baseLibrary), renamePluginMap);
diagramHandler = new DiagramHandler(
LibraryUtil.getLibraryRootPath(importingLibrary),
@@ -1683,6 +1684,14 @@
String name = plugin.getName();
String guid = plugin.getGuid();
+ MethodPlugin basePlugin0 = guidMap.get(guid);
+ if (basePlugin0 != null) {
+ String name0 = basePlugin0.getName();
+ if (! name0.equals(name)) {
+ renamePluginMap.put(name0, name);
+ }
+ }
+
MethodPlugin basePlugin = map.get(name);
boolean toAdd = false;
if (basePlugin != null && ! basePlugin.getGuid().equals(guid)
diff --git a/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/ResourceScanner.java b/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/ResourceScanner.java
index 01f7823..fc01cc7 100644
--- a/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/ResourceScanner.java
+++ b/org.eclipse.epf.import/src/org/eclipse/epf/importing/services/ResourceScanner.java
@@ -45,13 +45,15 @@
private Map newFileMap = new HashMap();
private Map existingFileMap = new HashMap();
+ Map<String, String> renamePluginMap;
/**
* Creates a new instance.
*/
- public ResourceScanner(File srcLibRoot, File targetLibRoot) {
+ public ResourceScanner(File srcLibRoot, File targetLibRoot, Map<String, String> renamePluginMap) {
this.srcLibRoot = srcLibRoot;
this.targetLibRoot = targetLibRoot;
+ this.renamePluginMap = renamePluginMap;
}
/**
@@ -130,6 +132,10 @@
String elementPath = ResourceHelper.getElementPath(owner);
srcFile = new File(new File(srcLibRoot, elementPath), url);
if (!srcFile.isFile() || !srcFile.exists()) {
+ elementPath = getElementPathWithRenamedPlugin(elementPath);
+ srcFile = new File(new File(srcLibRoot, elementPath), url);
+ }
+ if (!srcFile.isFile() || !srcFile.exists()) {
url = NetUtil.decodeURL(url);
srcFile = new File(new File(srcLibRoot, elementPath), url);
}
@@ -177,6 +183,20 @@
}
}
+
+ private String getElementPathWithRenamedPlugin(String elementPath) {
+ if (renamePluginMap != null && ! renamePluginMap.isEmpty()) {
+ int ix = elementPath.indexOf("\\");//$NON-NLS-1$
+ if (ix > 0) {
+ String basePluginName = elementPath.substring(0, ix);
+ String importPluginName = renamePluginMap.get(basePluginName);
+ if (importPluginName != null) {
+ return importPluginName + elementPath.substring(ix);
+ }
+ }
+ }
+ return elementPath;
+ }
/**
* Copies resource.