summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMathieu Denis2012-07-31 17:32:48 (EDT)
committer Alexandre Montplaisir2012-08-14 11:28:46 (EDT)
commit1f0bb2ddf8727c4631810c7b835db28f835ff4a7 (patch)
tree671aedc752b02abf85c33693d5ad07b8573785b1
parent4e795706cd963f572eb4d91b03d8083d766d016d (diff)
downloadorg.eclipse.linuxtools-1f0bb2ddf8727c4631810c7b835db28f835ff4a7.zip
org.eclipse.linuxtools-1f0bb2ddf8727c4631810c7b835db28f835ff4a7.tar.gz
org.eclipse.linuxtools-1f0bb2ddf8727c4631810c7b835db28f835ff4a7.tar.bz2
tmf: Generalization of the statistics view
The creation of the statistics view is now based on the type of the trace selected and his plugin definition. Thus, it is easier to provide a new implementation of the statistics for a different kind of trace. Change-Id: If105007a5f349565c14cdf6e5e084a4ab5d227b3 Signed-off-by: Mathieu Denis <mathieu.denis@polymtl.ca> Reviewed-on: https://git.eclipse.org/r/7041 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Bernd Hufmann <bhufmann@gmail.com> IP-Clean: Bernd Hufmann <bhufmann@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java18
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java8
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java10
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java10
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java8
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java12
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd23
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java20
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/ITmfExtraEventInfo.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java)5
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/Messages.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java)14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java323
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/messages.properties (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties)0
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/AbsTmfStatisticsTree.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java)5
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java)5
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java)7
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/Messages.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java)7
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java)19
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java)7
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseStatisticsTree.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java)24
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatistics.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java)6
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java)3
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeRootFactory.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java)6
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfTreeContentProvider.java (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java)6
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/messages.properties (renamed from lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/messages.properties)0
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java21
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java608
27 files changed, 749 insertions, 429 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
index 49a3a3a..1586ea5 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
@@ -24,13 +24,13 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.Messages;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnDataProvider;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnDataProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
/**
* TmfBaseColumnDataProvider test cases.
@@ -41,8 +41,8 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
// ------------------------------------------------------------------------
// Fields
// ------------------------------------------------------------------------
- private final static String LEVEL_COLUMN = org.eclipse.linuxtools.tmf.ui.views.statistics.Messages.TmfStatisticsView_LevelColumn;
- private final static String EVENTS_COUNT_COLUMN = org.eclipse.linuxtools.tmf.ui.views.statistics.Messages.TmfStatisticsView_NbEventsColumn;
+ private final static String LEVEL_COLUMN = org.eclipse.linuxtools.tmf.ui.viewers.statistics.Messages.TmfStatisticsView_LevelColumn;
+ private final static String EVENTS_COUNT_COLUMN = org.eclipse.linuxtools.tmf.ui.viewers.statistics.Messages.TmfStatisticsView_NbEventsColumn;
private TmfBaseColumnDataProvider provider;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
index 89bef92..4746d4d 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
@@ -18,10 +18,10 @@ import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
index 2ed137a..95399ab 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
@@ -25,11 +25,11 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.Messages;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
/**
* TmfBaseStatistics Test Cases.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
index e329df9..4a6e12d 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
@@ -25,11 +25,11 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.Messages;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
/**
* TmfStatisticsTreeNode Test Cases.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java
index ca8512c..1b35472 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java
@@ -15,10 +15,10 @@ package org.eclipse.linuxtools.tmf.ui.tests.statistics;
import junit.framework.TestCase;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeRootFactory;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeRootFactory;
/**
* TmfStatisticsTreeRootFactory Test Case.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
index 8f81c9e..8410505 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
@@ -25,12 +25,12 @@ import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.Messages;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfTreeContentProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.Messages;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfTreeContentProvider;
/**
* TmfTreeContentProvider Test Cases.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
index 79751e3..536752a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
@@ -30,6 +30,8 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.ui;x-friends:="org.eclipse.l
org.eclipse.linuxtools.tmf.ui.project.wizards,
org.eclipse.linuxtools.tmf.ui.signal,
org.eclipse.linuxtools.tmf.ui.viewers.events,
+ org.eclipse.linuxtools.tmf.ui.viewers.statistics,
+ org.eclipse.linuxtools.tmf.ui.viewers.statistics.model,
org.eclipse.linuxtools.tmf.ui.views,
org.eclipse.linuxtools.tmf.ui.views.colors,
org.eclipse.linuxtools.tmf.ui.views.distribution.model,
@@ -38,7 +40,6 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.ui;x-friends:="org.eclipse.l
org.eclipse.linuxtools.tmf.ui.views.filter,
org.eclipse.linuxtools.tmf.ui.views.histogram,
org.eclipse.linuxtools.tmf.ui.views.statistics,
- org.eclipse.linuxtools.tmf.ui.views.statistics.model,
org.eclipse.linuxtools.tmf.ui.views.timechart,
org.eclipse.linuxtools.tmf.ui.views.uml2sd,
org.eclipse.linuxtools.tmf.ui.views.uml2sd.core,
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd b/lttng/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd
index 758a884..14ec4cb 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd
@@ -72,6 +72,7 @@
<sequence>
<element ref="defaultEditor" minOccurs="0" maxOccurs="1"/>
<element ref="eventsTableType" minOccurs="0" maxOccurs="1"/>
+ <element ref="statisticsViewerType" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
@@ -171,6 +172,28 @@ If empty, the default events table will be used.
</complexType>
</element>
+ <element name="statisticsViewerType">
+ <annotation>
+ <documentation>
+ The statistics viewer to use for this trace type.
+If omitted, the default statistics viewer will be used.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="default" value="org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer">
+ <annotation>
+ <documentation>
+ The fully qualified name of a class that extends &lt;samp&gt;TmfStatisticsViewer&lt;/samp&gt; .
+If empty, the default statistics viewer will be used.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appinfo>
<meta.section type="since"/>
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java
index 667496c..dc0c206 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceType.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 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:
* Patrick Tasse - Initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.Platform;
/**
* Utility class for accessing TMF trace type extensions from the platform's extensions registry.
- *
+ *
* @version 1.0
* @author Patrick Tasse
*
@@ -41,13 +41,19 @@ public class TmfTraceType {
*/
public static final String TYPE_ELEM = "type"; //$NON-NLS-1$
/**
- * Extension point element 'Default editor'
+ * Extension point element 'Default editor'
*/
public static final String DEFAULT_EDITOR_ELEM = "defaultEditor"; //$NON-NLS-1$
/**
* Extension point element 'Events table type'
*/
public static final String EVENTS_TABLE_TYPE_ELEM = "eventsTableType"; //$NON-NLS-1$
+ /**
+ * Extension point element 'Statistics viewer type'
+ *
+ * @since 2.0
+ */
+ public static final String STATISTICS_VIEWER_ELEM = "statisticsViewerType"; //$NON-NLS-1$
/**
* Extension point attribute 'ID'
@@ -95,10 +101,10 @@ public class TmfTraceType {
}
/**
- * Retrieves all configuration elements from the platform extension registry
+ * Retrieves all configuration elements from the platform extension registry
* for the trace type extension.
- *
- * @return an array of trace type configuration elements
+ *
+ * @return an array of trace type configuration elements
*/
public static IConfigurationElement[] getTypeElements() {
IConfigurationElement[] elements = Platform.getExtensionRegistry()
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/ITmfExtraEventInfo.java
index 0ebc8c3..0a507eb 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/ITmfExtraEventInfo.java
@@ -11,14 +11,15 @@
* Bernd Hufmann - Changed interface and class name
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics;
/**
* This interface provides an extension for updating the data model and to pass
* along more information beside events.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public interface ITmfExtraEventInfo {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/Messages.java
index 9d9b929..a27be40 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/Messages.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics;
import org.eclipse.osgi.util.NLS;
@@ -19,39 +19,49 @@ import org.eclipse.osgi.util.NLS;
*
* @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.statistics.messages"; //$NON-NLS-1$
+
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.viewers.statistics.messages"; //$NON-NLS-1$
+
/**
* Level column name
*/
public static String TmfStatisticsView_LevelColumn;
+
/**
* Level column tool tip.
*/
public static String TmfStatisticsView_LevelColumnTip;
+
/**
* Number of events column name.
*/
public static String TmfStatisticsView_NbEventsColumn;
+
/**
* Number of events column tool tip.
*/
public static String TmfStatisticsView_NbEventsTip;
+
/**
* Partial number of events column.
* @since 2.0
*/
public static String TmfStatisticsView_NbEventsTimeRangeColumn;
+
/**
* Partial number of events column tool tip.
* @since 2.0
*/
public static String TmfStatisticsView_NbEventsTimeRangeTip;
+
/**
* String for unknown trace name.
*/
public static String TmfStatisticsView_UnknownTraceName;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
new file mode 100644
index 0000000..103913c
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
@@ -0,0 +1,323 @@
+/*******************************************************************************
+ * 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:
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfColumnDataProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnDataProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeRootFactory;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfTreeContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * A basic viewer to display statistics in the statistics view.
+ *
+ * @author Mathieu Denis
+ * @version 2.0
+ * @since 2.0
+ */
+public class TmfStatisticsViewer extends TmfComponent {
+
+ /**
+ * Refresh frequency
+ */
+ protected static final Long STATS_INPUT_CHANGED_REFRESH = 5000L;
+
+ /**
+ * The actual tree viewer to display
+ */
+ protected TreeViewer fTreeViewer;
+
+ /**
+ * View instance counter (for multiple statistic views)
+ */
+ private static int fCountInstance = 0;
+
+ /**
+ * Number of this instance. Used as an instance ID.
+ */
+ private int fInstanceNb;
+
+ /**
+ * Object to store the cursor while waiting for the experiment to load
+ */
+ private Cursor fWaitCursor = null;
+
+ /**
+ * Default constructor
+ *
+ * @param parent
+ * The parent of this viewer
+ */
+ public TmfStatisticsViewer(Composite parent) {
+ // Increment a counter to make sure the tree ID is unique.
+ fCountInstance++;
+ fInstanceNb = fCountInstance;
+
+ final List<TmfBaseColumnData> columnDataList = getColumnDataProvider().getColumnData();
+ parent.setLayout(new FillLayout());
+
+ fTreeViewer = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ fTreeViewer.setContentProvider(new TmfTreeContentProvider());
+ fTreeViewer.getTree().setHeaderVisible(true);
+ fTreeViewer.setUseHashlookup(true);
+
+ // Creates the columns defined by the column data provider
+ for (final TmfBaseColumnData columnData : columnDataList) {
+ final TreeViewerColumn treeColumn = new TreeViewerColumn(fTreeViewer, columnData.getAlignment());
+ treeColumn.getColumn().setText(columnData.getHeader());
+ treeColumn.getColumn().setWidth(columnData.getWidth());
+ treeColumn.getColumn().setToolTipText(columnData.getTooltip());
+
+ if (columnData.getComparator() != null) { // A comparator is defined.
+ // Adds a listener on the columns header for sorting purpose.
+ treeColumn.getColumn().addSelectionListener(new SelectionAdapter() {
+
+ private ViewerComparator reverseComparator;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // Initializes the reverse comparator once.
+ if (reverseComparator == null) {
+ reverseComparator = new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return -1 * columnData.getComparator().compare(viewer, e1, e2);
+ }
+ };
+ }
+
+ if (fTreeViewer.getTree().getSortDirection() == SWT.UP
+ || fTreeViewer.getTree().getSortColumn() != treeColumn.getColumn()) {
+ /*
+ * Puts the descendant order if the old order was
+ * up or if the selected column has changed.
+ */
+ fTreeViewer.setComparator(columnData.getComparator());
+ fTreeViewer.getTree().setSortDirection(SWT.DOWN);
+ } else {
+ /*
+ * Puts the ascendant ordering if the selected
+ * column hasn't changed.
+ */
+ fTreeViewer.setComparator(reverseComparator);
+ fTreeViewer.getTree().setSortDirection(SWT.UP);
+ }
+ fTreeViewer.getTree().setSortColumn(treeColumn.getColumn());
+ }
+ });
+ }
+ treeColumn.setLabelProvider(columnData.getLabelProvider());
+ }
+
+ // Handler that will draw the bar charts.
+ fTreeViewer.getTree().addListener(SWT.EraseItem, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (columnDataList.get(event.index).getPercentageProvider() != null) {
+ TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) event.item.getData();
+
+ double percentage = columnDataList.get(event.index).getPercentageProvider().getPercentage(node);
+ if (percentage == 0) { // No bar to draw
+ return;
+ }
+
+ if ((event.detail & SWT.SELECTED) > 0) { // The item is selected.
+ // Draws our own background to avoid overwritten the bar.
+ event.gc.fillRectangle(event.x, event.y, event.width, event.height);
+ event.detail &= ~SWT.SELECTED;
+ }
+
+ int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
+ int oldAlpha = event.gc.getAlpha();
+ Color oldForeground = event.gc.getForeground();
+ Color oldBackground = event.gc.getBackground();
+ /*
+ * Draws a transparent gradient rectangle from the color of
+ * foreground and background.
+ */
+ event.gc.setAlpha(64);
+ event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ event.gc.setBackground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ event.gc.fillGradientRectangle(event.x, event.y, barWidth, event.height, true);
+ event.gc.drawRectangle(event.x, event.y, barWidth, event.height);
+ // Restores old values
+ event.gc.setForeground(oldForeground);
+ event.gc.setBackground(oldBackground);
+ event.gc.setAlpha(oldAlpha);
+ event.detail &= ~SWT.BACKGROUND;
+ }
+ }
+ });
+
+ // Initializes the comparator parameters
+ fTreeViewer.setComparator(columnDataList.get(0).getComparator());
+ fTreeViewer.getTree().setSortColumn(fTreeViewer.getTree().getColumn(0));
+ fTreeViewer.getTree().setSortDirection(SWT.DOWN);
+ }
+
+ /**
+ * Refreshes this viewer completely with information freshly obtained from
+ * this viewer's model.
+ */
+ public void refresh() {
+ fTreeViewer.refresh();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.tmf.core.component.TmfComponent#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (fWaitCursor != null) {
+ fWaitCursor.dispose();
+ }
+ fTreeViewer.getControl().dispose();
+ super.dispose();
+ // clean the model
+ TmfStatisticsTreeRootFactory.removeAll();
+ }
+
+ /**
+ * Focus on the statistics tree of the viewer
+ */
+ public void setFocus() {
+ fTreeViewer.getTree().setFocus();
+ }
+
+ /**
+ * Sets or clears the input for this viewer.
+ *
+ * @param input
+ * The input of this viewer, or <code>null</code> if none
+ */
+ public void setInput(TmfStatisticsTreeNode input) {
+ fTreeViewer.setInput(input);
+ }
+
+ /**
+ * Returns the quantity of data to retrieve before a refresh of the view is
+ * performed
+ *
+ * @return the quantity of data to retrieve before a refresh of the view is
+ * performed.
+ */
+ public long getInputChangedRefresh() {
+ return STATS_INPUT_CHANGED_REFRESH;
+ }
+
+ /**
+ * This method can be overridden to implement another way to represent the
+ * statistics data and to retrieve the information for display.
+ *
+ * @return a TmfStatisticsData object.
+ */
+ public AbsTmfStatisticsTree getStatisticData() {
+ return new TmfBaseStatisticsTree();
+ }
+
+ /**
+ * Get the input of the viewer
+ *
+ * @return an object representing the input of the statistics viewer
+ */
+ public Object getInput() {
+ return fTreeViewer.getInput();
+ }
+
+ /**
+ * Returns the primary control associated with this viewer.
+ *
+ * @return the SWT control which displays this viewer's content
+ */
+ public Control getControl() {
+ return fTreeViewer.getControl();
+ }
+
+ /**
+ * When the experiment is loading the cursor will be different so the user
+ * know the processing is not finished yet.
+ *
+ * @param waitInd
+ * Indicates if we need to show the waiting cursor, or the
+ * default one
+ */
+ public void waitCursor(final boolean waitInd) {
+ if ((fTreeViewer == null) || (fTreeViewer.getTree().isDisposed())) {
+ return;
+ }
+
+ Display display = fTreeViewer.getControl().getDisplay();
+ if (fWaitCursor == null) {
+ fWaitCursor = new Cursor(display, SWT.CURSOR_WAIT);
+ }
+
+ // Perform the updates on the UI thread
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if ((fTreeViewer != null)
+ && (!fTreeViewer.getTree().isDisposed())) {
+ Cursor cursor = null; /* indicates default */
+ if (waitInd) {
+ cursor = fWaitCursor;
+ }
+ fTreeViewer.getControl().setCursor(cursor);
+ }
+ }
+ });
+ }
+
+ /**
+ * Constructs the ID based on the experiment name and the instance number
+ *
+ * @param name
+ * The name of the trace to show in the view
+ * @return a view ID
+ */
+ public String getTreeID(String name) {
+ return name + fInstanceNb;
+ }
+
+ /**
+ * This method can be overridden to change the representation of the data in
+ * the columns.
+ *
+ * @return an object implementing ITmfBaseColumnDataProvider.
+ */
+ protected ITmfColumnDataProvider getColumnDataProvider() {
+ return new TmfBaseColumnDataProvider();
+ }
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/messages.properties
index 2542d73..2542d73 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/messages.properties
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/AbsTmfStatisticsTree.java
index 7938047..41577ea 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/AbsTmfStatisticsTree.java
@@ -11,7 +11,7 @@
*
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import java.util.Collection;
import java.util.HashMap;
@@ -20,7 +20,7 @@ import java.util.Set;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
/**
* Base class for the statistics storage. It allow to implement a tree structure
@@ -29,6 +29,7 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
*
* @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public abstract class AbsTmfStatisticsTree {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java
index 35cd206..a63bd2b 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import java.util.List;
@@ -19,8 +19,9 @@ import java.util.List;
* <code>TmfStatisticsView</code> uses classes implementing this interface to
* define the columns in the statistics tree viewer.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public interface ITmfColumnDataProvider {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java
index 236423a..86a784b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java
@@ -10,17 +10,18 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
/**
* Provide the basic interface to create a statistics column for the statistics
* table tree.
*
- * @version 1.0
+ * @version 2.0
+ * @since 2.0
* @author Mathieu Denis
*/
public interface ITmfStatisticsColumnData {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/Messages.java
index 18e9ebe..08c95ae 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/Messages.java
@@ -10,19 +10,20 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import org.eclipse.osgi.util.NLS;
/**
* Message strings for the statistics framework.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.statistics.model.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.messages"; //$NON-NLS-1$
/**
* CPU statistic name.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java
index 7d9662a..c6cea95 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java
@@ -11,7 +11,7 @@
* Bernd Hufmann - Added Annotations
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ViewerComparator;
@@ -19,8 +19,9 @@ import org.eclipse.jface.viewers.ViewerComparator;
/**
* Contains all the information necessary to build a column of the table.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public class TmfBaseColumnData implements ITmfStatisticsColumnData {
@@ -110,7 +111,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getHeader()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getHeader()
*/
@Override
public String getHeader() {
@@ -119,7 +120,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getWidth()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getWidth()
*/
@Override
public int getWidth() {
@@ -128,7 +129,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getAlignment()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getAlignment()
*/
@Override
public int getAlignment() {
@@ -137,7 +138,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getTooltip()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getTooltip()
*/
@Override
public String getTooltip() {
@@ -146,7 +147,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getLabelProvider()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getLabelProvider()
*/
@Override
public ColumnLabelProvider getLabelProvider() {
@@ -155,7 +156,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getComparator()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getComparator()
*/
@Override
public ViewerComparator getComparator() {
@@ -164,7 +165,7 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
/*
* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getPercentageProvider()
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getPercentageProvider()
*/
@Override
public ITmfColumnPercentageProvider getPercentageProvider() {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
index aee9f60..29d6e4e 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Implementation and Initial API
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import java.util.Arrays;
import java.util.HashSet;
@@ -21,8 +21,8 @@ import java.util.Vector;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.Messages;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.Messages;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
@@ -33,6 +33,7 @@ import org.eclipse.ui.PlatformUI;
*
* @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseStatisticsTree.java
index d64bf26..0d85447 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseStatisticsTree.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import java.util.Collection;
import java.util.HashSet;
@@ -20,7 +20,7 @@ import java.util.Set;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
/**
* Store information about base statistics data.
@@ -30,6 +30,7 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
*
* @version 2.0
* @author Mathieu Denis
+ * @since 2.0
*/
public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
@@ -81,7 +82,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#getChildren(org.eclipse.linuxtools.tmf.util.TmfFixedArray)
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree#getChildren
+ * (org.eclipse.linuxtools.tmf.core.util.TmfFixedArray)
*/
@Override
public Collection<TmfStatisticsTreeNode> getChildren(TmfFixedArray<String> path) {
@@ -119,7 +121,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#getAllChildren(org.eclipse.linuxtools.tmf.util.TmfFixedArray)
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree#getAllChildren
+ * (org.eclipse.linuxtools.tmf.core.util.TmfFixedArray)
*/
@Override
public Collection<TmfStatisticsTreeNode> getAllChildren(TmfFixedArray<String> path) {
@@ -156,7 +159,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#increase(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo, int)
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree#increase
+ * (org.eclipse.linuxtools.tmf.core.event.ITmfEvent, org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo, int)
*/
@Override
public void increase(ITmfEvent event, ITmfExtraEventInfo extraInfo, int values) {
@@ -166,7 +170,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerEvent(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo)
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree#registerEvent
+ * (org.eclipse.linuxtools.tmf.core.event.ITmfEvent, org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo)
*/
@Override
public void registerEvent(ITmfEvent event, ITmfExtraEventInfo extraInfo) {
@@ -184,7 +189,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree#registerEventInTimeRange(org.eclipse.linuxtools.tmf.core.event.ITmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo)
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree#registerEventInTimeRange
+ * (org.eclipse.linuxtools.tmf.core.event.ITmfEvent, org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo)
*/
@Override
public void registerEventInTimeRange(ITmfEvent event, ITmfExtraEventInfo extraInfo) {
@@ -240,8 +246,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerName
- * (org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfFixedArray)
+ * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree#registerName
+ * (org.eclipse.linuxtools.tmf.core.util.TmfFixedArray)
*/
@Override
protected void registerName(TmfFixedArray<String> path) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatistics.java
index 49f618b..a6fffd5 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatistics.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Intial API and Implementation
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
/**
* Primitive container for Statistics data
@@ -22,15 +22,19 @@ package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
* another for the number of events in the selected time range
*
* @version 2.0
+ * @version 2.0
+ * @since 2.0
* @author Mathieu Denis
*/
public class TmfStatistics {
+
/**
* Total number of events.
*
* @since 2.0
*/
protected long fNbEvents = 0;
+
/**
* Number of events within a time range (Partial event count).
*
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java
index 4f3d084..95a4dcd 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeNode.java
@@ -12,7 +12,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Re-design for new stats structure (2)
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import java.util.Collection;
@@ -26,6 +26,7 @@ import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
* the path from the root to this node.
*
* @version 2.0
+ * @since 2.0
* @author Mathieu Denis
*/
public class TmfStatisticsTreeNode {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeRootFactory.java
index ff8d2f4..1e7eca4 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfStatisticsTreeRootFactory.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import java.util.HashMap;
import java.util.Map;
@@ -22,9 +22,9 @@ import java.util.Map;
* root node is created for each tree. Using the tree node ID the statistics
* tree can be retrieved.
*
- * @version 1.0
+ * @version 2.0
+ * @since 2.0
* @author Mathieu Denis
- *
*/
public class TmfStatisticsTreeRootFactory {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfTreeContentProvider.java
index 614be4f..d6bc3cf 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfTreeContentProvider.java
@@ -10,7 +10,7 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API
*******************************************************************************/
-package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
+package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -18,11 +18,13 @@ import org.eclipse.jface.viewers.Viewer;
/**
* Adapter TreeViewers can use to interact with StatisticsTreeNode objects.
*
- * @version 1.0
+ * @version 2.0
+ * @since 2.0
* @author Mathieu Denis
* @see org.eclipse.jface.viewers.ITreeContentProvider
*/
public class TmfTreeContentProvider implements ITreeContentProvider {
+
/*
* (non-Javadoc)
*
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/messages.properties
index 442d278..442d278 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/messages.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/messages.properties
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java
index 735586b..980b523 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java
@@ -17,8 +17,11 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeRootFactory;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.ITmfExtraEventInfo;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.Messages;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeRootFactory;
/**
* Class for the TMF event requests specific to the statistics view.
@@ -32,6 +35,11 @@ class TmfStatisticsRequest extends TmfEventRequest {
private final TmfStatisticsView fSender;
/**
+ * The viewer that displays the statistics data
+ */
+ private TmfStatisticsViewer fViewer;
+
+ /**
* The experiment for which to send the request
*/
private final TmfExperiment fExperiment;
@@ -63,11 +71,12 @@ class TmfStatisticsRequest extends TmfEventRequest {
* Is this for a global statistics request (true), or a partial
* one (false)?
*/
- TmfStatisticsRequest(TmfStatisticsView sender, TmfExperiment experiment, TmfTimeRange range, long index, ExecutionType prio, boolean global) {
+ TmfStatisticsRequest(TmfStatisticsView sender, TmfStatisticsViewer viewer, TmfExperiment experiment, TmfTimeRange range, long index, ExecutionType prio, boolean global) {
super(ITmfEvent.class, range, index, TmfDataRequest.ALL_DATA, sender.getIndexPageSize(), prio);
- String treeID = sender.getTreeID(experiment.getName());
+ String treeID = viewer.getTreeID(experiment.getName());
fSender = sender;
+ fViewer = viewer;
fExperiment = experiment;
fGlobal = global;
fStatisticsData = TmfStatisticsTreeRootFactory.getStatTree(treeID);
@@ -94,7 +103,7 @@ class TmfStatisticsRequest extends TmfEventRequest {
}
fStatisticsData.increase(data, extraInfo, 1);
// Refresh view
- if ((getNbRead() % fSender.getInputChangedRefresh()) == 0) {
+ if ((getNbRead() % fViewer.getInputChangedRefresh()) == 0) {
fSender.modelInputChanged(false);
}
}
@@ -105,7 +114,7 @@ class TmfStatisticsRequest extends TmfEventRequest {
super.handleSuccess();
fSender.modelInputChanged(true);
if (fGlobal) {
- fSender.waitCursor(false);
+ fViewer.waitCursor(false);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
index 40f4f6d..efe0608 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
@@ -10,17 +10,21 @@
* Mathieu Denis <mathieu.denis@polymtl.ca> - Generalized version based on LTTng
* Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming
* Mathieu Denis - New request added to update the statistics from the selected time range
+ * Mathieu Denis - Generalization of the view to instantiate a viewer specific to a trace type
*
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics;
-import java.util.List;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.TreeViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
@@ -33,25 +37,14 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceType;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
+import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTreeRootFactory;
import org.eclipse.linuxtools.tmf.ui.views.TmfView;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfColumnDataProvider;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnDataProvider;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeRootFactory;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfTreeContentProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Control;
+import org.osgi.framework.Bundle;
/**
* The generic Statistics View displays statistics for any kind of traces.
@@ -77,14 +70,14 @@ public class TmfStatisticsView extends TmfView {
public static final String TMF_STATISTICS_VIEW = "StatisticsView"; //$NON-NLS-1$
/**
- * Refresh frequency
+ * Stores the request to the experiment
*/
- protected static final Long STATS_INPUT_CHANGED_REFRESH = 5000L;
+ protected ITmfEventRequest fRequest = null;
/**
- * Default PAGE_SIZE for background requests
+ * The viewer that builds the columns to show the statistics
*/
- protected static final int PAGE_SIZE = 50000;
+ private TmfStatisticsViewer fStatsViewer;
/**
* The initial window span (in nanoseconds)
@@ -101,14 +94,24 @@ public class TmfStatisticsView extends TmfView {
public static final byte TIME_SCALE = -9;
/**
- * The actual tree viewer to display
+ * Stores a reference to the parent composite of this view
*/
- protected TreeViewer fTreeViewer;
+ private Composite fParent;
/**
- * Stores the global request to the experiment
+ * Stores a reference to the experiment
*/
- protected ITmfEventRequest fRequest = null;
+ private TmfExperiment fExperiment;
+
+ /**
+ * Flag to force request the data from trace
+ */
+ protected boolean fRequestData = false;
+
+ /**
+ * Default PAGE_SIZE for background requests
+ */
+ protected static final int PAGE_SIZE = 50000;
/**
* Stores the ranged request to the experiment
@@ -140,35 +143,12 @@ public class TmfStatisticsView extends TmfView {
protected final Object fStatisticsUpdateSyncObj = new Object();
/**
- * Flag to force request the data from trace
- */
- protected boolean fRequestData = false;
-
- /**
- * Object to store the cursor while waiting for the experiment to load
- */
- private Cursor fWaitCursor = null;
-
- /**
- * View instance counter (for multiple statistic views)
- */
- private static int fCountInstance = 0;
-
- /**
- * Number of this instance. Used as an instance ID.
- */
- private final int fInstanceNb;
-
- /**
* Constructor of a statistics view.
*
- * @param viewName
- * The name to give to the view.
+ * @param viewName The name to give to the view.
*/
public TmfStatisticsView(String viewName) {
super(viewName);
- fCountInstance++;
- fInstanceNb = fCountInstance;
}
/**
@@ -186,104 +166,35 @@ public class TmfStatisticsView extends TmfView {
*/
@Override
public void createPartControl(Composite parent) {
- final List<TmfBaseColumnData> columnDataList = getColumnDataProvider().getColumnData();
- parent.setLayout(new FillLayout());
-
- fTreeViewer = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- fTreeViewer.setContentProvider(new TmfTreeContentProvider());
- fTreeViewer.getTree().setHeaderVisible(true);
- fTreeViewer.setUseHashlookup(true);
-
- for (final TmfBaseColumnData columnData : columnDataList) {
- final TreeViewerColumn treeColumn = new TreeViewerColumn(fTreeViewer, columnData.getAlignment());
- treeColumn.getColumn().setText(columnData.getHeader());
- treeColumn.getColumn().setWidth(columnData.getWidth());
- treeColumn.getColumn().setToolTipText(columnData.getTooltip());
-
- if (columnData.getComparator() != null) {
- treeColumn.getColumn().addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (fTreeViewer.getTree().getSortDirection() == SWT.UP || fTreeViewer.getTree().getSortColumn() != treeColumn.getColumn()) {
- fTreeViewer.setComparator(columnData.getComparator());
- fTreeViewer.getTree().setSortDirection(SWT.DOWN);
- } else {
- fTreeViewer.setComparator(new ViewerComparator() {
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- return -1 * columnData.getComparator().compare(viewer, e1, e2);
- }
- });
- fTreeViewer.getTree().setSortDirection(SWT.UP);
- }
- fTreeViewer.getTree().setSortColumn(treeColumn.getColumn());
- }
- });
- }
- treeColumn.setLabelProvider(columnData.getLabelProvider());
- }
-
- // Handler that will draw the bar charts.
- fTreeViewer.getTree().addListener(SWT.EraseItem, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (columnDataList.get(event.index).getPercentageProvider() != null) {
- TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) event.item.getData();
-
- double percentage = columnDataList.get(event.index).getPercentageProvider().getPercentage(node);
- if (percentage == 0) {
- return;
- }
-
- if ((event.detail & SWT.SELECTED) > 0) {
- Color oldForeground = event.gc.getForeground();
- event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
- event.gc.fillRectangle(event.x, event.y, event.width, event.height);
- event.gc.setForeground(oldForeground);
- event.detail &= ~SWT.SELECTED;
- }
-
- int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
- int oldAlpha = event.gc.getAlpha();
- Color oldForeground = event.gc.getForeground();
- Color oldBackground = event.gc.getBackground();
- event.gc.setAlpha(64);
- event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_BLUE));
- event.gc.setBackground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- event.gc.fillGradientRectangle(event.x, event.y, barWidth, event.height, true);
- event.gc.drawRectangle(event.x, event.y, barWidth, event.height);
- event.gc.setForeground(oldForeground);
- event.gc.setBackground(oldBackground);
- event.gc.setAlpha(oldAlpha);
- event.detail &= ~SWT.BACKGROUND;
- }
- }
- });
-
- fTreeViewer.setComparator(columnDataList.get(0).getComparator());
- fTreeViewer.getTree().setSortColumn(fTreeViewer.getTree().getColumn(0));
- fTreeViewer.getTree().setSortDirection(SWT.DOWN);
-
+ fParent = parent;
+ TmfExperiment currentExperiment = TmfExperiment.getCurrentExperiment();
// Read current data if any available
- TmfExperiment experiment = TmfExperiment.getCurrentExperiment();
- if (experiment != null) {
+ if (currentExperiment != null) {
fRequestData = true;
// Insert the statistics data into the tree
- TmfExperimentSelectedSignal signal = new TmfExperimentSelectedSignal(this, experiment);
+ TmfExperimentSelectedSignal signal = new TmfExperimentSelectedSignal(this, currentExperiment);
experimentSelected(signal);
+ return;
}
+ fStatsViewer = createStatisticsViewer();
+ /*
+ * Updates the experiment field only at the end because
+ * experimentSelected signal verifies the old selected experiment to
+ * avoid reloading the same trace.
+ */
+ fExperiment = currentExperiment;
}
- /*
- * (non-Javadoc)
+ /**
+ * Handles the signal about disposal of the current experiment.
*
- * @see org.eclipse.linuxtools.tmf.ui.views.TmfView#dispose()
+ * @param signal
+ * The disposed signal
*/
- @Override
- public void dispose() {
- super.dispose();
- if (fWaitCursor != null) {
- fWaitCursor.dispose();
+ @TmfSignalHandler
+ public void experimentDisposed(TmfExperimentDisposedSignal signal) {
+ if (signal.getExperiment() != TmfExperiment.getCurrentExperiment()) {
+ return;
}
/*
@@ -292,37 +203,124 @@ public class TmfStatisticsView extends TmfView {
*/
cancelOngoingRequest(fRequestRange);
cancelOngoingRequest(fRequest);
- // clean the model
- TmfStatisticsTreeRootFactory.removeAll();
}
- /*
- * (non-Javadoc)
+ /**
+ * Handler called when an experiment is selected. Checks if the experiment
+ * has changed and requests the selected experiment if it has not yet been
+ * cached.
*
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ * @param signal
+ * Contains the information about the selection.
*/
- @Override
- public void setFocus() {
- fTreeViewer.getTree().setFocus();
+ @TmfSignalHandler
+ public void experimentSelected(TmfExperimentSelectedSignal signal) {
+ if (signal != null) {
+ // Does not reload the same trace if already opened
+ if (fExperiment == null
+ || signal.getExperiment().toString().compareTo(fExperiment.toString()) != 0) {
+ /*
+ * Dispose the current viewer and adapt the new one to the trace
+ * type of the experiment selected
+ */
+ if (fStatsViewer != null) {
+ fStatsViewer.dispose();
+ }
+ // Update the current experiment
+ fExperiment = signal.getExperiment();
+ fStatsViewer = createStatisticsViewer();
+ fParent.layout();
+
+ String experimentName = fExperiment.getName();
+ String treeID = fStatsViewer.getTreeID(experimentName);
+
+ setInput(treeID, fExperiment.getTraces());
+
+ if (fRequestData) {
+ requestData(fExperiment, fExperiment.getTimeRange());
+ fRequestData = false;
+ }
+ }
+ }
+ }
+
+ /**
+ * Initialize the viewer with the information received.
+ *
+ * @param treeID
+ * The unique ID of the tree that is returned by
+ * {@link TmfStatisticsViewer#getTreeID(String)}
+ * @param traces
+ * The list of the traces to add in the tree.
+ * @since 2.0
+ */
+ public void setInput(String treeID, ITmfTrace[] traces) {
+ if (TmfStatisticsTreeRootFactory.containsTreeRoot(treeID)) {
+ // The experiment root is already present
+ TmfStatisticsTreeNode experimentTreeNode = TmfStatisticsTreeRootFactory.getStatTreeRoot(treeID);
+
+ // check if there is partial data loaded in the experiment
+ int numTraces = traces.length;
+ int numNodeTraces = experimentTreeNode.getNbChildren();
+
+ if (numTraces == numNodeTraces) {
+ boolean same = true;
+ /*
+ * Detect if the experiment contains the same traces as when
+ * previously selected
+ */
+ for (int i = 0; i < numTraces; i++) {
+ String traceName = traces[i].getName();
+ if (!experimentTreeNode.containsChild(traceName)) {
+ same = false;
+ break;
+ }
+ }
+
+ if (same) {
+ // no need to reload data, all traces are already loaded
+ fStatsViewer.setInput(experimentTreeNode);
+
+ resetUpdateSynchronization();
+
+ return;
+ }
+ experimentTreeNode.reset();
+ }
+ } else {
+ TmfStatisticsTreeRootFactory.addStatsTreeRoot(treeID, fStatsViewer.getStatisticData());
+ }
+
+ resetUpdateSynchronization();
+
+ TmfStatisticsTreeNode treeModelRoot = TmfStatisticsTreeRootFactory.getStatTreeRoot(treeID);
+
+ // if the model has contents, clear to start over
+ if (treeModelRoot.hasChildren()) {
+ treeModelRoot.reset();
+ }
+
+ // set input to a clean data model
+ fStatsViewer.setInput(treeModelRoot);
}
/**
* Refresh the view.
*
- * @param complete
- * Should a pending update be sent afterwards or not
+ * @param complete Should a pending update be sent afterwards or not
*/
public void modelInputChanged(boolean complete) {
+ Control viewerControl = fStatsViewer.getControl();
// Ignore update if disposed
- if (fTreeViewer.getTree().isDisposed()) {
+ if (viewerControl.isDisposed()) {
return;
}
- fTreeViewer.getTree().getDisplay().asyncExec(new Runnable() {
+ fStatsViewer.getControl().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
- if (!fTreeViewer.getTree().isDisposed()) {
- fTreeViewer.refresh();
+ if (!fStatsViewer.getControl().isDisposed()) {
+ fStatsViewer.refresh();
}
}
});
@@ -340,111 +338,19 @@ public class TmfStatisticsView extends TmfView {
* The experiment name
*/
public void modelIncomplete(String name) {
- Object input = fTreeViewer.getInput();
+ Object input = fStatsViewer.getInput();
if (input != null && input instanceof TmfStatisticsTreeNode) {
/*
* The data from this experiment is invalid and shall be removed to
* refresh upon next selection
*/
- TmfStatisticsTreeRootFactory.removeStatTreeRoot(getTreeID(name));
+ TmfStatisticsTreeRootFactory.removeStatTreeRoot(fStatsViewer.getTreeID(name));
// Reset synchronization information
resetUpdateSynchronization();
modelInputChanged(false);
}
- waitCursor(false);
- }
-
- /**
- * Handles the signal about disposal of the current experiment.
- *
- * @param signal
- * The disposed signal
- */
- @TmfSignalHandler
- public void experimentDisposed(TmfExperimentDisposedSignal signal) {
- if (signal.getExperiment() != TmfExperiment.getCurrentExperiment()) {
- return;
- }
- /*
- * The range request must be cancelled first, since the global one removes
- * the statistics tree
- */
- cancelOngoingRequest(fRequestRange);
- cancelOngoingRequest(fRequest);
- resetTimeRangeValue();
- }
-
- /**
- * Handler called when an experiment is selected. Checks if the experiment
- * has changed and requests the selected experiment if it has not yet been
- * cached.
- *
- * @param signal
- * Contains the information about the selection.
- */
- @TmfSignalHandler
- public void experimentSelected(TmfExperimentSelectedSignal signal) {
- if (signal != null) {
- TmfExperiment experiment = signal.getExperiment();
- String experimentName = experiment.getName();
-
- if (TmfStatisticsTreeRootFactory.containsTreeRoot(getTreeID(experimentName))) {
- // The experiment root is already present
- String treeID = getTreeID(experimentName);
- TmfStatisticsTreeNode experimentTreeNode = TmfStatisticsTreeRootFactory.getStatTreeRoot(treeID);
-
- ITmfTrace[] traces = experiment.getTraces();
-
- // check if there is partial data loaded in the experiment
- int numTraces = experiment.getTraces().length;
- int numNodeTraces = experimentTreeNode.getNbChildren();
-
- if (numTraces == numNodeTraces) {
- boolean same = true;
- /*
- * Detect if the experiment contains the same traces as when
- * previously selected
- */
- for (int i = 0; i < numTraces; i++) {
- String traceName = traces[i].getName();
- if (!experimentTreeNode.containsChild(traceName)) {
- same = false;
- break;
- }
- }
-
- if (same) {
- // no need to reload data, all traces are already loaded
- fTreeViewer.setInput(experimentTreeNode);
-
- resetUpdateSynchronization();
-
- return;
- }
- experimentTreeNode.reset();
- }
- } else {
- TmfStatisticsTreeRootFactory.addStatsTreeRoot(getTreeID(experimentName), getStatisticData());
- }
-
- resetUpdateSynchronization();
-
- TmfStatisticsTreeNode treeModelRoot = TmfStatisticsTreeRootFactory.getStatTreeRoot(getTreeID(experiment.getName()));
-
- // if the model has contents, clear to start over
- if (treeModelRoot.hasChildren()) {
- treeModelRoot.reset();
- }
-
- // set input to a clean data model
- fTreeViewer.setInput(treeModelRoot);
-
- if (fRequestData) {
- requestData(experiment, experiment.getTimeRange());
- fRequestData = false;
- }
- }
+ fStatsViewer.waitCursor(false);
}
/**
@@ -461,7 +367,7 @@ public class TmfStatisticsView extends TmfView {
return;
}
- // Calculate the selected timerange for the request
+ // Calculate the selected timerange to request
long startTime = signal.getRange().getStartTime().normalize(0, TIME_SCALE).getValue();
TmfTimestamp startTS = new TmfTimestamp(startTime, TIME_SCALE);
TmfTimestamp endTS = new TmfTimestamp(startTime + INITIAL_WINDOW_SPAN, TIME_SCALE);
@@ -471,6 +377,36 @@ public class TmfStatisticsView extends TmfView {
requestData(experiment, signal.getRange());
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.tmf.ui.views.TmfView#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ fStatsViewer.dispose();
+
+ /*
+ * Make sure there is no request running before removing the statistics
+ * tree.
+ */
+ cancelOngoingRequest(fRequestRange);
+ cancelOngoingRequest(fRequest);
+ // clean the model
+ TmfStatisticsTreeRootFactory.removeAll();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ fStatsViewer.setFocus();
+ }
+
/**
* Handles the experiment updated signal. This will detect new events in
* case the indexing is not coalesced with a statistics request.
@@ -488,7 +424,7 @@ public class TmfStatisticsView extends TmfView {
}
int nbEvents = 0;
- for (TmfStatisticsTreeNode node : ((TmfStatisticsTreeNode) fTreeViewer.getInput()).getChildren()) {
+ for (TmfStatisticsTreeNode node : ((TmfStatisticsTreeNode) fStatsViewer.getInput()).getChildren()) {
nbEvents += (int) node.getValue().getTotal();
}
@@ -503,7 +439,7 @@ public class TmfStatisticsView extends TmfView {
}
/**
- * Handles the time range updated signal. It updates the time range
+ * * Handles the time range updated signal. It updates the time range
* statistics.
*
* @param signal
@@ -517,95 +453,79 @@ public class TmfStatisticsView extends TmfView {
* processing
*/
cancelOngoingRequest(fRequestRange);
- resetTimeRangeValue();
requestTimeRangeData(TmfExperiment.getCurrentExperiment(), signal.getCurrentRange());
}
/**
- * Return the size of the request when performing background request.
- *
- * @return the block size for background request.
- */
- protected int getIndexPageSize() {
- return PAGE_SIZE;
- }
-
- /**
- * Returns the quantity of data to retrieve before a refresh of the view is
- * performed
- *
- * @return the quantity of data to retrieve before a refresh of the view is
- * performed.
- */
- protected long getInputChangedRefresh() {
- return STATS_INPUT_CHANGED_REFRESH;
- }
-
- /**
- * This method can be overridden to implement another way to represent the
- * statistics data and to retrieve the information for display.
- *
- * @return a TmfStatisticsData object.
- */
- protected AbsTmfStatisticsTree getStatisticData() {
- return new TmfBaseStatisticsTree();
- }
-
- /**
- * This method can be overridden to change the representation of the data in
- * the columns.
- *
- * @return an object implementing ITmfBaseColumnDataProvider.
- */
- protected ITmfColumnDataProvider getColumnDataProvider() {
- return new TmfBaseColumnDataProvider();
- }
-
- /**
- * Constructs the ID based on the experiment name and
- * <code>fInstanceNb</code>
- *
- * @param experimentName
- * the name of the trace name to show in the view
- * @return a view ID
- */
- protected String getTreeID(String experimentName) {
- return experimentName + fInstanceNb;
- }
-
- /**
- * When the experiment is loading the cursor will be different so the user
- * knows the processing is not finished yet.
+ * Get the statistics viewer for an experiment. If all traces in the
+ * experiment are of the same type, use the extension point specified.
*
- * @param waitInd
- * Indicates if we need to show the waiting cursor, or the
- * default one
+ * @return a statistics viewer of the appropriate type
+ * @since 2.0
*/
- protected void waitCursor(final boolean waitInd) {
- if ((fTreeViewer == null) || (fTreeViewer.getTree().isDisposed())) {
- return;
- }
-
- Display display = fTreeViewer.getControl().getDisplay();
- if (fWaitCursor == null) {
- fWaitCursor = new Cursor(display, SWT.CURSOR_WAIT);
+ protected TmfStatisticsViewer createStatisticsViewer() {
+ if (fExperiment == null) {
+ return new TmfStatisticsViewer(fParent);
}
-
- // Perform the updates on the UI thread
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if ((fTreeViewer != null)
- && (!fTreeViewer.getTree().isDisposed())) {
- Cursor cursor = null; /* indicates default */
- if (waitInd) {
- cursor = fWaitCursor;
+ String commonTraceType = null;
+ try {
+ /*
+ * Determine if the traces of the experiment are of the same type.
+ * If not, it uses the most generic one.
+ */
+ for (ITmfTrace trace : fExperiment.getTraces()) {
+ IResource resource = trace.getResource();
+ if (resource == null) {
+ return new TmfStatisticsViewer(fParent);
+ }
+ String traceType = resource.getPersistentProperty(TmfCommonConstants.TRACETYPE);
+ if (commonTraceType != null && !commonTraceType.equals(traceType)) {
+ return new TmfStatisticsViewer(fParent);
+ }
+ commonTraceType = traceType;
+ }
+ if (commonTraceType == null) {
+ return new TmfStatisticsViewer(fParent);
+ }
+ /*
+ * Search in the configuration if there is any viewer specified for
+ * this kind of trace type.
+ */
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {
+ if (ce.getAttribute(TmfTraceType.ID_ATTR).equals(commonTraceType)) {
+ IConfigurationElement[] statisticsViewerCE = ce.getChildren(TmfTraceType.STATISTICS_VIEWER_ELEM);
+ if (statisticsViewerCE.length != 1) {
+ break;
}
- fTreeViewer.getControl().setCursor(cursor);
+ String statisticsViewer = statisticsViewerCE[0].getAttribute(TmfTraceType.CLASS_ATTR);
+ if (statisticsViewer == null || statisticsViewer.length() == 0) {
+ break;
+ }
+ Bundle bundle = Platform.getBundle(ce.getContributor().getName());
+ Class<?> c = bundle.loadClass(statisticsViewer);
+ Class<?>[] constructorArgs = new Class[] { Composite.class };
+ Constructor<?> constructor = c.getConstructor(constructorArgs);
+ Object[] args = new Object[] { fParent };
+ return (TmfStatisticsViewer) constructor.newInstance(args);
}
}
- });
+ } catch (CoreException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : cannot find the property TmfCommonConstants.TRACETYPE", e); //$NON-NLS-1$
+ } catch (ClassNotFoundException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : cannot load the statistics viewer class", e); //$NON-NLS-1$
+ } catch (NoSuchMethodException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : constructor of the viewer doesn't exist", e); //$NON-NLS-1$
+ } catch (InstantiationException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : cannot instantiate the statistics viewer", e); //$NON-NLS-1$
+ } catch (IllegalAccessException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : cannot access the constructor of the viewer", e); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : argument(s) sent to the constructor are illegal", e); //$NON-NLS-1$
+ } catch (InvocationTargetException e) {
+ Activator.getDefault().logError("Error creating statistics viewer : the constructor of the viewer sent an exception", e); //$NON-NLS-1$
+ }
+ return new TmfStatisticsViewer(fParent);
}
/**
@@ -626,15 +546,15 @@ public class TmfStatisticsView extends TmfView {
}
int index = 0;
- for (TmfStatisticsTreeNode node : ((TmfStatisticsTreeNode) fTreeViewer.getInput()).getChildren()) {
+ for (TmfStatisticsTreeNode node : ((TmfStatisticsTreeNode) fStatsViewer.getInput()).getChildren()) {
index += (int) node.getValue().getTotal();
}
// Prepare the global event request
- fRequest = new TmfStatisticsRequest(this, experiment, timeRange, index, ExecutionType.BACKGROUND, true);
+ fRequest = new TmfStatisticsRequest(this, fStatsViewer, experiment, timeRange, index, ExecutionType.BACKGROUND, true);
experiment.sendRequest(fRequest);
- waitCursor(true);
+ fStatsViewer.waitCursor(true);
}
}
@@ -650,9 +570,9 @@ public class TmfStatisticsView extends TmfView {
*/
protected void requestTimeRangeData(final TmfExperiment experiment, TmfTimeRange timeRange) {
if (experiment != null) {
-
+ resetTimeRangeValue();
// Prepare the partial event request
- fRequestRange = new TmfStatisticsRequest(this, experiment, timeRange, 0, ExecutionType.FOREGROUND, false);
+ fRequestRange = new TmfStatisticsRequest(this, fStatsViewer, experiment, timeRange, 0, ExecutionType.FOREGROUND, false);
experiment.sendRequest(fRequestRange);
}
}
@@ -664,7 +584,7 @@ public class TmfStatisticsView extends TmfView {
*/
protected void resetTimeRangeValue() {
// Reset the number of events in the time range
- String treeID = getTreeID(TmfExperiment.getCurrentExperiment().getName());
+ String treeID = fStatsViewer.getTreeID(TmfExperiment.getCurrentExperiment().getName());
TmfStatisticsTreeNode treeModelRoot = TmfStatisticsTreeRootFactory.getStatTreeRoot(treeID);
if (treeModelRoot.hasChildren()) {
treeModelRoot.resetTimeRangeValue();
@@ -672,6 +592,15 @@ public class TmfStatisticsView extends TmfView {
}
/**
+ * Return the size of the request when performing background request.
+ *
+ * @return the block size for background request.
+ */
+ protected int getIndexPageSize() {
+ return PAGE_SIZE;
+ }
+
+ /**
* Cancels the current ongoing request
*
* @param request
@@ -731,5 +660,4 @@ public class TmfStatisticsView extends TmfView {
}
}
}
-
}