/*******************************************************************************
- * Copyright (c) 2010 Ericsson
+ * Copyright (c) 2010, 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
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
private ITmfTrace fTrace;
private Composite fParent;
private ListenerList fSelectionChangedListeners = new ListenerList();
+ private boolean fTraceSelected;
@Override
public void doSave(final IProgressMonitor monitor) {
int cacheSize = Integer.MAX_VALUE;
final ITmfTrace[] traces = new ITmfTrace[nbTraces];
for (int i = 0; i < nbTraces; i++) {
- final TmfTraceElement traceElement = traceEntries.get(i);
+ final TmfTraceElement traceElement = traceEntries.get(i).getElementUnderTraceFolder();
final ITmfTrace trace = traceElement.instantiateTrace();
final ITmfEvent traceEvent = traceElement.instantiateEvent();
if ((trace == null) || (traceEvent == null)) {
try {
trace.initTrace(traceElement.getResource(), traceElement.getLocation().getPath(), traceEvent.getClass());
} catch (final TmfTraceException e) {
- throw new PartInitException(Messages.OpenTraceHandler_NoTrace, e);
+ throw new PartInitException(Messages.OpenTraceHandler_InitError, e);
}
cacheSize = Math.min(cacheSize, trace.getCacheSize());
traces[i] = trace;
}
- final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize);
+ final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize, experimentElement.getResource());
experiment.setBookmarksFile(fFile);
fTrace = experiment;
break;
try {
trace.initTrace(traceElement.getResource(), traceElement.getLocation().getPath(), traceEvent.getClass());
} catch (final TmfTraceException e) {
- throw new PartInitException(Messages.OpenTraceHandler_NoTrace, e);
+ throw new PartInitException(Messages.OpenTraceHandler_InitError, e);
}
fTrace = trace;
break;
try {
trace.initTrace(traceElement.getResource(), traceElement.getLocation().getPath(), traceEvent.getClass());
} catch (final TmfTraceException e) {
- throw new PartInitException(Messages.OpenTraceHandler_NoTrace, e);
+ throw new PartInitException(Messages.OpenTraceHandler_InitError, e);
}
fTrace = trace;
break;
fEventsTable.addSelectionChangedListener(this);
fEventsTable.setTrace(fTrace, true);
fEventsTable.refreshBookmarks(fFile);
+
+ /* ensure start time is set */
+ final ITmfContext context = fTrace.seekEvent(0);
+ fTrace.getNext(context);
+ context.dispose();
+
broadcast(new TmfTraceOpenedSignal(this, fTrace, fFile));
} else {
fEventsTable = new TmfEventsTable(fParent, 0);
fEventsTable.addSelectionChangedListener(this);
fEventsTable.setTrace(fTrace, true);
fEventsTable.refreshBookmarks(fFile);
+
+ /* ensure start time is set */
+ final ITmfContext context = fTrace.seekEvent(0);
+ fTrace.getNext(context);
+ context.dispose();
+
broadcast(new TmfTraceOpenedSignal(this, fTrace, fFile));
} else {
setPartName(getEditorInput().getName());
@Override
public void partActivated(IWorkbenchPart part) {
if (part == this && fTrace != null) {
+ if (fTraceSelected) {
+ return;
+ }
+ fTraceSelected = true;
broadcast(new TmfTraceSelectedSignal(this, fTrace));
}
}
*/
@Override
public void partBroughtToTop(IWorkbenchPart part) {
+ if (part == this && fTrace != null) {
+ if (fTraceSelected) {
+ return;
+ }
+ fTraceSelected = true;
+ broadcast(new TmfTraceSelectedSignal(this, fTrace));
+ }
}
/*
*/
@TmfSignalHandler
public void traceSelected(final TmfTraceSelectedSignal signal) {
- if ((signal.getSource() != this) && signal.getTrace().equals(fTrace)) {
- getSite().getPage().bringToTop(this);
+ if ((signal.getSource() != this)) {
+ if (signal.getTrace().equals(fTrace)) {
+ getSite().getPage().bringToTop(this);
+ } else {
+ fTraceSelected = false;
+ }
}
}