@Test
public void testGetEnvValue() {
String key = "tracer_name";
- String result = fixture.getEnvironment().get(key);
+ String result = fixture.getTraceProperties().get(key);
assertEquals("\"lttng-modules\"",result);
}
*/
@Test
public void testGetNbEnvVars() {
- int result = fixture.getEnvironment().size();
+ int result = fixture.getTraceProperties().size();
assertEquals(8, result);
}
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
* @version 1.0
* @author Matthew khouzam
*/
-public class CtfTmfTrace extends TmfTrace implements ITmfEventParser {
+public class CtfTmfTrace extends TmfTrace
+ implements ITmfEventParser, ITmfTraceProperties {
// -------------------------------------------
// Constants
}
// -------------------------------------------
- // Environment Parameters
+ // ITmfTraceProperties
// -------------------------------------------
/**
- * Get the map of environment variables of this trace.
- *
- * @return The map of env vars
* @since 2.0
*/
- public Map<String, String> getEnvironment() {
+ @Override
+ public Map<String, String> getTraceProperties() {
return Collections.unmodifiableMap(fTrace.getEnvironment());
}
--- /dev/null
+/*******************************************************************************
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace;
+
+import java.util.Map;
+
+/**
+ * Interface for trace types to implement when they can provide additional
+ * trace-wide properties.
+ *
+ * This information will be displayed in the trace's Properties View, among
+ * other things.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public interface ITmfTraceProperties {
+
+ /**
+ * Get the properties related to this trace.
+ *
+ * @return The map of properties, <name, value>
+ */
+ public Map<String, String> getTraceProperties();
+}
* Contributors:
* Matthew Khouzam - Initial API and implementation
* Bernd Hufmann - Updated to use Tree with columns to be able to group traces
+ * Alexandre Montplaisir - Display info for any ITmfTraceProperties trace
*******************************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.environment;
import java.util.Map;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
import org.eclipse.linuxtools.tmf.ui.views.TmfView;
import org.eclipse.swt.widgets.TreeItem;
/**
- * Displays the CTF trace properties.
+ * Displays the trace's properties.
*
* @version 1.1
* @author Matthew Khouzam
}
for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
- // FIXME This should be replaced with a method in ITmfTrace maybe?
- // Other trace types might want to supply environment variables.
- if (trace instanceof CtfTmfTrace) {
+ if (trace instanceof ITmfTraceProperties) {
TreeItem item = new TreeItem(fTree, SWT.NONE);
item.setText(0, trace.getName());
- CtfTmfTrace ctfTrace = (CtfTmfTrace) trace;
- Map <String, String> env = ctfTrace.getEnvironment();
- for (Map.Entry<String, String> entry : env.entrySet()) {
+ ITmfTraceProperties propTrace = (ITmfTraceProperties) trace;
+ Map <String, String> properties = propTrace.getTraceProperties();
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
TreeItem subItem = new TreeItem(item, SWT.NONE);
subItem.setText(0, entry.getKey()); // Variable name
subItem.setText(1, entry.getValue()); // Variable value