analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / event / aspect / ITmfEventAspect.java
index a0ca79240929037adee09155f77a8fef597e68b0..3a4da293905e7ba3b70950e148da7d8c38ef5c2e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2015 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -8,15 +8,23 @@
  *
  * Contributors:
  *   Alexandre Montplaisir - Initial API and implementation
+ *   Patrick Tasse - Added base aspect list
  *******************************************************************************/
 
 package org.eclipse.tracecompass.tmf.core.event.aspect;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.List;
+
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 
+import com.google.common.collect.ImmutableList;
+
 /**
  * An aspect is a piece of information that can be extracted, directly or
  * indirectly, from a trace event.
@@ -36,6 +44,16 @@ public interface ITmfEventAspect {
      */
     String EMPTY_STRING = ""; //$NON-NLS-1$
 
+    /**
+     * List of all common base aspects
+     */
+    public static final List<ITmfEventAspect> BASE_ASPECTS =
+            checkNotNull(ImmutableList.of(
+                    BaseAspects.TIMESTAMP,
+                    BaseAspects.EVENT_TYPE,
+                    BaseAspects.CONTENTS,
+                    BaseAspects.TRACE_NAME
+                    ));
     /**
      * Some basic aspects that all trace types should be able to use, using
      * methods found in {@link ITmfEvent}.
@@ -89,21 +107,17 @@ public interface ITmfEventAspect {
         /**
          * Aspect for the aggregated event contents (fields)
          */
-        ITmfEventAspect CONTENTS = new ITmfEventAspect() {
+        TmfEventFieldAspect CONTENTS = new TmfEventFieldAspect(Messages.getMessage(Messages.AspectName_Contents), null, new TmfEventFieldAspect.IRootField() {
             @Override
-            public String getName() {
-                return Messages.getMessage(Messages.AspectName_Contents);
+            public @Nullable ITmfEventField getRootField(ITmfEvent event) {
+                return event.getContent();
             }
-
+        }) {
             @Override
             public String getHelpText() {
                 return Messages.getMessage(Messages.AspectHelpText_Contents);
             }
 
-            @Override
-            public @Nullable String resolve(ITmfEvent event) {
-                return event.getContent().toString();
-            }
         };
 
         /**
This page took 0.041845 seconds and 5 git commands to generate.