tmf: Clean up tmf.core.trace package
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / stubs / org / eclipse / linuxtools / tmf / tests / stubs / trace / TmfTraceStub.java
index c2acb599e9c454082577c94dd03793a93a41a760..8b7b430fcad9445a34a68439a19afdc76316abf8 100644 (file)
@@ -20,18 +20,21 @@ import java.util.concurrent.locks.ReentrantLock;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
 
 /**
  * <b><u>TmfTraceStub</u></b>
@@ -90,7 +93,7 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
     public TmfTraceStub(final String path, final int cacheSize, final long interval) throws TmfTraceException {
         super(null, ITmfEvent.class, path, cacheSize, interval, null, null);
         try {
-            fTrace = new RandomAccessFile(path, "r");
+            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
@@ -124,13 +127,13 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
     public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException {
         super(null, ITmfEvent.class, path, cacheSize, 0, null, null);
         try {
-            fTrace = new RandomAccessFile(path, "r");
+            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
         setParser(new TmfEventParserStub(this));
         if (waitForCompletion) {
-            indexTrace();
+            indexTrace(true);
         }
     }
 
@@ -143,7 +146,7 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
     public TmfTraceStub(final IResource resource,  final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException {
         super(resource, ITmfEvent.class, path, cacheSize, 0, null, null);
         try {
-            fTrace = new RandomAccessFile(path, "r");
+            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
@@ -161,7 +164,7 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
             final ITmfEventParser parser, final ITmfTraceIndexer indexer) throws TmfTraceException {
         super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null);
         try {
-            fTrace = new RandomAccessFile(path, "r");
+            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
@@ -174,21 +177,17 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
     public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException {
         super(trace);
         try {
-            fTrace = new RandomAccessFile(getPath(), "r");
+            fTrace = new RandomAccessFile(getPath(), "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
         setParser(new TmfEventParserStub(this));
     }
 
-    public void indexTrace() {
-        indexTrace(true);
-    }
-
     @Override
     public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type) throws TmfTraceException {
         try {
-            fTrace = new RandomAccessFile(path, "r");
+            fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
         } catch (FileNotFoundException e) {
             throw new TmfTraceException(e.getMessage());
         }
@@ -367,12 +366,12 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
         super.dispose();
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
-     */
     @Override
-    public boolean validate(IProject project, String path) {
-        return fileExists(path);
+    public IStatus validate(IProject project, String path) {
+        if (fileExists(path)) {
+            return Status.OK_STATUS;
+        }
+        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File does not exist: " + path);
     }
 
 }
This page took 0.025254 seconds and 5 git commands to generate.