diff options
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 Binary files differnew file mode 100644 index 0000000000..ec50b70fab --- /dev/null +++ b/lttng/org.eclipse.linuxtools.tmf.ui/icons/elcl16/pin_view.gif 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 8b907fabf8..444b2601ff 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 e11d5f7ef0..1e33a32342 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 c431b62523..a3db451b19 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 0000000000..cb712b64ea --- /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 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); + } + } } |