use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TmfStateSystemExplorer method handleAnalysisStarted.
/**
* Rebuild the view's entry tree to ensure that entries from a newly started
* trace are added.
*
* @param signal
* analysis started signal.
* @since 3.3
*/
@TmfSignalHandler
public void handleAnalysisStarted(TmfStartAnalysisSignal signal) {
IAnalysisModule module = signal.getAnalysisModule();
if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) {
/*
* use set to wait for initialization in build entry list to avoid
* deadlocks.
*/
final ITmfTrace viewTrace = getTrace();
if (Iterables.contains(allModules(viewTrace), module)) {
/*
* Rebuild only if the started analysis module is from the
* active trace/experiment.
*/
new Thread(() -> {
/*
* DataProviderManager#getDataProvider() (see getDataProvider() below) should never be called in a signal handler.
*/
synchronized (fStartedAnalysis) {
fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module);
// Every children of ITmfAnalysisModuleWithStateSystems extends TmfAbstractAnalysisModule
ITmfTrace moduleTrace = module instanceof TmfAbstractAnalysisModule ? ((TmfAbstractAnalysisModule) module).getTrace() : viewTrace;
if (moduleTrace != null) {
getDataProvider(moduleTrace).startedAnalysisSignalHandler((ITmfAnalysisModuleWithStateSystems) module);
rebuild();
}
}
}).start();
} else {
/*
* Reset the View for the relevant trace, ensuring that the
* entry list will be rebuilt when the view switches back.
*/
for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) {
if (Iterables.contains(allModules(trace), module)) {
synchronized (fStartedAnalysis) {
fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module);
resetView(trace);
}
break;
}
}
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TimeChartView method traceClosed.
/**
* Handler for the Trace Closed signal
*
* @param signal
* The incoming signal
*/
@TmfSignalHandler
public void traceClosed(TmfTraceClosedSignal signal) {
final ITmfTrace trace = signal.getTrace();
for (int i = 0; i < fTimeAnalysisEntries.size(); i++) {
if (fTimeAnalysisEntries.get(i).getTrace().equals(trace)) {
fTimeAnalysisEntries.remove(i);
fDecorationProviders.remove(trace);
synchronized (fDecorateThreads) {
for (DecorateThread thread : fDecorateThreads) {
if (thread.fTimeAnalysisEntry.getTrace() == trace) {
thread.cancel();
fDecorateThreads.remove(thread);
break;
}
}
}
refreshViewer();
break;
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TimeChartView method traceOpened.
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
/**
* Handler for the Trace Opened signal
*
* @param signal
* The incoming signal
*/
@TmfSignalHandler
public void traceOpened(TmfTraceOpenedSignal signal) {
final ITmfTrace trace = signal.getTrace();
final IFile bookmarksFile = signal.getEditorFile();
TimeChartAnalysisEntry timeAnalysisEntry = null;
for (int i = 0; i < fTimeAnalysisEntries.size(); i++) {
if (fTimeAnalysisEntries.get(i).getTrace().equals(trace)) {
timeAnalysisEntry = fTimeAnalysisEntries.get(i);
break;
}
}
if (timeAnalysisEntry == null) {
timeAnalysisEntry = new TimeChartAnalysisEntry(trace, fDisplayWidth * 2);
fTimeAnalysisEntries.add(timeAnalysisEntry);
fDecorationProviders.put(trace, new TimeChartDecorationProvider(bookmarksFile));
startProcessTraceThread(timeAnalysisEntry);
}
refreshViewer();
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class AbstractTimeGraphView method selectionChanged.
/**
* Signal indicating a data model element was selected somewhere
*
* @param signal
* the signal carrying the select data model metadata
* @since 4.2
*/
@TmfSignalHandler
public void selectionChanged(TmfDataModelSelectedSignal signal) {
// Ignore signal from self
if (signal.getSource() == this) {
return;
}
Multimap<@NonNull String, @NonNull Object> metadata = signal.getMetadata();
// See if the current selection intersects the metadata
ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
if (selection instanceof IElementResolver && IElementResolver.commonIntersect(metadata, ((IElementResolver) selection).getMetadata())) {
return;
}
// See if an entry intersects the metadata
List<TimeGraphEntry> traceEntries = getEntryList(getTrace());
if (traceEntries == null) {
return;
}
for (TraceEntry traceEntry : Iterables.filter(traceEntries, TraceEntry.class)) {
Iterable<TimeGraphEntry> unfiltered = Utils.flatten(traceEntry);
for (TimeGraphEntry entry : unfiltered) {
if (IElementResolver.commonIntersect(metadata, entry.getMetadata())) {
getTimeGraphViewer().setSelection(entry, true);
}
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class ControlFlowView method traceSelected.
@TmfSignalHandler
@Override
public void traceSelected(TmfTraceSelectedSignal signal) {
super.traceSelected(signal);
/* Update the Flat and Hierarchical actions */
synchronized (fFlatTraces) {
if (fFlatTraces.contains(signal.getTrace())) {
fHierarchicalAction.setChecked(false);
fFlatAction.setChecked(true);
} else {
fFlatAction.setChecked(false);
fHierarchicalAction.setChecked(true);
}
}
/* Update the Dynamic Filters related actions */
ViewerFilter activeThreadFilter = null;
ViewerFilter[] traceFilters = getFiltersMap().get(signal.getTrace());
if (traceFilters != null) {
activeThreadFilter = getActiveThreadsFilter(traceFilters);
}
if (activeThreadFilter instanceof ActiveThreadsFilter) {
fActiveThreadsFilter = (ActiveThreadsFilter) activeThreadFilter;
} else {
fActiveThreadsFilter = new ActiveThreadsFilter(null, false, getTrace());
}
fActiveThreadsRapidToggle.setChecked(fActiveThreadsFilter.isEnabled());
}
Aggregations