Search in sources :

Example 11 with ITmfAnalysisModuleWithStateSystems

use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.

the class DataDrivenTimeGraphProviderFactory method create.

/**
 * Create a data provider for a trace
 *
 * @param trace
 *            The trace for which to create a provider
 * @return A time graph data provider, or <code>null</code> if the data
 *         provider cannot be built for this trace because it does not have
 *         the proper analyses.
 */
@Nullable
public ITimeGraphDataProvider<TimeGraphEntryModel> create(ITmfTrace trace) {
    Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>();
    List<ITmfStateSystem> sss = new ArrayList<>();
    if (fAnalysisIds.isEmpty()) {
        /*
             * No analysis specified, take all state system analysis modules
             */
        Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class));
    } else {
        for (String moduleId : fAnalysisIds) {
            // Get the module for the current trace only. The caller will
            // take care of
            // generating composite providers with experiments
            IAnalysisModule module = trace.getAnalysisModule(moduleId);
            if (module instanceof ITmfAnalysisModuleWithStateSystems) {
                stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module);
            }
        }
    }
    for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) {
        if (module.schedule().isOK() && module.waitForInitialization()) {
            module.getStateSystems().forEach(sss::add);
        }
    }
    return (sss.isEmpty() ? null : create(trace, sss, fEntries, fValues, null));
}
Also used : IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) ArrayList(java.util.ArrayList) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) HashSet(java.util.HashSet) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 12 with ITmfAnalysisModuleWithStateSystems

use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.

the class StateSystemPresentationProvider method getEventHoverToolTipInfo.

@Override
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) {
    Map<String, String> retMap = new LinkedHashMap<>();
    if (event instanceof TimeEvent) {
        ITimeGraphEntry entry = event.getEntry();
        ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();
        if (model instanceof StateSystemEntryModel) {
            TimeGraphEntry moduleEntry = (TimeGraphEntry) entry.getParent();
            ModuleEntryModel moduleModel = (ModuleEntryModel) moduleEntry.getEntryModel();
            ITmfAnalysisModuleWithStateSystems module = (moduleModel).getModule();
            if (module instanceof TmfAbstractAnalysisModule) {
                retMap.putAll(((TmfAbstractAnalysisModule) module).getProperties());
            }
        } else if (model instanceof ModuleEntryModel) {
            ITmfAnalysisModuleWithStateSystems module = ((ModuleEntryModel) model).getModule();
            retMap.put(Messages.ModuleHelpText, module.getHelpText());
            retMap.put(Messages.ModuleIsAutomatic, Boolean.toString(module.isAutomatic()));
        }
    }
    return retMap;
}
Also used : ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) ModuleEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) StateSystemEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.StateSystemEntryModel) TimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent) ITimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent) TmfAbstractAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) LinkedHashMap(java.util.LinkedHashMap) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems)

Example 13 with ITmfAnalysisModuleWithStateSystems

use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.

the class TmfStateSystemExplorer method createPartControl.

@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    getTimeGraphViewer().addTimeListener(event -> synchingToTime(event.getBeginTime()));
    getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent event) {
            ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
            if (selection instanceof TimeGraphEntry) {
                ITmfTreeDataModel model = ((TimeGraphEntry) selection).getEntryModel();
                if (model instanceof ModuleEntryModel && selection.getChildren().isEmpty()) {
                    /**
                     * Schedule the analysis if it has not run yet.
                     */
                    ITmfAnalysisModuleWithStateSystems module = ((ModuleEntryModel) model).getModule();
                    module.schedule();
                }
                TimeGraphControl control = getTimeGraphViewer().getTimeGraphControl();
                boolean expandedState = control.getExpandedState(selection);
                control.setExpandedState(selection, !expandedState);
            }
        }
    });
}
Also used : ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) ModuleEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel) MouseEvent(org.eclipse.swt.events.MouseEvent) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) MouseAdapter(org.eclipse.swt.events.MouseAdapter) TimeGraphControl(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems)

Aggregations

ITmfAnalysisModuleWithStateSystems (org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems)13 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)6 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)4 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)4 Test (org.junit.Test)4 Element (org.w3c.dom.Element)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 Nullable (org.eclipse.jdt.annotation.Nullable)3 AnalysisCompilationData (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.AnalysisCompilationData)3 TmfAbstractAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule)3 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)3 ModuleEntryModel (org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel)2 TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)2 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)2 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)2 LinkedHashMap (java.util.LinkedHashMap)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1