Search in sources :

Example 6 with TaskView

use of abs.backend.java.observing.TaskView in project abstools by abstools.

the class DebugTreeStyledLabelProvider method getLabel.

private StyledString getLabel(Object element) {
    if (element instanceof TaskView) {
        String s = "Task " + ((TaskView) element).getID() + " (" + ((TaskView) element).getMethodName() + ")";
        List<TaskView> schedulableTasks = getSchedulerRef().getSchedulableTasks();
        if (schedulableTasks != null) {
            for (TaskView taskView : schedulableTasks) {
                if (taskView.getID() == ((TaskView) element).getID()) {
                    return new StyledString(s, STYLER_BLACK);
                }
            }
        }
        return new StyledString(s, STYLER_GREY);
    } else if (element instanceof COGView) {
        COGView cog = (COGView) element;
        String s = "COG " + cog.getID() + " (" + getInitialObject(cog).getClassName() + " " + getInitialObject(cog).getID() + ")";
        // for color of the string, check if there is a task that can be stepped
        if (cog.getScheduler().getSchedulableTasks().size() > 0) {
            return new StyledString(s, STYLER_BLACK);
        } else {
            return new StyledString(s, STYLER_GREY);
        }
    } else if (element instanceof Tasks) {
        String s = "Tasks (" + getCOGInfo(((Tasks) element).getCOG()).getTasks().size() + ")";
        // for color of the string, check if there is a task that can be stepped
        if (((Tasks) element).getCOG().getScheduler().getSchedulableTasks().size() > 0) {
            return new StyledString(s, STYLER_BLACK);
        } else {
            return new StyledString(s, STYLER_GREY);
        }
    } else if (element instanceof Objects) {
        return new StyledString("Objects (" + ((Objects) element).getObjects().size() + ")", STYLER_BLACK);
    } else if (element instanceof TaskStackFrameView) {
        TaskStackFrameView tsv = ((TaskStackFrameView) element);
        MethodView mv = tsv.getMethod();
        return new StyledString("StackFrame (" + mv.toString() + ")", STYLER_BLACK);
    } else if (element instanceof ObjectView) {
        ObjectView obj = (ObjectView) element;
        return new StyledString(obj.getClassName() + " " + obj.getID(), STYLER_BLACK);
    } else if (element instanceof DebugModel) {
        return new StyledString(getDebugger().getProjectName(), STYLER_BLACK);
    } else {
        return new StyledString("UnknownObject", STYLER_GREY);
    }
}
Also used : COGView(abs.backend.java.observing.COGView) TaskView(abs.backend.java.observing.TaskView) Tasks(org.absmodels.abs.plugin.debug.model.Tasks) DebugModel(abs.backend.java.debugging.DebugModel) Objects(org.absmodels.abs.plugin.debug.model.Objects) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) TaskStackFrameView(abs.backend.java.observing.TaskStackFrameView) MethodView(abs.backend.java.observing.MethodView) ObjectView(abs.backend.java.observing.ObjectView)

Example 7 with TaskView

use of abs.backend.java.observing.TaskView in project abstools by abstools.

the class DebugView method createViewer.

@Override
protected Viewer createViewer(Composite parent) {
    final TreeViewer viewer = new TreeViewer(parent);
    viewer.setContentProvider(new DebugTreeContentProvider());
    viewer.setLabelProvider(new DebugTreeStyledLabelProvider());
    viewer.setInput(debugger.getModel());
    viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            refreshButtonEnablement();
            Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (selection instanceof TaskView || selection instanceof ObjectView || selection instanceof TaskStackFrameView) {
                refreshVariableView();
                if (selection instanceof TaskView) {
                    TaskView tv = (TaskView) selection;
                    TaskInfo taskInfo = getDebugger().getModel().getTaskInfo(tv);
                    highlightLine(taskInfo);
                }
            }
            getSchedulerRef().taskSelectionChanged(selection);
        }
    });
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (selection instanceof ObjectView || selection instanceof TaskStackFrameView) {
                openVariableView();
                refreshVariableView();
            } else {
                viewer.setExpandedState(selection, !viewer.getExpandedState(selection));
            }
        }
    });
    viewer.expandAll();
    return viewer;
}
Also used : TaskView(abs.backend.java.observing.TaskView) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) ObjectView(abs.backend.java.observing.ObjectView) TaskStackFrameView(abs.backend.java.observing.TaskStackFrameView) TaskInfo(abs.backend.java.debugging.TaskInfo) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener)

Aggregations

TaskView (abs.backend.java.observing.TaskView)7 TaskStackFrameView (abs.backend.java.observing.TaskStackFrameView)5 DebugModel (abs.backend.java.debugging.DebugModel)2 COGView (abs.backend.java.observing.COGView)2 ObjectView (abs.backend.java.observing.ObjectView)2 TaskStackView (abs.backend.java.observing.TaskStackView)2 ScheduleAction (abs.backend.java.scheduling.ScheduleAction)2 ArrayList (java.util.ArrayList)2 Objects (org.absmodels.abs.plugin.debug.model.Objects)2 Tasks (org.absmodels.abs.plugin.debug.model.Tasks)2 TaskInfo (abs.backend.java.debugging.TaskInfo)1 FutView (abs.backend.java.observing.FutView)1 MethodView (abs.backend.java.observing.MethodView)1 ScheduleOptions (abs.backend.java.scheduling.ScheduleOptions)1 TaskInfo (abs.backend.java.scheduling.SimpleTaskScheduler.TaskInfo)1 TaskScheduler (abs.backend.java.scheduling.TaskScheduler)1 List (java.util.List)1 SchedulingStrategy (org.absmodels.abs.plugin.debug.scheduling.SchedulingStrategy)1 StepOverScheduler (org.absmodels.abs.plugin.debug.scheduling.StepOverScheduler)1 TotalScheduler (org.absmodels.abs.plugin.debug.scheduling.TotalScheduler)1