releng: Add 2.1.0 baseline and fix API errors
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / TmfView.java
index feaffa8e6fc3fc83859503860c57b52f8edb5317..f073027a660d920c80f6719f583ae03340f26124 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2015 Ericsson
+ * Copyright (c) 2009, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -24,7 +24,9 @@ import org.eclipse.tracecompass.internal.tmf.ui.views.TmfAlignmentSynchronizer;
 import org.eclipse.tracecompass.tmf.core.component.ITmfComponent;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
+import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IViewSite;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.part.ViewPart;
@@ -73,6 +75,12 @@ public abstract class TmfView extends ViewPart implements ITmfComponent {
     @Override
     public void dispose() {
         TmfSignalManager.deregister(this);
+
+        /* Workaround for Bug 490400: Clear the action bars */
+        IActionBars bars = getViewSite().getActionBars();
+        bars.getToolBarManager().removeAll();
+        bars.getMenuManager().removeAll();
+
         super.dispose();
     }
 
@@ -193,4 +201,20 @@ public abstract class TmfView extends ViewPart implements ITmfComponent {
     public Composite getParentComposite() {
         return fParentComposite;
     }
+
+    /**
+     * Return the Eclipse view ID in the format <Primary ID>:<Secondary ID> or
+     * simply <Primary ID> if secondary ID is null
+     *
+     * @return This view's view ID
+     * @since 2.2
+     */
+    protected String getViewId() {
+        IViewSite viewSite = getViewSite();
+        String secondaryId = viewSite.getSecondaryId();
+        if (secondaryId == null) {
+            return viewSite.getId();
+        }
+        return viewSite.getId() + ':' + secondaryId;
+    }
 }
This page took 0.029712 seconds and 5 git commands to generate.