Search in sources :

Example 1 with ModuleEntryModel

use of org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel in project tracecompass by tracecompass.

the class StateSystemPresentationProvider method getStateTableIndex.

@Override
public int getStateTableIndex(ITimeEvent event) {
    if (event instanceof TimeEvent) {
        TimeEvent timeEvent = (TimeEvent) event;
        Object value = timeEvent.getLabel();
        if (value != null) {
            return Math.floorMod(value.hashCode(), NUM_COLORS);
        }
        ITimeGraphEntry entry = event.getEntry();
        if (entry != null) {
            ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();
            if (model instanceof StateSystemEntryModel || model instanceof ModuleEntryModel) {
                // tooltip
                return INVISIBLE;
            }
        }
        // grey
        return NUM_COLORS;
    }
    return INVISIBLE;
}
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) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Example 2 with ModuleEntryModel

use of org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel 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 3 with ModuleEntryModel

use of org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel 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

ModuleEntryModel (org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel)3 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)3 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)3 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)3 StateSystemEntryModel (org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.StateSystemEntryModel)2 ITmfAnalysisModuleWithStateSystems (org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems)2 ITimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent)2 TimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent)2 LinkedHashMap (java.util.LinkedHashMap)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 TmfAbstractAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule)1 TimeGraphControl (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl)1