tmf: Move the tmftracetype extension point to tmf.core
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 20 Feb 2014 22:30:33 +0000 (17:30 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 21 Feb 2014 22:07:08 +0000 (17:07 -0500)
Split the current "tmf.ui.tracetype" extension point into a
tmf.core.tracetype and tmf.ui.tracetypeui. "tracetypeui" refers to
the ID of the "tracetype", to add UI elements like type-specific icon
and events editor.

This separation makes it possible to unit-test the trace validation
without depending on UI/SWTBot tests. We will also eventually be able
to handle trace opening/validation in completely headless mode.

Change-Id: I227a199d1dddf62ad07b60392793b4694d0ec2de
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/21421
Tested-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
IP-Clean: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
28 files changed:
org.eclipse.linuxtools.gdbtrace.core/build.properties
org.eclipse.linuxtools.gdbtrace.core/plugin.xml [new file with mode: 0644]
org.eclipse.linuxtools.gdbtrace.ui/plugin.xml
org.eclipse.linuxtools.lttng2.kernel.core/plugin.properties
org.eclipse.linuxtools.lttng2.kernel.core/plugin.xml
org.eclipse.linuxtools.lttng2.kernel.ui/plugin.properties
org.eclipse.linuxtools.lttng2.kernel.ui/plugin.xml
org.eclipse.linuxtools.lttng2.ust.core/build.properties
org.eclipse.linuxtools.lttng2.ust.core/plugin.properties
org.eclipse.linuxtools.lttng2.ust.core/plugin.xml [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ust.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.ui/plugin.xml
org.eclipse.linuxtools.tmf.core.tests/plugin.xml
org.eclipse.linuxtools.tmf.core/plugin.properties
org.eclipse.linuxtools.tmf.core/plugin.xml
org.eclipse.linuxtools.tmf.core/schema/org.eclipse.linuxtools.tmf.core.tracetype.exsd [new file with mode: 0644]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/project/model/TmfTraceType.java
org.eclipse.linuxtools.tmf.ui.tests/plugin.xml
org.eclipse.linuxtools.tmf.ui.tests/shared/org/eclipse/linuxtools/tmf/ui/tests/shared/ProjectModelTestData.java
org.eclipse.linuxtools.tmf.ui/plugin.properties
org.eclipse.linuxtools.tmf.ui/plugin.xml
org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd [deleted file]
org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetypeui.exsd [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectTraceTypeContributionItem.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/editors/TmfEventsEditor.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceTypeUIUtils.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java

index 5e7e2cbe1d134ac966ad60fd9d5da55e757a6be0..5140553a313062d40cc0732b843f51bfff065ca8 100644 (file)
@@ -15,5 +15,6 @@ output.. = bin/
 bin.includes = META-INF/,\
                .,\
                plugin.properties,\
-               about.html
+               about.html,\
+               plugin.xml
 src.includes = about.html
diff --git a/org.eclipse.linuxtools.gdbtrace.core/plugin.xml b/org.eclipse.linuxtools.gdbtrace.core/plugin.xml
new file mode 100644 (file)
index 0000000..06b4921
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <category
+            id="org.eclipse.linuxtools.gdbtrace.core.category"
+            name="GDB">
+      </category>
+      <type
+            category="org.eclipse.linuxtools.gdbtrace.core.category"
+            event_type="org.eclipse.linuxtools.internal.gdbtrace.core.event.GdbTraceEvent"
+            id="org.eclipse.linuxtools.gdbtrace.core.type.gdb"
+            name="GDB Trace"
+            trace_type="org.eclipse.linuxtools.internal.gdbtrace.core.trace.GdbTrace">
+      </type>
+   </extension>
+
+</plugin>
index f5eda173e7de99f2b7435514c21c4ff063ce2c36..b6613ea6250611af4eceddd30ac9a5ff5011055c 100644 (file)
             name="%perspective.name">
       </perspective>
    </extension>
-   <extension
-         point="org.eclipse.linuxtools.tmf.ui.tracetype">
-      <category
-            id="org.eclipse.linuxtools.gdbtrace.ui.category"
-            name="GDB">
-      </category>
-      <type
-            category="org.eclipse.linuxtools.gdbtrace.ui.category"
-            event_type="org.eclipse.linuxtools.internal.gdbtrace.core.event.GdbTraceEvent"
-            icon="icons/obj16/gdb_icon16.png"
-            id="org.eclipse.linuxtools.gdbtrace.ui.type.gdb"
-            name="GDB Trace"
-            trace_type="org.eclipse.linuxtools.internal.gdbtrace.core.trace.GdbTrace">
-         <eventsTableType
-               class="org.eclipse.linuxtools.internal.gdbtrace.ui.views.events.GdbEventsTable">
-         </eventsTableType>
-      </type>
-   </extension>
    <extension
          point="org.eclipse.ui.commands">
       <command
          </enablement>
       </commonWizard>
    </extension>
+   <extension
+         point="org.eclipse.linuxtools.tmf.ui.tracetypeui">
+      <type
+            icon="icons/obj16/gdb_icon16.png"
+            tracetype="org.eclipse.linuxtools.gdbtrace.core.type.gdb">
+         <eventsTableType
+               class="org.eclipse.linuxtools.internal.gdbtrace.ui.views.events.GdbEventsTable">
+         </eventsTableType>
+      </type>
+   </extension>
 
 </plugin>
index 1b3c83845fb5464633e01e241dea42c3437d6b45..d9003d47e408901b733a2f9042061da25628e6e8 100644 (file)
@@ -14,4 +14,5 @@
 Bundle-Vendor = Eclipse Linux Tools
 Bundle-Name = Linux Tools LTTng Kernel Analysis Core Plug-in
 
+tracetype.type.kernel = LTTng Kernel Trace
 analysis.lttngkernel = LTTng Kernel Analysis
index cf7aefb756c36e9244cf0497c87ad450e5eb4517..278e8222f5ccebcf4ed1daae401ff8c762dea72e 100644 (file)
@@ -1,6 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.4"?>
 <plugin>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <type
+            category="org.eclipse.linuxtools.tmf.core.category.ctf"
+            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
+            id="org.eclipse.linuxtools.lttng2.kernel.tracetype"
+            isDirectory="true"
+            name="%tracetype.type.kernel"
+            trace_type="org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace">
+      </type>
+   </extension>
    <extension
          point="org.eclipse.linuxtools.tmf.core.analysis">
       <module
index 9172f4976ed16a59c977b55f969e6402d1a9c212..e0d7873fdc55ff10e3f17c928cccb033f46cb8ed 100644 (file)
@@ -20,3 +20,4 @@ controlflow.view.name = Control Flow
 resources.view.name = Resources
 
 tracetype.type.kernel = LTTng Kernel Trace
+analysis.lttngkernel = LTTng Kernel Analysis
index c28e2bc8eecb961c0e91292ef7cd4b520c34b84e..7416106ce267071d4bace8e4de8cb0b3898875a0 100644 (file)
             restorable="true">
       </view>
    </extension>
-   <extension
-         point="org.eclipse.linuxtools.tmf.ui.tracetype">
-      <type
-            category="org.eclipse.linuxtools.tmf.ui.category.ctf"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
-            icon="icons/obj16/garland16.png"
-            id="org.eclipse.linuxtools.lttng2.kernel.tracetype"
-            isDirectory="true"
-            name="%tracetype.type.kernel"
-            trace_type="org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace">
-         <eventsTableType
-               class="org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events.LTTng2EventsTable">
-         </eventsTableType>
-      </type>
-   </extension>
    <extension
          point="org.eclipse.ui.navigator.navigatorContent">
       <commonWizard
          </analysisId>
       </output>
    </extension>
+   <extension
+         point="org.eclipse.linuxtools.tmf.ui.tracetypeui">
+      <type
+            icon="icons/obj16/garland16.png"
+            tracetype="org.eclipse.linuxtools.lttng2.kernel.tracetype">
+         <eventsTableType
+               class="org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events.LTTng2EventsTable">
+         </eventsTableType>
+      </type>
+   </extension>
 </plugin>
index ddfbe617f6424e9ee0b8263ab5261016daa88bf4..001f6323b523103af9ee308223c940eafbbf2687 100644 (file)
@@ -15,5 +15,6 @@ output.. = bin/
 bin.includes = META-INF/,\
                .,\
                about.html,\
-               plugin.properties
+               plugin.properties,\
+               plugin.xml
 src.includes = about.html
index 4b3a353a3ba2e3f2a2b530e16b4238a0ed773636..b5e6b597efa6ef9f0f8064fd1901431e9ac8f20e 100644 (file)
@@ -12,4 +12,6 @@
 
 #Properties file for org.eclipse.linuxtools.lttng2.ust.core
 Bundle-Vendor = Eclipse Linux Tools
-Bundle-Name = Linux Tools LTTng Userspace Tracer Analysis Core Plug-in
\ No newline at end of file
+Bundle-Name = Linux Tools LTTng Userspace Tracer Analysis Core Plug-in
+
+tracetype.type.ust = LTTng UST Trace
diff --git a/org.eclipse.linuxtools.lttng2.ust.core/plugin.xml b/org.eclipse.linuxtools.lttng2.ust.core/plugin.xml
new file mode 100644 (file)
index 0000000..5bcebaf
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <type
+            category="org.eclipse.linuxtools.tmf.core.category.ctf"
+            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
+            id="org.eclipse.linuxtools.lttng2.ust.tracetype"
+            isDirectory="true"
+            name="%tracetype.type.ust"
+            trace_type="org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace">
+      </type>
+   </extension>
+
+</plugin>
index ac0be4a2093d14190ef326cccfbdfb3b889c2100..1b78306d292ab53f87ca19a360c9f710093cceb5 100644 (file)
@@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.core.resources,
  org.eclipse.ui,
  org.eclipse.linuxtools.lttng2.ust.core;bundle-version="3.0.0",
  org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.tmf.ui
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.internal.lttng2.ust.ui;x-friends:="org.eclipse.linuxtools.lttng2.ust.ui.tests",
  org.eclipse.linuxtools.internal.lttng2.ust.ui.views.memusage;x-friends:="org.eclipse.linuxtools.lttng2.ust.ui.tests",
  org.eclipse.linuxtools.lttng2.ust.ui.analysis.callstack,
index a756b42ceb7c53b16aa595e25ab80d9c641bb86a..fb339882d5e3678c6d7862f99fec16a7af9b4555 100644 (file)
@@ -2,15 +2,10 @@
 <?eclipse version="3.4"?>
 <plugin>
    <extension
-         point="org.eclipse.linuxtools.tmf.ui.tracetype">
+         point="org.eclipse.linuxtools.tmf.ui.tracetypeui">
       <type
-            category="org.eclipse.linuxtools.tmf.ui.category.ctf"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
             icon="icons/obj16/garland16.png"
-            id="org.eclipse.linuxtools.lttng2.ust.tracetype"
-            isDirectory="true"
-            name="%tracetype.type.ust"
-            trace_type="org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace">
+            tracetype="org.eclipse.linuxtools.lttng2.ust.tracetype">
       </type>
    </extension>
    <extension
index 8c2fca5405533d4af9071c09f7a408d5a486e6a8..d760b3c957011fd537026ef388b5990b5660a39c 100644 (file)
          </tracetype>
       </module>
    </extension>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <category
+            id="org.eclipse.linuxtools.tmf.core.tests.category"
+            name="Test trace">
+      </category>
+      <type
+            category="org.eclipse.linuxtools.tmf.core.tests.category"
+            event_type="org.eclipse.linuxtools.tmf.core.event.TmfEvent"
+            id="org.eclipse.linuxtools.tmf.core.tests.tracetype"
+            name="TMF Tests"
+            trace_type="org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub">
+      </type>
+      <type
+            category="org.eclipse.linuxtools.tmf.core.tests.category"
+            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
+            id="org.eclipse.linuxtools.tmf.core.tests.ctf.tracetype"
+            isDirectory="true"
+            name="CTF Tests"
+            trace_type="org.eclipse.linuxtools.tmf.tests.stubs.ctf.CtfTmfTraceStub">
+      </type>
+   </extension>
 
 </plugin>
index 032b57e3aac5ca300d510913137420572190cd21..3b0a7ae22e4be9407e3a45eb340fae9d592129fc 100644 (file)
@@ -13,3 +13,7 @@
 #Properties file for org.eclipse.linuxtools.tmf.core
 Bundle-Vendor = Eclipse Linux Tools
 Bundle-Name = Linux Tools TMF Core Plug-in
+
+# CTF trace type
+tracetype.category.ctf = Common Trace Format
+tracetype.type.ctf = Generic CTF Trace
index 6fce198ca703e862945c69e1fde3e7a194fc09bc..e48f58b236f99a3a1d8d903a6d7427683e3c83da 100644 (file)
@@ -1,17 +1,34 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.4"?>
 <plugin>
+   <extension-point id="org.eclipse.linuxtools.tmf.core.tracetype" name="Tmf Trace Type" schema="schema/org.eclipse.linuxtools.tmf.core.tracetype.exsd"/>
+   <extension-point id="org.eclipse.linuxtools.tmf.core.analysis" name="Trace Analysis Module" schema="schema/org.eclipse.linuxtools.tmf.core.analysis.exsd"/>
+
    <extension
          point="org.eclipse.core.runtime.preferences">
       <initializer
             class="org.eclipse.linuxtools.internal.tmf.core.TmfCorePreferenceInitializer">
       </initializer>
    </extension>
-   <extension-point id="org.eclipse.linuxtools.tmf.core.analysis" name="Trace Analysis Module" schema="schema/org.eclipse.linuxtools.tmf.core.analysis.exsd"/>
    <extension
          point="org.eclipse.linuxtools.tmf.core.analysis">
       <source
             class="org.eclipse.linuxtools.internal.tmf.core.analysis.TmfAnalysisModuleSourceConfigElement">
       </source>
    </extension>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <category
+            id="org.eclipse.linuxtools.tmf.core.category.ctf"
+            name="%tracetype.category.ctf">
+      </category>
+      <type
+            category="org.eclipse.linuxtools.tmf.core.category.ctf"
+            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
+            id="org.eclipse.linuxtools.tmf.core.type.ctf"
+            isDirectory="true"
+            name="%tracetype.type.ctf"
+            trace_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace">
+      </type>
+   </extension>
 </plugin>
diff --git a/org.eclipse.linuxtools.tmf.core/schema/org.eclipse.linuxtools.tmf.core.tracetype.exsd b/org.eclipse.linuxtools.tmf.core/schema/org.eclipse.linuxtools.tmf.core.tracetype.exsd
new file mode 100644 (file)
index 0000000..61e2a51
--- /dev/null
@@ -0,0 +1,183 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.linuxtools.tmf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.eclipse.linuxtools.tmf.core" id="tracetype" name="TMF Trace Type"/>
+      </appinfo>
+      <documentation>
+         This extension point is used to contribute new trace types to the generic components of the TMF framework.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="0" maxOccurs="unbounded">
+            <element ref="category"/>
+            <element ref="type"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a fully qualified identifier of the target extension point
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  an optional identifier of the extension instance
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  an optional name of the extension instance
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="category">
+      <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a unique name that will be used to identify this category
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a translatable name that will be used in the UI for this category
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="type">
+      <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The unique ID that identifies this trace type.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The type name as it is displayed to the end user.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="category" type="string">
+            <annotation>
+               <documentation>
+                  An optional attribute that is composed of the category ID. The referenced category must be declared in a corresponding category element.
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="identifier" basedOn="org.eclipse.linuxtools.tmf.core.tracetype/category/@id"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="trace_type" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The fully qualified name of a class that implements the &lt;samp&gt;ITmfTrace&lt;/samp&gt; interface.
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.tmf.core.trace.ITmfTrace"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="event_type" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The fully qualified name of a class that implements the &lt;samp&gt;ITmfEvent&lt;/samp&gt;  interface
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.tmf.core.event.ITmfEvent"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="isDirectory" type="boolean" use="default" value="false">
+            <annotation>
+               <documentation>
+                  Indicates whether the trace type is for traces that are directories  (true) or files (false)
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         3.0
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         Example use of the tmftracetype extension point for generic CTF traces (CtfTmfTrace):
+
+&lt;extension
+      point=&quot;org.eclipse.linuxtools.tmf.core.tracetype&quot;&gt;
+   &lt;category
+         id=&quot;org.eclipse.linuxtools.tmf.core.category.ctf&quot;
+         name=&quot;Common Trace Format&quot;&gt;
+   &lt;/category&gt;
+   &lt;type
+         category=&quot;org.eclipse.linuxtools.tmf.core.category.ctf&quot;
+         event_type=&quot;org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent&quot;
+         id=&quot;org.eclipse.linuxtools.tmf.core.type.ctf&quot;
+         name=&quot;Generic CTF Trace&quot;
+         trace_type=&quot;org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace&quot;&gt;
+   &lt;/type&gt;
+&lt;/extension&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         Trace types using this extension point have to specify the two following classes:
+
+* trace_type: Has to implement ITmfTrace. It&apos;s *highly* recommend to extend &apos;TmfTrace&apos; to get default implementations.
+* event_type: Has to implement ITmfEvent. Once again, TmfEvent provides a reference implementation that should work in most cases.
+      </documentation>
+   </annotation>
+
+
+   <annotation>
+      <appinfo>
+         <meta.section type="copyright"/>
+      </appinfo>
+      <documentation>
+         Copyright (c) 2014 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+      </documentation>
+   </annotation>
+
+</schema>
index f67044b946ccd4b6d831dc5215e202af771c08f7..e3fa565acec580c486ae772f133da9df88ae1b9b 100644 (file)
@@ -23,12 +23,9 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.Platform;
-import org.eclipse.linuxtools.internal.tmf.core.Activator;
-import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
 import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTrace;
 import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition;
 import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomXmlTrace;
@@ -50,7 +47,7 @@ public final class TmfTraceType {
     private static final char SEPARATOR = ':';
 
     /** Extension point ID */
-    public static final String TMF_TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.ui.tracetype"; //$NON-NLS-1$
+    public static final String TMF_TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.core.tracetype"; //$NON-NLS-1$
 
     /** Extension point element 'Category' */
     public static final String CATEGORY_ELEM = "category"; //$NON-NLS-1$
@@ -58,15 +55,6 @@ public final class TmfTraceType {
     /** Extension point element 'Type' */
     public static final String TYPE_ELEM = "type"; //$NON-NLS-1$
 
-    /** Extension point element 'Default editor' */
-    public static final String DEFAULT_EDITOR_ELEM = "defaultEditor"; //$NON-NLS-1$
-
-    /** Extension point element 'Events table type' */
-    public static final String EVENTS_TABLE_TYPE_ELEM = "eventsTableType"; //$NON-NLS-1$
-
-    /** Extension point element 'Statistics viewer type' */
-    public static final String STATISTICS_VIEWER_ELEM = "statisticsViewerType"; //$NON-NLS-1$
-
     /** Extension point attribute 'ID' */
     public static final String ID_ATTR = "id"; //$NON-NLS-1$
 
@@ -82,12 +70,6 @@ public final class TmfTraceType {
     /** Extension point attribute 'event_type' */
     public static final String EVENT_TYPE_ATTR = "event_type"; //$NON-NLS-1$
 
-    /** Extension point attribute 'icon' */
-    public static final String ICON_ATTR = "icon"; //$NON-NLS-1$
-
-    /** Extension point attribute 'class' */
-    public static final String CLASS_ATTR = "class"; //$NON-NLS-1$
-
     /** Extension point attribute 'isDirectory' */
     public static final String IS_DIR_ATTR = "isDirectory"; //$NON-NLS-1$
 
@@ -129,45 +111,6 @@ public final class TmfTraceType {
         return ""; //$NON-NLS-1$
     }
 
-    /**
-     * Retrieves and instantiates an element's object based on his plug-in
-     * definition for a specific trace type.
-     *
-     * The element's object is instantiated using its 0-argument constructor.
-     *
-     * @param resource
-     *            The resource where to find the information about the trace
-     *            properties
-     * @param element
-     *            The name of the element to find under the trace type
-     *            definition
-     * @return a new Object based on his definition in plugin.xml, or null if no
-     *         definition was found
-     */
-    public static Object getTraceTypeElement(IResource resource, String element) {
-        try {
-            if (resource != null) {
-                String traceType = resource.getPersistentProperty(TmfCommonConstants.TRACETYPE);
-                /*
-                 * Search in the configuration if there is any viewer specified
-                 * for this kind of trace type.
-                 */
-                for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {
-                    if (ce.getAttribute(TmfTraceType.ID_ATTR).equals(traceType)) {
-                        IConfigurationElement[] viewerCE = ce.getChildren(element);
-                        if (viewerCE.length != 1) {
-                            break;
-                        }
-                        return viewerCE[0].createExecutableExtension(TmfTraceType.CLASS_ATTR);
-                    }
-                }
-            }
-        } catch (CoreException e) {
-            Activator.logError("Error creating the element from the resource", e); //$NON-NLS-1$
-        }
-        return null;
-    }
-
     /**
      * Retrieves all configuration elements from the platform extension registry
      * for the trace type extension.
index 4b17ad330cb8440e438cb0ae6f2a815650316a06..5e7f3a6a3f6a4b32357aab21f4c013bdffa966f9 100644 (file)
     </uml2SDLoader>
  </extension>
 
-   <extension
-         point="org.eclipse.linuxtools.tmf.ui.tracetype">
-      <category
-            id="org.eclipse.linuxtools.tmf.tests.category.tracetype"
-            name="Test trace">
-      </category>
-      <type
-            category="org.eclipse.linuxtools.tmf.tests.category.tracetype"
-            event_type="org.eclipse.linuxtools.tmf.core.event.TmfEvent"
-            id="org.eclipse.linuxtools.tmf.tests.tracetype"
-            name="TMF Tests"
-            trace_type="org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub">
-         <eventsTableType
-               class="org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable">
-         </eventsTableType>
-      </type>
-      <type
-            category="org.eclipse.linuxtools.tmf.tests.category.tracetype"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
-            id="org.eclipse.linuxtools.tmf.tests.ctf.tracetype"
-            isDirectory="true"
-            name="CTF Tests"
-            trace_type="org.eclipse.linuxtools.tmf.tests.stubs.ctf.CtfTmfTraceStub">
-      </type>
-   </extension>
    <extension
          point="org.eclipse.linuxtools.tmf.core.analysis">
       <module
index 70a40def98b6e87c78b6c22b7611575533b741bd..9250a1363e278380007deac1907d0862f62d485e 100644 (file)
@@ -76,7 +76,7 @@ public class ProjectModelTestData {
             return null;
         }
         linkedTrace.setPersistentProperty(TmfCommonConstants.TRACETYPE,
-                "org.eclipse.linuxtools.tmf.tests.ctf.tracetype");
+                "org.eclipse.linuxtools.tmf.core.tests.ctf.tracetype");
 
         final TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true);
         TmfTraceElement traceElement = projectElement.getTracesFolder().getTraces().get(0);
index d9fd42bff3ce2cb0966276de02ef96580eb1ee73..c4822e89bc3fca4a61966c90705700492237ddf0 100644 (file)
@@ -180,8 +180,3 @@ commands.uml2sd.showend = Show node end
 commands.uml2sd.showend.description = Show the node end
 commands.uml2sd.showstart = Show node start 
 commands.uml2sd.showstart.description = Show the node start
-# CTF trace type
-tracetype.category.ctf = Common Trace Format
-tracetype.type.ctf = Generic CTF Trace
-
index 7021eaef227c856379e10f4bb6a7e1c7d547007b..b0652b14ef1ec9b5174af7ebbf10d2fdebde67b8 100644 (file)
@@ -2,7 +2,7 @@
 <?eclipse version="3.4"?>
 <plugin>
    <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"/>
-   <extension-point id="org.eclipse.linuxtools.tmf.ui.tracetype" name="Tmf Trace Type" schema="schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd"/>
+   <extension-point id="org.eclipse.linuxtools.tmf.ui.tracetypeui" name="Tmf Trace Type UI Elements" schema="schema/org.eclipse.linuxtools.tmf.ui.tracetypeui.exsd"/>
 
     <extension
          point="org.eclipse.ui.perspectives">
             type="org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement">
       </propertyTester>
    </extension>
-   <extension
-         point="org.eclipse.linuxtools.tmf.ui.tracetype">
-      <category
-            id="org.eclipse.linuxtools.tmf.ui.category.ctf"
-            name="%tracetype.category.ctf">
-      </category>
-      <type
-            category="org.eclipse.linuxtools.tmf.ui.category.ctf"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
-            icon="icons/eview16/events_view.gif"
-            id="org.eclipse.linuxtools.tmf.ui.type.ctf"
-            isDirectory="true"
-            name="%tracetype.type.ctf"
-            trace_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace">
-      </type>
-   </extension>
    <extension
          point="org.eclipse.ui.navigator.linkHelper">
       <linkHelper
          </tracetype>
       </module>
    </extension>
-
+   <extension
+         point="org.eclipse.linuxtools.tmf.ui.tracetypeui">
+      <type
+            icon="icons/eview16/events_view.gif"
+            tracetype="org.eclipse.linuxtools.tmf.core.type.ctf">
+      </type>
+   </extension>
 </plugin>
diff --git a/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd b/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetype.exsd
deleted file mode 100644 (file)
index 1644017..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-<?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="tracetype" name="TMF Trace Type"/>
-      </appinfo>
-      <documentation>
-         This extension point is used to contribute new trace types to the generic components of the TMF framework.
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <choice minOccurs="0" maxOccurs="unbounded">
-            <element ref="category"/>
-            <element ref="type"/>
-         </choice>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  a fully qualified identifier of the target extension point
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  an optional identifier of the extension instance
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  an optional name of the extension instance
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="category">
-      <complexType>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  a unique name that will be used to identify this category
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  a translatable name that will be used in the UI for this category
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="type">
-      <complexType>
-         <sequence>
-            <element ref="defaultEditor" minOccurs="0" maxOccurs="1"/>
-            <element ref="eventsTableType" minOccurs="0" maxOccurs="1"/>
-            <element ref="statisticsViewerType" minOccurs="0" maxOccurs="1"/>
-         </sequence>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  The unique ID that identifies this trace type.
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  The type name as it is displayed to the end user.
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="category" type="string">
-            <annotation>
-               <documentation>
-                  An optional attribute that is composed of the category ID. The referenced category must be declared in a corresponding category element.
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="identifier" basedOn="org.eclipse.linuxtools.tmf.ui.tracetype/category/@id"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="trace_type" type="string" use="required">
-            <annotation>
-               <documentation>
-                  The fully qualified name of a class that implements the &lt;samp&gt;ITmfTrace&lt;/samp&gt; interface.
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.tmf.core.trace.ITmfTrace"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="event_type" type="string" use="required">
-            <annotation>
-               <documentation>
-                  The fully qualified name of a class that implements the &lt;samp&gt;ITmfEvent&lt;/samp&gt;  interface
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.tmf.core.event.ITmfEvent"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="icon" type="string">
-            <annotation>
-               <documentation>
-                  The icon associated to the trace type.
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="resource"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="isDirectory" type="boolean" use="default" value="false">
-            <annotation>
-               <documentation>
-                  Indicates whether the trace type is for traces that are directories  (true) or files (false)
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="defaultEditor">
-      <annotation>
-         <documentation>
-            The default editor to use for this trace type.
-If omitted, the default events editor will be used.
-         </documentation>
-      </annotation>
-      <complexType>
-         <attribute name="id" type="string" use="default" value="org.eclipse.linuxtools.tmf.ui.editors.events">
-            <annotation>
-               <documentation>
-                  The id of the editor to use for this trace type.
-If empty, the default events editor will be used.
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="eventsTableType">
-      <annotation>
-         <documentation>
-            The events table to use for this trace type.
-If omitted, the default events table will be used.
-         </documentation>
-      </annotation>
-      <complexType>
-         <attribute name="class" type="string" use="default" value="org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable">
-            <annotation>
-               <documentation>
-                  The fully qualified name of a class that extends &lt;samp&gt;TmfEventsTable&lt;/samp&gt; .
-If empty, the default events table will be used.
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn="org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable:"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="statisticsViewerType">
-      <annotation>
-         <documentation>
-            The statistics viewer to use for this trace type.
-If omitted, the default statistics viewer will be used.
-         </documentation>
-      </annotation>
-      <complexType>
-         <attribute name="class" type="string" use="default" value="org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer">
-            <annotation>
-               <documentation>
-                  The fully qualified name of a class that extends &lt;samp&gt;TmfStatisticsViewer&lt;/samp&gt; .
-If empty, the default statistics viewer will be used.
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn="org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer:"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         0.9
-      </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>
diff --git a/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetypeui.exsd b/org.eclipse.linuxtools.tmf.ui/schema/org.eclipse.linuxtools.tmf.ui.tracetypeui.exsd
new file mode 100644 (file)
index 0000000..d8c55fd
--- /dev/null
@@ -0,0 +1,178 @@
+<?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="tracetypeui" name="TMF Trace Type UI Elements"/>
+      </appinfo>
+      <documentation>
+         This extension point is used to assign UI elements to a trace type defined by org.eclipse.linuxtools.tmf.core.tracetype.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="0" maxOccurs="unbounded">
+            <element ref="type"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a fully qualified identifier of the target extension point
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  an optional identifier of the extension instance
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  an optional name of the extension instance
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="type">
+      <complexType>
+         <sequence>
+            <element ref="eventsTableType" minOccurs="0" maxOccurs="1"/>
+            <element ref="defaultEditor" minOccurs="0" maxOccurs="1"/>
+         </sequence>
+         <attribute name="tracetype" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The unique ID that identifies this trace type.
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="identifier" basedOn="org.eclipse.linuxtools.tmf.core.tracetype/type/@id"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="icon" type="string">
+            <annotation>
+               <documentation>
+                  The icon associated to the trace type.
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="resource"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="eventsTableType">
+      <annotation>
+         <documentation>
+            The events table to use for this trace type.
+If omitted, the default events table will be used.
+         </documentation>
+      </annotation>
+      <complexType>
+         <attribute name="class" type="string" use="default" value="org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable">
+            <annotation>
+               <documentation>
+                  The fully qualified name of a class that extends &lt;samp&gt;TmfEventsTable&lt;/samp&gt; .
+If empty, the default events table will be used.
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn="org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable:"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="defaultEditor">
+      <annotation>
+         <documentation>
+            The default editor to use for this trace type.
+If omitted, the default events editor will be used.
+         </documentation>
+      </annotation>
+      <complexType>
+         <attribute name="id" type="string" use="default" value="org.eclipse.linuxtools.tmf.ui.editors.events">
+            <annotation>
+               <documentation>
+                  The id of the editor to use for this trace type.
+If empty, the default events editor will be used.
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         3.0
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         Example use of the extension point: the GDB trace type, which specifies a custom icon and a custom editor. The &apos;type/tracetype&apos; element has to point to an existing tmf.core.tracetype extension!
+
+&lt;extension
+      point=&quot;org.eclipse.linuxtools.tmf.ui.tracetypeui&quot;&gt;
+   &lt;type
+         icon=&quot;icons/obj16/gdb_icon16.png&quot;
+         tracetype=&quot;org.eclipse.linuxtools.gdbtrace.core.type.gdb&quot;&gt;
+      &lt;eventsTableType
+            class=&quot;org.eclipse.linuxtools.internal.gdbtrace.ui.views.events.GdbEventsTable&quot;&gt;
+      &lt;/eventsTableType&gt;
+   &lt;/type&gt;
+&lt;/extension&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         The &apos;eventsTableType/class&apos; element has to extend TmfEventsTable. It is optional however ; if it is not specified, the default TmfEventsTable will be used.
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="copyright"/>
+      </appinfo>
+      <documentation>
+         Copyright (c) 2014 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+      </documentation>
+   </annotation>
+
+</schema>
index 11dd13763ae05d5688dd9490a83b9c6778e85d44..0869fdd5cf31d1a300fbeb4dfde98a14864cb952 100644 (file)
@@ -33,6 +33,7 @@ import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomXmlTrace;
 import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomXmlTraceDefinition;
 import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceTypeUIUtils;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
@@ -107,11 +108,17 @@ public class SelectTraceTypeContributionItem extends CompoundContributionItem {
             if (ce.getName().equals(TmfTraceType.TYPE_ELEM)) {
                 String traceBundle = ce.getContributor().getName();
                 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));
 
+                /* Get the icon from the tmftracetypeui extension, if it exists */
+                String traceIcon = null;
+                IConfigurationElement uiCE = TmfTraceTypeUIUtils.getTraceUIAttributes(traceTypeId);
+                if (uiCE != null) {
+                    traceIcon = uiCE.getAttribute(TmfTraceTypeUIUtils.ICON_ATTR);
+                }
+
                 addContributionItem(list, traceBundle, traceTypeId, traceIcon, label, selected, subMenu);
             }
         }
index a01f050905d33e19a54327b1e25e1f5fd2422767..d4121cccedaa2fdc1dce1941fedbdbfd69eb2a45 100644 (file)
@@ -41,7 +41,6 @@ import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomEventsTable;
 import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
 import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTrace;
 import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomXmlTrace;
-import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
@@ -58,6 +57,7 @@ import org.eclipse.linuxtools.tmf.ui.project.model.TmfOpenTraceHelper;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectElement;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectRegistry;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceTypeUIUtils;
 import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
@@ -318,13 +318,13 @@ public class TmfEventsEditor extends TmfEditor implements ITmfTraceEditor, IReus
             if (traceType.startsWith(CustomXmlTrace.class.getCanonicalName())) {
                 return new CustomEventsTable(((CustomXmlTrace) fTrace).getDefinition(), parent, cacheSize);
             }
-            for (final IConfigurationElement ce : TmfTraceType.getTypeElements()) {
-                if (ce.getAttribute(TmfTraceType.ID_ATTR).equals(traceType)) {
-                    final IConfigurationElement[] eventsTableTypeCE = ce.getChildren(TmfTraceType.EVENTS_TABLE_TYPE_ELEM);
+            for (final IConfigurationElement ce : TmfTraceTypeUIUtils.getTypeUIElements()) {
+                if (ce.getAttribute(TmfTraceTypeUIUtils.TRACETYPE_ATTR).equals(traceType)) {
+                    final IConfigurationElement[] eventsTableTypeCE = ce.getChildren(TmfTraceTypeUIUtils.EVENTS_TABLE_TYPE_ELEM);
                     if (eventsTableTypeCE.length != 1) {
                         break;
                     }
-                    final String eventsTableType = eventsTableTypeCE[0].getAttribute(TmfTraceType.CLASS_ATTR);
+                    final String eventsTableType = eventsTableTypeCE[0].getAttribute(TmfTraceTypeUIUtils.CLASS_ATTR);
                     if ((eventsTableType == null) || (eventsTableType.length() == 0)) {
                         break;
                     }
@@ -397,13 +397,13 @@ public class TmfEventsEditor extends TmfEditor implements ITmfTraceEditor, IReus
             if (commonTraceType.startsWith(CustomXmlTrace.class.getCanonicalName())) {
                 return new CustomEventsTable(((CustomXmlTrace) experiment.getTraces()[0]).getDefinition(), parent, cacheSize);
             }
-            for (final IConfigurationElement ce : TmfTraceType.getTypeElements()) {
-                if (ce.getAttribute(TmfTraceType.ID_ATTR).equals(commonTraceType)) {
-                    final IConfigurationElement[] eventsTableTypeCE = ce.getChildren(TmfTraceType.EVENTS_TABLE_TYPE_ELEM);
+            for (final IConfigurationElement ce : TmfTraceTypeUIUtils.getTypeUIElements()) {
+                if (ce.getAttribute(TmfTraceTypeUIUtils.TRACETYPE_ATTR).equals(commonTraceType)) {
+                    final IConfigurationElement[] eventsTableTypeCE = ce.getChildren(TmfTraceTypeUIUtils.EVENTS_TABLE_TYPE_ELEM);
                     if (eventsTableTypeCE.length != 1) {
                         break;
                     }
-                    final String eventsTableType = eventsTableTypeCE[0].getAttribute(TmfTraceType.CLASS_ATTR);
+                    final String eventsTableType = eventsTableTypeCE[0].getAttribute(TmfTraceTypeUIUtils.CLASS_ATTR);
                     if ((eventsTableType == null) || (eventsTableType.length() == 0)) {
                         break;
                     }
index c5e3be12ec177bbd81cc5eb0fe530190d6a0639d..0f4d7cdb72d0a8603225256574e2a2b14d7b0b18 100644 (file)
@@ -135,6 +135,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
     // The mapping of available trace type IDs to their corresponding
     // configuration element
     private static final Map<String, IConfigurationElement> sfTraceTypeAttributes = new HashMap<>();
+    private static final Map<String, IConfigurationElement> sfTraceTypeUIAttributes = new HashMap<>();
     private static final Map<String, IConfigurationElement> sfTraceCategories = new HashMap<>();
 
     /**
@@ -142,15 +143,32 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
      * extension registry.
      */
     public static void init() {
+        /* Read the tmf.core "tracetype" extension point */
         IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfTraceType.TMF_TRACE_TYPE_ID);
         for (IConfigurationElement ce : config) {
-            String elementName = ce.getName();
-            if (elementName.equals(TmfTraceType.TYPE_ELEM)) {
+            switch (ce.getName()) {
+            case TmfTraceType.TYPE_ELEM:
                 String traceTypeId = ce.getAttribute(TmfTraceType.ID_ATTR);
                 sfTraceTypeAttributes.put(traceTypeId, ce);
-            } else if (elementName.equals(TmfTraceType.CATEGORY_ELEM)) {
+                break;
+            case TmfTraceType.CATEGORY_ELEM:
                 String categoryId = ce.getAttribute(TmfTraceType.ID_ATTR);
                 sfTraceCategories.put(categoryId, ce);
+                break;
+            default:
+            }
+        }
+
+        /*
+         * Read the corresponding tmf.ui "tracetypeui" extension point for this
+         * trace type, if it exists.
+         */
+        config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfTraceTypeUIUtils.TMF_TRACE_TYPE_UI_ID);
+        for (IConfigurationElement ce : config) {
+            String elemName = ce.getName();
+            if (TmfTraceTypeUIUtils.TYPE_ELEM.equals(elemName)) {
+                String traceType = ce.getAttribute(TmfTraceTypeUIUtils.TRACETYPE_ATTR);
+                sfTraceTypeUIAttributes.put(traceType, ce);
             }
         }
     }
@@ -375,8 +393,12 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
             if (fTraceTypeId.startsWith(CustomXmlTrace.class.getCanonicalName())) {
                 return TmfEventsEditor.ID;
             }
-            IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
-            IConfigurationElement[] defaultEditorCE = ce.getChildren(TmfTraceType.DEFAULT_EDITOR_ELEM);
+            IConfigurationElement ce = sfTraceTypeUIAttributes.get(fTraceTypeId);
+            if (ce == null) {
+                /* This trace type does not define UI attributes */
+                return null;
+            }
+            IConfigurationElement[] defaultEditorCE = ce.getChildren(TmfTraceTypeUIUtils.DEFAULT_EDITOR_ELEM);
             if (defaultEditorCE.length == 1) {
                 return defaultEditorCE[0].getAttribute(TmfTraceType.ID_ATTR);
             }
index cc282d26d828e73297ec9e3b21143f5afffe6119..2ca16b7b3ad2577c4d03ad65242e303831bd51ce 100644 (file)
@@ -16,6 +16,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
@@ -26,7 +27,9 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
 import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceImportException;
@@ -50,6 +53,27 @@ import org.eclipse.swt.widgets.Shell;
  */
 public final class TmfTraceTypeUIUtils {
 
+    /** Extension point ID */
+    public static final String TMF_TRACE_TYPE_UI_ID = "org.eclipse.linuxtools.tmf.ui.tracetypeui"; //$NON-NLS-1$
+
+    /** Extension point element 'type' (should match the type in TmfTraceType) */
+    public static final String TYPE_ELEM = "type"; //$NON-NLS-1$
+
+    /** Extension point element 'Default editor' */
+    public static final String DEFAULT_EDITOR_ELEM = "defaultEditor"; //$NON-NLS-1$
+
+    /** Extension point element 'Events table type' */
+    public static final String EVENTS_TABLE_TYPE_ELEM = "eventsTableType"; //$NON-NLS-1$
+
+    /** Extension point attribute 'tracetype' */
+    public static final String TRACETYPE_ATTR = "tracetype"; //$NON-NLS-1$
+
+    /** Extension point attribute 'icon' */
+    public static final String ICON_ATTR = "icon"; //$NON-NLS-1$
+
+    /** Extension point attribute 'class' (attribute of eventsTableType) */
+    public static final String CLASS_ATTR = "class"; //$NON-NLS-1$
+
     private static final String DEFAULT_TRACE_ICON_PATH = "icons" + File.separator + "elcl16" + File.separator + "trace.gif"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
     private static final char SEPARATOR = ':';
@@ -237,14 +261,21 @@ public final class TmfTraceTypeUIUtils {
      */
     public static IStatus setTraceType(IPath path, TraceTypeHelper traceType) throws CoreException {
         IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
-        String traceBundle = null, traceTypeId = traceType.getCanonicalName(), traceIcon = null;
+        String traceBundle = null;
+        String traceTypeId = traceType.getCanonicalName();
+        String traceIcon = DEFAULT_TRACE_ICON_PATH;
+
         if (isCustomTraceId(traceTypeId)) {
             traceBundle = Activator.getDefault().getBundle().getSymbolicName();
-            traceIcon = DEFAULT_TRACE_ICON_PATH;
         } else {
             IConfigurationElement ce = TmfTraceType.getInstance().getTraceAttributes(traceTypeId);
             traceBundle = ce.getContributor().getName();
-            traceIcon = ce.getAttribute(TmfTraceType.ICON_ATTR);
+        }
+
+        /* Check if there is an icon defined in tmftracetypeui */
+        IConfigurationElement ce = getTraceUIAttributes(traceTypeId);
+        if (ce != null) {
+            traceIcon = ce.getAttribute(TmfTraceTypeUIUtils.ICON_ATTR);
         }
 
         resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE, traceBundle);
@@ -263,4 +294,41 @@ public final class TmfTraceTypeUIUtils {
         tmfProject.refresh();
         return Status.OK_STATUS;
     }
+
+    /**
+     * Retrieves all configuration elements from the platform extension registry
+     * for the trace type UI extension.
+     *
+     * @return An array of trace type configuration elements
+     */
+    public static IConfigurationElement[] getTypeUIElements() {
+        IConfigurationElement[] elements =
+                Platform.getExtensionRegistry().getConfigurationElementsFor(TMF_TRACE_TYPE_UI_ID);
+        List<IConfigurationElement> typeElements = new LinkedList<>();
+        for (IConfigurationElement element : elements) {
+            if (element.getName().equals(TYPE_ELEM)) {
+                typeElements.add(element);
+            }
+        }
+        return typeElements.toArray(new IConfigurationElement[typeElements.size()]);
+    }
+
+    /**
+     * Get the UI elements for the given trace type
+     *
+     * @param traceType
+     *            The tracetype ID
+     * @return The top-level configuration element (access its children with
+     *         .getChildren()). Or null if there is no such element.
+     */
+    @Nullable
+    public static IConfigurationElement getTraceUIAttributes(String traceType) {
+        IConfigurationElement[] elements = getTypeUIElements();
+        for (IConfigurationElement ce : elements) {
+            if (traceType.equals(ce.getAttribute(TRACETYPE_ATTR))) {
+                return ce;
+            }
+        }
+        return null;
+    }
 }
index d1f36f547c32499143b381d718ba600c565f07ad..17512e2756b386c0810bcf49784b96335c49b26b 100755 (executable)
 
 package org.eclipse.linuxtools.tmf.ui.views.statistics;
 
-import org.eclipse.core.resources.IResource;
-import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceRangeUpdatedSignal;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
 import org.eclipse.linuxtools.tmf.ui.viewers.ITmfViewer;
 import org.eclipse.linuxtools.tmf.ui.viewers.statistics.TmfStatisticsViewer;
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;
@@ -221,21 +218,6 @@ public class TmfStatisticsView extends TmfView {
             TmfStatisticsViewer globalViewer = new TmfStatisticsViewer(folder, Messages.TmfStatisticsView_GlobalTabName + " - " + fTrace.getName(), fTrace); //$NON-NLS-1$
             fStatsViewers.addTab(globalViewer, Messages.TmfStatisticsView_GlobalTabName, defaultStyle);
 
-            // Creates a statistics viewer for each trace.
-            for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
-                String traceName = trace.getName();
-                IResource traceResource = trace.getResource();
-                TmfStatisticsViewer viewer = getStatisticsViewer(traceResource);
-                /*
-                 * Adds a new viewer only if there is one defined for the
-                 * selected trace type, since the global tab already contains
-                 * all the basic event counts for the trace(s)
-                 */
-                if (viewer != null) {
-                    viewer.init(folder, traceName, trace);
-                    fStatsViewers.addTab(viewer, viewer.getName(), defaultStyle);
-                }
-            }
         } else {
             // There is no trace selected. Shows an empty global tab
             TmfStatisticsViewer globalViewer = new TmfStatisticsViewer(folder, Messages.TmfStatisticsView_GlobalTabName, fTrace);
@@ -244,22 +226,4 @@ public class TmfStatisticsView extends TmfView {
         // Makes the global viewer visible
         fStatsViewers.setSelection(0);
     }
-
-    /**
-     * Retrieves and instantiates a viewer based on his plug-in definition for a
-     * specific trace type. It is specific to the statistics viewer.
-     *
-     * It only calls the 0-parameter constructor without performing any other
-     * initialization on the viewer.
-     *
-     * @param resource
-     *            The resource where to find the information about the trace
-     *            properties
-     * @return a new statistics viewer based on his plug-in definition, or null
-     *         if no statistics definition was found for the trace type.
-     * @since 2.0
-     */
-    protected static TmfStatisticsViewer getStatisticsViewer(IResource resource) {
-        return (TmfStatisticsViewer) TmfTraceType.getTraceTypeElement(resource, TmfTraceType.STATISTICS_VIEWER_ELEM);
-    }
 }
This page took 0.055062 seconds and 5 git commands to generate.