aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christian Kouamé2013-05-17 16:14:02 (EDT)
committerAlexandre Montplaisir2013-07-02 10:47:44 (EDT)
commiteb1d705816de4ac3111789cac05189b8b81311ca (patch)
treee55b31af229a6f29d59da3b1d027157322495bfc
parentff8ef26eafd43296fc268693c3c187c1306571f3 (diff)
downloadorg.eclipse.linuxtools-eb1d705816de4ac3111789cac05189b8b81311ca.zip
org.eclipse.linuxtools-eb1d705816de4ac3111789cac05189b8b81311ca.tar.gz
org.eclipse.linuxtools-eb1d705816de4ac3111789cac05189b8b81311ca.tar.bz2
tmf: Show trace environment variables in the Properties viewrefs/changes/29/12829/12
Fixes bug 407756 Change-Id: Ie90a3094ea8adc335a82182127d7bc0e3b727616 Signed-off-by: Jean-Christian Kouame Reviewed-on: https://git.eclipse.org/r/12829 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/Messages.java55
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java71
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/messages.properties20
3 files changed, 135 insertions, 11 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/Messages.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/Messages.java
new file mode 100644
index 0000000..f510694
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/Messages.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Jean-Christian Kouamé - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.project.model;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message strings for TMF model handling.
+ *
+ * @author Jean-Christian Kouamé
+ * @since 2.1
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.project.model.messages"; //$NON-NLS-1$
+
+ /** The category of the resource properties */
+ public static String TmfTraceElement_ResourceProperties;
+
+ /** The category of the trace properties */
+ public static String TmfTraceElement_TraceProperties;
+
+ /** The descriptor for the name property */
+ public static String TmfTraceElement_Name;
+
+ /** The descriptor for the path property */
+ public static String TmfTraceElement_Path;
+
+ /** The descriptor for the location properties */
+ public static String TmfTraceElement_Location;
+
+ /** The descriptor for the event type property */
+ public static String TmfTraceElement_EventType;
+
+ /** The description for the linked property */
+ public static String TmfTraceElement_IsLinked;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
index 2a81f93..bb0c361 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
@@ -12,6 +12,8 @@
* Geneviève Bastien - Moved supplementary files handling to parent class,
* added code to copy trace
* Patrick Tasse - Close editors to release resources
+ * Jean-Christian Kouame - added trace properties to be shown into
+ * the properties view
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.project.model;
@@ -38,7 +40,9 @@ import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefin
import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
import org.eclipse.ui.IActionFilter;
@@ -77,12 +81,13 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
public static final String IS_LINKED = "isLinked"; //$NON-NLS-1$
// Property View stuff
- private static final String sfInfoCategory = "Info"; //$NON-NLS-1$
- private static final String sfName = "name"; //$NON-NLS-1$
- private static final String sfPath = "path"; //$NON-NLS-1$
- private static final String sfLocation = "location"; //$NON-NLS-1$
- private static final String sfEventType = "type"; //$NON-NLS-1$
- private static final String sfIsLinked = "linked"; //$NON-NLS-1$
+ private static final String sfResourcePropertiesCategory = Messages.TmfTraceElement_ResourceProperties;
+ private static final String sfName = Messages.TmfTraceElement_Name;
+ private static final String sfPath = Messages.TmfTraceElement_Path;
+ private static final String sfLocation = Messages.TmfTraceElement_Location;
+ private static final String sfEventType = Messages.TmfTraceElement_EventType;
+ private static final String sfIsLinked = Messages.TmfTraceElement_IsLinked;
+ private static final String sfTracePropertiesCategory = Messages.TmfTraceElement_TraceProperties;
private static final ReadOnlyTextPropertyDescriptor sfNameDescriptor = new ReadOnlyTextPropertyDescriptor(sfName, sfName);
private static final ReadOnlyTextPropertyDescriptor sfPathDescriptor = new ReadOnlyTextPropertyDescriptor(sfPath, sfPath);
@@ -94,11 +99,11 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
sfTypeDescriptor, sfIsLinkedDescriptor };
static {
- sfNameDescriptor.setCategory(sfInfoCategory);
- sfPathDescriptor.setCategory(sfInfoCategory);
- sfLocationDescriptor.setCategory(sfInfoCategory);
- sfTypeDescriptor.setCategory(sfInfoCategory);
- sfIsLinkedDescriptor.setCategory(sfInfoCategory);
+ sfNameDescriptor.setCategory(sfResourcePropertiesCategory);
+ sfPathDescriptor.setCategory(sfResourcePropertiesCategory);
+ sfLocationDescriptor.setCategory(sfResourcePropertiesCategory);
+ sfTypeDescriptor.setCategory(sfResourcePropertiesCategory);
+ sfIsLinkedDescriptor.setCategory(sfResourcePropertiesCategory);
}
private static final String BOOKMARKS_HIDDEN_FILE = ".bookmarks"; //$NON-NLS-1$
@@ -408,8 +413,43 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
return null;
}
+ /**
+ * Get the trace properties of this traceElement if the corresponding trace
+ * is opened in an editor
+ *
+ * @return a map with the names and values of the trace properties
+ * respectively as keys and values
+ */
+ private Map<String, String> getTraceProperties() {
+ for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) {
+ if (trace.getResource().equals(this.getResource())) {
+ if (trace instanceof ITmfTraceProperties) {
+ ITmfTraceProperties traceProperties = (ITmfTraceProperties) trace;
+ return traceProperties.getTraceProperties();
+ }
+ }
+ }
+ return new HashMap<String, String>();
+ }
+
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
+ Map<String, String> traceProperties = getTraceProperties();
+ if (!traceProperties.isEmpty()) {
+ IPropertyDescriptor[] propertyDescriptorArray = new IPropertyDescriptor[traceProperties.size() + sfDescriptors.length];
+ int index = 0;
+ for (Map.Entry<String, String> varName : traceProperties.entrySet()) {
+ ReadOnlyTextPropertyDescriptor descriptor = new ReadOnlyTextPropertyDescriptor(this.getName() + "_" + varName.getKey(), varName.getKey()); //$NON-NLS-1$
+ descriptor.setCategory(sfTracePropertiesCategory);
+ propertyDescriptorArray[index] = descriptor;
+ index++;
+ }
+ for (int i = 0; i < sfDescriptors.length; i++) {
+ propertyDescriptorArray[index] = sfDescriptors[i];
+ index++;
+ }
+ return propertyDescriptorArray;
+ }
return Arrays.copyOf(sfDescriptors, sfDescriptors.length);
}
@@ -439,6 +479,14 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
}
+ Map<String, String> traceProperties = getTraceProperties();
+ if (id != null && !traceProperties.isEmpty()) {
+ String key = (String) id;
+ key = key.replaceFirst(this.getName() + "_", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ String value = traceProperties.get(key);
+ return value;
+ }
+
return null;
}
@@ -488,6 +536,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
/**
* Close opened editors associated with this trace.
+ *
* @since 2.0
*/
public void closeEditors() {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/messages.properties
new file mode 100644
index 0000000..03ba4b3
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/messages.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2013 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+# Environment properties dialog
+TmfTraceElement_ResourceProperties = Resource properties
+TmfTraceElement_TraceProperties = Trace properties
+TmfTraceElement_Name = name
+TmfTraceElement_Path = path
+TmfTraceElement_Location = location
+TmfTraceElement_EventType = type
+TmfTraceElement_IsLinked = linked \ No newline at end of file