Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2014-12-18 00:23:14 +0000
committerMarc-Andre Laperle2014-12-19 19:27:26 +0000
commit5934d46c52f50e24c55bcc4f50a2c6d858d000c5 (patch)
tree14c9d19dc43819eebb1129789d3f92ae6545a58f
parent081483010c64d829fa1f2b4a415f9ac82be6dd49 (diff)
downloadorg.eclipse.linuxtools-5934d46c52f50e24c55bcc4f50a2c6d858d000c5.tar.gz
org.eclipse.linuxtools-5934d46c52f50e24c55bcc4f50a2c6d858d000c5.tar.xz
org.eclipse.linuxtools-5934d46c52f50e24c55bcc4f50a2c6d858d000c5.zip
rcp: Fix not being able to print the Sequence diagram
Bug: 436440 Change-Id: Ifea6db0fe4da8bdc60520fef71e2b17740585fd4 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/38455 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java61
1 files changed, 58 insertions, 3 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
index cdd804c943..402865e873 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
@@ -23,6 +23,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -68,10 +69,14 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
@@ -83,7 +88,7 @@ import org.eclipse.ui.views.properties.IPropertySheetPage;
* @version 1.0
* @author sveyrier
*/
-public class SDView extends ViewPart {
+public class SDView extends ViewPart implements IPartListener {
// ------------------------------------------------------------------------
// Constants
@@ -201,6 +206,12 @@ public class SDView extends ViewPart {
private Zoom fNoZoomAction;
private Zoom fZoomInAction;
private Zoom fZoomOutAction;
+ private ActionHandler fPrintActionHandler;
+ /**
+ * Keeping this allows to deactivate the action when the view is
+ * deactivated.
+ */
+ private IHandlerActivation fPrintHandlerActivation;
// ------------------------------------------------------------------------
// Methods
@@ -235,8 +246,8 @@ public class SDView extends ViewPart {
fTimeCompressionBar.setVisible(false);
parent.layout(true);
- Print print = new Print(this);
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), print);
+ fPrintActionHandler = new ActionHandler(new Print(this));
+ getSite().getPage().addPartListener(this);
fNeedInit = restoreLoader();
}
@@ -266,6 +277,7 @@ public class SDView extends ViewPart {
public void dispose() {
KeyBindingsManager.getInstance().remove(this.getSite().getId());
disposeZoomActions();
+ fPrintActionHandler.dispose();
super.dispose();
}
@@ -1178,4 +1190,47 @@ public class SDView extends ViewPart {
public void dispose() {
}
}
+
+ /**
+ * @since 3.2
+ */
+ @Override
+ public void partActivated(IWorkbenchPart part) {
+ if (part == this) {
+ final IHandlerService hs = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ fPrintHandlerActivation = hs.activateHandler(ActionFactory.PRINT.getCommandId(), fPrintActionHandler);
+ }
+ }
+
+ /**
+ * @since 3.2
+ */
+ @Override
+ public void partBroughtToTop(IWorkbenchPart part) {
+ }
+
+ /**
+ * @since 3.2
+ */
+ @Override
+ public void partClosed(IWorkbenchPart part) {
+ }
+
+ /**
+ * @since 3.2
+ */
+ @Override
+ public void partDeactivated(IWorkbenchPart part) {
+ if (part == this && fPrintHandlerActivation != null) {
+ final IHandlerService hs = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ hs.deactivateHandler(fPrintHandlerActivation);
+ }
+ }
+
+ /**
+ * @since 3.2
+ */
+ @Override
+ public void partOpened(IWorkbenchPart part) {
+ }
}

Back to the top