jh: fix plugin packages refresh issue
diff --git a/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/MethodPluginItemProvider.java b/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/MethodPluginItemProvider.java
index dbeba61..786b067 100755
--- a/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/MethodPluginItemProvider.java
+++ b/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/MethodPluginItemProvider.java
@@ -155,10 +155,10 @@
.getNotifier(), true, false));
return;
case UmaPackage.METHOD_PLUGIN__NAME:
+ TngUtil.refreshParentIfNameChanged(notification, this);
fireNotifyChanged(new ViewerNotification(notification, notification
.getNotifier(), true, true));
TngUtil.refreshPluginExtenders(this, notification, true, true);
- TngUtil.refreshParentIfNameChanged(notification, this);
break;
}
diff --git a/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/PluginUIPackagesItemProvider.java b/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/PluginUIPackagesItemProvider.java
index 9f6bd0e..c7c3b17 100755
--- a/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/PluginUIPackagesItemProvider.java
+++ b/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/navigator/PluginUIPackagesItemProvider.java
@@ -56,18 +56,6 @@
private Map<String, PluginUIPackagesItemProvider> pluginPackagesItemProvidersMap = new HashMap<String, PluginUIPackagesItemProvider>();
- protected Adapter nameChangedListener = new AdapterImpl() {
- public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
- switch (notification.getFeatureID(MethodPlugin.class)) {
- case UmaPackage.METHOD_PLUGIN__NAME:
- updateChildren(notification);
-
- TngUtil.refreshParentIfNameChanged(notification, PluginUIPackagesItemProvider.this);
- break;
- }
- }
- };
-
/**
* Creates a new instance.
@@ -76,7 +64,6 @@
super(adapterFactory);
this.name = packageName;
this.plugins = plugins;
- addToPluginsAdapters();
}
public void setParent(Object parent) {
@@ -127,9 +114,12 @@
if(bottomName == null || topName.equals(bottomName))
return topName;
-
- String deltaname= bottomName.substring(topName.length()+1);
- return deltaname;
+ try {
+ String deltaname= bottomName.substring(topName.length()+1);
+ return deltaname;
+ } catch (StringIndexOutOfBoundsException e) {
+ return bottomName;
+ }
}
@@ -218,7 +208,6 @@
@Override
public void dispose() {
// remove this from the plugins' adapter list
- removeFromPluginsAdapters();
if (pluginPackagesItemProvidersMap != null) {
pluginPackagesItemProvidersMap.clear();
pluginPackagesItemProvidersMap = null;
@@ -239,21 +228,6 @@
}
}
- private void addToPluginsAdapters() {
- for (Iterator<MethodPlugin> iter = plugins.iterator();iter.hasNext();) {
- MethodPlugin plugin = iter.next();
- plugin.eAdapters().add(nameChangedListener);
- }
- }
-
- private void removeFromPluginsAdapters() {
- for (Iterator<MethodPlugin> iter = plugins.iterator();iter.hasNext();) {
- MethodPlugin plugin = iter.next();
- plugin.eAdapters().remove(nameChangedListener);
- }
- }
-
-
public Collection<MethodPlugin> getPlugins() {
return plugins;
}