lttng: More luna annotation updates
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / TimeGraphViewer.java
index 3545eede08bccb91fe064a4d90094c5c184239ca..97e01a87f842f323bd4339882d69f7eaf86b6b72 100644 (file)
@@ -1,6 +1,5 @@
-
 /*****************************************************************************
- * Copyright (c) 2007, 2008 Intel Corporation, 2009, 2010, 2011, 2012 Ericsson.
+ * Copyright (c) 2007, 2013 Intel Corporation, 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
  *   Alexander N. Alexeev, Intel - Add monitors statistics support
  *   Alvaro Sanchez-Leon - Adapted for TMF
  *   Patrick Tasse - Refactoring
- *
  *****************************************************************************/
 
 package org.eclipse.linuxtools.tmf.ui.widgets.timegraph;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
 import org.eclipse.linuxtools.internal.tmf.ui.Messages;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.dialogs.TimeGraphLegend;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider2;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphColorScheme;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphControl;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.TimeGraphScale;
@@ -60,50 +60,55 @@ import org.eclipse.swt.widgets.Slider;
  * @version 1.0
  * @author Patrick Tasse, and others
  */
-public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
-
-    /** vars */
-    private long _minTimeInterval;
-    private long _selectedTime;
-    private ITimeGraphEntry _selectedEntry;
-    private long _beginTime;
-    private long _endTime;
-    private long _time0;
-    private long _time1;
-    private long _time0_;
-    private long _time1_;
-    private long _time0_extSynch = 0;
-    private long _time1_extSynch = 0;
-    private boolean _timeRangeFixed;
-    private int _nameWidthPref = 200;
-    private int _minNameWidth = 6;
-    private int _nameWidth;
-    private Composite _dataViewer;
-
-    private TimeGraphControl _stateCtrl;
-    private TimeGraphScale _timeScaleCtrl;
-    private Slider _verticalScrollBar;
-    private TimeGraphTooltipHandler _threadTip;
-    private TimeGraphColorScheme _colors;
+public class TimeGraphViewer implements ITimeDataProvider2, SelectionListener {
+
+    private static final int DEFAULT_NAME_WIDTH = 200;
+    private static final int MIN_NAME_WIDTH = 6;
+    private static final int MAX_NAME_WIDTH = 1000;
+    private static final int DEFAULT_HEIGHT = 22;
+    private static final long RECENTERING_MARGIN_FACTOR = 50;
+
+    private long fMinTimeInterval;
+    private ITimeGraphEntry fSelectedEntry;
+    private long fBeginTime;
+    private long fEndTime;
+    private long fTime0;
+    private long fTime1;
+    private long fSelectionBegin = 0;
+    private long fSelectionEnd = 0;
+    private long fTime0Bound;
+    private long fTime1Bound;
+    private long fTime0ExtSynch = 0;
+    private long fTime1ExtSynch = 0;
+    private boolean fTimeRangeFixed;
+    private int fNameWidthPref = DEFAULT_NAME_WIDTH;
+    private int fMinNameWidth = MIN_NAME_WIDTH;
+    private int fNameWidth;
+    private Composite fDataViewer;
+
+    private TimeGraphControl fTimeGraphCtrl;
+    private TimeGraphScale fTimeScaleCtrl;
+    private Slider fVerticalScrollBar;
+    private TimeGraphColorScheme fColorScheme;
     private ITimeGraphPresentationProvider fTimeGraphProvider;
 
-    ArrayList<ITimeGraphSelectionListener> fSelectionListeners = new ArrayList<ITimeGraphSelectionListener>();
-    ArrayList<ITimeGraphTimeListener> fTimeListeners = new ArrayList<ITimeGraphTimeListener>();
-    ArrayList<ITimeGraphRangeListener> fRangeListeners = new ArrayList<ITimeGraphRangeListener>();
+    private List<ITimeGraphSelectionListener> fSelectionListeners = new ArrayList<ITimeGraphSelectionListener>();
+    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
-    private TimeFormat timeFormat = TimeFormat.RELATIVE;
-    private int borderWidth = 0;
-    private int timeScaleHeight = 22;
+    private TimeFormat fTimeFormat = TimeFormat.RELATIVE;
+    private int fBorderWidth = 0;
+    private int fTimeScaleHeight = DEFAULT_HEIGHT;
 
-    private Action resetScale;
-    private Action showLegendAction;
-    private Action nextEventAction;
-    private Action prevEventAction;
-    private Action nextItemAction;
-    private Action previousItemAction;
-    private Action zoomInAction;
-    private Action zoomOutAction;
+    private Action fResetScaleAction;
+    private Action fShowLegendAction;
+    private Action fNextEventAction;
+    private Action fPrevEventAction;
+    private Action fNextItemAction;
+    private Action fPreviousItemAction;
+    private Action fZoomInAction;
+    private Action fZoomOutAction;
 
     /**
      * Standard constructor
@@ -124,28 +129,31 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     public void setTimeGraphProvider(ITimeGraphPresentationProvider timeGraphProvider) {
         fTimeGraphProvider = timeGraphProvider;
-        _stateCtrl.setTimeGraphProvider(timeGraphProvider);
-        _threadTip = new TimeGraphTooltipHandler(_dataViewer.getShell(), fTimeGraphProvider, this);
-        _threadTip.activateHoverHelp(_stateCtrl);
+        fTimeGraphCtrl.setTimeGraphProvider(timeGraphProvider);
+        TimeGraphTooltipHandler toolTipHandler = new TimeGraphTooltipHandler(fTimeGraphProvider, this);
+        toolTipHandler.activateHoverHelp(fTimeGraphCtrl);
     }
 
     /**
      * 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) {
-        if (null != _stateCtrl) {
-            if (null == input) {
-                input = new ITimeGraphEntry[0];
+        ITimeGraphEntry[] realInput = input;
+
+        if (fTimeGraphCtrl != null) {
+            if (realInput == null) {
+                realInput = new ITimeGraphEntry[0];
             }
-            setTimeRange(input);
-            _verticalScrollBar.setEnabled(true);
+            setTimeRange(realInput);
+            fVerticalScrollBar.setEnabled(true);
             setTopIndex(0);
-            _selectedTime = 0;
-            _selectedEntry = null;
-            refreshAllData(input);
+            fSelectionBegin = 0;
+            fSelectionEnd = 0;
+            fSelectedEntry = null;
+            refreshAllData(realInput);
         }
     }
 
@@ -153,7 +161,9 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Refresh the view
      */
     public void refresh() {
-        setInput(_stateCtrl.getTraces());
+        setTimeRange(fTimeGraphCtrl.getTraces());
+        fVerticalScrollBar.setEnabled(true);
+        refreshAllData(fTimeGraphCtrl.getTraces());
     }
 
     /**
@@ -190,110 +200,123 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     public void modelUpdate(ITimeGraphEntry[] traces, long start,
             long end, boolean updateTimeBounds) {
-        if (null != _stateCtrl) {
-            //loadOptions();
+        if (null != fTimeGraphCtrl) {
             updateInternalData(traces, start, end);
             if (updateTimeBounds) {
-                _timeRangeFixed = true;
+                fTimeRangeFixed = true;
                 // set window to match limits
-                setStartFinishTime(_time0_, _time1_);
+                setStartFinishTime(fTime0Bound, fTime1Bound);
             } else {
-                _stateCtrl.redraw();
-                _timeScaleCtrl.redraw();
+                fTimeGraphCtrl.redraw();
+                fTimeScaleCtrl.redraw();
             }
         }
     }
 
+    /**
+     * @return The string representing the view type
+     */
     protected String getViewTypeStr() {
         return "viewoption.threads"; //$NON-NLS-1$
     }
 
-    int getMarginWidth(int idx) {
+    int getMarginWidth() {
         return 0;
     }
 
-    int getMarginHeight(int idx) {
+    int getMarginHeight() {
         return 0;
     }
 
     void loadOptions() {
-        _minTimeInterval = 1;
-        _selectedTime = -1;
-        _nameWidth = Utils.loadIntOption(getPreferenceString("namewidth"), //$NON-NLS-1$
-                _nameWidthPref, _minNameWidth, 1000);
+        fMinTimeInterval = 1;
+        fSelectionBegin = -1;
+        fSelectionEnd = -1;
+        fNameWidth = Utils.loadIntOption(getPreferenceString("namewidth"), //$NON-NLS-1$
+                fNameWidthPref, fMinNameWidth, MAX_NAME_WIDTH);
     }
 
     void saveOptions() {
-        Utils.saveIntOption(getPreferenceString("namewidth"), _nameWidth); //$NON-NLS-1$
+        Utils.saveIntOption(getPreferenceString("namewidth"), fNameWidth); //$NON-NLS-1$
     }
 
+    /**
+     * Create a data viewer.
+     *
+     * @param parent
+     *            Parent composite
+     * @param style
+     *            Style to use
+     * @return The new data viewer
+     */
     protected Control createDataViewer(Composite parent, int style) {
         loadOptions();
-        _colors = new TimeGraphColorScheme();
-        _dataViewer = new Composite(parent, style) {
+        fColorScheme = new TimeGraphColorScheme();
+        fDataViewer = new Composite(parent, style) {
             @Override
             public void redraw() {
-                _timeScaleCtrl.redraw();
-                _stateCtrl.redraw();
+                fTimeScaleCtrl.redraw();
+                fTimeGraphCtrl.redraw();
                 super.redraw();
             }
         };
         GridLayout gl = new GridLayout(2, false);
-        gl.marginHeight = borderWidth;
+        gl.marginHeight = fBorderWidth;
         gl.marginWidth = 0;
         gl.verticalSpacing = 0;
         gl.horizontalSpacing = 0;
-        _dataViewer.setLayout(gl);
+        fDataViewer.setLayout(gl);
 
-        _timeScaleCtrl = new TimeGraphScale(_dataViewer, _colors);
-        _timeScaleCtrl.setTimeProvider(this);
-        _timeScaleCtrl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
-        _timeScaleCtrl.setHeight(timeScaleHeight);
+        fTimeScaleCtrl = new TimeGraphScale(fDataViewer, fColorScheme);
+        fTimeScaleCtrl.setTimeProvider(this);
+        fTimeScaleCtrl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
+        fTimeScaleCtrl.setHeight(fTimeScaleHeight);
 
-        _verticalScrollBar = new Slider(_dataViewer, SWT.VERTICAL | SWT.NO_FOCUS);
-        _verticalScrollBar.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, true, 1, 2));
-        _verticalScrollBar.addSelectionListener(new SelectionAdapter() {
+        fVerticalScrollBar = new Slider(fDataViewer, SWT.VERTICAL | SWT.NO_FOCUS);
+        fVerticalScrollBar.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, true, 1, 2));
+        fVerticalScrollBar.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
-                setTopIndex(_verticalScrollBar.getSelection());
+                setTopIndex(fVerticalScrollBar.getSelection());
             }
         });
