import java.util.List;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
private static final int MAX_NAME_WIDTH = 1000;
private static final int DEFAULT_HEIGHT = 22;
private static final long RECENTERING_MARGIN_FACTOR = 50;
+ private static final String HIDE_ARROWS_KEY = "hide.arrows"; //$NON-NLS-1$
private long fMinTimeInterval;
private ITimeGraphEntry fSelectedEntry;
private List<ITimeGraphTimeListener> fTimeListeners = new ArrayList<ITimeGraphTimeListener>();
private List<ITimeGraphRangeListener> fRangeListeners = new ArrayList<ITimeGraphRangeListener>();
- // Time format, using Epoch reference, Relative time format(default) or Number
+ // Time format, using Epoch reference, Relative time format(default) or
+ // Number
private TimeFormat fTimeFormat = TimeFormat.RELATIVE;
private int fBorderWidth = 0;
private int fTimeScaleHeight = DEFAULT_HEIGHT;
private Action fPreviousItemAction;
private Action fZoomInAction;
private Action fZoomOutAction;
+ private Action fHideArrowsAction;
/**
* Standard constructor
/**
* Sets the timegraph provider used by this timegraph viewer.
*
- * @param timeGraphProvider the timegraph provider
+ * @param timeGraphProvider
+ * the timegraph provider
*/
public void setTimeGraphProvider(ITimeGraphPresentationProvider timeGraphProvider) {
fTimeGraphProvider = timeGraphProvider;
}
/**
- * Sets or clears the input for this time graph viewer.
- * The input array should only contain top-level elements.
+ * Sets or clears the input for this time graph viewer. The input array
+ * should only contain top-level elements.
*
- * @param input The input of this time graph viewer, or <code>null</code> if none
+ * @param input
+ * The input of this time graph viewer, or <code>null</code> if
+ * none
*/
public void setInput(ITimeGraphEntry[] input) {
ITimeGraphEntry[] realInput = input;
}
/**
- * @param tf the {@link TimeFormat} used to display timestamps
+ * @param tf
+ * the {@link TimeFormat} used to display timestamps
* @since 2.0
*/
public void setTimeFormat(TimeFormat tf) {
public void setBorderWidth(int borderWidth) {
if (borderWidth > -1) {
this.fBorderWidth = borderWidth;
- GridLayout gl = (GridLayout)fDataViewer.getLayout();
+ GridLayout gl = (GridLayout) fDataViewer.getLayout();
gl.marginHeight = borderWidth;
}
}
/**
* Set the width for the name column
*
- * @param width The width
+ * @param width
+ * The width
*/
public void setNameWidthPref(int width) {
fNameWidthPref = width;
/**
* Return the x coordinate corresponding to a time
*
- * @param time the time
+ * @param time
+ * the time
* @return the x coordinate corresponding to the time
*
* @since 2.0
/**
* Return the time corresponding to an x coordinate
*
- * @param x the x coordinate
+ * @param x
+ * the x coordinate
* @return the time corresponding to the x coordinate
*
* @since 2.0
return fZoomOutAction;
}
+ /**
+ * Get the hide arrows action
+ *
+ * @param dialogSettings
+ * The dialog settings section where the state should be stored,
+ * or null
+ *
+ * @return The Action object
+ *
+ * @since 2.1
+ */
+ public Action getHideArrowsAction(final IDialogSettings dialogSettings) {
+ if (fHideArrowsAction == null) {
+ fHideArrowsAction = new Action(Messages.TmfTimeGraphViewer_HideArrowsActionNameText, IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ boolean hideArrows = fHideArrowsAction.isChecked();
+ fTimeGraphCtrl.hideArrows(hideArrows);
+ refresh();
+ if (dialogSettings != null) {
+ dialogSettings.put(HIDE_ARROWS_KEY, hideArrows);
+ }
+ }
+ };
+ fHideArrowsAction.setToolTipText(Messages.TmfTimeGraphViewer_HideArrowsActionToolTipText);
+ fHideArrowsAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_HIDE_ARROWS));
+ if (dialogSettings != null) {
+ boolean hideArrows = dialogSettings.getBoolean(HIDE_ARROWS_KEY);
+ fTimeGraphCtrl.hideArrows(hideArrows);
+ fHideArrowsAction.setChecked(hideArrows);
+ }
+ }
+ return fHideArrowsAction;
+ }
private void adjustVerticalScrollBar() {
int topIndex = fTimeGraphCtrl.getTopIndex();
}
/**
- * @param listener a {@link MenuDetectListener}
+ * @param listener
+ * a {@link MenuDetectListener}
* @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphControl#addTimeGraphEntryMenuListener(org.eclipse.swt.events.MenuDetectListener)
* @since 1.2
*/
}
/**
- * @param listener a {@link MenuDetectListener}
+ * @param listener
+ * a {@link MenuDetectListener}
* @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphControl#removeTimeGraphEntryMenuListener(org.eclipse.swt.events.MenuDetectListener)
* @since 1.2
*/
}
/**
- * @param listener a {@link MenuDetectListener}
+ * @param listener
+ * a {@link MenuDetectListener}
* @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphControl#addTimeEventMenuListener(org.eclipse.swt.events.MenuDetectListener)
* @since 1.2
*/
}
/**
- * @param listener a {@link MenuDetectListener}
+ * @param listener
+ * a {@link MenuDetectListener}
* @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphControl#removeTimeEventMenuListener(org.eclipse.swt.events.MenuDetectListener)
* @since 1.2
*/
}
/**
- * @param filter The filter object to be attached to the view
+ * @param filter
+ * The filter object to be attached to the view
* @since 2.0
*/
public void addFilter(ViewerFilter filter) {
}
/**
- * @param filter The filter object to be attached to the view
+ * @param filter
+ * The filter object to be attached to the view
* @since 2.0
*/
public void removeFilter(ViewerFilter filter) {