-
/*****************************************************************************
- * 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 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;
* 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 (_stateCtrl != null) {
+ if (realInput == null) {
+ realInput = new ITimeGraphEntry[0];
}
- setTimeRange(input);
+ setTimeRange(realInput);
_verticalScrollBar.setEnabled(true);
setTopIndex(0);
_selectedTime = 0;
_selectedEntry = null;
- refreshAllData(input);
+ refreshAllData(realInput);
}
}
* @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;
}
- refreshAllData(traces);
+ refreshAllData(realTraces);
}
/**
@Override
public void setNameSpace(int width) {
_nameWidth = width;
- width = _stateCtrl.getClientArea().width;
- if (_nameWidth > width - 6) {
- _nameWidth = width - 6;
+ int w = _stateCtrl.getClientArea().width;
+ if (_nameWidth > w - 6) {
+ _nameWidth = w - 6;
}
if (_nameWidth < 6) {
_nameWidth = 6;
_time1_extSynch = _time1;
}
- @Override
- @Deprecated
- public boolean isCalendarFormat() {
- return timeFormat == TimeFormat.CALENDAR;
- }
-
/**
* @since 2.0
*/
_stateCtrl.removeTimeEventMenuListener(listener);
}
+ /**
+ * @param filter The filter object to be attached to the view
+ * @since 2.0
+ */
+ public void addFilter(ViewerFilter filter) {
+ _stateCtrl.addFilter(filter);
+ refresh();
+ }
+ /**
+ * @param filter The filter object to be attached to the view
+ * @since 2.0
+ */
+ public void removeFilter(ViewerFilter filter) {
+ _stateCtrl.removeFilter(filter);
+ refresh();
+ }
}