lttng2: Use ReadOnlyTextPropertyDescriptor in control model
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / property / BaseEventPropertySource.java
index 3c55169f6a79b23440bdf0705dfbe03cdda4c5c2..2a76dc9fa8149717eb509a10c20b747f4446d971 100644 (file)
@@ -1,30 +1,32 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
- * 
+ * Copyright (c) 2012, 2013 Ericsson
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Bernd Hufmann - Updated for support of LTTng Tools 2.1
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventComponent;
+import org.eclipse.linuxtools.tmf.core.util.ReadOnlyTextPropertyDescriptor;
 import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
 
 /**
- * <b><u>BaseEventPropertySource</u></b>
  * <p>
  * Property source implementation for the base event component.
  * </p>
+ *
+ * @author Bernd Hufmann
  */
 public class BaseEventPropertySource extends BasePropertySource {
 
@@ -45,7 +47,11 @@ public class BaseEventPropertySource extends BasePropertySource {
      */
     public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID = "base.event.loglevel"; //$NON-NLS-1$
     /**
-     *  The base event 'name' property name. 
+     * The base event 'fields' property ID.
+     */
+    public static final String BASE_EVENT_FIELDS_PROPERTY_ID = "base.event.fields"; //$NON-NLS-1$
+    /**
+     *  The base event 'name' property name.
      */
     public static final String BASE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName;
     /**
@@ -56,15 +62,19 @@ public class BaseEventPropertySource extends BasePropertySource {
      * The base event 'log level' property name.
      */
     public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName;
-    
+    /**
+     * The base event 'fields' property name.
+     */
+    public static final String BASE_EVENT_FIELDS_PROPERTY_NAME = Messages.TraceControl_FieldsPropertyName;
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
     /**
-     * The base event component which this property source is for. 
+     * The base event component which this property source is for.
      */
     private final BaseEventComponent fBaseEvent;
-    
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -75,7 +85,7 @@ public class BaseEventPropertySource extends BasePropertySource {
     public BaseEventPropertySource(BaseEventComponent component) {
         fBaseEvent = component;
     }
-    
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -86,12 +96,15 @@ public class BaseEventPropertySource extends BasePropertySource {
     @Override
     public IPropertyDescriptor[] getPropertyDescriptors() {
         List<IPropertyDescriptor> list = new ArrayList<IPropertyDescriptor> ();
-        list.add(new TextPropertyDescriptor(BASE_EVENT_NAME_PROPERTY_ID, BASE_EVENT_NAME_PROPERTY_NAME));
-        list.add(new TextPropertyDescriptor(BASE_EVENT_TYPE_PROPERTY_ID, BASE_EVENT_TYPE_PROPERTY_NAME));
+        list.add(new ReadOnlyTextPropertyDescriptor(BASE_EVENT_NAME_PROPERTY_ID, BASE_EVENT_NAME_PROPERTY_NAME));
+        list.add(new ReadOnlyTextPropertyDescriptor(BASE_EVENT_TYPE_PROPERTY_ID, BASE_EVENT_TYPE_PROPERTY_NAME));
         if (fBaseEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) {
-            list.add(new TextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID, BASE_EVENT_LOGLEVEL_PROPERTY_NAME));
+            list.add(new ReadOnlyTextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID, BASE_EVENT_LOGLEVEL_PROPERTY_NAME));
         }
-        return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]);        
+        if (fBaseEvent.getFieldString() != null) {
+            list.add(new ReadOnlyTextPropertyDescriptor(BASE_EVENT_FIELDS_PROPERTY_ID, BASE_EVENT_FIELDS_PROPERTY_NAME));
+        }
+        return list.toArray(new IPropertyDescriptor[list.size()]);
     }
 
     /*
@@ -109,6 +122,9 @@ public class BaseEventPropertySource extends BasePropertySource {
         if (BASE_EVENT_LOGLEVEL_PROPERTY_ID.equals(id)) {
             return fBaseEvent.getLogLevel().name();
         }
+        if (BASE_EVENT_FIELDS_PROPERTY_ID.equals(id)) {
+            return fBaseEvent.getFieldString();
+        }
         return null;
     }
 
This page took 0.025565 seconds and 5 git commands to generate.