--- /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:
+ * 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() {
+ }
+}
* 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;
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;
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);
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$
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);
}
}
}
+ 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;
}
/**
* Close opened editors associated with this trace.
+ *
* @since 2.0
*/
public void closeEditors() {
--- /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:
+# 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