Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java')
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java50
1 files changed, 43 insertions, 7 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java
index 19b1687181..1f3233d442 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java
@@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2009, 2010, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -8,27 +8,36 @@
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Bernd Hufmann - Added possibility to pin view
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.linuxtools.tmf.core.component.ITmfComponent;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
+import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.ViewPart;
/**
* Basic abstract TMF view class implementation.
- *
+ *
* It registers any sub class to the signal manager for receiving and sending
- * TMF signals.
- *
- * @version 1.0
+ * TMF signals.
+ *
+ * @version 1.2
* @author Francois Chouinard
*/
public abstract class TmfView extends ViewPart implements ITmfComponent {
private final String fName;
+ /**
+ * Action class for pinning of TmfView.
+ * @since 1.2
+ */
+ protected PinTmfViewAction fPinAction;
// ------------------------------------------------------------------------
// Constructor
@@ -36,7 +45,7 @@ public abstract class TmfView extends ViewPart implements ITmfComponent {
/**
* Constructor. Creates a TMF view and registers to the signal manager.
- *
+ *
* @param viewName A view name
*/
public TmfView(String viewName) {
@@ -46,7 +55,7 @@ public abstract class TmfView extends ViewPart implements ITmfComponent {
}
/**
- * Disposes this view and deregisters itself from the signal manager
+ * Disposes this view and deregisters itself from the signal manager
* @see org.eclipse.ui.part.WorkbenchPart#dispose()
*/
@Override
@@ -77,4 +86,31 @@ public abstract class TmfView extends ViewPart implements ITmfComponent {
TmfSignalManager.dispatchSignal(signal);
}
+ /**
+ * Returns whether the pin flag is set.
+ * For example, this flag can be used to ignore time synchronization signals from other TmfViews.
+ *
+ * @return pin flag
+ * @since 1.2
+ */
+ public boolean isPinned() {
+ return ((fPinAction != null) && (fPinAction.isChecked()));
+ }
+
+ /**
+ * Method adds a pin action to the TmfView. The pin action allows to toggle the <code>fIsPinned</code> flag.
+ * For example, this flag can be used to ignore time synchronization signals from other TmfViews.
+ *
+ * @since 1.2
+ */
+ protected void contributePinActionToToolBar() {
+ if (fPinAction == null) {
+ fPinAction = new PinTmfViewAction();
+
+ IToolBarManager toolBarManager = getViewSite().getActionBars()
+ .getToolBarManager();
+ toolBarManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ toolBarManager.add(fPinAction);
+ }
+ }
}

Back to the top