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>
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());
}
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);
}
}
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());
}
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());
}
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());
}
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);
}
}