summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBernd Hufmann2012-08-28 07:49:57 (EDT)
committer Bernd Hufmann2012-08-28 11:04:35 (EDT)
commitb46fef196d6ebbff8542a18ab15c21f03f5d73df (patch)
tree4dcb13a7d2585c93c5d6ca1c5bbbd0287a51501d
parente7370dba3de59766eb562112edfdc1d353d07d3a (diff)
downloadorg.eclipse.linuxtools-b46fef196d6ebbff8542a18ab15c21f03f5d73df.zip
org.eclipse.linuxtools-b46fef196d6ebbff8542a18ab15c21f03f5d73df.tar.gz
org.eclipse.linuxtools-b46fef196d6ebbff8542a18ab15c21f03f5d73df.tar.bz2
Provide interface for showing state type names per time graph entry
This change adds an interface to the ITimeGraphPresentationProvider to allow user to define state type names per entry instead of one name for all entries. This change also provides a default implementation. In case that the entry specific name and the global name are define then the entry specific name takes precedence when displaying the tooltip information during hovering operation. Change-Id: Ib3d545588bf8e09ee58532a2145ee0c6294ec2be Signed-off-by: Bernd Hufmann <bhufmann@gmail.com> Reviewed-on: https://git.eclipse.org/r/7451 Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider.java11
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java10
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java12
5 files changed, 40 insertions, 3 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
index c431b62..0a20939 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties
@@ -73,7 +73,7 @@ TmfTimeFilterDialog_TRACE_FILTER_DESC=Define the filter set
TmfTimeFilterDialog_TRACE_ID=Trace Id
TmfTimeFilterDialog_TRACE_NAME=Trace Name
TmfTimeLegend_LEGEND=Legend
-TmfTimeLegend_TRACE_STATES=Trace states
+TmfTimeLegend_TRACE_STATES=Trace
TmfTimeLegend_TRACE_STATES_TITLE=States Transition Visualizer
TmfTimeLegend_WINDOW_TITLE=Trace Visualizer's Legend
TmfTimeLegend_StateTypeName=States
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider.java
index 648b5da..f5f51ca 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/ITimeGraphPresentationProvider.java
@@ -35,6 +35,17 @@ public interface ITimeGraphPresentationProvider {
*/
public String getStateTypeName();
+ /**
+ * Returns the name of state type depending on the given entry.
+ * Note that this overwrites the name which is return by getStateTypeName().
+ *
+ * @param entry
+ * the entry
+ * @return the name of state type depending on the given entry or null.
+ * @since 2.0
+ */
+ public String getStateTypeName(ITimeGraphEntry entry);
+
/**
* Returns table of states with state name to state color relationship.
*
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java
index de63a2f..53b50fc 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphPresentationProvider.java
@@ -49,6 +49,14 @@ public class TimeGraphPresentationProvider implements ITimeGraphPresentationProv
return Messages.TmfTimeLegend_TRACE_STATES;
}
+ /**
+ * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateTypeName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)
+ * @since 2.0
+ */
+ @Override
+ public String getStateTypeName(ITimeGraphEntry entry) {
+ return null;
+ }
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateTable()
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java
index 55c9d02..6a020e2 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java
@@ -97,7 +97,15 @@ public class TimeGraphLegend extends TitleAreaDialog {
private void createStatesGroup(Composite composite) {
Group gs = new Group(composite, SWT.NONE);
- gs.setText(provider.getStateTypeName() + " " + Messages.TmfTimeLegend_StateTypeName); //$NON-NLS-1$
+ String stateTypeName = provider.getStateTypeName();
+ StringBuffer buffer = new StringBuffer();
+ if (!stateTypeName.isEmpty()) {
+ buffer.append(stateTypeName);
+ buffer.append(" "); //$NON-NLS-1$
+ }
+ buffer.append(Messages.TmfTimeLegend_StateTypeName);
+ gs.setText(buffer.toString());
+
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gs.setLayoutData(gd);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
index a72c3f4..f2b8040 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
@@ -180,10 +180,20 @@ public class TimeGraphTooltipHandler {
}
// state name
- addItem(_utilImp.getStateTypeName(), entry.getName());
+ String stateTypeName = _utilImp.getStateTypeName(entry);
+ String entryName = entry.getName();
+ if (stateTypeName == null) {
+ stateTypeName = _utilImp.getStateTypeName();
+ }
+
+ if (!entryName.isEmpty()) {
+ addItem(stateTypeName, entry.getName());
+ }
+
if (currEvent == null) {
return;
}
+
// state
String state = _utilImp.getEventName(currEvent);
if (state != null) {