tmf.core: Introduce TmfTimestamp factory methods
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / statesystem / TmfStateSystemViewer.java
index cb29e26020b1698752f5c70cb2f179202fdfc367..edda1f7f514c8b58f8bb29a7efa8fa490b6cc032 100644 (file)
@@ -37,7 +37,6 @@ import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal;
 import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems;
-import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -212,9 +211,8 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
         for (ITmfAnalysisModuleWithStateSystems module : modules) {
             /* Just schedule the module, the data will be filled when available */
             module.schedule();
-            if (module instanceof TmfStateSystemAnalysisModule) {
-                // TODO: add this method to ITmfAnalysisModuleWithStateSystems
-                ((TmfStateSystemAnalysisModule) module).waitForInitialization();
+            if (!module.waitForInitialization()) {
+                continue;
             }
             for (ITmfStateSystem ss : module.getStateSystems()) {
                 traceEntry.addChild(new StateSystemEntry(ss));
@@ -267,8 +265,8 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
                                 !interval.getStateValue().isNull();
                     stateEntry = new StateEntry(ss.getAttributeName(quark), quark, ss.getFullAttributePath(quark),
                             interval.getStateValue(),
-                            new TmfTimestamp(interval.getStartTime(), ITmfTimestamp.NANOSECOND_SCALE),
-                            new TmfTimestamp(interval.getEndTime(), ITmfTimestamp.NANOSECOND_SCALE),
+                            TmfTimestamp.fromNanos(interval.getStartTime()),
+                            TmfTimestamp.fromNanos(interval.getEndTime()),
                             modified);
 
                     // update children first to know if parent is really needed
@@ -285,8 +283,8 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
                     }
                 } else {
                     stateEntry.update(interval.getStateValue(),
-                            new TmfTimestamp(interval.getStartTime(), ITmfTimestamp.NANOSECOND_SCALE),
-                            new TmfTimestamp(interval.getEndTime(), ITmfTimestamp.NANOSECOND_SCALE));
+                            TmfTimestamp.fromNanos(interval.getStartTime()),
+                            TmfTimestamp.fromNanos(interval.getEndTime()));
 
                     // update children recursively
                     updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
@@ -367,13 +365,13 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
 
         private final int fQuark;
         private final String fFullPath;
-        private @NonNull TmfTimestamp fStart;
-        private @NonNull TmfTimestamp fEnd;
+        private @NonNull ITmfTimestamp fStart;
+        private @NonNull ITmfTimestamp fEnd;
         private ITmfStateValue fValue;
         private boolean fModified;
         private boolean fOutOfRange = false;
 
-        public StateEntry(String name, int quark, String fullPath, ITmfStateValue value, @NonNull TmfTimestamp start, @NonNull TmfTimestamp end, boolean modified) {
+        public StateEntry(String name, int quark, String fullPath, ITmfStateValue value, @NonNull ITmfTimestamp start, @NonNull ITmfTimestamp end, boolean modified) {
             super(name);
             fQuark = quark;
             fFullPath = fullPath;
@@ -444,7 +442,7 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
             return fModified;
         }
 
-        public void update(ITmfStateValue value, @NonNull TmfTimestamp start, @NonNull TmfTimestamp end) {
+        public void update(ITmfStateValue value, @NonNull ITmfTimestamp start, @NonNull ITmfTimestamp end) {
             fModified = false;
             fOutOfRange = false;
             if (!start.equals(fStart)) {
This page took 0.026336 seconds and 5 git commands to generate.