-        _verticalScrollBar.setEnabled(false);
+        fVerticalScrollBar.setEnabled(false);
 
-        _stateCtrl = createTimeGraphControl(_dataViewer, _colors);
+        fTimeGraphCtrl = createTimeGraphControl(fDataViewer, fColorScheme);
 
-        _stateCtrl.setTimeProvider(this);
-        _stateCtrl.addSelectionListener(this);
-        _stateCtrl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
-        _stateCtrl.addMouseWheelListener(new MouseWheelListener() {
+        fTimeGraphCtrl.setTimeProvider(this);
+        fTimeGraphCtrl.setTimeGraphScale(fTimeScaleCtrl);
+        fTimeGraphCtrl.addSelectionListener(this);
+        fTimeGraphCtrl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
+        fTimeGraphCtrl.addMouseWheelListener(new MouseWheelListener() {
             @Override
             public void mouseScrolled(MouseEvent e) {
                 adjustVerticalScrollBar();
             }
         });
-        _stateCtrl.addKeyListener(new KeyAdapter() {
+        fTimeGraphCtrl.addKeyListener(new KeyAdapter() {
             @Override
             public void keyPressed(KeyEvent e) {
                 adjustVerticalScrollBar();
             }
         });
 
-        Composite filler = new Composite(_dataViewer, SWT.NONE);
+        Composite filler = new Composite(fDataViewer, SWT.NONE);
         GridData gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
-        gd.heightHint = _stateCtrl.getHorizontalBar().getSize().y;
+        gd.heightHint = fTimeGraphCtrl.getHorizontalBar().getSize().y;
         filler.setLayoutData(gd);
         filler.setLayout(new FillLayout());
 
-        _stateCtrl.addControlListener(new ControlAdapter() {
+        fTimeGraphCtrl.addControlListener(new ControlAdapter() {
             @Override
             public void controlResized(ControlEvent event) {
                 resizeControls();
             }
         });
         resizeControls();
-        _dataViewer.update();
+        fDataViewer.update();
         adjustVerticalScrollBar();
-        return _dataViewer;
+        return fDataViewer;
     }
 
     /**
@@ -301,15 +324,23 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     public void dispose() {
         saveOptions();
-        _stateCtrl.dispose();
-        _dataViewer.dispose();
-        _colors.dispose();
+        fTimeGraphCtrl.dispose();
+        fDataViewer.dispose();
+        fColorScheme.dispose();
     }
 
     /**
+     * Create a new time graph control.
+     *
+     * @param parent
+     *            The parent composite
+     * @param colors
+     *            The color scheme
+     * @return The new TimeGraphControl
      * @since 2.0
      */
-    protected TimeGraphControl createTimeGraphControl(Composite parent, TimeGraphColorScheme colors) {
+    protected TimeGraphControl createTimeGraphControl(Composite parent,
+            TimeGraphColorScheme colors) {
         return new TimeGraphControl(parent, colors);
     }
 
@@ -317,17 +348,17 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Resize the controls
      */
     public void resizeControls() {
-        Rectangle r = _dataViewer.getClientArea();
+        Rectangle r = fDataViewer.getClientArea();
         if (r.isEmpty()) {
             return;
         }
 
         int width = r.width;
-        if (_nameWidth > width - _minNameWidth) {
-            _nameWidth = width - _minNameWidth;
+        if (fNameWidth > width - fMinNameWidth) {
+            fNameWidth = width - fMinNameWidth;
         }
-        if (_nameWidth < _minNameWidth) {
-            _nameWidth = _minNameWidth;
+        if (fNameWidth < fMinNameWidth) {
+            fNameWidth = fMinNameWidth;
         }
         adjustVerticalScrollBar();
     }
@@ -339,22 +370,22 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The traces in the model
      */
     public void setTimeRange(ITimeGraphEntry traces[]) {
-        _endTime = 0;
-        _beginTime = -1;
+        fEndTime = 0;
+        fBeginTime = -1;
         for (int i = 0; i < traces.length; i++) {
             ITimeGraphEntry entry = traces[i];
             if (entry.getEndTime() >= entry.getStartTime() && entry.getEndTime() > 0) {
-                if (_beginTime < 0 || entry.getStartTime() < _beginTime) {
-                    _beginTime = entry.getStartTime();
+                if (fBeginTime < 0 || entry.getStartTime() < fBeginTime) {
+                    fBeginTime = entry.getStartTime();
                 }
-                if (entry.getEndTime() > _endTime) {
-                    _endTime = entry.getEndTime();
+                if (entry.getEndTime() > fEndTime) {
+                    fEndTime = entry.getEndTime();
                 }
             }
         }
 
-        if (_beginTime < 0) {
-            _beginTime = 0;
+        if (fBeginTime < 0) {
+            fBeginTime = 0;
         }
     }
 
@@ -362,21 +393,17 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Recalculate the time bounds
      */
     public void setTimeBounds() {
-        //_time0_ = _beginTime - (long) ((_endTime - _beginTime) * 0.02);
-        _time0_ = _beginTime;
-        if (_time0_ < 0) {
-            _time0_ = 0;
+        fTime0Bound = fBeginTime;
+        if (fTime0Bound < 0) {
+            fTime0Bound = 0;
         }
-        // _time1_ = _time0_ + (_endTime - _time0_) * 1.05;
-        _time1_ = _endTime;
-        // _time0_ = Math.floor(_time0_);
-        // _time1_ = Math.ceil(_time1_);
-        if (!_timeRangeFixed) {
-            _time0 = _time0_;
-            _time1 = _time1_;
+        fTime1Bound = fEndTime;
+        if (!fTimeRangeFixed) {
+            fTime0 = fTime0Bound;
+            fTime1 = fTime1Bound;
         }
-        if (_time1 - _time0 < _minTimeInterval) {
-            _time1 = Math.min(_time1_, _time0 + _minTimeInterval);
+        if (fTime1 - fTime0 < fMinTimeInterval) {
+            fTime1 = Math.min(fTime1Bound, fTime0 + fMinTimeInterval);
         }
     }
 
@@ -386,19 +413,21 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @param end
      */
     void updateInternalData(ITimeGraphEntry[] traces, long start, long end) {
-        if (null == traces) {
-            traces = new ITimeGraphEntry[0];
+        ITimeGraphEntry[] realTraces = traces;
+
+        if (null == realTraces) {
+            realTraces = new ITimeGraphEntry[0];
         }
         if ((start == 0 && end == 0) || start < 0 || end < 0) {
             // Start and end time are unspecified and need to be determined from
             // individual processes
-            setTimeRange(traces);
+            setTimeRange(realTraces);
         } else {
-            _beginTime = start;
-            _endTime = end;
+            fBeginTime = start;
+            fEndTime = end;
         }
 
-        refreshAllData(traces);
+        refreshAllData(realTraces);
     }
 
     /**
@@ -406,13 +435,18 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     private void refreshAllData(ITimeGraphEntry[] traces) {
         setTimeBounds();
-        if (_selectedTime < _beginTime) {
-            _selectedTime = _beginTime;
-        } else if (_selectedTime > _endTime) {
-            _selectedTime = _endTime;
+        if (fSelectionBegin < fBeginTime) {
+            fSelectionBegin = fBeginTime;
+        } else if (fSelectionBegin > fEndTime) {
+            fSelectionBegin = fEndTime;
+        }
+        if (fSelectionEnd < fBeginTime) {
+            fSelectionEnd = fBeginTime;
+        } else if (fSelectionEnd > fEndTime) {
+            fSelectionEnd = fEndTime;
         }
-        _stateCtrl.refreshData(traces);
-        _timeScaleCtrl.redraw();
+        fTimeGraphCtrl.refreshData(traces);
+        fTimeScaleCtrl.redraw();
         adjustVerticalScrollBar();
     }
 
@@ -420,8 +454,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Callback for when this view is focused
      */
     public void setFocus() {
-        if (null != _stateCtrl) {
-            _stateCtrl.setFocus();
+        if (null != fTimeGraphCtrl) {
+            fTimeGraphCtrl.setFocus();
         }
     }
 
@@ -431,7 +465,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return If the view is currently focused, or not
      */
     public boolean isInFocus() {
-        return _stateCtrl.isInFocus();
+        return fTimeGraphCtrl.isInFocus();
     }
 
     /**
@@ -440,7 +474,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The entry that is selected
      */
     public ITimeGraphEntry getSelection() {
-        return _stateCtrl.getSelectedTrace();
+        return fTimeGraphCtrl.getSelectedTrace();
     }
 
     /**
@@ -449,127 +483,127 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The index
      */
     public int getSelectionIndex() {
-        return _stateCtrl.getSelectedIndex();
+        return fTimeGraphCtrl.getSelectedIndex();
     }
 
     @Override
     public long getTime0() {
-        return _time0;
+        return fTime0;
     }
 
     @Override
     public long getTime1() {
-        return _time1;
+        return fTime1;
     }
 
     @Override
     public long getMinTimeInterval() {
-        return _minTimeInterval;
+        return fMinTimeInterval;
     }
 
     @Override
     public int getNameSpace() {
-        return _nameWidth;
+        return fNameWidth;
     }
 
     @Override
     public void setNameSpace(int width) {
-        _nameWidth = width;
-        width = _stateCtrl.getClientArea().width;
-        if (_nameWidth > width - 6) {
-            _nameWidth = width - 6;
+        fNameWidth = width;
+        int w = fTimeGraphCtrl.getClientArea().width;
+        if (fNameWidth > w - MIN_NAME_WIDTH) {
+            fNameWidth = w - MIN_NAME_WIDTH;
         }
-        if (_nameWidth < 6) {
-            _nameWidth = 6;
+        if (fNameWidth < MIN_NAME_WIDTH) {
+            fNameWidth = MIN_NAME_WIDTH;
         }
-        _stateCtrl.adjustScrolls();
-        _stateCtrl.redraw();
-        _timeScaleCtrl.redraw();
+        fTimeGraphCtrl.adjustScrolls();
+        fTimeGraphCtrl.redraw();
+        fTimeScaleCtrl.redraw();
     }
 
     @Override
     public int getTimeSpace() {
-        int w = _stateCtrl.getClientArea().width;
-        return w - _nameWidth;
+        int w = fTimeGraphCtrl.getClientArea().width;
+        return w - fNameWidth;
     }
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     @Override
     public long getSelectedTime() {
-        return _selectedTime;
+        return fSelectionBegin;
     }
 
     @Override
     public long getBeginTime() {
-        return _beginTime;
+        return fBeginTime;
     }
 
     @Override
     public long getEndTime() {
-        return _endTime;
+        return fEndTime;
     }
 
     @Override
     public long getMaxTime() {
-        return _time1_;
+        return fTime1Bound;
     }
 
     @Override
     public long getMinTime() {
-        return _time0_;
+        return fTime0Bound;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.widgets.ITimeDataProvider
-     * #setStartFinishTimeNotify(long, long)
+    /**
+     * @since 3.0
+     */
+    @Override
+    public long getSelectionBegin() {
+        return fSelectionBegin;
+    }
+
+    /**
+     * @since 3.0
      */
+    @Override
+    public long getSelectionEnd() {
+        return fSelectionEnd;
+    }
+
     @Override
     public void setStartFinishTimeNotify(long time0, long time1) {
         setStartFinishTime(time0, time1);
         notifyRangeListeners(time0, time1);
     }
 
-
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.widgets.ITimeDataProvider#notifyStartFinishTime()
-     */
     @Override
     public void notifyStartFinishTime() {
-        notifyRangeListeners(_time0, _time1);
+        notifyRangeListeners(fTime0, fTime1);
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.widgets.ITimeDataProvider
-     * #setStartFinishTime(long, long)
-     */
     @Override
     public void setStartFinishTime(long time0, long time1) {
-        _time0 = time0;
-        if (_time0 < _time0_) {
-            _time0 = _time0_;
+        fTime0 = time0;
+        if (fTime0 < fTime0Bound) {
+            fTime0 = fTime0Bound;
         }
-        if (_time0 > _time1_) {
-            _time0 = _time1_;
+        if (fTime0 > fTime1Bound) {
+            fTime0 = fTime1Bound;
         }
-        _time1 = time1;
-        if (_time1 < _time0_) {
-            _time1 = _time0_;
+        fTime1 = time1;
+        if (fTime1 < fTime0Bound) {
+            fTime1 = fTime0Bound;
         }
-        if (_time1 > _time1_) {
-            _time1 = _time1_;
+        if (fTime1 > fTime1Bound) {
+            fTime1 = fTime1Bound;
         }
-        if (_time1 - _time0 < _minTimeInterval) {
-            _time1 = Math.min(_time1_, _time0 + _minTimeInterval);
+        if (fTime1 - fTime0 < fMinTimeInterval) {
+            fTime1 = Math.min(fTime1Bound, fTime0 + fMinTimeInterval);
         }
-        _timeRangeFixed = true;
-        _stateCtrl.adjustScrolls();
-        _stateCtrl.redraw();
-        _timeScaleCtrl.redraw();
+        fTimeRangeFixed = true;
+        fTimeGraphCtrl.adjustScrolls();
+        fTimeGraphCtrl.redraw();
+        fTimeScaleCtrl.redraw();
     }
 
     /**
@@ -581,17 +615,17 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The end time
      */
     public void setTimeBounds(long beginTime, long endTime) {
-        _beginTime = beginTime;
-        _endTime = endTime;
-        _time0_ = beginTime;
-        _time1_ = endTime;
-        _stateCtrl.adjustScrolls();
+        fBeginTime = beginTime;
+        fEndTime = endTime;
+        fTime0Bound = beginTime;
+        fTime1Bound = endTime;
+        fTimeGraphCtrl.adjustScrolls();
     }
 
     @Override
     public void resetStartFinishTime() {
-        setStartFinishTime(_time0_, _time1_);
-        _timeRangeFixed = false;
+        setStartFinishTime(fTime0Bound, fTime1Bound);
+        fTimeRangeFixed = false;
     }
 
     @Override
@@ -604,62 +638,88 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
         setSelectedTimeInt(time, ensureVisible, false);
     }
 
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void setSelectionRangeNotify(long beginTime, long endTime) {
+        boolean changed = (beginTime != fSelectionBegin || endTime != fSelectionEnd);
+        fSelectionBegin = Math.max(fTime0Bound, Math.min(fTime1Bound, beginTime));
+        fSelectionEnd = Math.max(fTime0Bound, Math.min(fTime1Bound, endTime));
+        fTimeGraphCtrl.redraw();
+        fTimeScaleCtrl.redraw();
+        if (changed) {
+            notifyTimeListeners(fSelectionBegin, fSelectionEnd);
+        }
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void setSelectionRange(long beginTime, long endTime) {
+        fSelectionBegin = Math.max(fTime0Bound, Math.min(fTime1Bound, beginTime));
+        fSelectionEnd = Math.max(fTime0Bound, Math.min(fTime1Bound, endTime));
+        fTimeGraphCtrl.redraw();
+        fTimeScaleCtrl.redraw();
+    }
+
     private void setSelectedTimeInt(long time, boolean ensureVisible, boolean doNotify) {
-        long time0 = _time0;
-        long time1 = _time1;
+        long time0 = fTime0;
+        long time1 = fTime1;
         if (ensureVisible) {
-            long timeSpace = (long) ((_time1 - _time0) * .02);
-            long timeMid = (long) ((_time1 - _time0) * .5);
-            if (time < _time0 + timeSpace) {
-                long dt = _time0 - time + timeMid;
-                _time0 -= dt;
-                _time1 -= dt;
-            } else if (time > _time1 - timeSpace) {
-                long dt = time - _time1 + timeMid;
-                _time0 += dt;
-                _time1 += dt;
+            long timeSpace = (fTime1 - fTime0) / RECENTERING_MARGIN_FACTOR;
+            long timeMid = (fTime1 - fTime0) / 2;
+            if (time < fTime0 + timeSpace) {
+                long dt = fTime0 - time + timeMid;
+                fTime0 -= dt;
+                fTime1 -= dt;
+            } else if (time > fTime1 - timeSpace) {
+                long dt = time - fTime1 + timeMid;
+                fTime0 += dt;
+                fTime1 += dt;
             }
-            if (_time0 < _time0_) {
-                _time1 = Math.min(_time1_, _time1 + (_time0_ - _time0));
-                _time0 = _time0_;
-            } else if (_time1 > _time1_) {
-                _time0 = Math.max(_time0_, _time0 - (_time1 - _time1_));
-                _time1 = _time1_;
+            if (fTime0 < fTime0Bound) {
+                fTime1 = Math.min(fTime1Bound, fTime1 + (fTime0Bound - fTime0));
+                fTime0 = fTime0Bound;
+            } else if (fTime1 > fTime1Bound) {
+                fTime0 = Math.max(fTime0Bound, fTime0 - (fTime1 - fTime1Bound));
+                fTime1 = fTime1Bound;
             }
         }
-        if (_time1 - _time0 < _minTimeInterval) {
-            _time1 = Math.min(_time1_, _time0 + _minTimeInterval);
+        if (fTime1 - fTime0 < fMinTimeInterval) {
+            fTime1 = Math.min(fTime1Bound, fTime0 + fMinTimeInterval);
         }
-        _stateCtrl.adjustScrolls();
-        _stateCtrl.redraw();
-        _timeScaleCtrl.redraw();
-
+        fTimeGraphCtrl.adjustScrolls();
+        fTimeGraphCtrl.redraw();
+        fTimeScaleCtrl.redraw();
 
-        boolean notifySelectedTime = (time != _selectedTime);
-        _selectedTime = time;
+        boolean notifySelectedTime = (time != fSelectionBegin || time != fSelectionEnd);
+        fSelectionBegin = time;
+        fSelectionEnd = time;
 
-        if (doNotify && ((time0 != _time0) || (time1 != _time1))) {
-            notifyRangeListeners(_time0, _time1);
+        if (doNotify && ((time0 != fTime0) || (time1 != fTime1))) {
+            notifyRangeListeners(fTime0, fTime1);
         }
 
         if (doNotify && notifySelectedTime) {
-            notifyTimeListeners(_selectedTime);
+            notifyTimeListeners(fSelectionBegin, fSelectionEnd);
         }
     }
 
     @Override
     public void widgetDefaultSelected(SelectionEvent e) {
-        if (_selectedEntry != getSelection()) {
-            _selectedEntry = getSelection();
-            notifySelectionListeners(_selectedEntry);
+        if (fSelectedEntry != getSelection()) {
+            fSelectedEntry = getSelection();
+            notifySelectionListeners(fSelectedEntry);
         }
     }
 
     @Override
     public void widgetSelected(SelectionEvent e) {
-        if (_selectedEntry != getSelection()) {
-            _selectedEntry = getSelection();
-            notifySelectionListeners(_selectedEntry);
+        if (fSelectedEntry != getSelection()) {
+            fSelectedEntry = getSelection();
+            notifySelectionListeners(fSelectedEntry);
         }
     }
 
@@ -667,7 +727,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Callback for when the next event is selected
      */
     public void selectNextEvent() {
-        _stateCtrl.selectNextEvent();
+        fTimeGraphCtrl.selectNextEvent();
         adjustVerticalScrollBar();
     }
 
@@ -675,7 +735,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Callback for when the previous event is selected
      */
     public void selectPrevEvent() {
-        _stateCtrl.selectPrevEvent();
+        fTimeGraphCtrl.selectPrevEvent();
         adjustVerticalScrollBar();
     }
 
@@ -683,7 +743,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Callback for when the next item is selected
      */
     public void selectNextItem() {
-        _stateCtrl.selectNextTrace();
+        fTimeGraphCtrl.selectNextTrace();
         adjustVerticalScrollBar();
     }
 
@@ -691,7 +751,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Callback for when the previous item is selected
      */
     public void selectPrevItem() {
-        _stateCtrl.selectPrevTrace();
+        fTimeGraphCtrl.selectPrevTrace();
         adjustVerticalScrollBar();
     }
 
@@ -699,25 +759,25 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Callback for the show legend action
      */
     public void showLegend() {
-        if (_dataViewer == null || _dataViewer.isDisposed()) {
+        if (fDataViewer == null || fDataViewer.isDisposed()) {
             return;
         }
 
-        TimeGraphLegend.open(_dataViewer.getShell(), fTimeGraphProvider);
+        TimeGraphLegend.open(fDataViewer.getShell(), fTimeGraphProvider);
     }
 
     /**
      * Callback for the Zoom In action
      */
     public void zoomIn() {
-        _stateCtrl.zoomIn();
+        fTimeGraphCtrl.zoomIn();
     }
 
     /**
      * Callback for the Zoom Out action
      */
     public void zoomOut() {
-        _stateCtrl.zoomOut();
+        fTimeGraphCtrl.zoomOut();
     }
 
     private String getPreferenceString(String string) {
@@ -772,8 +832,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
         fTimeListeners.remove(listener);
     }
 
-    private void notifyTimeListeners(long time) {
-        TimeGraphTimeEvent event = new TimeGraphTimeEvent(this, time);
+    private void notifyTimeListeners(long startTime, long endTime) {
+        TimeGraphTimeEvent event = new TimeGraphTimeEvent(this, startTime, endTime);
 
         for (ITimeGraphTimeListener listener : fTimeListeners) {
             listener.timeSelected(event);
@@ -802,7 +862,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
 
     private void notifyRangeListeners(long startTime, long endTime) {
         // Check if the time has actually changed from last notification
-        if (startTime != _time0_extSynch || endTime != _time1_extSynch) {
+        if (startTime != fTime0ExtSynch || endTime != fTime1ExtSynch) {
             // Notify Time Scale Selection Listeners
             TimeGraphRangeUpdateEvent event = new TimeGraphRangeUpdateEvent(this, startTime, endTime);
 
@@ -827,8 +887,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
         if (event == null || source == this) {
             return;
         }
-        _selectedEntry = event.getEntry();
-        _stateCtrl.selectItem(_selectedEntry, false);
+        fSelectedEntry = event.getEntry();
+        fTimeGraphCtrl.selectItem(fSelectedEntry, false);
 
         setSelectedTimeInt(event.getTime(), true, true);
         adjustVerticalScrollBar();
@@ -848,8 +908,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
         if (trace == null || source == this) {
             return;
         }
-        _selectedEntry = trace;
-        _stateCtrl.selectItem(trace, false);
+        fSelectedEntry = trace;
+        fTimeGraphCtrl.selectItem(trace, false);
 
         setSelectedTimeInt(time, true, true);
     }
@@ -861,8 +921,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The trace that was selected
      */
     public void setSelection(ITimeGraphEntry trace) {
-        _selectedEntry = trace;
-        _stateCtrl.selectItem(trace, false);
+        fSelectedEntry = trace;
+        fTimeGraphCtrl.selectItem(trace, false);
         adjustVerticalScrollBar();
     }
 
@@ -894,14 +954,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     private void updateExtSynchTimers() {
         // last time notification cache
-        _time0_extSynch = _time0;
-        _time1_extSynch = _time1;
-    }
-
-    @Override
-    @Deprecated
-    public boolean isCalendarFormat() {
-        return timeFormat == TimeFormat.CALENDAR;
+        fTime0ExtSynch = fTime0;
+        fTime1ExtSynch = fTime1;
     }
 
     /**
@@ -909,7 +963,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     @Override
     public TimeFormat getTimeFormat() {
-        return timeFormat;
+        return fTimeFormat;
     }
 
     /**
@@ -917,7 +971,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 2.0
      */
     public void setTimeFormat(TimeFormat tf) {
-        this.timeFormat = tf;
+        this.fTimeFormat = tf;
     }
 
     /**
@@ -926,7 +980,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The width
      */
     public int getBorderWidth() {
-        return borderWidth;
+        return fBorderWidth;
     }
 
     /**
@@ -937,8 +991,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     public void setBorderWidth(int borderWidth) {
         if (borderWidth > -1) {
-            this.borderWidth = borderWidth;
-            GridLayout gl = (GridLayout)_dataViewer.getLayout();
+            this.fBorderWidth = borderWidth;
+            GridLayout gl = (GridLayout)fDataViewer.getLayout();
             gl.marginHeight = borderWidth;
         }
     }
@@ -949,7 +1003,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The height
      */
     public int getHeaderHeight() {
-        return timeScaleHeight;
+        return fTimeScaleHeight;
     }
 
     /**
@@ -960,8 +1014,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      */
     public void setHeaderHeight(int headerHeight) {
         if (headerHeight > -1) {
-            this.timeScaleHeight = headerHeight;
-            _timeScaleCtrl.setHeight(headerHeight);
+            this.fTimeScaleHeight = headerHeight;
+            fTimeScaleCtrl.setHeight(headerHeight);
         }
     }
 
@@ -971,8 +1025,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The height
      */
     public int getItemHeight() {
-        if (_stateCtrl != null) {
-            return _stateCtrl.getItemHeight();
+        if (fTimeGraphCtrl != null) {
+            return fTimeGraphCtrl.getItemHeight();
         }
         return 0;
     }
@@ -984,8 +1038,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The height to set
      */
     public void setItemHeight(int rowHeight) {
-        if (_stateCtrl != null) {
-            _stateCtrl.setItemHeight(rowHeight);
+        if (fTimeGraphCtrl != null) {
+            fTimeGraphCtrl.setItemHeight(rowHeight);
         }
     }
 
@@ -996,8 +1050,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The min width
      */
     public void setMinimumItemWidth(int width) {
-        if (_stateCtrl != null) {
-            _stateCtrl.setMinimumItemWidth(width);
+        if (fTimeGraphCtrl != null) {
+            fTimeGraphCtrl.setMinimumItemWidth(width);
         }
     }
 
@@ -1007,10 +1061,10 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @param width The width
      */
     public void setNameWidthPref(int width) {
-        _nameWidthPref = width;
+        fNameWidthPref = width;
         if (width == 0) {
-            _minNameWidth = 0;
-            _nameWidth = 0;
+            fMinNameWidth = 0;
+            fNameWidth = 0;
         }
     }
 
@@ -1022,7 +1076,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The width
      */
     public int getNameWidthPref(int width) {
-        return _nameWidthPref;
+        return fNameWidthPref;
     }
 
     /**
@@ -1031,25 +1085,27 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return the SWT control which displays this viewer's content
      */
     public Control getControl() {
-        return _dataViewer;
+        return fDataViewer;
     }
 
     /**
      * Returns the time graph control associated with this viewer.
      *
      * @return the time graph control
+     * @since 2.0
      */
-    TimeGraphControl getTimeGraphControl() {
-        return _stateCtrl;
+    public TimeGraphControl getTimeGraphControl() {
+        return fTimeGraphCtrl;
     }
 
     /**
      * Returns the time graph scale associated with this viewer.
      *
      * @return the time graph scale
+     * @since 2.0
      */
-    TimeGraphScale getTimeGraphScale() {
-        return _timeScaleCtrl;
+    public TimeGraphScale getTimeGraphScale() {
+        return fTimeScaleCtrl;
     }
 
     /**
@@ -1061,7 +1117,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 2.0
      */
     public int getXForTime(long time) {
-        return _stateCtrl.getXForTime(time);
+        return fTimeGraphCtrl.getXForTime(time);
     }
 
     /**
@@ -1073,7 +1129,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 2.0
      */
     public long getTimeAtX(int x) {
-        return _stateCtrl.getTimeAtX(x);
+        return fTimeGraphCtrl.getTimeAtX(x);
     }
 
     /**
@@ -1082,7 +1138,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return the selection provider
      */
     public ISelectionProvider getSelectionProvider() {
-        return _stateCtrl;
+        return fTimeGraphCtrl;
     }
 
     /**
@@ -1092,7 +1148,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            Wait indefinitely?
      */
     public void waitCursor(boolean waitInd) {
-        _stateCtrl.waitCursor(waitInd);
+        fTimeGraphCtrl.waitCursor(waitInd);
     }
 
     /**
@@ -1101,7 +1157,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The scroll bar
      */
     public ScrollBar getHorizontalBar() {
-        return _stateCtrl.getHorizontalBar();
+        return fTimeGraphCtrl.getHorizontalBar();
     }
 
     /**
@@ -1110,7 +1166,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The scroll bar
      */
     public Slider getVerticalBar() {
-        return _verticalScrollBar;
+        return fVerticalScrollBar;
     }
 
     /**
@@ -1120,7 +1176,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The index that will go to the top
      */
     public void setTopIndex(int index) {
-        _stateCtrl.setTopIndex(index);
+        fTimeGraphCtrl.setTopIndex(index);
         adjustVerticalScrollBar();
     }
 
@@ -1130,7 +1186,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The top index
      */
     public int getTopIndex() {
-        return _stateCtrl.getTopIndex();
+        return fTimeGraphCtrl.getTopIndex();
     }
 
     /**
@@ -1142,7 +1198,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            True for expanded, false for collapsed
      */
     public void setExpandedState(ITimeGraphEntry entry, boolean expanded) {
-        _stateCtrl.setExpandedState(entry, expanded);
+        fTimeGraphCtrl.setExpandedState(entry, expanded);
         adjustVerticalScrollBar();
     }
 
@@ -1152,7 +1208,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 2.0
      */
     public void collapseAll() {
-        _stateCtrl.collapseAll();
+        fTimeGraphCtrl.collapseAll();
         adjustVerticalScrollBar();
     }
 
@@ -1162,7 +1218,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 2.0
      */
     public void expandAll() {
-        _stateCtrl.expandAll();
+        fTimeGraphCtrl.expandAll();
         adjustVerticalScrollBar();
     }
 
@@ -1172,7 +1228,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The element count
      */
     public int getExpandedElementCount() {
-        return _stateCtrl.getExpandedElementCount();
+        return fTimeGraphCtrl.getExpandedElementCount();
     }
 
     /**
@@ -1181,7 +1237,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The array of entries that are below this one
      */
     public ITimeGraphEntry[] getExpandedElements() {
-        return _stateCtrl.getExpandedElements();
+        return fTimeGraphCtrl.getExpandedElements();
     }
 
     /**
@@ -1191,7 +1247,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The listener to add
      */
     public void addTreeListener(ITimeGraphTreeListener listener) {
-        _stateCtrl.addTreeListener(listener);
+        fTimeGraphCtrl.addTreeListener(listener);
     }
 
     /**
@@ -1201,7 +1257,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      *            The listener to remove
      */
     public void removeTreeListener(ITimeGraphTreeListener listener) {
-        _stateCtrl.removeTreeListener(listener);
+        fTimeGraphCtrl.removeTreeListener(listener);
     }
 
     /**
@@ -1210,20 +1266,20 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getResetScaleAction() {
-        if (resetScale == null) {
+        if (fResetScaleAction == null) {
             // resetScale
-            resetScale = new Action() {
+            fResetScaleAction = new Action() {
                 @Override
                 public void run() {
                     resetStartFinishTime();
                     notifyStartFinishTime();
                 }
             };
-            resetScale.setText(Messages.TmfTimeGraphViewer_ResetScaleActionNameText);
-            resetScale.setToolTipText(Messages.TmfTimeGraphViewer_ResetScaleActionToolTipText);
-            resetScale.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_HOME_MENU));
+            fResetScaleAction.setText(Messages.TmfTimeGraphViewer_ResetScaleActionNameText);
+            fResetScaleAction.setToolTipText(Messages.TmfTimeGraphViewer_ResetScaleActionToolTipText);
+            fResetScaleAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_HOME_MENU));
         }
-        return resetScale;
+        return fResetScaleAction;
     }
 
     /**
@@ -1232,20 +1288,20 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getShowLegendAction() {
-        if (showLegendAction == null) {
+        if (fShowLegendAction == null) {
             // showLegend
-            showLegendAction = new Action() {
+            fShowLegendAction = new Action() {
                 @Override
                 public void run() {
                     showLegend();
                 }
             };
-            showLegendAction.setText(Messages.TmfTimeGraphViewer_LegendActionNameText);
-            showLegendAction.setToolTipText(Messages.TmfTimeGraphViewer_LegendActionToolTipText);
-            showLegendAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SHOW_LEGEND));
+            fShowLegendAction.setText(Messages.TmfTimeGraphViewer_LegendActionNameText);
+            fShowLegendAction.setToolTipText(Messages.TmfTimeGraphViewer_LegendActionToolTipText);
+            fShowLegendAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SHOW_LEGEND));
         }
 
-        return showLegendAction;
+        return fShowLegendAction;
     }
 
     /**
@@ -1254,20 +1310,20 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The action object
      */
     public Action getNextEventAction() {
-        if (nextEventAction == null) {
-            nextEventAction = new Action() {
+        if (fNextEventAction == null) {
+            fNextEventAction = new Action() {
                 @Override
                 public void run() {
                     selectNextEvent();
                 }
             };
 
-            nextEventAction.setText(Messages.TmfTimeGraphViewer_NextEventActionNameText);
-            nextEventAction.setToolTipText(Messages.TmfTimeGraphViewer_NextEventActionToolTipText);
-            nextEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_EVENT));
+            fNextEventAction.setText(Messages.TmfTimeGraphViewer_NextEventActionNameText);
+            fNextEventAction.setToolTipText(Messages.TmfTimeGraphViewer_NextEventActionToolTipText);
+            fNextEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_EVENT));
         }
 
-        return nextEventAction;
+        return fNextEventAction;
     }
 
     /**
@@ -1276,20 +1332,20 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getPreviousEventAction() {
-        if (prevEventAction == null) {
-            prevEventAction = new Action() {
+        if (fPrevEventAction == null) {
+            fPrevEventAction = new Action() {
                 @Override
                 public void run() {
                     selectPrevEvent();
                 }
             };
 
-            prevEventAction.setText(Messages.TmfTimeGraphViewer_PreviousEventActionNameText);
-            prevEventAction.setToolTipText(Messages.TmfTimeGraphViewer_PreviousEventActionToolTipText);
-            prevEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_PREV_EVENT));
+            fPrevEventAction.setText(Messages.TmfTimeGraphViewer_PreviousEventActionNameText);
+            fPrevEventAction.setToolTipText(Messages.TmfTimeGraphViewer_PreviousEventActionToolTipText);
+            fPrevEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_PREV_EVENT));
         }
 
-        return prevEventAction;
+        return fPrevEventAction;
     }
 
     /**
@@ -1298,19 +1354,19 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getNextItemAction() {
-        if (nextItemAction == null) {
+        if (fNextItemAction == null) {
 
-            nextItemAction = new Action() {
+            fNextItemAction = new Action() {
                 @Override
                 public void run() {
                     selectNextItem();
                 }
             };
-            nextItemAction.setText(Messages.TmfTimeGraphViewer_NextItemActionNameText);
-            nextItemAction.setToolTipText(Messages.TmfTimeGraphViewer_NextItemActionToolTipText);
-            nextItemAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_ITEM));
+            fNextItemAction.setText(Messages.TmfTimeGraphViewer_NextItemActionNameText);
+            fNextItemAction.setToolTipText(Messages.TmfTimeGraphViewer_NextItemActionToolTipText);
+            fNextItemAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_ITEM));
         }
-        return nextItemAction;
+        return fNextItemAction;
     }
 
     /**
@@ -1319,19 +1375,19 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getPreviousItemAction() {
-        if (previousItemAction == null) {
+        if (fPreviousItemAction == null) {
 
-            previousItemAction = new Action() {
+            fPreviousItemAction = new Action() {
                 @Override
                 public void run() {
                     selectPrevItem();
                 }
             };
-            previousItemAction.setText(Messages.TmfTimeGraphViewer_PreviousItemActionNameText);
-            previousItemAction.setToolTipText(Messages.TmfTimeGraphViewer_PreviousItemActionToolTipText);
-            previousItemAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_PREV_ITEM));
+            fPreviousItemAction.setText(Messages.TmfTimeGraphViewer_PreviousItemActionNameText);
+            fPreviousItemAction.setToolTipText(Messages.TmfTimeGraphViewer_PreviousItemActionToolTipText);
+            fPreviousItemAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_PREV_ITEM));
         }
-        return previousItemAction;
+        return fPreviousItemAction;
     }
 
     /**
@@ -1340,18 +1396,18 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getZoomInAction() {
-        if (zoomInAction == null) {
-            zoomInAction = new Action() {
+        if (fZoomInAction == null) {
+            fZoomInAction = new Action() {
                 @Override
                 public void run() {
                     zoomIn();
                 }
             };
-            zoomInAction.setText(Messages.TmfTimeGraphViewer_ZoomInActionNameText);
-            zoomInAction.setToolTipText(Messages.TmfTimeGraphViewer_ZoomInActionToolTipText);
-            zoomInAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_ZOOM_IN_MENU));
+            fZoomInAction.setText(Messages.TmfTimeGraphViewer_ZoomInActionNameText);
+            fZoomInAction.setToolTipText(Messages.TmfTimeGraphViewer_ZoomInActionToolTipText);
+            fZoomInAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_ZOOM_IN_MENU));
         }
-        return zoomInAction;
+        return fZoomInAction;
     }
 
     /**
@@ -1360,36 +1416,36 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @return The Action object
      */
     public Action getZoomOutAction() {
-        if (zoomOutAction == null) {
-            zoomOutAction = new Action() {
+        if (fZoomOutAction == null) {
+            fZoomOutAction = new Action() {
                 @Override
                 public void run() {
                     zoomOut();
                 }
             };
-            zoomOutAction.setText(Messages.TmfTimeGraphViewer_ZoomOutActionNameText);
-            zoomOutAction.setToolTipText(Messages.TmfTimeGraphViewer_ZoomOutActionToolTipText);
-            zoomOutAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_ZOOM_OUT_MENU));
+            fZoomOutAction.setText(Messages.TmfTimeGraphViewer_ZoomOutActionNameText);
+            fZoomOutAction.setToolTipText(Messages.TmfTimeGraphViewer_ZoomOutActionToolTipText);
+            fZoomOutAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_ZOOM_OUT_MENU));
         }
-        return zoomOutAction;
+        return fZoomOutAction;
     }
 
 
     private void adjustVerticalScrollBar() {
-        int topIndex = _stateCtrl.getTopIndex();
-        int countPerPage = _stateCtrl.countPerPage();
-        int expandedElementCount = _stateCtrl.getExpandedElementCount();
+        int topIndex = fTimeGraphCtrl.getTopIndex();
+        int countPerPage = fTimeGraphCtrl.countPerPage();
+        int expandedElementCount = fTimeGraphCtrl.getExpandedElementCount();
         if (topIndex + countPerPage > expandedElementCount) {
-            _stateCtrl.setTopIndex(Math.max(0, expandedElementCount - countPerPage));
+            fTimeGraphCtrl.setTopIndex(Math.max(0, expandedElementCount - countPerPage));
         }
 
-        int selection = _stateCtrl.getTopIndex();
+        int selection = fTimeGraphCtrl.getTopIndex();
         int min = 0;
         int max = Math.max(1, expandedElementCount - 1);
         int thumb = Math.min(max, Math.max(1, countPerPage - 1));
         int increment = 1;
         int pageIncrement = Math.max(1, countPerPage);
-        _verticalScrollBar.setValues(selection, min, max, thumb, increment, pageIncrement);
+        fVerticalScrollBar.setValues(selection, min, max, thumb, increment, pageIncrement);
     }
 
     /**
@@ -1398,7 +1454,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 1.2
      */
     public void addTimeGraphEntryMenuListener(MenuDetectListener listener) {
-        _stateCtrl.addTimeGraphEntryMenuListener(listener);
+        fTimeGraphCtrl.addTimeGraphEntryMenuListener(listener);
     }
 
     /**
@@ -1407,7 +1463,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 1.2
      */
     public void removeTimeGraphEntryMenuListener(MenuDetectListener listener) {
-        _stateCtrl.removeTimeGraphEntryMenuListener(listener);
+        fTimeGraphCtrl.removeTimeGraphEntryMenuListener(listener);
     }
 
     /**
@@ -1416,7 +1472,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 1.2
      */
     public void addTimeEventMenuListener(MenuDetectListener listener) {
-        _stateCtrl.addTimeEventMenuListener(listener);
+        fTimeGraphCtrl.addTimeEventMenuListener(listener);
     }
 
     /**
@@ -1425,9 +1481,25 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 1.2
      */
     public void removeTimeEventMenuListener(MenuDetectListener listener) {
-        _stateCtrl.removeTimeEventMenuListener(listener);
+        fTimeGraphCtrl.removeTimeEventMenuListener(listener);
     }
 
+    /**
+     * @param filter The filter object to be attached to the view
+     * @since 2.0
+     */
+    public void addFilter(ViewerFilter filter) {
+        fTimeGraphCtrl.addFilter(filter);
+        refresh();
+    }
 
+    /**
+     * @param filter The filter object to be attached to the view
+     * @since 2.0
+     */
+    public void removeFilter(ViewerFilter filter) {
+        fTimeGraphCtrl.removeFilter(filter);
+        refresh();
+    }
 
 }
This page took 0.049866 seconds and 5 git commands to generate.