summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBernd Hufmann2012-08-29 15:09:27 (EDT)
committer Francois Chouinard2012-09-04 11:07:20 (EDT)
commita21a765fe5d3b9cc40a9ebe774dbe6f6e1d8a939 (patch)
tree9d0dbffb0de4b0c6a189b4cdbdb3c5551277ea40
parent3094f0a210a9c1a6abe8af1581d26e6945308a4d (diff)
downloadorg.eclipse.linuxtools-a21a765fe5d3b9cc40a9ebe774dbe6f6e1d8a939.zip
org.eclipse.linuxtools-a21a765fe5d3b9cc40a9ebe774dbe6f6e1d8a939.tar.gz
org.eclipse.linuxtools-a21a765fe5d3b9cc40a9ebe774dbe6f6e1d8a939.tar.bz2
Add support pin in TmfView base class (Bug 388372)
Change-Id: I8d5710ab56165b9db296629a4eeb73982995fad5 Signed-off-by: Bernd Hufmann <bhufmann@gmail.com> Reviewed-on: https://git.eclipse.org/r/7500 Tested-by: Hudson CI Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-by: Francois Chouinard <fchouinard@gmail.com> Tested-by: Francois Chouinard <fchouinard@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/icons/elcl16/pin_view.gifbin0 -> 358 bytes
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/ITmfImageConstants.java7
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java5
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties5
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/PinTmfViewAction.java37
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/TmfView.java50
6 files changed, 92 insertions, 12 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/icons/elcl16/pin_view.gif b/lttng/org.eclipse.linuxtools.tmf.ui/icons/elcl16/pin_view.gif
new file mode 100644
index 0000000..ec50b70
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/icons/elcl16/pin_view.gif
Binary files differ
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/ITmfImageConstants.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/ITmfImageConstants.java
index 8b907fa..444b260 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/ITmfImageConstants.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/ITmfImageConstants.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson and others.
- * All rights reserved. This program and the accompanying materials
+ * 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
* http://www.eclipse.org/legal/epl-v10.html
* $Id: CommonUIImages.java,v 1.6 2010/05/05 12:32:31 paules Exp $
- *
+ *
* Contributors:
* Bernd Hufmann - initial API and implementation
*******************************************************************************/
@@ -13,7 +13,7 @@ package org.eclipse.linuxtools.internal.tmf.ui;
@SuppressWarnings("nls")
public interface ITmfImageConstants {
-
+
public static final String ICONS_PATH = "icons/"; //$NON-NLS-1$
/* elcl16 */
@@ -38,6 +38,7 @@ public interface ITmfImageConstants {
// public static final String IMG_UI_PREV_ITEM = ICONS_PATH + "elcl16/prev_item.gif";
public static final String IMG_UI_NEXT_ITEM = IMG_UI_NEXT_PAGE;
public static final String IMG_UI_PREV_ITEM = IMG_UI_PREV_PAGE;
+ public static final String IMG_UI_PIN_VIEW = ICONS_PATH + "elcl16/pin_view.gif";
/* eview16 */
public static final String IMG_UI_SEQ_DIAGRAM_OBJ = ICONS_PATH + "eview16/sequencediagram_view.gif";
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java
index e11d5f7..1e33a32 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java
@@ -104,7 +104,7 @@ public class Messages extends NLS {
public static String TmfTimeGraphViewer_ZoomInActionToolTipText;
public static String TmfTimeGraphViewer_ZoomOutActionNameText;
public static String TmfTimeGraphViewer_ZoomOutActionToolTipText;
-
+
public static String ColorsView_AddActionToolTipText;
public static String ColorsView_BackgroundButtonText;
public static String ColorsView_BackgroundDialogText;
@@ -251,6 +251,9 @@ public class Messages extends NLS {
public static String FilterViewer_ValueHint;
public static String FilterViewer_ValueLabel;
+ public static String TmfView_PinActionNameText;
+ public static String TmfView_PinActionToolTipText;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
index c431b62..a3db451 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
@@ -104,7 +104,6 @@ TmfTimeGraphViewer_ZoomInActionToolTipText=Zoom In
TmfTimeGraphViewer_ZoomOutActionNameText=Zoom Out
TmfTimeGraphViewer_ZoomOutActionToolTipText=Zoom Out
-
# org.eclipse.linuxtools.tmf.ui.views.colors
ColorsView_AddActionToolTipText=Insert new color setting
ColorsView_BackgroundButtonText=BG
@@ -253,3 +252,7 @@ FilterViewer_TimestampButtonText=Timestamp
FilterViewer_TypeLabel=type:
FilterViewer_ValueHint=type value
FilterViewer_ValueLabel=value:
+
+TmfView_PinActionNameText=Pin View
+TmfView_PinActionToolTipText=Pin View
+
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/PinTmfViewAction.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/PinTmfViewAction.java
new file mode 100644
index 0000000..cb712b6
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/PinTmfViewAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.tmf.ui.views;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;
+
+/**
+ *
+ * @version 1.0
+ * @author Bernd Hufmann
+ * @since 1.2
+ */
+public class PinTmfViewAction extends Action {
+ /**
+ * Creates a new <code>PinPropertySheetAction</code>.
+ */
+ public PinTmfViewAction() {
+ super(Messages.TmfView_PinActionNameText, IAction.AS_CHECK_BOX);
+
+ setId("org.eclipse.linuxtools.tmf.ui.views.PinTmfViewAction"); //$NON-NLS-1$
+ setToolTipText(Messages.TmfView_PinActionToolTipText);
+ setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_PIN_VIEW));
+ }
+}
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 19b1687..1f3233d 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);
+ }
+ }
}