// Parameter-less constructor
public LttngEvent() {
super();
+ fType = LttngEventType.DEFAULT_EVENT_TYPE;
}
/**
*/
@Override
public synchronized Object getField(String name) {
-
- // Check for generic table header fields
- if (name.equals(FIELD_ID_TIMESTAMP)) {
- return new Long(fParentEvent.getTimestamp().getValue()).toString();
- } else if (name.equals(FIELD_ID_SOURCE)) {
- return fParentEvent.getSource().getSourceId().toString();
- } else if (name.equals(FIELD_ID_TYPE)) {
- return fParentEvent.getType().getTypeId().toString();
- } else if (name.equals(FIELD_ID_REFERENCE)) {
- return fParentEvent.getReference().getReference().toString();
- } else if (name.equals(FIELD_ID_CONTENT)) {
- return fParentEvent.getContent().toString();
- }
+
+ // Check for generic table header fields
+ if (name.equals(LttngEventType.CONTENT_LABEL) || name.equals(FIELD_ID_CONTENT)) {
+ return fParentEvent.getContent().toString();
+ } else if (name.equals(LttngEventType.MARKER_LABEL) || name.equals(FIELD_ID_TYPE)) {
+ return fParentEvent.getType().getTypeId().toString();
+ } else if (name.equals(LttngEventType.TRACE_LABEL) || name.equals(FIELD_ID_REFERENCE)) {
+ return fParentEvent.getReference().getReference().toString();
+ } else if (name.equals(LttngEventType.TIMESTAMP_LABEL) || name.equals(FIELD_ID_TIMESTAMP)) {
+ return new Long(fParentEvent.getTimestamp().getValue()).toString();
+ } else if (name.equals(FIELD_ID_SOURCE)) {
+ return fParentEvent.getSource().getSourceId().toString();
+ }
// *** VERIFY ***
// Should we check if the field exists in LttngType before parsing?
*/
public class LttngEventType extends TmfEventType {
+ private static final String DEFAULT_TYPE_ID = "Kernel Trace"; //$NON-NLS-1$
+ // These should match the column names in LTTng Events Table
+ public static final String TIMESTAMP_LABEL = "Timestamp"; //$NON-NLS-1$
+ public static final String TRACE_LABEL = "Trace"; //$NON-NLS-1$
+ public static final String MARKER_LABEL = "Marker"; //$NON-NLS-1$
+ public static final String CONTENT_LABEL = "Content"; //$NON-NLS-1$
+ private static final String[] DEFAULT_LABELS = {
+ TIMESTAMP_LABEL, TRACE_LABEL, MARKER_LABEL, CONTENT_LABEL
+ };
+ public static final LttngEventType DEFAULT_EVENT_TYPE = new LttngEventType(DEFAULT_TYPE_ID, DEFAULT_LABELS);
+
private String tracefileName = null;
private Long cpuId = null;
private String markerName = null;
super();
}
+ /**
+ * Default Constructor.<p>
+ *
+ */
+ public LttngEventType(String typeId, String[] labels) {
+ super(typeId, labels);
+ }
+
/**
* Constructor with parameters.<p>
*
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.linuxtools.tmf.ui,
org.eclipse.linuxtools.tmf.ui.editors,
- org.eclipse.linuxtools.tmf.ui.parsers,
org.eclipse.linuxtools.tmf.ui.project.model,
org.eclipse.linuxtools.tmf.ui.project.wizards,
org.eclipse.linuxtools.tmf.ui.signal,
<?xml version="1.0" encoding="UTF-8"?>\r
<?eclipse version="3.4"?>\r
<plugin>\r
- <extension-point id="org.eclipse.linuxtools.tmf.ui.parserProviders" name="Parser Providers" schema="schema/org.eclipse.linuxtools.tmf.ui.parserprovider.exsd"/>\r
<extension-point id="org.eclipse.linuxtools.tmf.ui.uml2SDLoader" name="TMF UML 2 Sequence Diagram Loader" schema="schema/org.eclipse.linuxtools.tmf.ui.uml2SDLoader.exsd"/>\r
\r
<extension\r
</activeWhen>\r
</handler>\r
</extension>\r
- <extension\r
- point="org.eclipse.core.runtime.preferences">\r
- <initializer\r
- class="org.eclipse.linuxtools.tmf.ui.TmfUiPreferenceInitializer">\r
- </initializer>\r
- </extension>\r
<extension\r
point="org.eclipse.core.contenttype.contentTypes">\r
<content-type\r
priority="normal">\r
</content-type>\r
</extension>\r
- <extension\r
- point="org.eclipse.linuxtools.tmf.ui.parserProviders">\r
- <parserProvider\r
- class="org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomParserProvider">\r
- </parserProvider>\r
- </extension>\r
<extension\r
point="org.eclipse.ui.contexts">\r
<context\r
+++ /dev/null
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.linuxtools.tmf.ui" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.linuxtools.tmf.ui" id="org.eclipse.linuxtools.tmf.ui.parserProviders" name="Parser Providers"/>
- </appinfo>
- <documentation>
- A parser provider registers a list of trace parsers to the tracing framework.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="parserProvider"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parserProvider">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.tmf.ui.views.project.IParserProvider"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.linuxtools.tmf.ui.parsers.ParserProviderManager;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
super.start(context);
plugin = this;
TmfUiTracer.init();
- ParserProviderManager.init();
TmfTraceElement.init();
}
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui;\r
-\r
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;\r
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;\r
-import org.eclipse.core.runtime.preferences.InstanceScope;\r
-\r
-public class TmfUiPreferenceInitializer extends AbstractPreferenceInitializer {\r
-\r
- public static final String ACTIVE_PROJECT_PREFERENCE = "ACTIVE_PROJECT"; //$NON-NLS-1$\r
- public static final String ACTIVE_PROJECT_DEFAULT = ""; //$NON-NLS-1$\r
- \r
- public TmfUiPreferenceInitializer() {\r
- super();\r
- }\r
-\r
- @Override\r
- public void initializeDefaultPreferences() {\r
- IEclipsePreferences node = new InstanceScope().getNode(TmfUiPlugin.PLUGIN_ID);\r
- node.put(ACTIVE_PROJECT_PREFERENCE, ACTIVE_PROJECT_DEFAULT);\r
- }\r
-\r
-}\r
\r
package org.eclipse.linuxtools.tmf.ui.dialogs;\r
\r
-import java.io.File;\r
-import java.net.URI;\r
-\r
-import org.eclipse.core.resources.IFile;\r
-import org.eclipse.core.resources.IFolder;\r
-import org.eclipse.core.resources.IProject;\r
-import org.eclipse.core.resources.IResource;\r
-import org.eclipse.core.resources.IWorkspace;\r
-import org.eclipse.core.resources.IWorkspaceRoot;\r
-import org.eclipse.core.resources.ResourcesPlugin;\r
-import org.eclipse.core.runtime.CoreException;\r
-import org.eclipse.core.runtime.IPath;\r
-import org.eclipse.core.runtime.Path;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;\r
-import org.eclipse.core.runtime.preferences.InstanceScope;\r
import org.eclipse.jface.dialogs.Dialog;\r
import org.eclipse.jface.dialogs.IDialogConstants;\r
import org.eclipse.jface.dialogs.MessageDialog;\r
import org.eclipse.jface.wizard.WizardDialog;\r
import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;\r
-import org.eclipse.linuxtools.tmf.ui.TmfUiPreferenceInitializer;\r
-import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;\r
import org.eclipse.linuxtools.tmf.ui.internal.Messages;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.ParserProviderManager;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTraceDefinition;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;\r
import org.eclipse.linuxtools.tmf.ui.parsers.wizards.CustomTxtParserWizard;\r
import org.eclipse.linuxtools.tmf.ui.parsers.wizards.CustomXmlParserWizard;\r
-import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.events.SelectionListener;\r
import org.eclipse.swt.widgets.Label;\r
import org.eclipse.swt.widgets.List;\r
import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.IEditorInput;\r
-import org.eclipse.ui.IEditorPart;\r
-import org.eclipse.ui.IReusableEditor;\r
-import org.eclipse.ui.IWorkbench;\r
-import org.eclipse.ui.IWorkbenchPage;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.eclipse.ui.part.FileEditorInput;\r
\r
public class ManageCustomParsersDialog extends Dialog {\r
\r
Button deleteButton;\r
Button importButton;\r
Button exportButton;\r
- Button parseButton;\r
\r
public ManageCustomParsersDialog(Shell parent) {\r
super(parent);\r
editButton.setEnabled(false);\r
deleteButton.setEnabled(false);\r
exportButton.setEnabled(false);\r
- parseButton.setEnabled(false);\r
} else {\r
editButton.setEnabled(true);\r
deleteButton.setEnabled(true);\r
exportButton.setEnabled(true);\r
- parseButton.setEnabled(true);\r
}\r
}});\r
\r
}\r
}});\r
\r
- parseButton = new Button(buttonContainer, SWT.PUSH);\r
- parseButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));\r
- parseButton.setText(Messages.ManageCustomParsersDialog_ParseButtonLabel);\r
- parseButton.setEnabled(false);\r
- parseButton.addSelectionListener(new SelectionListener(){\r
- @Override\r
- public void widgetDefaultSelected(SelectionEvent e) {}\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.OPEN);\r
- dialog.setText(Messages.ManageCustomParsersDialog_TraceSelection + parserList.getSelection()[0]);\r
- if (xmlButton.getSelection()) {\r
- dialog.setFilterExtensions(new String[] {"*.xml", "*"}); //$NON-NLS-1$ //$NON-NLS-2$\r
- }\r
- String path = dialog.open();\r
- String parser = null;\r
- if (path != null) {\r
- CustomTraceDefinition def = null;\r
- if (txtButton.getSelection()) {\r
- def = CustomTxtTraceDefinition.load(parserList.getSelection()[0]);\r
- parser = CustomTxtTrace.class.getCanonicalName() + "." + def.definitionName; //$NON-NLS-1$\r
- } else if (xmlButton.getSelection()) {\r
- def = CustomXmlTraceDefinition.load(parserList.getSelection()[0]);\r
- parser = CustomXmlTrace.class.getCanonicalName() + "." + def.definitionName; //$NON-NLS-1$\r
- }\r
- if (def != null) {\r
- try {\r
- IWorkspace workspace = ResourcesPlugin.getWorkspace();\r
- IPath location = Path.fromOSString(path);\r
- IFile file = workspace.getRoot().getFileForLocation(location);\r
- if (file == null) {\r
- file = createLink(new File(location.toPortableString()).toURI());\r
- }\r
- file.setPersistentProperty(ParserProviderManager.PARSER_PROPERTY, parser);\r
- IEditorInput editorInput = new FileEditorInput(file);\r
- IWorkbench wb = PlatformUI.getWorkbench();\r
- IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();\r
- \r
- String editorId = TmfEventsEditor.ID;\r
- IEditorPart editor = activePage.findEditor(editorInput);\r
- if (editor != null && editor instanceof IReusableEditor) {\r
- activePage.reuseEditor((IReusableEditor)editor, editorInput);\r
- activePage.activate(editor);\r
- } else {\r
- editor = activePage.openEditor(editorInput, editorId);\r
- }\r
- } catch (CoreException e1) {\r
- MessageDialog.openError(getShell(), "Parse Error", e1.getMessage()); //$NON-NLS-1$\r
- }\r
- }\r
- }\r
- }});\r
-\r
fillParserList();\r
\r
getShell().setMinimumSize(300, 275);\r
return composite;\r
}\r
\r
- // /////////////////////////////////////////////////////////////////////////////\r
- // FIXME: Duplicated in TmfEventsEditor\r
- // From the legacy ProjectView\r
- // /////////////////////////////////////////////////////////////////////////////\r
-\r
- // ------------------------------------------------------------------------\r
- // Static methods\r
- // ------------------------------------------------------------------------\r
-\r
- static public IFolder getActiveProjectTracesFolder() {\r
- IEclipsePreferences node = new InstanceScope()\r
- .getNode(TmfUiPlugin.PLUGIN_ID);\r
- String activeProjectName = node.get(\r
- TmfUiPreferenceInitializer.ACTIVE_PROJECT_PREFERENCE,\r
- TmfUiPreferenceInitializer.ACTIVE_PROJECT_DEFAULT);\r
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();\r
- IProject[] projects = root.getProjects();\r
- for (IProject project : projects) {\r
- if (project.isAccessible()\r
- && project.getName().equals(activeProjectName)) {\r
- return project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);\r
- }\r
- }\r
- return null;\r
- }\r
-\r
- static public IFile createLink(URI uri) throws CoreException {\r
- IFolder folder = getActiveProjectTracesFolder();\r
- if (folder == null || !folder.exists()) {\r
- throw new CoreException(new Status(Status.ERROR,\r
- TmfUiPlugin.PLUGIN_ID, "No active project set")); //$NON-NLS-1$\r
- }\r
- String path = uri.getPath();\r
- // TODO: support duplicate file names\r
- IFile file = folder.getFile(path.substring(path\r
- .lastIndexOf(Path.SEPARATOR)));\r
- if (!file.exists()) {\r
- file.createLink(uri, IResource.NONE, null);\r
- }\r
- return file;\r
- }\r
-\r
- // /////////////////////////////////////////////////////////////////////////////\r
-\r
/* (non-Javadoc)\r
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
*/\r
editButton.setEnabled(false);\r
deleteButton.setEnabled(false);\r
exportButton.setEnabled(false);\r
- parseButton.setEnabled(false);\r
}\r
\r
}\r
\r
package org.eclipse.linuxtools.tmf.ui.editors;\r
\r
+import java.io.FileNotFoundException;\r
import java.lang.reflect.Constructor;\r
import java.lang.reflect.InvocationTargetException;\r
-import java.net.URI;\r
\r
-import org.eclipse.core.resources.IFile;\r
-import org.eclipse.core.resources.IFolder;\r
import org.eclipse.core.resources.IMarker;\r
import org.eclipse.core.resources.IMarkerDelta;\r
-import org.eclipse.core.resources.IProject;\r
import org.eclipse.core.resources.IResource;\r
import org.eclipse.core.resources.IResourceChangeEvent;\r
import org.eclipse.core.resources.IResourceChangeListener;\r
import org.eclipse.core.resources.IResourceDelta;\r
-import org.eclipse.core.resources.IWorkspaceRoot;\r
import org.eclipse.core.resources.ResourcesPlugin;\r
import org.eclipse.core.runtime.CoreException;\r
import org.eclipse.core.runtime.IConfigurationElement;\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.InvalidRegistryObjectException;\r
-import org.eclipse.core.runtime.Path;\r
import org.eclipse.core.runtime.Platform;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;\r
-import org.eclipse.core.runtime.preferences.InstanceScope;\r
-import org.eclipse.linuxtools.tmf.TmfCorePlugin;\r
+import org.eclipse.linuxtools.tmf.event.TmfEvent;\r
import org.eclipse.linuxtools.tmf.signal.TmfSignalHandler;\r
import org.eclipse.linuxtools.tmf.signal.TmfTraceSelectedSignal;\r
import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
-import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;\r
-import org.eclipse.linuxtools.tmf.ui.TmfUiPreferenceInitializer;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.ParserProviderManager;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomEventsTable;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;\r
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;\r
-import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;\r
import org.eclipse.linuxtools.tmf.ui.signal.TmfTraceClosedSignal;\r
import org.eclipse.linuxtools.tmf.ui.signal.TmfTraceOpenedSignal;\r
import org.eclipse.linuxtools.tmf.ui.signal.TmfTraceParserUpdatedSignal;\r
import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;\r
+import org.eclipse.linuxtools.tmf.util.TmfTraceType;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Display;\r
import org.eclipse.ui.IEditorInput;\r
import org.eclipse.ui.IPropertyListener;\r
import org.eclipse.ui.IReusableEditor;\r
import org.eclipse.ui.PartInitException;\r
-import org.eclipse.ui.ide.FileStoreEditorInput;\r
import org.eclipse.ui.ide.IGotoMarker;\r
import org.osgi.framework.Bundle;\r
\r
\r
private TmfEventsTable fEventsTable;\r
private IResource fResource;\r
- private ITmfTrace<?> fTrace;\r
+ @SuppressWarnings("rawtypes")\r
+ private ITmfTrace fTrace;\r
private Composite fParent;\r
\r
@Override\r
public void doSaveAs() {\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
@Override\r
public void init(IEditorSite site, IEditorInput input) throws PartInitException {\r
if (input instanceof TmfEditorInput) {\r
fTrace = ((TmfEditorInput) input).getTrace();\r
} else if (input instanceof IFileEditorInput) {\r
fResource = ((IFileEditorInput) input).getFile();\r
- fTrace = ParserProviderManager.getTrace(fResource);\r
- input = new TmfEditorInput(fResource, fTrace);\r
- } else if (input instanceof FileStoreEditorInput) {\r
try {\r
- FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) input;\r
- fResource = createLink(fileStoreEditorInput.getURI());\r
- fTrace = ParserProviderManager.getTrace(fResource);\r
- input = new TmfEditorInput(fResource, fTrace);\r
+ String traceTypeId = fResource.getPersistentProperty(TmfTraceElement.TRACETYPE);\r
+ if (traceTypeId != null) {\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ if (traceTypeId.equals(ce.getAttribute(TmfTraceType.ID_ATTR))) {\r
+ fTrace = (ITmfTrace<?>) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);\r
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);\r
+ String path = fResource.getLocation().toOSString();\r
+ fTrace.initTrace(path, event.getClass(), true);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ } catch (InvalidRegistryObjectException e) {\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
} catch (CoreException e) {\r
- throw new PartInitException(e.getMessage());\r
+ e.printStackTrace();\r
}\r
+ input = new TmfEditorInput(fResource, fTrace);\r
} else {\r
throw new PartInitException("Invalid IEditorInput: " + input.getClass()); //$NON-NLS-1$\r
}\r
super.setInput(input);\r
}\r
\r
- ///////////////////////////////////////////////////////////////////////////////\r
- // FIXME: Duplicated in ManageCustomParsersDialog\r
- // From the legacy ProjectView\r
- ///////////////////////////////////////////////////////////////////////////////\r
-\r
- // ------------------------------------------------------------------------\r
- // Static methods\r
- // ------------------------------------------------------------------------\r
-\r
- static public IFolder getActiveProjectTracesFolder() {\r
- @SuppressWarnings("deprecation")\r
- IEclipsePreferences node = new InstanceScope()\r
- .getNode(TmfUiPlugin.PLUGIN_ID);\r
- String activeProjectName = node.get(\r
- TmfUiPreferenceInitializer.ACTIVE_PROJECT_PREFERENCE,\r
- TmfUiPreferenceInitializer.ACTIVE_PROJECT_DEFAULT);\r
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();\r
- IProject[] projects = root.getProjects();\r
- for (IProject project : projects) {\r
- if (project.isAccessible()\r
- && project.getName().equals(activeProjectName)) {\r
- return project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);\r
- }\r
- }\r
- return null;\r
- }\r
-\r
- static public IFile createLink(URI uri) throws CoreException {\r
- IFolder folder = getActiveProjectTracesFolder();\r
- if (folder == null || !folder.exists()) {\r
- throw new CoreException(new Status(Status.ERROR, TmfUiPlugin.PLUGIN_ID, "No active project set")); //$NON-NLS-1$\r
- }\r
- String path = uri.getPath();\r
- // TODO: support duplicate file names\r
- IFile file = folder.getFile(path.substring(path\r
- .lastIndexOf(Path.SEPARATOR)));\r
- if (!file.exists()) {\r
- file.createLink(uri, IResource.NONE, null);\r
- }\r
- return file;\r
- }\r
- ///////////////////////////////////////////////////////////////////////////////\r
-\r
@Override\r
public boolean isDirty() {\r
return false;\r
\r
private TmfEventsTable getEventsTable(Composite parent, int cacheSize) {\r
TmfEventsTable eventsTable = null;\r
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfCorePlugin.TMF_TRACE_TYPE_ID);\r
try {\r
String traceType = fResource.getPersistentProperty(TmfTraceElement.TRACETYPE);\r
- for (IConfigurationElement ce : config) {\r
- if (ce.getAttribute(TmfTraceElement.ID).equals(traceType)) {\r
- IConfigurationElement[] eventsTableTypeCE = ce.getChildren(TmfTraceElement.EVENTS_TABLE_TYPE);\r
+ if (traceType.startsWith(CustomTxtTrace.class.getCanonicalName())) {\r
+ return new CustomEventsTable(((CustomTxtTrace) fTrace).getDefinition(), parent, cacheSize);\r
+ }\r
+ if (traceType.startsWith(CustomXmlTrace.class.getCanonicalName())) {\r
+ return new CustomEventsTable(((CustomXmlTrace) fTrace).getDefinition(), parent, cacheSize);\r
+ }\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ if (ce.getAttribute(TmfTraceType.ID_ATTR).equals(traceType)) {\r
+ IConfigurationElement[] eventsTableTypeCE = ce.getChildren(TmfTraceType.EVENTS_TABLE_TYPE_ELEM);\r
if (eventsTableTypeCE.length != 1) {\r
break;\r
}\r
- String eventsTableType = eventsTableTypeCE[0].getAttribute(TmfTraceElement.CLASS);\r
+ String eventsTableType = eventsTableTypeCE[0].getAttribute(TmfTraceType.CLASS_ATTR);\r
if (eventsTableType == null || eventsTableType.length() == 0) {\r
break;\r
}\r
// Signal handlers\r
// ------------------------------------------------------------------------\r
\r
+ @SuppressWarnings("unchecked")\r
@TmfSignalHandler\r
public void traceParserUpdated(TmfTraceParserUpdatedSignal signal) {\r
if (signal.getTraceResource().equals(fResource)) {\r
broadcast(new TmfTraceClosedSignal(this, fTrace));\r
- fTrace = ParserProviderManager.getTrace(fResource);\r
+ try {\r
+ fTrace = null;\r
+ String traceTypeId = fResource.getPersistentProperty(TmfTraceElement.TRACETYPE);\r
+ if (traceTypeId != null) {\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ if (traceTypeId.equals(ce.getAttribute(TmfTraceType.ID_ATTR))) {\r
+ fTrace = (ITmfTrace<?>) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);\r
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);\r
+ String path = fResource.getLocation().toOSString();\r
+ fTrace.initTrace(path, event.getClass(), true);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ } catch (InvalidRegistryObjectException e) {\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ } catch (CoreException e) {\r
+ e.printStackTrace();\r
+ }\r
fEventsTable.dispose();\r
if (fTrace != null) {\r
fEventsTable = createEventsTable(fParent, fTrace.getCacheSize());\r
import org.eclipse.osgi.util.NLS;\r
\r
public class Messages extends NLS {\r
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.internal.messages"; //$NON-NLS-1$\r
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.internal.messages"; //$NON-NLS-1$\r
\r
- public static String ManageCustomParsersDialog_DeleteButtonLabel;\r
- public static String ManageCustomParsersDialog_DeleteConfirmation;\r
- public static String ManageCustomParsersDialog_DeleteParserDialogHeader;\r
- public static String ManageCustomParsersDialog_DialogHeader;\r
- public static String ManageCustomParsersDialog_EditButtonLabel;\r
- public static String ManageCustomParsersDialog_ExportButtonLabel;\r
- public static String ManageCustomParsersDialog_ExportParserSelection;\r
- public static String ManageCustomParsersDialog_ImportButtonLabel;\r
- public static String ManageCustomParsersDialog_ImportParserSelection;\r
- public static String ManageCustomParsersDialog_NewButtonLabel;\r
- public static String ManageCustomParsersDialog_ParseButtonLabel;\r
- public static String ManageCustomParsersDialog_TextButtonLabel;\r
- public static String ManageCustomParsersDialog_TraceSelection;\r
+ public static String ManageCustomParsersDialog_DeleteButtonLabel;\r
+ public static String ManageCustomParsersDialog_DeleteConfirmation;\r
+ public static String ManageCustomParsersDialog_DeleteParserDialogHeader;\r
+ public static String ManageCustomParsersDialog_DialogHeader;\r
+ public static String ManageCustomParsersDialog_EditButtonLabel;\r
+ public static String ManageCustomParsersDialog_ExportButtonLabel;\r
+ public static String ManageCustomParsersDialog_ExportParserSelection;\r
+ public static String ManageCustomParsersDialog_ImportButtonLabel;\r
+ public static String ManageCustomParsersDialog_ImportParserSelection;\r
+ public static String ManageCustomParsersDialog_NewButtonLabel;\r
+ public static String ManageCustomParsersDialog_ParseButtonLabel;\r
+ public static String ManageCustomParsersDialog_ParseError;\r
+ public static String ManageCustomParsersDialog_TextButtonLabel;\r
+ public static String ManageCustomParsersDialog_TraceSelection;\r
\r
- public static String CustomTraceDefinition_messageTag;\r
- public static String CustomTraceDefinition_otherTag;\r
- public static String CustomTraceDefinition_timestampTag;\r
- public static String CustomTxtTraceDefinition_action;\r
- public static String CustomTxtTraceDefinition_cardinality;\r
- public static String CustomTxtTraceDefinition_definition;\r
- public static String CustomTxtTraceDefinition_definitionRootElement;\r
- public static String CustomTxtTraceDefinition_format;\r
- public static String CustomTxtTraceDefinition_inputData;\r
- public static String CustomTxtTraceDefinition_inputLine;\r
- public static String CustomTxtTraceDefinition_max;\r
- public static String CustomTxtTraceDefinition_min;\r
- public static String CustomTxtTraceDefinition_name;\r
- public static String CustomTxtTraceDefinition_outputColumn;\r
- public static String CustomTxtTraceDefinition_regEx;\r
- public static String CustomTxtTraceDefinition_timestampOutputFormat;\r
- public static String CustomXmlTraceDefinition_action;\r
- public static String CustomXmlTraceDefinition_attribute;\r
- public static String CustomXmlTraceDefinition_definition;\r
- public static String CustomXmlTraceDefinition_definitionRootElement;\r
- public static String CustomXmlTraceDefinition_format;\r
- public static String CustomXmlTraceDefinition_ignoreTag;\r
- public static String CustomXmlTraceDefinition_inputData;\r
- public static String CustomXmlTraceDefinition_inputElement;\r
- public static String CustomXmlTraceDefinition_logEntry;\r
- public static String CustomXmlTraceDefinition_name;\r
- public static String CustomXmlTraceDefinition_outputColumn;\r
- public static String CustomXmlTraceDefinition_timestampOutputFormat;\r
+ public static String CustomTraceDefinition_messageTag;\r
+ public static String CustomTraceDefinition_otherTag;\r
+ public static String CustomTraceDefinition_timestampTag;\r
+ public static String CustomTxtTraceDefinition_action;\r
+ public static String CustomTxtTraceDefinition_cardinality;\r
+ public static String CustomTxtTraceDefinition_definition;\r
+ public static String CustomTxtTraceDefinition_definitionRootElement;\r
+ public static String CustomTxtTraceDefinition_format;\r
+ public static String CustomTxtTraceDefinition_inputData;\r
+ public static String CustomTxtTraceDefinition_inputLine;\r
+ public static String CustomTxtTraceDefinition_max;\r
+ public static String CustomTxtTraceDefinition_min;\r
+ public static String CustomTxtTraceDefinition_name;\r
+ public static String CustomTxtTraceDefinition_outputColumn;\r
+ public static String CustomTxtTraceDefinition_regEx;\r
+ public static String CustomTxtTraceDefinition_timestampOutputFormat;\r
+ public static String CustomXmlTraceDefinition_action;\r
+ public static String CustomXmlTraceDefinition_attribute;\r
+ public static String CustomXmlTraceDefinition_definition;\r
+ public static String CustomXmlTraceDefinition_definitionRootElement;\r
+ public static String CustomXmlTraceDefinition_format;\r
+ public static String CustomXmlTraceDefinition_ignoreTag;\r
+ public static String CustomXmlTraceDefinition_inputData;\r
+ public static String CustomXmlTraceDefinition_inputElement;\r
+ public static String CustomXmlTraceDefinition_logEntry;\r
+ public static String CustomXmlTraceDefinition_name;\r
+ public static String CustomXmlTraceDefinition_outputColumn;\r
+ public static String CustomXmlTraceDefinition_timestampOutputFormat;\r
\r
- public static String TmfEventsTable_AddBookmarkActionText;\r
- public static String TmfEventsTable_AddBookmarkDialogText;\r
- public static String TmfEventsTable_AddBookmarkDialogTitle;\r
- public static String TmfEventsTable_ApplyPresetFilterMenuName;\r
- public static String TmfEventsTable_ClearFiltersActionText;\r
- public static String TmfEventsTable_ContentColumnHeader;\r
- public static String TmfEventsTable_FilterHint;\r
- public static String TmfEventsTable_HideRawActionText;\r
- public static String TmfEventsTable_HideTableActionText;\r
- public static String TmfEventsTable_ReferenceColumnHeader;\r
- public static String TmfEventsTable_RemoveBookmarkActionText;\r
- public static String TmfEventsTable_SearchHint;\r
- public static String TmfEventsTable_SearchingJobName;\r
- public static String TmfEventsTable_ShowFilterBarActionText;\r
- public static String TmfEventsTable_ShowRawActionText;\r
- public static String TmfEventsTable_ShowSearchBarActionText;\r
- public static String TmfEventsTable_ShowTableActionText;\r
- public static String TmfEventsTable_SourceColumnHeader;\r
- public static String TmfEventsTable_TimestampColumnHeader;\r
- public static String TmfEventsTable_TypeColumnHeader;\r
+ public static String TmfEventsTable_AddBookmarkActionText;\r
+ public static String TmfEventsTable_AddBookmarkDialogText;\r
+ public static String TmfEventsTable_AddBookmarkDialogTitle;\r
+ public static String TmfEventsTable_ApplyPresetFilterMenuName;\r
+ public static String TmfEventsTable_ClearFiltersActionText;\r
+ public static String TmfEventsTable_ContentColumnHeader;\r
+ public static String TmfEventsTable_FilterHint;\r
+ public static String TmfEventsTable_HideRawActionText;\r
+ public static String TmfEventsTable_HideTableActionText;\r
+ public static String TmfEventsTable_ReferenceColumnHeader;\r
+ public static String TmfEventsTable_RemoveBookmarkActionText;\r
+ public static String TmfEventsTable_SearchHint;\r
+ public static String TmfEventsTable_SearchingJobName;\r
+ public static String TmfEventsTable_ShowFilterBarActionText;\r
+ public static String TmfEventsTable_ShowRawActionText;\r
+ public static String TmfEventsTable_ShowSearchBarActionText;\r
+ public static String TmfEventsTable_ShowTableActionText;\r
+ public static String TmfEventsTable_SourceColumnHeader;\r
+ public static String TmfEventsTable_TimestampColumnHeader;\r
+ public static String TmfEventsTable_TypeColumnHeader;\r
\r
- public static String TmfTimeFilterDialog_EDIT_PROFILING_OPTIONS;\r
- public static String TmfTimeFilterDialog_TRACE_FILTER;\r
- public static String TmfTimeFilterDialog_TRACE_FILTER_DESC;\r
- public static String TmfTimeFilterDialog_TRACE_ID;\r
- public static String TmfTimeFilterDialog_TRACE_NAME;\r
- public static String TmfTimeLegend_LEGEND;\r
- public static String TmfTimeLegend_TRACE_STATES;\r
- public static String TmfTimeLegend_TRACE_STATES_TITLE;\r
- public static String TmfTimeLegend_WINDOW_TITLE;\r
+ public static String TmfTimeFilterDialog_EDIT_PROFILING_OPTIONS;\r
+ public static String TmfTimeFilterDialog_TRACE_FILTER;\r
+ public static String TmfTimeFilterDialog_TRACE_FILTER_DESC;\r
+ public static String TmfTimeFilterDialog_TRACE_ID;\r
+ public static String TmfTimeFilterDialog_TRACE_NAME;\r
+ public static String TmfTimeLegend_LEGEND;\r
+ public static String TmfTimeLegend_TRACE_STATES;\r
+ public static String TmfTimeLegend_TRACE_STATES_TITLE;\r
+ public static String TmfTimeLegend_WINDOW_TITLE;\r
\r
- public static String TimeScaleCtrl_Timescale;\r
- public static String TmfTimeStatesCtrl_TRACE_GROUP_LABEL;\r
- public static String TmfTimeStatesCtrl_UNDEFINED_GROUP;\r
- public static String TmfTimeTipHandler_DURATION;\r
- public static String TmfTimeTipHandler_NUMBER_OF_TRACES;\r
- public static String TmfTimeTipHandler_TRACE_CLASS_NAME;\r
- public static String TmfTimeTipHandler_TRACE_DATE;\r
- public static String TmfTimeTipHandler_TRACE_EVENT_TIME;\r
- public static String TmfTimeTipHandler_TRACE_GROUP_NAME;\r
- public static String TmfTimeTipHandler_TRACE_NAME;\r
- public static String TmfTimeTipHandler_TRACE_START_TIME;\r
- public static String TmfTimeTipHandler_TRACE_STATE;\r
- public static String TmfTimeTipHandler_TRACE_STOP_TIME;\r
+ public static String TimeScaleCtrl_Timescale;\r
+ public static String TmfTimeStatesCtrl_TRACE_GROUP_LABEL;\r
+ public static String TmfTimeStatesCtrl_UNDEFINED_GROUP;\r
+ public static String TmfTimeTipHandler_DURATION;\r
+ public static String TmfTimeTipHandler_NUMBER_OF_TRACES;\r
+ public static String TmfTimeTipHandler_TRACE_CLASS_NAME;\r
+ public static String TmfTimeTipHandler_TRACE_DATE;\r
+ public static String TmfTimeTipHandler_TRACE_EVENT_TIME;\r
+ public static String TmfTimeTipHandler_TRACE_GROUP_NAME;\r
+ public static String TmfTimeTipHandler_TRACE_NAME;\r
+ public static String TmfTimeTipHandler_TRACE_START_TIME;\r
+ public static String TmfTimeTipHandler_TRACE_STATE;\r
+ public static String TmfTimeTipHandler_TRACE_STOP_TIME;\r
\r
- public static String ColorsView_AddActionToolTipText;\r
- public static String ColorsView_BackgroundButtonText;\r
- public static String ColorsView_BackgroundDialogText;\r
- public static String ColorsView_DeleteActionToolTipText;\r
- public static String ColorsView_ExportActionToolTipText;\r
- public static String ColorsView_FilterButtonText;\r
- public static String ColorsView_ForegroundButtonText;\r
- public static String ColorsView_ForegroundDialogText;\r
- public static String ColorsView_ImportActionToolTipText;\r
- public static String ColorsView_ImportOverwriteDialogMessage1;\r
- public static String ColorsView_ImportOverwriteDialogMessage2;\r
- public static String ColorsView_ImportOverwriteDialogTitle;\r
- public static String ColorsView_MoveDownActionToolTipText;\r
- public static String ColorsView_MoveUpActionToolTipText;\r
- public static String ColorsView_TickButtonText;\r
- public static String TickColorDialog_TickColorDialogTitle;\r
+ public static String ColorsView_AddActionToolTipText;\r
+ public static String ColorsView_BackgroundButtonText;\r
+ public static String ColorsView_BackgroundDialogText;\r
+ public static String ColorsView_DeleteActionToolTipText;\r
+ public static String ColorsView_ExportActionToolTipText;\r
+ public static String ColorsView_FilterButtonText;\r
+ public static String ColorsView_ForegroundButtonText;\r
+ public static String ColorsView_ForegroundDialogText;\r
+ public static String ColorsView_ImportActionToolTipText;\r
+ public static String ColorsView_ImportOverwriteDialogMessage1;\r
+ public static String ColorsView_ImportOverwriteDialogMessage2;\r
+ public static String ColorsView_ImportOverwriteDialogTitle;\r
+ public static String ColorsView_MoveDownActionToolTipText;\r
+ public static String ColorsView_MoveUpActionToolTipText;\r
+ public static String ColorsView_TickButtonText;\r
+ public static String TickColorDialog_TickColorDialogTitle;\r
\r
- public static String CustomTxtParserInputWizardPage_addChildLine;\r
- public static String CustomTxtParserInputWizardPage_addGroup;\r
- public static String CustomTxtParserInputWizardPage_addNextLine;\r
- public static String CustomTxtParserInputWizardPage_append;\r
- public static String CustomTxtParserInputWizardPage_appendWith;\r
- public static String CustomTxtParserInputWizardPage_capturedGroup;\r
- public static String CustomTxtParserInputWizardPage_cardinality;\r
- public static String CustomTxtParserInputWizardPage_dateFormatHelp;\r
- public static String CustomTxtParserInputWizardPage_desccriptionEdit;\r
- public static String CustomTxtParserInputWizardPage_descriptionNew;\r
- public static String CustomTxtParserInputWizardPage_format;\r
- public static String CustomTxtParserInputWizardPage_group;\r
- public static String CustomTxtParserInputWizardPage_highlightAll;\r
- public static String CustomTxtParserInputWizardPage_logType;\r
- public static String CustomTxtParserInputWizardPage_matchingLineRoot;\r
- public static String CustomTxtParserInputWizardPage_matchingOtherLine;\r
- public static String CustomTxtParserInputWizardPage_matchingRootLine;\r
- public static String CustomTxtParserInputWizardPage_max;\r
- public static String CustomTxtParserInputWizardPage_min;\r
- public static String CustomTxtParserInputWizardPage_moveDown;\r
- public static String CustomTxtParserInputWizardPage_moveUp;\r
- public static String CustomTxtParserInputWizardPage_name;\r
- public static String CustomTxtParserInputWizardPage_newGroup;\r
- public static String CustomTxtParserInputWizardPage_noMatch;\r
- public static String CustomTxtParserInputWizardPage_noMatchingGroup;\r
- public static String CustomTxtParserInputWizardPage_noMatchingLine;\r
- public static String CustomTxtParserInputWizardPage_noMatchingTimestamp;\r
- public static String CustomTxtParserInputWizardPage_noMathcingLine;\r
- public static String CustomTxtParserInputWizardPage_nonMatchingLine;\r
- public static String CustomTxtParserInputWizardPage_noTimestampGroup;\r
- public static String CustomTxtParserInputWizardPage_preview;\r
- public static String CustomTxtParserInputWizardPage_previewInput;\r
- public static String CustomTxtParserInputWizardPage_previewLegend;\r
- public static String CustomTxtParserInputWizardPage_regularExpression;\r
- public static String CustomTxtParserInputWizardPage_regularExpressionHelp;\r
- public static String CustomTxtParserInputWizardPage_removeGroup;\r
- public static String CustomTxtParserInputWizardPage_removeLine;\r
- public static String CustomTxtParserInputWizardPage_set;\r
- public static String CustomTxtParserInputWizardPage_timestampFormat;\r
- public static String CustomTxtParserInputWizardPage_uncapturedText;\r
- public static String CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;\r
- public static String CustomTxtParserInputWizardPage_windowTitleEdit;\r
- public static String CustomTxtParserInputWizardPage_windowTitleNew;\r
- public static String CustomTxtParserOutputWizardPage_description;\r
- public static String CustomTxtParserOutputWizardPage_moveAfter;\r
- public static String CustomTxtParserOutputWizardPage_moveBefore;\r
- public static String CustomTxtParserOutputWizardPage_visible;\r
- public static String CustomXmlParserInputWizardPage_emptyLogTypeError;\r
- public static String CustomXmlParserInputWizardPage_duplicatelogTypeError;\r
- public static String CustomXmlParserInputWizardPage_noDocumentError;\r
- public static String CustomXmlParserInputWizardPage_missingLogEntryError;\r
- public static String CustomXmlParserInputWizardPage_missingTimestampFmtError;\r
- public static String CustomXmlParserInputWizardPage_invalidTimestampFmtError;\r
- public static String CustomXmlParserInputWizardPage_notimestamporAttributeError;\r
- public static String CustomXmlParserInputWizardPage_missingDocumentElementError;\r
- public static String CustomXmlParserInputWizardPage_timestampFormatPrompt;\r
- public static String CustomXmlParserInputWizardPage_timestampElementPrompt;\r
- public static String CustomXmlParserInputWizardPage_missingInputElementNameError;\r
- public static String CustomXmlParserInputWizardPage_attributePrompt;\r
- public static String CustomXmlParserInputWizardPage_missingAttribute;\r
- public static String CustomXmlParserInputWizardPage_duplicateAttributeError;\r
- public static String CustomXmlParserInputWizardPage_missingTimestampInFmtError;\r
- public static String CustomXmlParserInputWizardPage_invalidTimestampInFmtError;\r
- public static String CustomXmlParserInputWizardPage_missingDataGroupNameError;\r
- public static String CustomXmlParserInputWizardPage_missingElementNameError;\r
- public static String CustomXmlParserInputWizardPage_duplicateElementNameError;\r
- public static String CustomXmlParserInputWizardPage_addAttribute;\r
- public static String CustomXmlParserInputWizardPage_addChildElement;\r
- public static String CustomXmlParserInputWizardPage_addDocumentEleemnt;\r
- public static String CustomXmlParserInputWizardPage_addDocumentElement;\r
- public static String CustomXmlParserInputWizardPage_addNextElement;\r
- public static String CustomXmlParserInputWizardPage_append;\r
- public static String CustomXmlParserInputWizardPage_appendWith;\r
- public static String CustomXmlParserInputWizardPage_attibute;\r
- public static String CustomXmlParserInputWizardPage_dateFormatHelp;\r
- public static String CustomXmlParserInputWizardPage_descriptionEdit;\r
- public static String CustomXmlParserInputWizardPage_descriptionNew;\r
- public static String CustomXmlParserInputWizardPage_elementName;\r
- public static String CustomXmlParserInputWizardPage_feelingLucky;\r
- public static String CustomXmlParserInputWizardPage_format;\r
- public static String CustomXmlParserInputWizardPage_logEntry;\r
- public static String CustomXmlParserInputWizardPage_logType;\r
- public static String CustomXmlParserInputWizardPage_moveDown;\r
- public static String CustomXmlParserInputWizardPage_moveUp;\r
- public static String CustomXmlParserInputWizardPage_name;\r
- public static String CustomXmlParserInputWizardPage_newAttibute;\r
- public static String CustomXmlParserInputWizardPage_noMatchingAttribute;\r
- public static String CustomXmlParserInputWizardPage_noMatch;\r
- public static String CustomXmlParserInputWizardPage_noMatchingElement;\r
- public static String CustomXmlParserInputWizardPage_preview;\r
- public static String CustomXmlParserInputWizardPage_previewInput;\r
- public static String CustomXmlParserInputWizardPage_removeAttribute;\r
- public static String CustomXmlParserInputWizardPage_removeElement;\r
- public static String CustomXmlParserInputWizardPage_set;\r
- public static String CustomXmlParserInputWizardPage_tagName;\r
- public static String CustomXmlParserInputWizardPage_timestampFormat;\r
- public static String CustomXmlParserInputWizardPage_titleEdit;\r
- public static String CustomXmlParserInputWizardPage_titleNew;\r
- public static String CustomXmlParserOutputWizardPage_description;\r
- public static String CustomXmlParserOutputWizardPage_moveAfter;\r
- public static String CustomXmlParserOutputWizardPage_moveBefore;\r
- public static String CustomXmlParserOutputWizardPage_visible;\r
+ public static String CustomTxtParserInputWizardPage_addChildLine;\r
+ public static String CustomTxtParserInputWizardPage_addGroup;\r
+ public static String CustomTxtParserInputWizardPage_addNextLine;\r
+ public static String CustomTxtParserInputWizardPage_append;\r
+ public static String CustomTxtParserInputWizardPage_appendWith;\r
+ public static String CustomTxtParserInputWizardPage_capturedGroup;\r
+ public static String CustomTxtParserInputWizardPage_cardinality;\r
+ public static String CustomTxtParserInputWizardPage_dateFormatHelp;\r
+ public static String CustomTxtParserInputWizardPage_desccriptionEdit;\r
+ public static String CustomTxtParserInputWizardPage_descriptionNew;\r
+ public static String CustomTxtParserInputWizardPage_format;\r
+ public static String CustomTxtParserInputWizardPage_group;\r
+ public static String CustomTxtParserInputWizardPage_highlightAll;\r
+ public static String CustomTxtParserInputWizardPage_logType;\r
+ public static String CustomTxtParserInputWizardPage_matchingLineRoot;\r
+ public static String CustomTxtParserInputWizardPage_matchingOtherLine;\r
+ public static String CustomTxtParserInputWizardPage_matchingRootLine;\r
+ public static String CustomTxtParserInputWizardPage_max;\r
+ public static String CustomTxtParserInputWizardPage_min;\r
+ public static String CustomTxtParserInputWizardPage_moveDown;\r
+ public static String CustomTxtParserInputWizardPage_moveUp;\r
+ public static String CustomTxtParserInputWizardPage_name;\r
+ public static String CustomTxtParserInputWizardPage_newGroup;\r
+ public static String CustomTxtParserInputWizardPage_noMatch;\r
+ public static String CustomTxtParserInputWizardPage_noMatchingGroup;\r
+ public static String CustomTxtParserInputWizardPage_noMatchingLine;\r
+ public static String CustomTxtParserInputWizardPage_noMatchingTimestamp;\r
+ public static String CustomTxtParserInputWizardPage_noMathcingLine;\r
+ public static String CustomTxtParserInputWizardPage_nonMatchingLine;\r
+ public static String CustomTxtParserInputWizardPage_noTimestampGroup;\r
+ public static String CustomTxtParserInputWizardPage_preview;\r
+ public static String CustomTxtParserInputWizardPage_previewInput;\r
+ public static String CustomTxtParserInputWizardPage_previewLegend;\r
+ public static String CustomTxtParserInputWizardPage_regularExpression;\r
+ public static String CustomTxtParserInputWizardPage_regularExpressionHelp;\r
+ public static String CustomTxtParserInputWizardPage_removeGroup;\r
+ public static String CustomTxtParserInputWizardPage_removeLine;\r
+ public static String CustomTxtParserInputWizardPage_set;\r
+ public static String CustomTxtParserInputWizardPage_timestampFormat;\r
+ public static String CustomTxtParserInputWizardPage_uncapturedText;\r
+ public static String CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;\r
+ public static String CustomTxtParserInputWizardPage_windowTitleEdit;\r
+ public static String CustomTxtParserInputWizardPage_windowTitleNew;\r
+ public static String CustomTxtParserOutputWizardPage_description;\r
+ public static String CustomTxtParserOutputWizardPage_moveAfter;\r
+ public static String CustomTxtParserOutputWizardPage_moveBefore;\r
+ public static String CustomTxtParserOutputWizardPage_visible;\r
+ public static String CustomXmlParserInputWizardPage_emptyLogTypeError;\r
+ public static String CustomXmlParserInputWizardPage_duplicatelogTypeError;\r
+ public static String CustomXmlParserInputWizardPage_noDocumentError;\r
+ public static String CustomXmlParserInputWizardPage_missingLogEntryError;\r
+ public static String CustomXmlParserInputWizardPage_missingTimestampFmtError;\r
+ public static String CustomXmlParserInputWizardPage_invalidTimestampFmtError;\r
+ public static String CustomXmlParserInputWizardPage_notimestamporAttributeError;\r
+ public static String CustomXmlParserInputWizardPage_missingDocumentElementError;\r
+ public static String CustomXmlParserInputWizardPage_timestampFormatPrompt;\r
+ public static String CustomXmlParserInputWizardPage_timestampElementPrompt;\r
+ public static String CustomXmlParserInputWizardPage_missingInputElementNameError;\r
+ public static String CustomXmlParserInputWizardPage_attributePrompt;\r
+ public static String CustomXmlParserInputWizardPage_missingAttribute;\r
+ public static String CustomXmlParserInputWizardPage_duplicateAttributeError;\r
+ public static String CustomXmlParserInputWizardPage_missingTimestampInFmtError;\r
+ public static String CustomXmlParserInputWizardPage_invalidTimestampInFmtError;\r
+ public static String CustomXmlParserInputWizardPage_missingDataGroupNameError;\r
+ public static String CustomXmlParserInputWizardPage_missingElementNameError;\r
+ public static String CustomXmlParserInputWizardPage_duplicateElementNameError;\r
+ public static String CustomXmlParserInputWizardPage_addAttribute;\r
+ public static String CustomXmlParserInputWizardPage_addChildElement;\r
+ public static String CustomXmlParserInputWizardPage_addDocumentEleemnt;\r
+ public static String CustomXmlParserInputWizardPage_addDocumentElement;\r
+ public static String CustomXmlParserInputWizardPage_addNextElement;\r
+ public static String CustomXmlParserInputWizardPage_append;\r
+ public static String CustomXmlParserInputWizardPage_appendWith;\r
+ public static String CustomXmlParserInputWizardPage_attibute;\r
+ public static String CustomXmlParserInputWizardPage_dateFormatHelp;\r
+ public static String CustomXmlParserInputWizardPage_descriptionEdit;\r
+ public static String CustomXmlParserInputWizardPage_descriptionNew;\r
+ public static String CustomXmlParserInputWizardPage_elementName;\r
+ public static String CustomXmlParserInputWizardPage_feelingLucky;\r
+ public static String CustomXmlParserInputWizardPage_format;\r
+ public static String CustomXmlParserInputWizardPage_logEntry;\r
+ public static String CustomXmlParserInputWizardPage_logType;\r
+ public static String CustomXmlParserInputWizardPage_moveDown;\r
+ public static String CustomXmlParserInputWizardPage_moveUp;\r
+ public static String CustomXmlParserInputWizardPage_name;\r
+ public static String CustomXmlParserInputWizardPage_newAttibute;\r
+ public static String CustomXmlParserInputWizardPage_noMatchingAttribute;\r
+ public static String CustomXmlParserInputWizardPage_noMatch;\r
+ public static String CustomXmlParserInputWizardPage_noMatchingElement;\r
+ public static String CustomXmlParserInputWizardPage_preview;\r
+ public static String CustomXmlParserInputWizardPage_previewInput;\r
+ public static String CustomXmlParserInputWizardPage_removeAttribute;\r
+ public static String CustomXmlParserInputWizardPage_removeElement;\r
+ public static String CustomXmlParserInputWizardPage_set;\r
+ public static String CustomXmlParserInputWizardPage_tagName;\r
+ public static String CustomXmlParserInputWizardPage_timestampFormat;\r
+ public static String CustomXmlParserInputWizardPage_titleEdit;\r
+ public static String CustomXmlParserInputWizardPage_titleNew;\r
+ public static String CustomXmlParserOutputWizardPage_description;\r
+ public static String CustomXmlParserOutputWizardPage_moveAfter;\r
+ public static String CustomXmlParserOutputWizardPage_moveBefore;\r
+ public static String CustomXmlParserOutputWizardPage_visible;\r
\r
- public static String FilterDialog_FilterDialogTitle;\r
- public static String FilterView_AddActionToolTipText;\r
- public static String FilterView_DeleteActionToolTipText;\r
- public static String FilterView_ExportActionToolTipText;\r
- public static String FilterView_FileDialogFilterName;\r
- public static String FilterView_ImportActionToolTipText;\r
- public static String FilterView_SaveActionToolTipText;\r
- public static String FilterViewer_AlphaButtonText;\r
- public static String FilterViewer_DeleteActionText;\r
- public static String FilterViewer_FieldLabel;\r
- public static String FilterViewer_FilterNameHint;\r
- public static String FilterViewer_IgnoreCaseButtonText;\r
- public static String FilterViewer_NameLabel;\r
- public static String FilterViewer_NewPrefix;\r
- public static String FilterViewer_NotLabel;\r
- public static String FilterViewer_NumButtonText;\r
- public static String FilterViewer_RegexHint;\r
- public static String FilterViewer_RegexLabel;\r
- public static String FilterViewer_ResultLabel;\r
- public static String FilterViewer_TimestampButtonText;\r
- public static String FilterViewer_TypeLabel;\r
- public static String FilterViewer_ValueHint;\r
- public static String FilterViewer_ValueLabel;\r
+ public static String FilterDialog_FilterDialogTitle;\r
+ public static String FilterView_AddActionToolTipText;\r
+ public static String FilterView_DeleteActionToolTipText;\r
+ public static String FilterView_ExportActionToolTipText;\r
+ public static String FilterView_FileDialogFilterName;\r
+ public static String FilterView_ImportActionToolTipText;\r
+ public static String FilterView_SaveActionToolTipText;\r
+ public static String FilterViewer_AlphaButtonText;\r
+ public static String FilterViewer_DeleteActionText;\r
+ public static String FilterViewer_FieldLabel;\r
+ public static String FilterViewer_FilterNameHint;\r
+ public static String FilterViewer_IgnoreCaseButtonText;\r
+ public static String FilterViewer_NameLabel;\r
+ public static String FilterViewer_NewPrefix;\r
+ public static String FilterViewer_NotLabel;\r
+ public static String FilterViewer_NumButtonText;\r
+ public static String FilterViewer_RegexHint;\r
+ public static String FilterViewer_RegexLabel;\r
+ public static String FilterViewer_ResultLabel;\r
+ public static String FilterViewer_TimestampButtonText;\r
+ public static String FilterViewer_TypeLabel;\r
+ public static String FilterViewer_ValueHint;\r
+ public static String FilterViewer_ValueLabel;\r
\r
- static {\r
- // initialize resource bundle\r
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
- }\r
+ static {\r
+ // initialize resource bundle\r
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
+ }\r
\r
- private Messages() {\r
- }\r
+ private Messages() {\r
+ }\r
}\r
ManageCustomParsersDialog_ImportParserSelection=Select custom parser file to import\r
ManageCustomParsersDialog_NewButtonLabel=New...\r
ManageCustomParsersDialog_ParseButtonLabel=Parse...\r
+ManageCustomParsersDialog_ParseError=Parse Error\r
ManageCustomParsersDialog_TextButtonLabel=Text\r
ManageCustomParsersDialog_TraceSelection=Select log file to parse using \r
\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui.parsers;\r
-\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.resources.IResource;\r
-import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-public interface IParserProvider {\r
-\r
- /**\r
- * Return the readable category name for this parser provider\r
- * \r
- * @return the category name\r
- */\r
- public String getCategory();\r
- \r
- /**\r
- * Return a trace instance for a resource given a parser id\r
- * \r
- * @param parser the parser id\r
- * @param resource the resource\r
- * @return a trace instance or null if the parser id is not handled by this parser provider\r
- */\r
- public ITmfTrace<?> getTraceForParser(String parser, IResource resource);\r
- \r
- /**\r
- * Return a trace instance for a resource given a content type id\r
- * \r
- * @param contentTypeId the content type id\r
- * @param resource the resource\r
- * @return a trace instance or null if the content type id is not handled by this parser provider\r
- */\r
- public ITmfTrace<?> getTraceForContentType(String contentTypeId, IResource resource);\r
- \r
- /**\r
- * Return the parser map for this parser provider\r
- * Map key: readable parser name\r
- * Map value: unique parser id\r
- * \r
- * @return the parser map\r
- */\r
- public Map<String, String> getParserMap();\r
-\r
- /**\r
- * Return the event type map given a parser id\r
- * Map key: readable event type name\r
- * Map value: unique event type id\r
- * \r
- * @param parser the parser id\r
- * @return the event type map or null if the parser id is not handled by this parser provider\r
- */\r
- public Map<String, String> getEventTypeMapForParser(String parser);\r
- \r
- /**\r
- * Return the field label array given an event type id\r
- * Array value: readable field label\r
- * \r
- * @param eventType the event type id\r
- * @return the field label array or null if the event type id is not handled by this parser provider\r
- */\r
- public String[] getFieldLabelsForEventType(String eventType);\r
- \r
- /**\r
- * Return the editor id given a parser id\r
- * \r
- * @param parser the parser id\r
- * @return an editor id or null to use the default trace editor\r
- */\r
- public String getEditorIdForParser(String parser);\r
-\r
- /**\r
- * Return an events table instance for a given trace\r
- * \r
- * @param parser the parser id\r
- * @param parent the parent composite for the table\r
- * @param cacheSize the desired cache size for the table\r
- * @return an events table instance or null if the trace is not handled by this parser provider\r
- */\r
- public TmfEventsTable getEventsTable(ITmfTrace<?> trace, Composite parent, int cacheSize);\r
-\r
-}\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui.parsers;\r
-\r
-import java.util.ArrayList;\r
-import java.util.LinkedHashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.resources.IResource;\r
-import org.eclipse.core.runtime.CoreException;\r
-import org.eclipse.core.runtime.IConfigurationElement;\r
-import org.eclipse.core.runtime.IExtensionRegistry;\r
-import org.eclipse.core.runtime.Platform;\r
-import org.eclipse.core.runtime.QualifiedName;\r
-import org.eclipse.core.runtime.content.IContentType;\r
-import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
-import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;\r
-import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-public class ParserProviderManager {\r
-\r
- public static final QualifiedName PARSER_PROPERTY = new QualifiedName(TmfUiPlugin.PLUGIN_ID, "PARSER"); //$NON-NLS-1$\r
-\r
- private static List<IParserProvider> fParserProviders = new ArrayList<IParserProvider>();\r
-\r
- public static void init() {\r
- IExtensionRegistry reg = Platform.getExtensionRegistry();\r
- IConfigurationElement[] extensions = reg.getConfigurationElementsFor("org.eclipse.linuxtools.tmf.ui.parserProviders"); //$NON-NLS-1$\r
- for (int i = 0; i < extensions.length; i++) {\r
- IConfigurationElement element = extensions[i];\r
- try {\r
- IParserProvider parserProvider = (IParserProvider) element.createExecutableExtension("class"); //$NON-NLS-1$\r
- addParserProvider(parserProvider);\r
- } catch (CoreException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
- \r
- public static void addParserProvider(IParserProvider parserProvider) {\r
- fParserProviders.add(parserProvider);\r
- }\r
-\r
- public static void removeParserProvider(IParserProvider parserProvider) {\r
- fParserProviders.remove(parserProvider);\r
- }\r
-\r
- public static ITmfTrace getTrace(IResource resource) {\r
- if (resource == null) {\r
- return null;\r
- }\r
- try {\r
- String parser = resource.getPersistentProperty(PARSER_PROPERTY);\r
- if (parser != null) {\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- if (parserProvider != null) {\r
- ITmfTrace trace = parserProvider.getTraceForParser(parser, resource);\r
- if (trace != null) {\r
- return trace;\r
- }\r
- }\r
- }\r
- }\r
- IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(resource.getName());\r
- if (contentType != null) {\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- if (parserProvider != null) {\r
- ITmfTrace trace = parserProvider.getTraceForContentType(contentType.getId(), resource);\r
- if (trace != null) {\r
- resource.setPersistentProperty(PARSER_PROPERTY, trace.getClass().getCanonicalName());\r
- return trace;\r
- }\r
- }\r
- }\r
- }\r
- } catch (CoreException e) {\r
- e.printStackTrace();\r
- }\r
- return null;\r
- }\r
-\r
- public static String getEditorId(IResource resource) {\r
- if (resource == null) {\r
- return null;\r
- }\r
- try {\r
- String parser = resource.getPersistentProperty(PARSER_PROPERTY);\r
- if (parser != null) {\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- if (parserProvider != null) {\r
- String editorId = parserProvider.getEditorIdForParser(parser);\r
- if (editorId != null) {\r
- return editorId;\r
- }\r
- }\r
- }\r
- }\r
- return TmfEventsEditor.ID;\r
- } catch (CoreException e) {\r
- e.printStackTrace();\r
- }\r
- return null;\r
- }\r
- \r
- public static Map<String, Map<String, String>> getParserMap() {\r
- Map<String, Map<String, String>> parserMap = new LinkedHashMap<String, Map<String, String>>();\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- parserMap.put(parserProvider.getCategory(), parserProvider.getParserMap());\r
- }\r
- return parserMap;\r
- }\r
-\r
- public static Map<String, String> getEventTypeMapForParser(String parser) {\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- Map<String, String> map = parserProvider.getEventTypeMapForParser(parser);\r
- if (map != null) {\r
- return map;\r
- }\r
- }\r
- return new LinkedHashMap<String, String>(0);\r
- }\r
- \r
- public static String[] getFieldLabelsForEventType(String eventType) {\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- String[] fieldLabels = parserProvider.getFieldLabelsForEventType(eventType);\r
- if (fieldLabels != null) {\r
- return fieldLabels;\r
- }\r
- }\r
- return new String[0];\r
- }\r
-\r
- public static TmfEventsTable getEventsTable(ITmfTrace trace, Composite parent, int cacheSize) {\r
- for (IParserProvider parserProvider : fParserProviders) {\r
- if (parserProvider != null) {\r
- TmfEventsTable eventsTable = parserProvider.getEventsTable(trace, parent, cacheSize);\r
- if (eventsTable != null) {\r
- return eventsTable;\r
- }\r
- }\r
- }\r
- return null;\r
- }\r
-\r
-}\r
import org.eclipse.linuxtools.tmf.event.TmfEventSource;\r
import org.eclipse.linuxtools.tmf.event.TmfEventType;\r
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;\r
+import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;\r
\r
public class CustomEvent extends TmfEvent {\r
protected Map<String, String> fData;\r
private String[] fColumnData;\r
\r
+ public CustomEvent(CustomTraceDefinition definition) {\r
+ fDefinition = definition;\r
+ fData = new HashMap<String, String>();\r
+ }\r
+\r
public CustomEvent(CustomTraceDefinition definition, TmfEvent other) {\r
super(other);\r
fDefinition = definition;\r
fData = new HashMap<String, String>();\r
}\r
\r
- public CustomEvent(CustomTraceDefinition definition, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
- super(timestamp, source, type, reference);\r
+ public CustomEvent(CustomTraceDefinition definition, ITmfTrace<?> parentTrace, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
+ super(parentTrace, timestamp, source, type, reference);\r
fDefinition = definition;\r
fData = new HashMap<String, String>();\r
}\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui.parsers.custom;\r
-\r
-import java.io.FileNotFoundException;\r
-import java.util.LinkedHashMap;\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.resources.IResource;\r
-import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.IParserProvider;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-public class CustomParserProvider implements IParserProvider {\r
-\r
- @Override\r
- public String getCategory() {\r
- return "Custom"; //$NON-NLS-1$\r
- }\r
-\r
- @Override\r
- public ITmfTrace<?> getTraceForParser(String parser, IResource resource) {\r
- try {\r
- String name = resource.getName();\r
- String path = resource.getLocation().toOSString();\r
- for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
- if (parser.equals(CustomTxtTrace.class.getCanonicalName() + "." + def.definitionName)) { //$NON-NLS-1$\r
- return new CustomTxtTrace(name, def, path, 100);\r
- }\r
- }\r
- for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
- if (parser.equals(CustomXmlTrace.class.getCanonicalName() + "." + def.definitionName)) { //$NON-NLS-1$\r
- return new CustomXmlTrace(name, def, path, 100);\r
- }\r
- }\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- }\r
- return null;\r
- }\r
-\r
- @Override\r
- public ITmfTrace<?> getTraceForContentType(String contentTypeId, IResource resource) {\r
- return null;\r
- }\r
-\r
- @Override\r
- public String getEditorIdForParser(String parser) {\r
- return null;\r
- }\r
-\r
- @Override\r
- public Map<String, String> getEventTypeMapForParser(String parser) {\r
- for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
- if (parser.equals(CustomTxtTrace.class.getCanonicalName() + "." + def.definitionName)) { //$NON-NLS-1$\r
- Map<String, String> eventTypeMap = new LinkedHashMap<String, String>();\r
- eventTypeMap.put(def.definitionName, CustomTxtEventType.class.getCanonicalName() + "." + def.definitionName); //$NON-NLS-1$\r
- return eventTypeMap;\r
- }\r
- }\r
- for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
- if (parser.equals(CustomXmlTrace.class.getCanonicalName() + "." + def.definitionName)) { //$NON-NLS-1$\r
- Map<String, String> eventTypeMap = new LinkedHashMap<String, String>();\r
- eventTypeMap.put(def.definitionName, CustomXmlEventType.class.getCanonicalName() + "." + def.definitionName); //$NON-NLS-1$\r
- return eventTypeMap;\r
- }\r
- }\r
- return null;\r
- }\r
-\r
- @Override\r
- public String[] getFieldLabelsForEventType(String eventType) {\r
- for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
- if (eventType.equals(CustomTxtEventType.class.getCanonicalName() + "." + def.definitionName)) { //$NON-NLS-1$\r
- String[] labels = new String[def.outputs.size()];\r
- for (int i = 0; i < labels.length; i++) {\r
- labels[i] = def.outputs.get(i).name;\r
- }\r
- return labels;\r
- }\r
- }\r
- for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
- if (eventType.equals(CustomXmlEventType.class.getCanonicalName() + "." + def.definitionName)) { //$NON-NLS-1$\r
- String[] labels = new String[def.outputs.size()];\r
- for (int i = 0; i < labels.length; i++) {\r
- labels[i] = def.outputs.get(i).name;\r
- }\r
- return labels;\r
- }\r
- }\r
- return null;\r
- }\r
-\r
- @Override\r
- public Map<String, String> getParserMap() {\r
- Map<String, String> parserMap = new LinkedHashMap<String, String>();\r
- for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
- parserMap.put(def.definitionName, CustomTxtTrace.class.getCanonicalName() + "." + def.definitionName); //$NON-NLS-1$\r
- }\r
- for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
- parserMap.put(def.definitionName, CustomXmlTrace.class.getCanonicalName() + "." + def.definitionName); //$NON-NLS-1$\r
- }\r
- return parserMap;\r
- }\r
-\r
- @Override\r
- public TmfEventsTable getEventsTable(ITmfTrace<?> trace, Composite parent, int cacheSize) {\r
- if (trace instanceof CustomTxtTrace) {\r
- return new CustomEventsTable(((CustomTxtTrace) trace).getDefinition(), parent, cacheSize);\r
- } else if (trace instanceof CustomXmlTrace) {\r
- return new CustomEventsTable(((CustomXmlTrace) trace).getDefinition(), parent, cacheSize);\r
- }\r
- return null;\r
- }\r
-\r
-}\r
import org.eclipse.linuxtools.tmf.event.TmfEventSource;\r
import org.eclipse.linuxtools.tmf.event.TmfEventType;\r
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;\r
+import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;\r
import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;\r
\r
public class CustomTxtEvent extends CustomEvent {\r
\r
+ public CustomTxtEvent(CustomTxtTraceDefinition definition) {\r
+ super(definition);\r
+ fType = new CustomTxtEventType(definition);\r
+ }\r
+\r
public CustomTxtEvent(CustomTxtTraceDefinition definition, TmfEvent other) {\r
super(definition, other);\r
}\r
\r
- public CustomTxtEvent(CustomTxtTraceDefinition definition, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
- super(definition, timestamp, source, type, reference);\r
+ public CustomTxtEvent(CustomTxtTraceDefinition definition, ITmfTrace<?> parentTrace, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
+ super(definition, parentTrace, timestamp, source, type, reference);\r
}\r
\r
public CustomTxtEvent(CustomTxtTraceDefinition definition, TmfTimestamp originalTS, TmfTimestamp effectiveTS, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
\r
private CustomTxtTraceDefinition fDefinition;\r
private CustomTxtEventType fEventType;\r
- \r
+\r
+ public CustomTxtTrace(CustomTxtTraceDefinition definition) {\r
+ fDefinition = definition;\r
+ fEventType = new CustomTxtEventType(fDefinition);\r
+ }\r
+\r
public CustomTxtTrace(String name, CustomTxtTraceDefinition definition, String path, int cacheSize) throws FileNotFoundException {\r
super(name, CustomTxtEvent.class, path, cacheSize);\r
fDefinition = definition;\r
}\r
\r
public CustomTxtEvent parseFirstLine(CustomTxtTraceContext context) {\r
- CustomTxtEvent event = new CustomTxtEvent(fDefinition, TmfTimestamp.Zero, new TmfEventSource(""), fEventType, new TmfEventReference("")); //$NON-NLS-1$ //$NON-NLS-2$\r
+ CustomTxtEvent event = new CustomTxtEvent(fDefinition, this, TmfTimestamp.Zero, new TmfEventSource(""), fEventType, new TmfEventReference("")); //$NON-NLS-1$ //$NON-NLS-2$\r
event.processGroups(context.inputLine, context.firstLineMatcher);\r
event.setContent(new CustomEventContent(event, new StringBuffer(context.firstLine)));\r
return event;\r
import org.eclipse.linuxtools.tmf.event.TmfEventSource;\r
import org.eclipse.linuxtools.tmf.event.TmfEventType;\r
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;\r
+import org.eclipse.linuxtools.tmf.trace.ITmfTrace;\r
\r
public class CustomXmlEvent extends CustomEvent {\r
\r
+ public CustomXmlEvent(CustomXmlTraceDefinition definition) {\r
+ super(definition);\r
+ fType = new CustomXmlEventType(definition);\r
+ }\r
+\r
public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {\r
super(definition, other);\r
}\r
\r
- public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
- super(definition, timestamp, source, type, reference);\r
+ public CustomXmlEvent(CustomXmlTraceDefinition definition, ITmfTrace<?> parentTrace, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
+ super(definition, parentTrace, timestamp, source, type, reference);\r
}\r
\r
public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfTimestamp originalTS, TmfTimestamp effectiveTS, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
private CustomXmlEventType fEventType;\r
private InputElement fRecordInputElement;\r
\r
+ public CustomXmlTrace(CustomXmlTraceDefinition definition) {\r
+ fDefinition = definition;\r
+ fEventType = new CustomXmlEventType(fDefinition);\r
+ fRecordInputElement = getRecordInputElement(fDefinition.rootInputElement);\r
+ }\r
+\r
public CustomXmlTrace(String name, CustomXmlTraceDefinition definition, String path, int cacheSize) throws FileNotFoundException {\r
super(name, CustomXmlEvent.class, path, cacheSize);\r
fDefinition = definition;\r
}\r
\r
public CustomXmlEvent extractEvent(Element element, InputElement inputElement) {\r
- CustomXmlEvent event = new CustomXmlEvent(fDefinition, TmfTimestamp.Zero, new TmfEventSource(""), fEventType, new TmfEventReference("")); //$NON-NLS-1$ //$NON-NLS-2$\r
+ CustomXmlEvent event = new CustomXmlEvent(fDefinition, this, TmfTimestamp.Zero, new TmfEventSource(""), fEventType, new TmfEventReference("")); //$NON-NLS-1$ //$NON-NLS-2$\r
event.setContent(new CustomEventContent(event, new StringBuffer()));\r
parseElement(element, event, inputElement);\r
return event;\r
}\r
\r
private void updatePreviewTable() {\r
- final int MAX_NUM_ENTRIES = 50;\r
+ final int CACHE_SIZE = 50;\r
definition.outputs = extractOutputs();\r
\r
try {\r
writer.write(wizard.inputPage.getInputText());\r
writer.close();\r
\r
- ITmfTrace<?> trace = new CustomTxtTrace(tmpFile.getName(), definition, tmpFile.getAbsolutePath(), MAX_NUM_ENTRIES);\r
+ ITmfTrace<?> trace = new CustomTxtTrace(tmpFile.getName(), definition, tmpFile.getAbsolutePath(), CACHE_SIZE);\r
previewTable.dispose();\r
- previewTable = new CustomEventsTable(definition, tableContainer, MAX_NUM_ENTRIES);\r
+ previewTable = new CustomEventsTable(definition, tableContainer, CACHE_SIZE);\r
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
previewTable.setTrace(trace, true);\r
} catch (FileNotFoundException e) {\r
}\r
\r
private void updatePreviewTable() {\r
- final int MAX_NUM_ENTRIES = 50;\r
+ final int CACHE_SIZE = 50;\r
definition.outputs = extractOutputs();\r
\r
try {\r
writer.write(wizard.inputPage.getInputText());\r
writer.close();\r
\r
- ITmfTrace<?> trace = new CustomXmlTrace(tmpFile.getName(), definition, tmpFile.getAbsolutePath(), MAX_NUM_ENTRIES);\r
+ ITmfTrace<?> trace = new CustomXmlTrace(tmpFile.getName(), definition, tmpFile.getAbsolutePath(), CACHE_SIZE);\r
previewTable.dispose();\r
- previewTable = new CustomEventsTable(definition, tableContainer, MAX_NUM_ENTRIES);\r
+ previewTable = new CustomEventsTable(definition, tableContainer, CACHE_SIZE);\r
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
previewTable.setTrace(trace, true);\r
} catch (FileNotFoundException e) {\r
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.tmf.TmfCorePlugin;
import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
+import org.eclipse.linuxtools.tmf.util.TmfTraceType;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
//private static final ImageDescriptor SELECTED_ICON = ImageDescriptor.createFromImage(TmfUiPlugin.getDefault().getImageFromPath("icons/elcl16/bullet.gif")); //$NON-NLS-1$
private static final ImageDescriptor SELECTED_ICON = TmfUiPlugin.getDefault().getImageDescripterFromPath(
"icons/elcl16/bullet.gif"); //$NON-NLS-1$
+ private static final String BUNDLE_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.project.trace.select_trace_type.bundle"; //$NON-NLS-1$
+ private static final String TYPE_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.project.trace.select_trace_type.type"; //$NON-NLS-1$
+ private static final String ICON_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.project.trace.select_trace_type.icon"; //$NON-NLS-1$
+ private static final String SELECT_TRACE_TYPE_COMMAND_ID = "org.eclipse.linuxtools.tmf.ui.command.project.trace.select_trace_type"; //$NON-NLS-1$
+ private static final String CUSTOM_TXT_CATEGORY = "Custom Text"; //$NON-NLS-1$
+ private static final String CUSTOM_XML_CATEGORY = "Custom XML"; //$NON-NLS-1$
+ private static final String DEFAULT_TRACE_ICON_PATH = "icons/elcl16/trace.gif"; //$NON-NLS-1$
@Override
protected IContributionItem[] getContributionItems() {
- final String CATEGORY_ELEMENT = "category"; //$NON-NLS-1$
- final String TYPE_ELEMENT = "type"; //$NON-NLS-1$
- final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
- final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
- final String BUNDLE_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.project.trace.select_trace_type.bundle"; //$NON-NLS-1$
- final String TYPE_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.project.trace.select_trace_type.type"; //$NON-NLS-1$
- final String ICON_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.project.trace.select_trace_type.icon"; //$NON-NLS-1$
- final String SELECT_TRACE_TYPE_COMMAND_ID = "org.eclipse.linuxtools.tmf.ui.command.project.trace.select_trace_type"; //$NON-NLS-1$
-
- Map<String, String> params;
LinkedList<IContributionItem> list = new LinkedList<IContributionItem>();
HashMap<String, MenuManager> categoriesMap = new HashMap<String, MenuManager>();
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
- TmfCorePlugin.TMF_TRACE_TYPE_ID);
+ TmfTraceType.TMF_TRACE_TYPE_ID);
for (IConfigurationElement ce : config) {
- if (ce.getName().equals(CATEGORY_ELEMENT)) {
- MenuManager subMenu = new MenuManager(ce.getAttribute(NAME_ATTRIBUTE));
- categoriesMap.put(ce.getAttribute(ID_ATTRIBUTE), subMenu);
+ if (ce.getName().equals(TmfTraceType.CATEGORY_ELEM)) {
+ MenuManager subMenu = new MenuManager(ce.getAttribute(TmfTraceType.NAME_ATTR));
+ categoriesMap.put(ce.getAttribute(TmfTraceType.ID_ATTR), subMenu);
list.add(subMenu);
}
}
+ if (CustomTxtTraceDefinition.loadAll().length > 0) {
+ MenuManager subMenu = new MenuManager(CUSTOM_TXT_CATEGORY);
+ categoriesMap.put(CUSTOM_TXT_CATEGORY, subMenu);
+ list.add(subMenu);
+ }
+ if (CustomXmlTraceDefinition.loadAll().length > 0) {
+ MenuManager subMenu = new MenuManager(CUSTOM_XML_CATEGORY);
+ categoriesMap.put(CUSTOM_XML_CATEGORY, subMenu);
+ list.add(subMenu);
+ }
HashSet<String> selectedTraceTypes = new HashSet<String>();
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
for (IConfigurationElement ce : config) {
- if (ce.getName().equals(TYPE_ELEMENT)) {
+ if (ce.getName().equals(TmfTraceType.TYPE_ELEM)) {
String traceBundle = ce.getContributor().getName();
- String traceType = ce.getAttribute(ID_ATTRIBUTE);
- String traceIcon = ce.getAttribute(TmfTraceElement.ICON);
- params = new HashMap<String, String>();
- params.put(BUNDLE_PARAMETER, traceBundle);
- params.put(TYPE_PARAMETER, traceType);
- params.put(ICON_PARAMETER, traceIcon);
-
- String label = ce.getAttribute(NAME_ATTRIBUTE).replaceAll("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
- ImageDescriptor icon = null;
- if (selectedTraceTypes.contains(traceType)) {
- icon = SELECTED_ICON;
- }
+ String traceTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
+ String traceIcon = ce.getAttribute(TmfTraceType.ICON_ATTR);
+ String label = ce.getAttribute(TmfTraceType.NAME_ATTR).replaceAll("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
+ boolean selected = selectedTraceTypes.contains(traceTypeId);
+ MenuManager subMenu = categoriesMap.get(ce.getAttribute(TmfTraceType.CATEGORY_ATTR));
- CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow(), "my.parameterid", // id //$NON-NLS-1$
- SELECT_TRACE_TYPE_COMMAND_ID, // commandId
- params, // parameters
- icon, // icon
- icon, // disabled icon
- icon, // hover icon
- label, // label
- null, // mnemonic
- null, // tooltip
- CommandContributionItem.STYLE_PUSH, // style
- null, // help context id
- true // visibleEnable
- );
-
- MenuManager subMenu = categoriesMap.get(ce.getAttribute(TmfTraceElement.CATEGORY));
- if (subMenu != null) {
- subMenu.add(new CommandContributionItem(param));
- } else {
- list.add(new CommandContributionItem(param));
- }
+ addContributionItem(list, traceBundle, traceTypeId, traceIcon, label, selected, subMenu);
}
}
+ // add the custom trace types
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
+ String traceBundle = TmfUiPlugin.getDefault().getBundle().getSymbolicName();
+ String traceTypeId = CustomTxtTrace.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$
+ String traceIcon = DEFAULT_TRACE_ICON_PATH;
+ String label = def.definitionName;
+ boolean selected = selectedTraceTypes.contains(traceTypeId);
+ MenuManager subMenu = categoriesMap.get(CUSTOM_TXT_CATEGORY);
+
+ addContributionItem(list, traceBundle, traceTypeId, traceIcon, label, selected, subMenu);
+ }
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
+ String traceBundle = TmfUiPlugin.getDefault().getBundle().getSymbolicName();
+ String traceTypeId = CustomXmlTrace.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$
+ String traceIcon = DEFAULT_TRACE_ICON_PATH;
+ String label = def.definitionName;
+ boolean selected = selectedTraceTypes.contains(traceTypeId);
+ MenuManager subMenu = categoriesMap.get(CUSTOM_XML_CATEGORY);
+
+ addContributionItem(list, traceBundle, traceTypeId, traceIcon, label, selected, subMenu);
+ }
+
return list.toArray(new IContributionItem[list.size()]);
}
+ private void addContributionItem(LinkedList<IContributionItem> list,
+ String traceBundle, String traceTypeId, String traceIcon, String label, boolean selected,
+ MenuManager subMenu) {
+ Map<String, String> params;
+
+ params = new HashMap<String, String>();
+ params.put(BUNDLE_PARAMETER, traceBundle);
+ params.put(TYPE_PARAMETER, traceTypeId);
+ params.put(ICON_PARAMETER, traceIcon);
+
+ ImageDescriptor icon = null;
+ if (selected) {
+ icon = SELECTED_ICON;
+ }
+
+ CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow(), "my.parameterid", // id //$NON-NLS-1$
+ SELECT_TRACE_TYPE_COMMAND_ID, // commandId
+ params, // parameters
+ icon, // icon
+ icon, // disabled icon
+ icon, // hover icon
+ label, // label
+ null, // mnemonic
+ null, // tooltip
+ CommandContributionItem.STYLE_PUSH, // style
+ null, // help context id
+ true // visibleEnable
+ );
+
+ if (subMenu != null) {
+ subMenu.add(new CommandContributionItem(param));
+ } else {
+ list.add(new CommandContributionItem(param));
+ }
+ }
}
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.linuxtools.tmf.TmfCorePlugin;
import org.eclipse.linuxtools.tmf.event.TmfEvent;
import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtEvent;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlEvent;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;
+import org.eclipse.linuxtools.tmf.util.TmfTraceType;
import org.eclipse.ui.IActionFilter;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
public static final QualifiedName TRACETYPE = new QualifiedName("org.eclipse.linuxtools.tmf", "tracetype.id"); //$NON-NLS-1$//$NON-NLS-2$
public static final QualifiedName TRACEICON = new QualifiedName("org.eclipse.linuxtools.tmf", "tracetype.icon"); //$NON-NLS-1$//$NON-NLS-2$
- // Extension point fields
- public static final String TYPE = "type"; //$NON-NLS-1$
- public static final String ID = "id"; //$NON-NLS-1$
- public static final String CATEGORY = "category"; //$NON-NLS-1$
- public static final String NAME = "name"; //$NON-NLS-1$
- public static final String TRACE_TYPE = "trace_type"; //$NON-NLS-1$
- public static final String EVENT_TYPE = "event_type"; //$NON-NLS-1$
- public static final String ICON = "icon"; //$NON-NLS-1$
-
- public static final String DEFAULT_EDITOR = "defaultEditor"; //$NON-NLS-1$
- public static final String EVENTS_TABLE_TYPE = "eventsTableType"; //$NON-NLS-1$
- public static final String CLASS = "class"; //$NON-NLS-1$
-
// Other attributes
public static final String BUNDLE = "bundle"; //$NON-NLS-1$
public static final String IS_LINKED = "isLinked"; //$NON-NLS-1$
// Initialize statically at startup
public static void init() {
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfCorePlugin.TMF_TRACE_TYPE_ID);
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfTraceType.TMF_TRACE_TYPE_ID);
for (IConfigurationElement ce : config) {
- String attribute = ce.getName();
- if (attribute.equals(TYPE)) {
- String traceTypeId = ce.getAttribute(ID);
+ String elementName = ce.getName();
+ if (elementName.equals(TmfTraceType.TYPE_ELEM)) {
+ String traceTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
sfTraceTypeAttributes.put(traceTypeId, ce);
- } else if (attribute.equals(CATEGORY)) {
- String categoryId = ce.getAttribute(ID);
+ } else if (elementName.equals(TmfTraceType.CATEGORY_ELEM)) {
+ String categoryId = ce.getAttribute(TmfTraceType.ID_ATTR);
sfTraceCategories.put(categoryId, ce);
}
}
public ITmfTrace<?> instantiateTrace() {
try {
if (fTraceTypeId != null) {
+ if (fTraceTypeId.startsWith(CustomTxtTrace.class.getCanonicalName())) {
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
+ if (fTraceTypeId.equals(CustomTxtTrace.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$
+ return new CustomTxtTrace(def);
+ }
+ }
+ }
+ if (fTraceTypeId.startsWith(CustomXmlTrace.class.getCanonicalName())) {
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
+ if (fTraceTypeId.equals(CustomXmlTrace.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$
+ return new CustomXmlTrace(def);
+ }
+ }
+ }
IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
- ITmfTrace<?> trace = (ITmfTrace<?>) ce.createExecutableExtension(TRACE_TYPE);
+ ITmfTrace<?> trace = (ITmfTrace<?>) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);
return trace;
}
} catch (CoreException e) {
public TmfEvent instantiateEvent() {
try {
if (fTraceTypeId != null) {
+ if (fTraceTypeId.startsWith(CustomTxtTrace.class.getCanonicalName())) {
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
+ if (fTraceTypeId.equals(CustomTxtTrace.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$
+ return new CustomTxtEvent(def);
+ }
+ }
+ }
+ if (fTraceTypeId.startsWith(CustomXmlTrace.class.getCanonicalName())) {
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
+ if (fTraceTypeId.equals(CustomXmlTrace.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$
+ return new CustomXmlEvent(def);
+ }
+ }
+ }
IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
- TmfEvent event = (TmfEvent) ce.createExecutableExtension(EVENT_TYPE);
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);
return event;
}
} catch (CoreException e) {
public String getEditorId() {
if (fTraceTypeId != null) {
+ if (fTraceTypeId.startsWith(CustomTxtTrace.class.getCanonicalName())) {
+ return TmfEventsEditor.ID;
+ }
+ if (fTraceTypeId.startsWith(CustomXmlTrace.class.getCanonicalName())) {
+ return TmfEventsEditor.ID;
+ }
IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
- IConfigurationElement[] defaultEditorCE = ce.getChildren(DEFAULT_EDITOR);
+ IConfigurationElement[] defaultEditorCE = ce.getChildren(TmfTraceType.DEFAULT_EDITOR_ELEM);
if (defaultEditorCE.length == 1) {
- return defaultEditorCE[0].getAttribute(ID);
+ return defaultEditorCE[0].getAttribute(TmfTraceType.ID_ATTR);
}
}
return null;
if (sfEventType.equals(id)) {
if (fTraceTypeId != null) {
IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
- return (ce != null) ? (getCategory(ce) + " : " + ce.getAttribute(NAME)) : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ return (ce != null) ? (getCategory(ce) + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR)) : ""; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
private String getCategory(IConfigurationElement ce) {
- String categoryId = ce.getAttribute(CATEGORY);
+ String categoryId = ce.getAttribute(TmfTraceType.CATEGORY_ATTR);
if (categoryId != null) {
IConfigurationElement category = sfTraceCategories.get(categoryId);
- if (category != null && !category.equals("")) { //$NON-NLS-1$
- return category.getAttribute(NAME);
+ if (category != null) {
+ return category.getAttribute(TmfTraceType.NAME_ATTR);
}
}
return "[no category]"; //$NON-NLS-1$
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.linuxtools.tmf.TmfCorePlugin;
import org.eclipse.linuxtools.tmf.TmfProjectNature;
import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;
+import org.eclipse.linuxtools.tmf.util.TmfTraceType;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.FocusEvent;
// ------------------------------------------------------------------------
static private final String IMPORT_WIZARD_PAGE = "ImportTraceWizardPage"; //$NON-NLS-1$
+ private static final String CUSTOM_TXT_CATEGORY = "Custom Text"; //$NON-NLS-1$
+ private static final String CUSTOM_XML_CATEGORY = "Custom XML"; //$NON-NLS-1$
+ private static final String DEFAULT_TRACE_ICON_PATH = "icons/elcl16/trace.gif"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
private String[] getAvailableTraceTypes() {
// Populate the Categories and Trace Types
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfCorePlugin.TMF_TRACE_TYPE_ID);
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfTraceType.TMF_TRACE_TYPE_ID);
for (IConfigurationElement ce : config) {
- String attribute = ce.getName();
- if (attribute.equals(TmfTraceElement.TYPE)) {
- String traceTypeId = ce.getAttribute(TmfTraceElement.ID);
+ String elementName = ce.getName();
+ if (elementName.equals(TmfTraceType.TYPE_ELEM)) {
+ String traceTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
fTraceTypeAttributes.put(traceTypeId, ce);
- } else if (attribute.equals(TmfTraceElement.CATEGORY)) {
- String categoryId = ce.getAttribute(TmfTraceElement.ID);
+ } else if (elementName.equals(TmfTraceType.CATEGORY_ELEM)) {
+ String categoryId = ce.getAttribute(TmfTraceType.ID_ATTR);
fTraceCategories.put(categoryId, ce);
}
}
List<String> traceTypes = new ArrayList<String>();
for (String typeId : fTraceTypeAttributes.keySet()) {
IConfigurationElement ce = fTraceTypeAttributes.get(typeId);
- String traceTypeName = getCategory(ce) + " : " + ce.getAttribute(TmfTraceElement.NAME); //$NON-NLS-1$
+ String traceTypeName = getCategory(ce) + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR); //$NON-NLS-1$
fTraceAttributes.put(traceTypeName, ce);
traceTypes.add(traceTypeName);
}
Collections.sort(traceTypes);
- // TODO: Add Custom Parsers
+ // add the custom trace types
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
+ String traceTypeName = CUSTOM_TXT_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$
+ traceTypes.add(traceTypeName);
+ }
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
+ String traceTypeName = CUSTOM_XML_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$
+ traceTypes.add(traceTypeName);
+ }
// Format result
- String[] result = new String[traceTypes.size()];
- result = traceTypes.toArray(result);
- return result;
+ return traceTypes.toArray(new String[0]);
}
private String getCategory(IConfigurationElement ce) {
- String categoryId = ce.getAttribute(TmfTraceElement.CATEGORY);
+ String categoryId = ce.getAttribute(TmfTraceType.CATEGORY_ATTR);
if (categoryId != null) {
IConfigurationElement category = fTraceCategories.get(categoryId);
if (category != null && !category.equals("")) { //$NON-NLS-1$
- return category.getAttribute(TmfTraceElement.NAME);
+ return category.getAttribute(TmfTraceType.NAME_ATTR);
}
}
return "[no category]"; //$NON-NLS-1$
// Perform trace validation
String traceTypeName = fTraceTypes.getText();
- if (traceTypeName != null && !"".equals(traceTypeName)) { //$NON-NLS-1$
+ if (traceTypeName != null && !"".equals(traceTypeName) && //$NON-NLS-1$
+ !traceTypeName.startsWith(CUSTOM_TXT_CATEGORY) && !traceTypeName.startsWith(CUSTOM_XML_CATEGORY)) {
+
List<File> traces = isolateTraces();
for (File trace : traces) {
- IConfigurationElement ce = fTraceAttributes.get(traceTypeName);
ITmfTrace<?> tmfTrace = null;
try {
- tmfTrace = (ITmfTrace<?>) ce.createExecutableExtension(TmfTraceElement.TRACE_TYPE);
+ IConfigurationElement ce = fTraceAttributes.get(traceTypeName);
+ tmfTrace = (ITmfTrace<?>) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);
if (!tmfTrace.validate(fProject, trace.getAbsolutePath())) {
setMessage(null);
setErrorMessage(Messages.ImportTraceWizard_TraceValidationFailed);
if (fileSystemObjects.size() > 0) {
boolean ok = importResources(sourceDirPath, fileSystemObjects);
+ String traceBundle = null;
+ String traceTypeId = null;
+ String traceIcon = null;
String traceType = fTraceTypes.getText();
- IConfigurationElement ce = fTraceAttributes.get(traceType);
- if (ok && !traceType.equals("") && ce != null) { //$NON-NLS-1$
+ if (traceType.startsWith(CUSTOM_TXT_CATEGORY)) {
+ ok = false;
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
+ if (traceType.equals(CUSTOM_TXT_CATEGORY + " : " + def.definitionName)) { //$NON-NLS-1$
+ ok = true;
+ traceBundle = TmfUiPlugin.getDefault().getBundle().getSymbolicName();
+ traceTypeId = CustomTxtTrace.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$
+ traceIcon = DEFAULT_TRACE_ICON_PATH;
+ break;
+ }
+ }
+ } else if (traceType.startsWith(CUSTOM_XML_CATEGORY)) {
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
+ if (traceType.equals(CUSTOM_XML_CATEGORY + " : " + def.definitionName)) { //$NON-NLS-1$
+ ok = true;
+ traceBundle = TmfUiPlugin.getDefault().getBundle().getSymbolicName();
+ traceTypeId = CustomXmlTrace.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$
+ traceIcon = DEFAULT_TRACE_ICON_PATH;
+ break;
+ }
+ }
+ } else {
+ IConfigurationElement ce = fTraceAttributes.get(traceType);
+ if (ce != null) {
+ traceBundle = ce.getContributor().getName();
+ traceTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
+ traceIcon = ce.getAttribute(TmfTraceType.ICON_ATTR);
+ } else {
+ ok = false;
+ }
+ }
+ if (ok && !traceType.equals("")) { //$NON-NLS-1$
// Tag the selected traces with their type
List<String> files = new ArrayList<String>(fileSystemObjects.keySet());
Collections.sort(files);
if (resource != null) {
try {
// Set the trace properties for this resource
- resource.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, ce.getContributor().getName());
- resource.setPersistentProperty(TmfTraceElement.TRACETYPE, ce.getAttribute(TmfTraceElement.ID));
- resource.setPersistentProperty(TmfTraceElement.TRACEICON, ce.getAttribute(TmfTraceElement.ICON));
+ resource.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, traceBundle);
+ resource.setPersistentProperty(TmfTraceElement.TRACETYPE, traceTypeId);
+ resource.setPersistentProperty(TmfTraceElement.TRACEICON, traceIcon);
} catch (CoreException e) {
e.printStackTrace();
}
import java.util.Map;\r
import java.util.Map.Entry;\r
\r
+import org.eclipse.core.runtime.CoreException;\r
+import org.eclipse.core.runtime.IConfigurationElement;\r
import org.eclipse.jface.action.Action;\r
import org.eclipse.jface.action.IMenuListener;\r
import org.eclipse.jface.action.IMenuManager;\r
import org.eclipse.jface.viewers.SelectionChangedEvent;\r
import org.eclipse.jface.viewers.StructuredSelection;\r
import org.eclipse.jface.viewers.TreeViewer;\r
+import org.eclipse.linuxtools.tmf.event.TmfEvent;\r
+import org.eclipse.linuxtools.tmf.event.TmfEventType;\r
import org.eclipse.linuxtools.tmf.filter.model.ITmfFilterTreeNode;\r
import org.eclipse.linuxtools.tmf.filter.model.TmfFilterAndNode;\r
import org.eclipse.linuxtools.tmf.filter.model.TmfFilterCompareNode;\r
import org.eclipse.linuxtools.tmf.filter.model.TmfFilterOrNode;\r
import org.eclipse.linuxtools.tmf.filter.model.TmfFilterRootNode;\r
import org.eclipse.linuxtools.tmf.ui.internal.Messages;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.ParserProviderManager;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtEvent;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlEvent;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;\r
+import org.eclipse.linuxtools.tmf.util.TmfTraceType;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.SashForm;\r
import org.eclipse.swt.events.FocusEvent;\r
\r
class FilterViewer extends Composite {\r
\r
- private static final Map<String, Entry<String, String>> EVENT_TYPES_MAP;\r
- static {\r
- Map<String, Entry<String, String>> eventTypesMap = new LinkedHashMap<String, Entry<String, String>>();\r
- for (Entry<String, Map<String, String>> categoryEntry : ParserProviderManager.getParserMap().entrySet()) {\r
- for (Entry<String, String> parserEntry : categoryEntry.getValue().entrySet()) {\r
- String prefix = categoryEntry.getKey() + " - " + parserEntry.getKey() + " - "; //$NON-NLS-1$ //$NON-NLS-2$\r
- for (Entry<String, String> eventTypeEntry : ParserProviderManager.getEventTypeMapForParser(parserEntry.getValue()).entrySet()) {\r
- eventTypesMap.put(prefix + eventTypeEntry.getKey(), eventTypeEntry);\r
- }\r
- }\r
- }\r
- EVENT_TYPES_MAP = eventTypesMap;\r
- }\r
- \r
- private static final String[] FIELDS_LIST;\r
- static {\r
- ArrayList<String> fieldsList = new ArrayList<String>();\r
- for (Entry<String, Map<String, String>> categoryEntry : ParserProviderManager.getParserMap().entrySet()) {\r
- for (Entry<String, String> parserEntry : categoryEntry.getValue().entrySet()) {\r
- fieldsList.add(""); //$NON-NLS-1$\r
- fieldsList.add("["+ categoryEntry.getKey() +" - " + parserEntry.getKey() +"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
- for (String eventType : ParserProviderManager.getEventTypeMapForParser(parserEntry.getValue()).values()) {\r
- for (String field : ParserProviderManager.getFieldLabelsForEventType(eventType)) {\r
- fieldsList.add(field);\r
- }\r
- }\r
- }\r
- }\r
- FIELDS_LIST = fieldsList.toArray(new String[0]);\r
- }\r
- \r
+ private static final String CUSTOM_TXT_CATEGORY = "Custom Text"; //$NON-NLS-1$\r
+ private static final String CUSTOM_XML_CATEGORY = "Custom XML"; //$NON-NLS-1$\r
+\r
private TreeViewer fViewer;\r
private Composite fComposite;\r
\r
- public FilterViewer(Composite parent, int style) {\r
- super(parent, style);\r
+ public FilterViewer(Composite parent, int style) {\r
+ super(parent, style);\r
\r
- setLayout(new FillLayout());\r
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);\r
- setLayoutData(gd);\r
- \r
+ setLayout(new FillLayout());\r
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);\r
+ setLayoutData(gd);\r
+ \r
final SashForm sash = new SashForm(this, SWT.HORIZONTAL);\r
\r
- // Create the tree viewer to display the filter tree\r
- fViewer = new TreeViewer(sash, SWT.NONE);\r
- fViewer.setContentProvider(new FilterTreeContentProvider());\r
- fViewer.setLabelProvider(new FilterTreeLabelProvider());\r
- fViewer.setInput(new TmfFilterRootNode());\r
- \r
- // Create the empty filter node properties panel\r
- fComposite = new Composite(sash, SWT.NONE);\r
- GridLayout gl = new GridLayout();\r
- gl.marginHeight = 0;\r
- gl.marginWidth = 0;\r
- fComposite.setLayout(gl);\r
+ // Create the tree viewer to display the filter tree\r
+ fViewer = new TreeViewer(sash, SWT.NONE);\r
+ fViewer.setContentProvider(new FilterTreeContentProvider());\r
+ fViewer.setLabelProvider(new FilterTreeLabelProvider());\r
+ fViewer.setInput(new TmfFilterRootNode());\r
+ \r
+ // Create the empty filter node properties panel\r
+ fComposite = new Composite(sash, SWT.NONE);\r
+ GridLayout gl = new GridLayout();\r
+ gl.marginHeight = 0;\r
+ gl.marginWidth = 0;\r
+ fComposite.setLayout(gl);\r
\r
- createContextMenu();\r
- \r
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {\r
- @Override\r
+ createContextMenu();\r
+ \r
+ fViewer.addSelectionChangedListener(new ISelectionChangedListener() {\r
+ @Override\r
public void selectionChanged(SelectionChangedEvent event) {\r
- if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {\r
- // Update the filter node properties panel to the selection\r
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();\r
- ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();\r
- updateFilterNodeComposite(node);\r
- // Highlight the selection's children\r
- highlightTreeItems(fViewer.getTree().getSelection()[0].getItems());\r
- } else {\r
- updateFilterNodeComposite(null);\r
- }\r
- }\r
- });\r
- }\r
- \r
- /**\r
- * Create the context menu for the tree viewer\r
- */\r
- private void createContextMenu() {\r
- // Adds root context menu\r
- MenuManager menuManager = new MenuManager();\r
- menuManager.setRemoveAllWhenShown(true);\r
- menuManager.addMenuListener(new IMenuListener() {\r
- @Override\r
+ if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {\r
+ // Update the filter node properties panel to the selection\r
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();\r
+ ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();\r
+ updateFilterNodeComposite(node);\r
+ // Highlight the selection's children\r
+ highlightTreeItems(fViewer.getTree().getSelection()[0].getItems());\r
+ } else {\r
+ updateFilterNodeComposite(null);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ \r
+ /**\r
+ * Create the context menu for the tree viewer\r
+ */\r
+ private void createContextMenu() {\r
+ // Adds root context menu\r
+ MenuManager menuManager = new MenuManager();\r
+ menuManager.setRemoveAllWhenShown(true);\r
+ menuManager.addMenuListener(new IMenuListener() {\r
+ @Override\r
public void menuAboutToShow(IMenuManager manager) {\r
- fillContextMenu(manager);\r
- }\r
- });\r
+ fillContextMenu(manager);\r
+ }\r
+ });\r
\r
- // Context\r
- Menu contextMenu = menuManager.createContextMenu(fViewer.getTree());\r
+ // Context\r
+ Menu contextMenu = menuManager.createContextMenu(fViewer.getTree());\r
\r
- // Publish it\r
- fViewer.getTree().setMenu(contextMenu);\r
- }\r
- \r
- /**\r
- * Fill the context menu for the tree viewer\r
- */\r
- protected void fillContextMenu(IMenuManager manager) {\r
- final ISelection selection = fViewer.getSelection();\r
- ITmfFilterTreeNode filterTreeNode = null;\r
- if (selection instanceof StructuredSelection) {\r
- Object element = ((StructuredSelection) selection).getFirstElement();\r
- if (element instanceof ITmfFilterTreeNode) {\r
- filterTreeNode = (ITmfFilterTreeNode) element;\r
- }\r
- }\r
+ // Publish it\r
+ fViewer.getTree().setMenu(contextMenu);\r
+ }\r
+ \r
+ /**\r
+ * Fill the context menu for the tree viewer\r
+ */\r
+ protected void fillContextMenu(IMenuManager manager) {\r
+ final ISelection selection = fViewer.getSelection();\r
+ ITmfFilterTreeNode filterTreeNode = null;\r
+ if (selection instanceof StructuredSelection) {\r
+ Object element = ((StructuredSelection) selection).getFirstElement();\r
+ if (element instanceof ITmfFilterTreeNode) {\r
+ filterTreeNode = (ITmfFilterTreeNode) element;\r
+ }\r
+ }\r
\r
- final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
- \r
- if (selectedNode != null) {\r
- \r
- fillContextMenuForNode(selectedNode, manager);\r
- \r
- if (selectedNode.getValidChildren().size() > 0) {\r
- manager.add(new Separator());\r
- }\r
+ final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
+ \r
+ if (selectedNode != null) {\r
+ \r
+ fillContextMenuForNode(selectedNode, manager);\r
+ \r
+ if (selectedNode.getValidChildren().size() > 0) {\r
+ manager.add(new Separator());\r
+ }\r
\r
- Action deleteAction = new Action() {\r
- @Override\r
- public void run() {\r
- selectedNode.remove();\r
- fViewer.refresh();\r
- }\r
- };\r
- deleteAction.setText(Messages.FilterViewer_DeleteActionText);\r
- manager.add(deleteAction);\r
- \r
- manager.add(new Separator());\r
- }\r
+ Action deleteAction = new Action() {\r
+ @Override\r
+ public void run() {\r
+ selectedNode.remove();\r
+ fViewer.refresh();\r
+ }\r
+ };\r
+ deleteAction.setText(Messages.FilterViewer_DeleteActionText);\r
+ manager.add(deleteAction);\r
+ \r
+ manager.add(new Separator());\r
+ }\r
\r
- if (fViewer.getInput() instanceof TmfFilterRootNode || selectedNode == null) {\r
- final ITmfFilterTreeNode root = (ITmfFilterTreeNode) fViewer.getInput();\r
- \r
- fillContextMenuForNode(root, manager);\r
- }\r
- }\r
- \r
- /**\r
- * Fill the context menu with the valid children of the provided node\r
- */\r
- protected void fillContextMenuForNode(final ITmfFilterTreeNode node, IMenuManager manager) {\r
- for (final String child : node.getValidChildren()) {\r
- final Action action = new Action() {\r
- @Override\r
- public void run() {\r
- ITmfFilterTreeNode newNode = null;\r
- if (TmfFilterNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterNode(node, ""); //$NON-NLS-1$\r
- } else if (TmfFilterEventTypeNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterEventTypeNode(node);\r
- } else if (TmfFilterAndNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterAndNode(node);\r
- } else if (TmfFilterOrNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterOrNode(node);\r
- } else if (TmfFilterContainsNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterContainsNode(node);\r
- } else if (TmfFilterEqualsNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterEqualsNode(node);\r
- } else if (TmfFilterMatchesNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterMatchesNode(node);\r
- } else if (TmfFilterCompareNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterCompareNode(node);\r
- }\r
- if (newNode != null) {\r
- fViewer.refresh();\r
- fViewer.setSelection(new StructuredSelection(newNode), true);\r
- }\r
- }\r
- };\r
- if (TmfFilterNode.NODE_NAME.equals(child)) {\r
- action.setText(Messages.FilterViewer_NewPrefix + " " + child); //$NON-NLS-1$\r
- } else {\r
- action.setText(child);\r
- }\r
- manager.add(action);\r
- }\r
- }\r
- \r
- /**\r
- * Create the appropriate filter node properties composite\r
- */\r
- private void updateFilterNodeComposite(ITmfFilterTreeNode node) {\r
- for (Control control : fComposite.getChildren()) {\r
- control.dispose();\r
- }\r
- \r
- if (node instanceof TmfFilterNode) {\r
- new FilterNodeComposite(fComposite, (TmfFilterNode) node);\r
- } else if (node instanceof TmfFilterEventTypeNode) {\r
- new FilterEventTypeNodeComposite(fComposite, (TmfFilterEventTypeNode) node);\r
- } else if (node instanceof TmfFilterAndNode) {\r
- new FilterAndNodeComposite(fComposite, (TmfFilterAndNode) node);\r
- } else if (node instanceof TmfFilterOrNode) {\r
- new FilterOrNodeComposite(fComposite, (TmfFilterOrNode) node);\r
- } else if (node instanceof TmfFilterContainsNode) {\r
- new FilterContainsNodeComposite(fComposite, (TmfFilterContainsNode) node);\r
- } else if (node instanceof TmfFilterEqualsNode) {\r
- new FilterEqualsNodeComposite(fComposite, (TmfFilterEqualsNode) node);\r
- } else if (node instanceof TmfFilterMatchesNode) {\r
- new FilterMatchesNodeComposite(fComposite, (TmfFilterMatchesNode) node);\r
- } else if (node instanceof TmfFilterCompareNode) {\r
- new FilterCompareNodeComposite(fComposite, (TmfFilterCompareNode) node);\r
- } else {\r
- new FilterBaseNodeComposite(fComposite);\r
- }\r
- fComposite.layout();\r
- }\r
- \r
- /**\r
- * Highlight the provided tree items\r
- */\r
- private void highlightTreeItems(TreeItem[] items) {\r
- resetTreeItems(fViewer.getTree().getItems());\r
- for (TreeItem item : items) {\r
- item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));\r
- }\r
+ if (fViewer.getInput() instanceof TmfFilterRootNode || selectedNode == null) {\r
+ final ITmfFilterTreeNode root = (ITmfFilterTreeNode) fViewer.getInput();\r
+ \r
+ fillContextMenuForNode(root, manager);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Fill the context menu with the valid children of the provided node\r
+ */\r
+ protected void fillContextMenuForNode(final ITmfFilterTreeNode node, IMenuManager manager) {\r
+ for (final String child : node.getValidChildren()) {\r
+ final Action action = new Action() {\r
+ @Override\r
+ public void run() {\r
+ ITmfFilterTreeNode newNode = null;\r
+ if (TmfFilterNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterNode(node, ""); //$NON-NLS-1$\r
+ } else if (TmfFilterEventTypeNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterEventTypeNode(node);\r
+ } else if (TmfFilterAndNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterAndNode(node);\r
+ } else if (TmfFilterOrNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterOrNode(node);\r
+ } else if (TmfFilterContainsNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterContainsNode(node);\r
+ } else if (TmfFilterEqualsNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterEqualsNode(node);\r
+ } else if (TmfFilterMatchesNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterMatchesNode(node);\r
+ } else if (TmfFilterCompareNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterCompareNode(node);\r
+ }\r
+ if (newNode != null) {\r
+ fViewer.refresh();\r
+ fViewer.setSelection(new StructuredSelection(newNode), true);\r
+ }\r
+ }\r
+ };\r
+ if (TmfFilterNode.NODE_NAME.equals(child)) {\r
+ action.setText(Messages.FilterViewer_NewPrefix + " " + child); //$NON-NLS-1$\r
+ } else {\r
+ action.setText(child);\r
+ }\r
+ manager.add(action);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Create the appropriate filter node properties composite\r
+ */\r
+ private void updateFilterNodeComposite(ITmfFilterTreeNode node) {\r
+ for (Control control : fComposite.getChildren()) {\r
+ control.dispose();\r
+ }\r
+ \r
+ if (node instanceof TmfFilterNode) {\r
+ new FilterNodeComposite(fComposite, (TmfFilterNode) node);\r
+ } else if (node instanceof TmfFilterEventTypeNode) {\r
+ new FilterEventTypeNodeComposite(fComposite, (TmfFilterEventTypeNode) node);\r
+ } else if (node instanceof TmfFilterAndNode) {\r
+ new FilterAndNodeComposite(fComposite, (TmfFilterAndNode) node);\r
+ } else if (node instanceof TmfFilterOrNode) {\r
+ new FilterOrNodeComposite(fComposite, (TmfFilterOrNode) node);\r
+ } else if (node instanceof TmfFilterContainsNode) {\r
+ new FilterContainsNodeComposite(fComposite, (TmfFilterContainsNode) node);\r
+ } else if (node instanceof TmfFilterEqualsNode) {\r
+ new FilterEqualsNodeComposite(fComposite, (TmfFilterEqualsNode) node);\r
+ } else if (node instanceof TmfFilterMatchesNode) {\r
+ new FilterMatchesNodeComposite(fComposite, (TmfFilterMatchesNode) node);\r
+ } else if (node instanceof TmfFilterCompareNode) {\r
+ new FilterCompareNodeComposite(fComposite, (TmfFilterCompareNode) node);\r
+ } else {\r
+ new FilterBaseNodeComposite(fComposite);\r
+ }\r
+ fComposite.layout();\r
+ }\r
+ \r
+ /**\r
+ * Highlight the provided tree items\r
+ */\r
+ private void highlightTreeItems(TreeItem[] items) {\r
+ resetTreeItems(fViewer.getTree().getItems());\r
+ for (TreeItem item : items) {\r
+ item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));\r
+ }\r
\r
- }\r
- \r
- /**\r
- * Reset the provided tree items (remove highlight)\r
- */\r
- private void resetTreeItems(TreeItem[] items) {\r
- for (TreeItem item : items) {\r
- item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- resetTreeItems(item.getItems());\r
- }\r
- }\r
- \r
- public void setInput(ITmfFilterTreeNode root) {\r
- fViewer.setInput(root);\r
- fViewer.expandAll();\r
- \r
- updateFilterNodeComposite(null);\r
- }\r
- \r
- public ITmfFilterTreeNode getInput() {\r
- return (ITmfFilterTreeNode) fViewer.getInput();\r
- }\r
- \r
- public void refresh() {\r
- fViewer.refresh();\r
- }\r
+ }\r
+ \r
+ /**\r
+ * Reset the provided tree items (remove highlight)\r
+ */\r
+ private void resetTreeItems(TreeItem[] items) {\r
+ for (TreeItem item : items) {\r
+ item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ resetTreeItems(item.getItems());\r
+ }\r
+ }\r
+ \r
+ public void setInput(ITmfFilterTreeNode root) {\r
+ fViewer.setInput(root);\r
+ fViewer.expandAll();\r
+ \r
+ updateFilterNodeComposite(null);\r
+ }\r
+ \r
+ public ITmfFilterTreeNode getInput() {\r
+ return (ITmfFilterTreeNode) fViewer.getInput();\r
+ }\r
+ \r
+ public void refresh() {\r
+ fViewer.refresh();\r
+ }\r
\r
- public void setSelection(ITmfFilterTreeNode node, boolean reveal) {\r
- fViewer.setSelection(new StructuredSelection(node), reveal);\r
- }\r
+ public void setSelection(ITmfFilterTreeNode node, boolean reveal) {\r
+ fViewer.setSelection(new StructuredSelection(node), reveal);\r
+ }\r
\r
- public void setSelection(ITmfFilterTreeNode node) {\r
- fViewer.setSelection(new StructuredSelection(node));\r
- }\r
- \r
- public ITmfFilterTreeNode getSelection() {\r
- final ISelection selection = fViewer.getSelection();\r
- ITmfFilterTreeNode filterTreeNode = null;\r
- if (selection instanceof StructuredSelection) {\r
- Object element = ((StructuredSelection) selection).getFirstElement();\r
- if (element instanceof ITmfFilterTreeNode) {\r
- filterTreeNode = (ITmfFilterTreeNode) element;\r
- }\r
- }\r
+ public void setSelection(ITmfFilterTreeNode node) {\r
+ fViewer.setSelection(new StructuredSelection(node));\r
+ }\r
+ \r
+ public ITmfFilterTreeNode getSelection() {\r
+ final ISelection selection = fViewer.getSelection();\r
+ ITmfFilterTreeNode filterTreeNode = null;\r
+ if (selection instanceof StructuredSelection) {\r
+ Object element = ((StructuredSelection) selection).getFirstElement();\r
+ if (element instanceof ITmfFilterTreeNode) {\r
+ filterTreeNode = (ITmfFilterTreeNode) element;\r
+ }\r
+ }\r
\r
- final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
- return selectedNode;\r
- }\r
- \r
- public void addSelectionChangedListener(ISelectionChangedListener listener) {\r
- fViewer.addSelectionChangedListener(listener);\r
- }\r
- \r
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {\r
- fViewer.removeSelectionChangedListener(listener);\r
- }\r
- \r
- private class FilterBaseNodeComposite extends Composite {\r
- \r
- FilterBaseNodeComposite(Composite parent) {\r
- super(parent, SWT.NONE);\r
- setLayout(new GridLayout(2, false));\r
- setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
- setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- }\r
- \r
- protected String[] getFieldsList(ITmfFilterTreeNode node) {\r
- while (node != null) {\r
- if (node instanceof TmfFilterEventTypeNode) {\r
- TmfFilterEventTypeNode eventTypeNode = (TmfFilterEventTypeNode) node;\r
- return ParserProviderManager.getFieldLabelsForEventType(eventTypeNode.getEventType());\r
- }\r
- node = node.getParent();\r
- }\r
- return FIELDS_LIST;\r
- }\r
- }\r
+ final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
+ return selectedNode;\r
+ }\r
+ \r
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {\r
+ fViewer.addSelectionChangedListener(listener);\r
+ }\r
+ \r
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {\r
+ fViewer.removeSelectionChangedListener(listener);\r
+ }\r
+ \r
+ private class FilterBaseNodeComposite extends Composite {\r
+ \r
+ FilterBaseNodeComposite(Composite parent) {\r
+ super(parent, SWT.NONE);\r
+ setLayout(new GridLayout(2, false));\r
+ setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
+ setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ }\r
+ \r
+ protected String[] getFieldsList(ITmfFilterTreeNode node) {\r
+ ArrayList<String> fieldsList = new ArrayList<String>();\r
+ while (node != null) {\r
+ if (node instanceof TmfFilterEventTypeNode) {\r
+ TmfFilterEventTypeNode eventTypeNode = (TmfFilterEventTypeNode) node;\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ if (ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR).equals(eventTypeNode.getEventType())) {\r
+ try {\r
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);\r
+ TmfEventType eventType = event.getType();\r
+ if (eventType != null) {\r
+ for (String field : eventType.getLabels()) {\r
+ fieldsList.add(field);\r
+ }\r
+ }\r
+ } catch (CoreException e) {\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
+ if (eventTypeNode.getEventType().startsWith(CustomTxtEvent.class.getCanonicalName())) {\r
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
+ if (eventTypeNode.getEventType().equals(CustomTxtEvent.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
+ }\r
+ if (eventTypeNode.getEventType().startsWith(CustomXmlEvent.class.getCanonicalName())) {\r
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
+ if (eventTypeNode.getEventType().equals(CustomXmlEvent.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ node = node.getParent();\r
+ }\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ try {\r
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);\r
+ TmfEventType eventType = event.getType();\r
+ if (eventType != null) {\r
+ fieldsList.add("[" + TmfTraceType.getCategoryName(ce.getAttribute(TmfTraceType.CATEGORY_ATTR)) + //$NON-NLS-1$\r
+ " : " + ce.getAttribute(TmfTraceType.NAME_ATTR) + "]"); //$NON-NLS-1$ //$NON-NLS-2$\r
+ for (String field : eventType.getLabels()) {\r
+ fieldsList.add(field);\r
+ }\r
+ fieldsList.add(""); //$NON-NLS-1$\r
+ }\r
+ } catch (CoreException e) {\r
+ }\r
+ }\r
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
+ fieldsList.add("[" + CUSTOM_TXT_CATEGORY + //$NON-NLS-1$\r
+ " : " + def.definitionName + "]"); //$NON-NLS-1$ //$NON-NLS-2$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ fieldsList.add(""); //$NON-NLS-1$\r
+ }\r
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
+ fieldsList.add("[" + CUSTOM_XML_CATEGORY + //$NON-NLS-1$\r
+ " : " + def.definitionName + "]"); //$NON-NLS-1$ //$NON-NLS-2$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ fieldsList.add(""); //$NON-NLS-1$\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
\r
- private class FilterNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterNode fNode;\r
- Text fNameText;\r
- \r
- FilterNodeComposite(Composite parent, TmfFilterNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NameLabel);\r
- \r
- fNameText = new Text(this, SWT.BORDER);\r
- fNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getFilterName() != null && node.getFilterName().length() > 0) {\r
- fNameText.setText(node.getFilterName());\r
- } else {\r
- fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
- }\r
- fNameText.addFocusListener(new FocusListener() {\r
- @Override\r
+ private class FilterNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterNode fNode;\r
+ Text fNameText;\r
+ \r
+ FilterNodeComposite(Composite parent, TmfFilterNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NameLabel);\r
+ \r
+ fNameText = new Text(this, SWT.BORDER);\r
+ fNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getFilterName() != null && node.getFilterName().length() > 0) {\r
+ fNameText.setText(node.getFilterName());\r
+ } else {\r
+ fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
+ }\r
+ fNameText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getFilterName() == null || fNode.getFilterName().length() == 0) {\r
- fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getFilterName() == null || fNode.getFilterName().length() == 0) {\r
+ fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNameText.setText(""); //$NON-NLS-1$\r
- }\r
- fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fNameText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNameText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fNameText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setFilterName(fNameText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- }\r
- }\r
+ if (! fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setFilterName(fNameText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterEventTypeNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterEventTypeNode fNode;\r
- Combo fTypeCombo;\r
- \r
- FilterEventTypeNodeComposite(Composite parent, TmfFilterEventTypeNode node) {\r
- super(parent);\r
- fNode = node;\r
+ private class FilterEventTypeNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterEventTypeNode fNode;\r
+ Combo fTypeCombo;\r
+ Map<String, Object> fEventsTypeMap;\r
+ \r
+ FilterEventTypeNodeComposite(Composite parent, TmfFilterEventTypeNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ fEventsTypeMap = getEventsTypeMap();\r
\r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_TypeLabel);\r
- \r
- fTypeCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);\r
- fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fTypeCombo.setItems(EVENT_TYPES_MAP.keySet().toArray(new String[0]));\r
- if (fNode.getEventType() != null) {\r
- for (Entry <String, Entry<String, String>> eventTypeEntry : EVENT_TYPES_MAP.entrySet()) {\r
- if (eventTypeEntry.getValue().getValue().equals(fNode.getEventType())) {\r
- fTypeCombo.setText(eventTypeEntry.getKey());\r
- }\r
- }\r
- }\r
- fTypeCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_TypeLabel);\r
+ \r
+ fTypeCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);\r
+ fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fTypeCombo.setItems(fEventsTypeMap.keySet().toArray(new String[0]));\r
+ if (fNode.getEventType() != null) {\r
+ for (Entry <String, Object> eventTypeEntry : fEventsTypeMap.entrySet()) {\r
+ Object value = eventTypeEntry.getValue();\r
+ if (value instanceof IConfigurationElement) {\r
+ IConfigurationElement ce = (IConfigurationElement) value;\r
+ if (ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR).equals(fNode.getEventType())) {\r
+ fTypeCombo.setText(eventTypeEntry.getKey());\r
+ }\r
+ } else if (value instanceof CustomTxtTraceDefinition) {\r
+ CustomTxtTraceDefinition def = (CustomTxtTraceDefinition) value;\r
+ String eventType = CustomTxtEvent.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$\r
+ if (eventType.equals(fNode.getEventType())) {\r
+ fTypeCombo.setText(eventTypeEntry.getKey());\r
+ }\r
+ } else if (value instanceof CustomXmlTraceDefinition) {\r
+ CustomXmlTraceDefinition def = (CustomXmlTraceDefinition) value;\r
+ String eventType = CustomXmlEvent.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$\r
+ if (eventType.equals(fNode.getEventType())) {\r
+ fTypeCombo.setText(eventTypeEntry.getKey());\r
+ }\r
+ }\r
+ }\r
+ }\r
+ fTypeCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- for (Entry <String, Entry<String, String>> eventTypeEntry : EVENT_TYPES_MAP.entrySet()) {\r
- if (eventTypeEntry.getKey().equals(fTypeCombo.getText())) {\r
- fNode.setEventType(eventTypeEntry.getValue().getValue());\r
- fNode.setName(eventTypeEntry.getValue().getKey());\r
- fViewer.refresh(fNode);\r
- break;\r
- }\r
- }\r
- }\r
- });\r
- }\r
- }\r
- \r
- private class FilterAndNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterAndNode fNode;\r
- Button fNotButton;\r
- \r
- FilterAndNodeComposite(Composite parent, TmfFilterAndNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
+ for (Entry <String, Object> eventTypeEntry : fEventsTypeMap.entrySet()) {\r
+ if (eventTypeEntry.getKey().equals(fTypeCombo.getText())) {\r
+ Object value = eventTypeEntry.getValue();\r
+ if (value instanceof IConfigurationElement) {\r
+ IConfigurationElement ce = (IConfigurationElement) value;\r
+ fNode.setEventType(ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR));\r
+ fNode.setName(ce.getAttribute(TmfTraceType.NAME_ATTR));\r
+ } else if (value instanceof CustomTxtTraceDefinition) {\r
+ CustomTxtTraceDefinition def = (CustomTxtTraceDefinition) value;\r
+ fNode.setEventType(CustomTxtEvent.class.getCanonicalName() + ":" + def.definitionName); //$NON-NLS-1$\r
+ fNode.setName(def.definitionName);\r
+ } else if (value instanceof CustomXmlTraceDefinition) {\r
+ CustomXmlTraceDefinition def = (CustomXmlTraceDefinition) value;\r
+ fNode.setEventType(CustomXmlEvent.class.getCanonicalName() + ":" + def.definitionName); //$NON-NLS-1$\r
+ fNode.setName(def.definitionName);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ });\r
+ }\r
+\r
+ protected Map<String, Object> getEventsTypeMap() {\r
+ Map<String, Object> eventsTypeMap = new LinkedHashMap<String, Object>();\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ String categoryName = TmfTraceType.getCategoryName(ce.getAttribute(TmfTraceType.CATEGORY_ATTR));\r
+ String text = categoryName + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR); //$NON-NLS-1$\r
+ eventsTypeMap.put(text, ce);\r
+ }\r
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
+ String text = CUSTOM_TXT_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$\r
+ eventsTypeMap.put(text, def);\r
+ }\r
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
+ String text = CUSTOM_XML_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$\r
+ eventsTypeMap.put(text, def);\r
+ }\r
+ return eventsTypeMap;\r
+ }\r
+ }\r
+ \r
+ private class FilterAndNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterAndNode fNode;\r
+ Button fNotButton;\r
+ \r
+ FilterAndNodeComposite(Composite parent, TmfFilterAndNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterOrNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterOrNode fNode;\r
- Button fNotButton;\r
- \r
- FilterOrNodeComposite(Composite parent, TmfFilterOrNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
- \r
- private class FilterContainsNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterContainsNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fValueText;\r
- Button fIgnoreCaseButton;\r
- \r
- FilterContainsNodeComposite(Composite parent, TmfFilterContainsNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterOrNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterOrNode fNode;\r
+ Button fNotButton;\r
+ \r
+ FilterOrNodeComposite(Composite parent, TmfFilterOrNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
+ \r
+ private class FilterContainsNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterContainsNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fValueText;\r
+ Button fIgnoreCaseButton;\r
+ \r
+ FilterContainsNodeComposite(Composite parent, TmfFilterContainsNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ValueLabel);\r
- \r
- fValueText = new Text(this, SWT.BORDER);\r
- fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getValue() != null && node.getValue().length() > 0) {\r
- fValueText.setText(node.getValue());\r
- } else {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- fValueText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ValueLabel);\r
+ \r
+ fValueText = new Text(this, SWT.BORDER);\r
+ fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getValue() != null && node.getValue().length() > 0) {\r
+ fValueText.setText(node.getValue());\r
+ } else {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ fValueText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fValueText.setText(""); //$NON-NLS-1$\r
- }\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fValueText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fValueText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fValueText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setValue(fValueText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
- fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
- fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
- fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
+ if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setValue(fValueText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
+ fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
+ fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
+ fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterEqualsNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterEqualsNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fValueText;\r
- Button fIgnoreCaseButton;\r
- \r
- FilterEqualsNodeComposite(Composite parent, TmfFilterEqualsNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterEqualsNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterEqualsNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fValueText;\r
+ Button fIgnoreCaseButton;\r
+ \r
+ FilterEqualsNodeComposite(Composite parent, TmfFilterEqualsNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ValueLabel);\r
- \r
- fValueText = new Text(this, SWT.BORDER);\r
- fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getValue() != null && node.getValue().length() > 0) {\r
- fValueText.setText(node.getValue());\r
- } else {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- fValueText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ValueLabel);\r
+ \r
+ fValueText = new Text(this, SWT.BORDER);\r
+ fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getValue() != null && node.getValue().length() > 0) {\r
+ fValueText.setText(node.getValue());\r
+ } else {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ fValueText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fValueText.setText(""); //$NON-NLS-1$\r
- }\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fValueText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fValueText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fValueText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setValue(fValueText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
- fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
- fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
- fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
+ if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setValue(fValueText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
+ fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
+ fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
+ fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterMatchesNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterMatchesNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fRegexText;\r
- \r
- FilterMatchesNodeComposite(Composite parent, TmfFilterMatchesNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterMatchesNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterMatchesNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fRegexText;\r
+ \r
+ FilterMatchesNodeComposite(Composite parent, TmfFilterMatchesNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_RegexLabel);\r
- \r
- fRegexText = new Text(this, SWT.BORDER);\r
- fRegexText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getRegex() != null && node.getRegex().length() > 0) {\r
- fRegexText.setText(node.getRegex());\r
- } else {\r
- fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fRegexText.setText(Messages.FilterViewer_RegexHint);\r
- }\r
- fRegexText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_RegexLabel);\r
+ \r
+ fRegexText = new Text(this, SWT.BORDER);\r
+ fRegexText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getRegex() != null && node.getRegex().length() > 0) {\r
+ fRegexText.setText(node.getRegex());\r
+ } else {\r
+ fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fRegexText.setText(Messages.FilterViewer_RegexHint);\r
+ }\r
+ fRegexText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getRegex() == null || fNode.getRegex().length() == 0) {\r
- fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fRegexText.setText(Messages.FilterViewer_RegexHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getRegex() == null || fNode.getRegex().length() == 0) {\r
+ fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fRegexText.setText(Messages.FilterViewer_RegexHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fRegexText.setText(""); //$NON-NLS-1$\r
- }\r
- fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fRegexText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fRegexText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fRegexText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setRegex(fRegexText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- }\r
- }\r
+ if (! fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setRegex(fRegexText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterCompareNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterCompareNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fValueText;\r
- Button fLTButton;\r
- Button fEQButton;\r
- Button fGTButton;\r
- Button fNumButton;\r
- Button fAlphaButton;\r
- Button fTimestampButton;\r
- \r
- FilterCompareNodeComposite(Composite parent, TmfFilterCompareNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterCompareNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterCompareNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fValueText;\r
+ Button fLTButton;\r
+ Button fEQButton;\r
+ Button fGTButton;\r
+ Button fNumButton;\r
+ Button fAlphaButton;\r
+ Button fTimestampButton;\r
+ \r
+ FilterCompareNodeComposite(Composite parent, TmfFilterCompareNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ResultLabel);\r
- \r
- Composite resultGroup = new Composite(this, SWT.NONE);\r
- GridLayout rggl = new GridLayout(3, true);\r
- rggl.marginHeight = 0;\r
- rggl.marginWidth = 0;\r
- resultGroup.setLayout(rggl);\r
- resultGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fLTButton = new Button(resultGroup, SWT.RADIO);\r
- fLTButton.setSelection(fNode.getResult() < 0);\r
- fLTButton.setText("<"); //$NON-NLS-1$\r
- fLTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fLTButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fLTButton.getSelection()) {\r
- fNode.setResult(-1);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fEQButton = new Button(resultGroup, SWT.RADIO);\r
- fEQButton.setSelection(fNode.getResult() == 0);\r
- fEQButton.setText("="); //$NON-NLS-1$\r
- fEQButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fEQButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fEQButton.getSelection()) {\r
- fNode.setResult(0);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fGTButton = new Button(resultGroup, SWT.RADIO);\r
- fGTButton.setSelection(fNode.getResult() > 0);\r
- fGTButton.setText(">"); //$NON-NLS-1$\r
- fGTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fGTButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fGTButton.getSelection()) {\r
- fNode.setResult(1);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_TypeLabel);\r
- \r
- Composite typeGroup = new Composite(this, SWT.NONE);\r
- GridLayout tggl = new GridLayout(3, false);\r
- tggl.marginHeight = 0;\r
- tggl.marginWidth = 0;\r
- typeGroup.setLayout(tggl);\r
- typeGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fNumButton = new Button(typeGroup, SWT.RADIO);\r
- fNumButton.setSelection(fNode.getType() == Type.NUM);\r
- fNumButton.setText(Messages.FilterViewer_NumButtonText);\r
- fNumButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fNumButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fNumButton.getSelection()) {\r
- fNode.setType(Type.NUM);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fAlphaButton = new Button(typeGroup, SWT.RADIO);\r
- fAlphaButton.setSelection(fNode.getType() == Type.ALPHA);\r
- fAlphaButton.setText(Messages.FilterViewer_AlphaButtonText);\r
- fAlphaButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fAlphaButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fAlphaButton.getSelection()) {\r
- fNode.setType(Type.ALPHA);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fTimestampButton = new Button(typeGroup, SWT.RADIO);\r
- fTimestampButton.setSelection(fNode.getType() == Type.TIMESTAMP);\r
- fTimestampButton.setText(Messages.FilterViewer_TimestampButtonText);\r
- fTimestampButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fTimestampButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fTimestampButton.getSelection()) {\r
- fNode.setType(Type.TIMESTAMP);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ValueLabel);\r
- \r
- fValueText = new Text(this, SWT.BORDER);\r
- fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getValue() != null && node.getValue().length() > 0) {\r
- fValueText.setText(node.getValue());\r
- } else {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- fValueText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ResultLabel);\r
+ \r
+ Composite resultGroup = new Composite(this, SWT.NONE);\r
+ GridLayout rggl = new GridLayout(3, true);\r
+ rggl.marginHeight = 0;\r
+ rggl.marginWidth = 0;\r
+ resultGroup.setLayout(rggl);\r
+ resultGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fLTButton = new Button(resultGroup, SWT.RADIO);\r
+ fLTButton.setSelection(fNode.getResult() < 0);\r
+ fLTButton.setText("<"); //$NON-NLS-1$\r
+ fLTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fLTButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fLTButton.getSelection()) {\r
+ fNode.setResult(-1);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fEQButton = new Button(resultGroup, SWT.RADIO);\r
+ fEQButton.setSelection(fNode.getResult() == 0);\r
+ fEQButton.setText("="); //$NON-NLS-1$\r
+ fEQButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fEQButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fEQButton.getSelection()) {\r
+ fNode.setResult(0);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fGTButton = new Button(resultGroup, SWT.RADIO);\r
+ fGTButton.setSelection(fNode.getResult() > 0);\r
+ fGTButton.setText(">"); //$NON-NLS-1$\r
+ fGTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fGTButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fGTButton.getSelection()) {\r
+ fNode.setResult(1);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_TypeLabel);\r
+ \r
+ Composite typeGroup = new Composite(this, SWT.NONE);\r
+ GridLayout tggl = new GridLayout(3, false);\r
+ tggl.marginHeight = 0;\r
+ tggl.marginWidth = 0;\r
+ typeGroup.setLayout(tggl);\r
+ typeGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fNumButton = new Button(typeGroup, SWT.RADIO);\r
+ fNumButton.setSelection(fNode.getType() == Type.NUM);\r
+ fNumButton.setText(Messages.FilterViewer_NumButtonText);\r
+ fNumButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNumButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fNumButton.getSelection()) {\r
+ fNode.setType(Type.NUM);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fAlphaButton = new Button(typeGroup, SWT.RADIO);\r
+ fAlphaButton.setSelection(fNode.getType() == Type.ALPHA);\r
+ fAlphaButton.setText(Messages.FilterViewer_AlphaButtonText);\r
+ fAlphaButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fAlphaButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fAlphaButton.getSelection()) {\r
+ fNode.setType(Type.ALPHA);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fTimestampButton = new Button(typeGroup, SWT.RADIO);\r
+ fTimestampButton.setSelection(fNode.getType() == Type.TIMESTAMP);\r
+ fTimestampButton.setText(Messages.FilterViewer_TimestampButtonText);\r
+ fTimestampButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fTimestampButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fTimestampButton.getSelection()) {\r
+ fNode.setType(Type.TIMESTAMP);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ValueLabel);\r
+ \r
+ fValueText = new Text(this, SWT.BORDER);\r
+ fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getValue() != null && node.getValue().length() > 0) {\r
+ fValueText.setText(node.getValue());\r
+ } else {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ fValueText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fValueText.setText(""); //$NON-NLS-1$\r
- }\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fValueText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fValueText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fValueText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setValue(fValueText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- }\r
- }\r
+ if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setValue(fValueText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
}\r
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf"; //$NON-NLS-1$
- public static final String TMF_TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.tracetype"; //$NON-NLS-1$
// The shared instance
private static TmfCorePlugin fPlugin;
// Attributes
// ------------------------------------------------------------------------
- protected ITmfTrace fParentTrace;
+ protected ITmfTrace<?> fParentTrace;
protected long fEventRank;
protected TmfTimestamp fEffectiveTimestamp;
protected TmfTimestamp fOriginalTimestamp;
// ------------------------------------------------------------------------
/**
+ * @param trace the parent trace
* @param originalTS the original timestamp
* @param effectiveTS the effective timestamp
* @param source the event source (generator)
* @param type the event type
* @param reference a free-form reference field
*/
- public TmfEvent(ITmfTrace trace, long rank, TmfTimestamp originalTS, TmfTimestamp effectiveTS,
+ public TmfEvent(ITmfTrace<?> trace, long rank, TmfTimestamp originalTS, TmfTimestamp effectiveTS,
TmfEventSource source, TmfEventType type, TmfEventReference reference)
{
fParentTrace = trace;
this(null, -1, originalTS, effectiveTS, source, type, reference);
}
+ /**
+ * @param trace the parent trace
+ * @param timestamp the effective timestamp
+ * @param source the event source (generator)
+ * @param type the event type
+ * @param reference a free-form reference field
+ */
+ public TmfEvent(ITmfTrace<?> parentTrace, TmfTimestamp timestamp, TmfEventSource source,
+ TmfEventType type, TmfEventReference reference)
+ {
+ this(parentTrace, -1, timestamp, timestamp, source, type, reference);
+ }
+
/**
* @param timestamp the effective timestamp
* @param source the event source (generator)
/**
* @return the parent trace
*/
- public ITmfTrace getParentTrace() {
+ public ITmfTrace<?> getParentTrace() {
return fParentTrace;
}
public class TmfEventContent implements Cloneable {
// Default field ids
- public static final String FIELD_ID_TIMESTAMP = "$time$"; //$NON-NLS-1$
- public static final String FIELD_ID_SOURCE = "$sour$"; //$NON-NLS-1$
- public static final String FIELD_ID_TYPE = "$type$"; //$NON-NLS-1$
- public static final String FIELD_ID_REFERENCE = "$refe$"; //$NON-NLS-1$
- public static final String FIELD_ID_CONTENT = "$cont$"; //$NON-NLS-1$
+ public static final String FIELD_ID_TIMESTAMP = ":timestamp:"; //$NON-NLS-1$
+ public static final String FIELD_ID_SOURCE = ":source:"; //$NON-NLS-1$
+ public static final String FIELD_ID_TYPE = ":type:"; //$NON-NLS-1$
+ public static final String FIELD_ID_REFERENCE = ":reference:"; //$NON-NLS-1$
+ public static final String FIELD_ID_CONTENT = ":content:"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
* @return the corresponding field
* @throws TmfNoSuchFieldException
*/
- public Object getField(String id) throws TmfNoSuchFieldException {
- if (fFields == null) {
- parseContent();
- }
- try {
- return fFields[getType().getFieldIndex(id)];
+ public Object getField(String id) throws TmfNoSuchFieldException {
+ if (fFields == null) {
+ parseContent();
+ }
+ try {
+ return fFields[getType().getFieldIndex(id)];
} catch (TmfNoSuchFieldException e) {
- // Required for filtering from default TmfEventsTable columns
- if (id.equals(FIELD_ID_TIMESTAMP)) {
- return new Long(fParentEvent.getTimestamp().getValue()).toString();
- } else if (id.equals(FIELD_ID_SOURCE)) {
- return fParentEvent.getSource().getSourceId().toString();
- } else if (id.equals(FIELD_ID_TYPE)) {
- return fParentEvent.getType().getTypeId().toString();
- } else if (id.equals(FIELD_ID_REFERENCE)) {
- return fParentEvent.getReference().getReference().toString();
- } else if (id.equals(FIELD_ID_CONTENT)) {
- return fParentEvent.getContent().toString();
- }
- throw e;
+ // Required for filtering from default TmfEventsTable columns
+ if (id.equals(FIELD_ID_CONTENT)) {
+ return fParentEvent.getContent().toString();
+ } else if (id.equals(FIELD_ID_TIMESTAMP)) {
+ return new Long(fParentEvent.getTimestamp().getValue()).toString();
+ } else if (id.equals(FIELD_ID_SOURCE)) {
+ return fParentEvent.getSource().getSourceId().toString();
+ } else if (id.equals(FIELD_ID_TYPE)) {
+ return fParentEvent.getType().getTypeId().toString();
+ } else if (id.equals(FIELD_ID_REFERENCE)) {
+ return fParentEvent.getReference().getReference().toString();
+ }
+ throw e;
}
- }
+ }
/**
* @param n the field index as per TmfEventType.getLabels()
this.fName = name;\r
}\r
\r
- @Override\r
- public boolean matches(TmfEvent event) {\r
- if (event.getType().getTypeId().equals(fName)) {\r
- // There should be at most one child\r
- for (ITmfFilterTreeNode node : getChildren()) {\r
- if (! node.matches(event)) {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
- return false;\r
- }\r
+ @Override\r
+ public boolean matches(TmfEvent event) {\r
+ boolean match = false;\r
+ if (fType.contains(":")) { //$NON-NLS-1$\r
+ // special case for custom parsers\r
+ if (fType.startsWith(event.getClass().getCanonicalName())) {\r
+ if (fType.endsWith(event.getType().getTypeId())) {\r
+ match = true;\r
+ }\r
+ }\r
+ } else {\r
+ if (event.getClass().getCanonicalName().equals(fType)) {\r
+ match = true;\r
+ }\r
+ }\r
+ if (match) {\r
+ // There should be at most one child\r
+ for (ITmfFilterTreeNode node : getChildren()) {\r
+ if (! node.matches(event)) {\r
+ return false;\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
\r
@Override\r
public List<String> getValidChildren() {\r
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011 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
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+
+public class TmfTraceType {
+
+ // Extension point ID
+ public static final String TMF_TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.tracetype"; //$NON-NLS-1$
+
+ // Extension point elements
+ public static final String CATEGORY_ELEM = "category"; //$NON-NLS-1$
+ public static final String TYPE_ELEM = "type"; //$NON-NLS-1$
+ public static final String DEFAULT_EDITOR_ELEM = "defaultEditor"; //$NON-NLS-1$
+ public static final String EVENTS_TABLE_TYPE_ELEM = "eventsTableType"; //$NON-NLS-1$
+
+ // Extension point attributes
+ public static final String ID_ATTR = "id"; //$NON-NLS-1$
+ public static final String NAME_ATTR = "name"; //$NON-NLS-1$
+ public static final String CATEGORY_ATTR = "category"; //$NON-NLS-1$
+ public static final String TRACE_TYPE_ATTR = "trace_type"; //$NON-NLS-1$
+ public static final String EVENT_TYPE_ATTR = "event_type"; //$NON-NLS-1$
+ public static final String ICON_ATTR = "icon"; //$NON-NLS-1$
+ public static final String CLASS_ATTR = "class"; //$NON-NLS-1$
+
+ public static String getCategoryName(String categoryId) {
+ IConfigurationElement[] elements = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
+ for (IConfigurationElement element : elements) {
+ if (element.getName().equals(CATEGORY_ELEM) && categoryId.equals(element.getAttribute(ID_ATTR))) {
+ return element.getAttribute(NAME_ATTR);
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public static IConfigurationElement[] getTypeElements() {
+ IConfigurationElement[] elements = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
+ List<IConfigurationElement> typeElements = new LinkedList<IConfigurationElement>();
+ for (IConfigurationElement element : elements) {
+ if (element.getName().equals(TYPE_ELEM)) {
+ typeElements.add(element);
+ }
+ }
+ return typeElements.toArray(new IConfigurationElement[0]);
+ }
+}