aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Suen2011-08-08 11:12:56 (EDT)
committerPaul Webster2011-08-25 10:21:59 (EDT)
commit9f3d09331b4424712c16d1ec9d83d4971dbdd576 (patch)
treeaaffb8e6c4ce89e9ce02939e8b9aeb24fa793b93
parent1dfcf4e96bcc6249163d07c5ff5ec4ea710dec49 (diff)
downloadeclipse.platform.ui-9f3d09331b4424712c16d1ec9d83d4971dbdd576.zip
eclipse.platform.ui-9f3d09331b4424712c16d1ec9d83d4971dbdd576.tar.gz
eclipse.platform.ui-9f3d09331b4424712c16d1ec9d83d4971dbdd576.tar.bz2
Bug 354151 [Compatibility] Property listeners on part references do not
get notified of part property changes Part references can have part property change listeners attached to them but they were not getting notified when their underlying parts implemented the IWorkbenchPart3 interface and were sending out part property change events. The part reference must attach a listener to the IWorkbenchPart3 implementation to get events forwarded out to its own part property change listeners.
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java26
3 files changed, 7 insertions, 21 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
index 5d09ea4..057da26 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
@@ -349,6 +349,7 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
}
legacyPart = part;
+ addPropertyListeners();
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
index cfb688c..7e590f8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
@@ -149,6 +149,7 @@ public class ViewReference extends WorkbenchPartReference implements IViewRefere
}
legacyPart = part;
+ addPropertyListeners();
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
index 3dcc472..ebafa0b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
@@ -438,33 +438,19 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
public abstract void initialize(IWorkbenchPart part) throws PartInitException;
- private void addPropertyListeners() {
+ void addPropertyListeners() {
IWorkbenchPart workbenchPart = getPart(false);
if (workbenchPart != null) {
- workbenchPart.addPropertyListener(new IPropertyListener() {
- public void propertyChanged(Object source, int propId) {
- firePropertyListeners(source, propId);
- }
- });
+ workbenchPart.addPropertyListener(propertyChangeListener);
if (workbenchPart instanceof IWorkbenchPart3) {
((IWorkbenchPart3) workbenchPart)
- .addPartPropertyListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- firePartPropertyChange(event);
- }
- });
+ .addPartPropertyListener(partPropertyChangeListener);
}
}
}
- private void firePropertyListeners(Object source, int propId) {
- for (Object listener : propChangeListeners.getListeners()) {
- ((IPropertyListener) listener).propertyChanged(source, propId);
- }
- }
-
public final IWorkbenchPart getPart(boolean restore) {
if (isDisposed()) {
return null;
@@ -487,7 +473,6 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
CompatibilityPart compatibilityPart = (CompatibilityPart) part.getObject();
if (compatibilityPart != null) {
legacyPart = compatibilityPart.getPart();
- addPropertyListeners();
}
}
}
@@ -508,7 +493,7 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
/**
*
*/
- public void doDisposePart() {
+ private void doDisposePart() {
if (legacyPart != null) {
fireInternalPropertyChange(INTERNAL_PROPERTY_CLOSED);
// Don't let exceptions in client code bring us down. Log them and continue.
@@ -518,7 +503,6 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
((IWorkbenchPart3) legacyPart)
.removePartPropertyListener(partPropertyChangeListener);
}
- legacyPart.dispose();
} catch (Exception e) {
WorkbenchPlugin.log(e);
}
@@ -662,7 +646,7 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
}
public void invalidate() {
- legacyPart = null;
+ doDisposePart();
}
public final PartPane getPane() {