diff options
| author | Andrey Loskutov | 2016-08-12 14:34:57 +0000 |
|---|---|---|
| committer | Andrey Loskutov | 2016-08-12 14:34:57 +0000 |
| commit | 3b94b08bd36e82fffd41893c775cbf0b820960b9 (patch) | |
| tree | be770ded628c1131edb9a1275149b9cf82f63302 | |
| parent | 95dc0f989b45182c0a095182328830277bd29a8f (diff) | |
| download | eclipse.platform.ui-3b94b08bd36e82fffd41893c775cbf0b820960b9.tar.gz eclipse.platform.ui-3b94b08bd36e82fffd41893c775cbf0b820960b9.tar.xz eclipse.platform.ui-3b94b08bd36e82fffd41893c775cbf0b820960b9.zip | |
Revert "Bug 495567 - properly handle dirty state changes in properties view"
This reverts commit a6caf724e1deda57bdaa9cb36c979393ec2a12ad.
2 files changed, 4 insertions, 64 deletions
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java index dc979368f24..510eda4ea94 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java @@ -36,7 +36,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IMemento; import org.eclipse.ui.ISaveablePart; -import org.eclipse.ui.ISaveablesLifecycleListener; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewReference; @@ -44,13 +43,8 @@ import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartConstants; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.PartInitException; -import org.eclipse.ui.Saveable; -import org.eclipse.ui.SaveablesLifecycleEvent; -import org.eclipse.ui.internal.DefaultSaveable; -import org.eclipse.ui.internal.SaveablesList; import org.eclipse.ui.internal.views.properties.PropertiesMessages; import org.eclipse.ui.part.IContributedContentsView; import org.eclipse.ui.part.IPage; @@ -135,48 +129,6 @@ public class PropertySheet extends PageBookView implements ISelectionListener, I private boolean wasHidden; - private final SaveablesTracker saveablesTracker; - - /** - * Propagates state changes of the saveable part tracked by this properties - * view, to properly update the dirty status. See bug 495567 comment 18. - */ - class SaveablesTracker implements ISaveablesLifecycleListener { - - @Override - public void handleLifecycleEvent(SaveablesLifecycleEvent event) { - if (currentPart == null || event.getEventType() != SaveablesLifecycleEvent.DIRTY_CHANGED) { - return; - } - // to avoid endless loop we must ignore our own instance which - // reports state changes too - Saveable[] saveables = event.getSaveables(); - if (saveables == null) { - return; - } - for (Saveable saveable : saveables) { - // check if the saveable is for the current part - if (new DefaultSaveable(PropertySheet.this).equals(saveable)) { - return; - } - } - - if (event.getSource() instanceof SaveablesList) { - SaveablesList saveablesList = (SaveablesList) event.getSource(); - for (Saveable saveable : saveables) { - IWorkbenchPart[] parts = saveablesList.getPartsForSaveable(saveable); - for (IWorkbenchPart part : parts) { - if (PropertySheet.this.currentPart == part) { - firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); - return; - } - } - } - } - } - - } - /** * Creates a property sheet view. */ @@ -184,7 +136,6 @@ public class PropertySheet extends PageBookView implements ISelectionListener, I super(); pinPropertySheetAction = new PinPropertySheetAction(); RegistryFactory.getRegistry().addListener(this, EXT_POINT); - saveablesTracker = new SaveablesTracker(); } @Override @@ -223,10 +174,7 @@ public class PropertySheet extends PageBookView implements ISelectionListener, I .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); - ISaveablesLifecycleListener saveables = getSite().getService(ISaveablesLifecycleListener.class); - if (saveables instanceof SaveablesList) { - ((SaveablesList) saveables).addModelLifecycleListener(saveablesTracker); - } + getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); @@ -240,10 +188,7 @@ public class PropertySheet extends PageBookView implements ISelectionListener, I // remove ourselves as a selection and registry listener getSite().getPage().removePostSelectionListener(this); RegistryFactory.getRegistry().removeListener(this); - ISaveablesLifecycleListener saveables = getSite().getService(ISaveablesLifecycleListener.class); - if (saveables instanceof SaveablesList) { - ((SaveablesList) saveables).removeModelLifecycleListener(saveablesTracker); - } + currentPart = null; currentSelection = null; pinPropertySheetAction = null; @@ -469,8 +414,6 @@ public class PropertySheet extends PageBookView implements ISelectionListener, I } else { setContentDescription(""); //$NON-NLS-1$ } - // since our selection changes, our dirty state might change too - firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); } /** diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java index a43bbf9159d..e62c9ef114f 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java @@ -26,6 +26,7 @@ import org.eclipse.e4.core.services.log.Logger; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.di.PersistState; +import org.eclipse.e4.ui.model.application.ui.MDirtyable; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.menu.MMenu; import org.eclipse.e4.ui.workbench.IPresentationEngine; @@ -375,11 +376,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener { case IWorkbenchPartConstants.PROP_DIRTY: ISaveablePart saveable = SaveableHelper.getSaveable(wrapped); if (saveable != null) { - part.setDirty(saveable.isDirty()); - } else if (part.isDirty()) { - // reset if the wrapped legacy part do not exposes - // saveable adapter anymore, see bug 495567 comment 6 - part.setDirty(false); + ((MDirtyable) part).setDirty(saveable.isDirty()); } break; case IWorkbenchPartConstants.PROP_INPUT: |
