From 5dbf2f399a4f511a8b27e6a23f44c15e6dfa9073 Mon Sep 17 00:00:00 2001 From: luukkainen Date: Thu, 22 Jan 2009 15:27:52 +0000 Subject: [PATCH] Selection events coming from other editors/views should be fixed. git-svn-id: https://www.simantics.org/svn/simantics/3d/branches/dev@8809 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../proconf/g3d/base/ThreeDimensionalEditorPart.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java b/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java index 3e99d5ef..702037b6 100644 --- a/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java +++ b/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/ThreeDimensionalEditorPart.java @@ -15,7 +15,6 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IPartListener; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPart; import org.simantics.db.Graph; @@ -139,12 +138,14 @@ public abstract class ThreeDimensionalEditorPart extends ResourceEditorPart impl private void hookPageSelection() { pageSelectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if (part == ThreeDimensionalEditorPart.this) - return; + if (part == ThreeDimensionalEditorPart.this) { + return; + } pageSelectionChanged(part, selection); } }; getSite().getPage().addPostSelectionListener(pageSelectionListener); + getSite().getPage().addSelectionListener(pageSelectionListener); ISelection sel = getSite().getPage().getSelection(); IWorkbenchPart wb = getSite().getPage().getActivePart(); pageSelectionChanged(wb, sel); @@ -161,8 +162,10 @@ public abstract class ThreeDimensionalEditorPart extends ResourceEditorPart impl } public void dispose() { - if (pageSelectionListener != null) + if (pageSelectionListener != null) { getSite().getPage().removePostSelectionListener(pageSelectionListener); + getSite().getPage().removeSelectionListener(pageSelectionListener); + } editor.dispose(); super.dispose(); } -- 2.47.1