mbtarranger.pathfinder.PathfinderView.java Source code

Java tutorial

Introduction

Here is the source code for mbtarranger.pathfinder.PathfinderView.java

Source

/*******************************************************************************
* Copyright (c) 2013, 2014 ETAS GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Dennis Eder (ETAS GmbH) - initial API and implementation and/or initial documentation
*******************************************************************************/
package mbtarranger.pathfinder;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import mbtarranger.BadBank;
import mbtarranger.bmcommon.FileMapping.SourceLine;
import mbtarranger.editors.EditorSourcelineSelection;
import mbtarranger.postnondet.SimStep;
import mbtarranger.sim.SimStepWithDbg;
import mbtarranger.sim.SmvChoiceOffer;
import mbtarranger.sim.SimXplrNode;
import mbtarranger.sim.SimStepWithDbg.QueueContentDebugInfo;
import mbtarranger.sim.SimStepWithDbg.VariableValueDebugInfo;

import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateListStrategy;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.beans.PojoObservables;
import org.eclipse.core.databinding.conversion.IConverter;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.progress.IProgressConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.eclipse.core.databinding.beans.PojoProperties;
import org.eclipse.swt.widgets.Label;

public class PathfinderView extends ViewPart {
    //   /**
    //    * The name of the view as specified by the extension.
    //    */
    //   public static final String ID = "PLUGIN_ArrExplorer.views.View";

    // private TableViewer viewer;
    private Action action_syncToEditorFile;
    private Action action_refresh;
    private Action action_resetProblemReporting;

    private Text text_inputFilePath;
    protected InteractionModel interactionModel = new InteractionModel();

    public synchronized InteractionModel getInteractionModel() {
        return interactionModel;
    }

    private StyledText styledText_recentOutput;
    private Spinner spinner_lookbehind;
    private Spinner spinner_lookaside;
    private Spinner spinner_lookahead;

    private Composite m_parent;

    private SelectionProvider selectionProvider = new SelectionProvider();

    public class SelectionProvider implements ISelectionProvider {
        ListenerList listeners = new ListenerList();
        private ISelection selection = new StructuredSelection();

        @Override
        public void addSelectionChangedListener(ISelectionChangedListener listener) {
            listeners.add(listener);
        }

        @Override
        public ISelection getSelection() {
            return selection;
        }

        @Override
        public void removeSelectionChangedListener(ISelectionChangedListener listener) {
            listeners.remove(listener);

        }

        @Override
        public void setSelection(ISelection select) {
            selection = select;
            Object[] list = listeners.getListeners();
            for (int i = 0; i < list.length; i++) {
                ((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, select));
            }
        }

    }

    public static class Converter_SpinXplrNode2String implements IConverter {
        @Override
        public Object getFromType() {
            return SimXplrNode.class;
        }

        @Override
        public Object getToType() {
            return String.class;
        }

        @Override
        public Object convert(Object fromObject) {
            if (fromObject == null)
                return "--";
            SimXplrNode node = (SimXplrNode) fromObject;
            return node.toString();
        }
    }

    public static class Converter_IFile2HumanReadablePathAsString implements IConverter {
        @Override
        public Object getFromType() {
            return IFile.class;
        }

        @Override
        public Object getToType() {
            return String.class;
        }

        @Override
        public Object convert(Object fromObject) {
            if (fromObject == null)
                return "--";
            IFile ifile = (IFile) fromObject;
            String name = ifile.getRawLocation().toFile().getName();
            String dir = ifile.getRawLocation().toFile().getParentFile().getAbsolutePath();
            return String.format("%s (%s)", name, dir);
        }
    }

    public static class Converter_File2HumanReadablePathAsString implements IConverter {
        @Override
        public Object getFromType() {
            return File.class;
        }

        @Override
        public Object getToType() {
            return String.class;
        }

        @Override
        public Object convert(Object fromObject) {
            if (fromObject == null)
                return "--";
            File file = (File) fromObject;
            String name = file.getName();
            String dir = file.getParentFile().getAbsolutePath();
            return String.format("%s (%s)", name, dir);
        }
    }

    class NameSorter extends ViewerSorter {
    }

    /**
     * The constructor.
     */
    public PathfinderView() {
        super();
        setupIcons();
    }

    protected void setupIcons() {
        // setup icons
        Bundle bundle = FrameworkUtil.getBundle(this.getClass());
        // URL url = FileLocator.find(bundle, new Path("icons/tx16.gif"), null);
        // ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url);
        // image_icon4tx16px = imageDescriptor.createImage();
    }

    /**
     * This is a callback that will allow us to create the viewer and initialize
     * it.
     */
    public void createPartControl(Composite parent) {
        m_parent = parent;
        getSite().setSelectionProvider(selectionProvider);
        parent.setLayout(new FillLayout(SWT.VERTICAL));

        SashForm sash_vert = new SashForm(parent, SWT.VERTICAL);

        SashForm sashForm_horz = new SashForm(sash_vert, SWT.NONE);

        SashForm sashForm_current = new SashForm(sashForm_horz, SWT.VERTICAL);

        Composite composite_buttonsGrid = new Composite(sashForm_current, SWT.NONE);
        composite_buttonsGrid.setLayout(new GridLayout(1, false));
        text_inputFilePath = new Text(composite_buttonsGrid, SWT.BORDER);
        text_inputFilePath.setToolTipText("input file (*.arr)");

        text_inputFilePath.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
        text_inputFilePath.setSize(231, 235);
        text_inputFilePath.setEditable(false);
        combo = new Text(composite_buttonsGrid, SWT.BORDER);
        combo.setEditable(false);

        GridData gd_combo = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1);
        gd_combo.widthHint = 118;
        combo.setLayoutData(gd_combo);
        combo.setSize(498, 23);

        ToolBar toolBar_main = new ToolBar(composite_buttonsGrid, SWT.FLAT | SWT.WRAP);

        toolBar_main.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
        toolBar_main.setSize(500, 130);

        ToolItem tltm_runVerify = new ToolItem(toolBar_main, SWT.NONE);
        tltm_runVerify.setToolTipText("run verify automatically");
        tltm_runVerify.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                Job job = PathfinderJobs.job_runVerify(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tltm_runVerify.setText("veRun");

        ToolItem tltm_vizualize_io = new ToolItem(toolBar_main, SWT.NONE);
        tltm_vizualize_io.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                Job job = PathfinderJobs.job_vizualizeIO(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tltm_vizualize_io.setText("Viz IO...");

        ToolItem tltm_open = new ToolItem(toolBar_main, SWT.NONE);
        tltm_open.setEnabled(false);
        tltm_open.setText("Open...");

        ToolItem tltm_saveAs = new ToolItem(toolBar_main, SWT.NONE);
        tltm_saveAs.setEnabled(false);
        tltm_saveAs.setText("Save As...");
        ToolBar toolBar_numerics = new ToolBar(composite_buttonsGrid, SWT.FLAT | SWT.WRAP);
        toolBar_numerics.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));

        ToolItem tltm_runInteractive = new ToolItem(toolBar_numerics, SWT.NONE);
        tltm_runInteractive.setToolTipText("(re-)run with given look-specs and decisions");
        tltm_runInteractive.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                Job job = PathfinderJobs.job_runInteractive(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tltm_runInteractive.setText("iRun");

        ToolItem tltm_reset = new ToolItem(toolBar_numerics, SWT.NONE);
        tltm_reset.setToolTipText("clear decisions");
        tltm_reset.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                interactionModel.setDecisions(new ArrayList<SmvChoiceOffer>());
                interactionModel.setSteps(new ArrayList<SimStepWithDbg>());
                interactionModel.setOffers(new ArrayList<SmvChoiceOffer>());
                interactionModel.setRecentOutput("");
                interactionModel.setQueueContentDebugInfos(null);
                interactionModel.setVariableValueDebugInfos(null);
            }
        });
        tltm_reset.setText("Reset");

        ToolItem tltm_maxTransitions = new ToolItem(toolBar_numerics, SWT.SEPARATOR);
        tltm_maxTransitions.setWidth(50);

        spinner_maxTransitions = new Spinner(toolBar_numerics, SWT.BORDER);
        tltm_maxTransitions.setControl(spinner_maxTransitions);
        spinner_maxTransitions.setMinimum(-1);
        spinner_maxTransitions.setToolTipText("max. transition count");

        ToolItem tltm_sepa1 = new ToolItem(toolBar_numerics, SWT.SEPARATOR);

        ToolItem tltm_lookbehind = new ToolItem(toolBar_numerics, SWT.SEPARATOR);
        tltm_lookbehind.setToolTipText("");
        tltm_lookbehind.setWidth(50);

        spinner_lookbehind = new Spinner(toolBar_numerics, SWT.BORDER);
        tltm_lookbehind.setControl(spinner_lookbehind);
        spinner_lookbehind.setToolTipText("look behind from current decision");

        ToolItem tltm_lookaside = new ToolItem(toolBar_numerics, SWT.SEPARATOR);
        tltm_lookaside.setWidth(50);

        spinner_lookaside = new Spinner(toolBar_numerics, SWT.BORDER);
        tltm_lookaside.setControl(spinner_lookaside);
        spinner_lookaside.setToolTipText("look aside for each decision");

        ToolItem tltm_lookahead = new ToolItem(toolBar_numerics, SWT.SEPARATOR);
        tltm_lookahead.setWidth(50);

        spinner_lookahead = new Spinner(toolBar_numerics, SWT.BORDER);
        tltm_lookahead.setControl(spinner_lookahead);
        spinner_lookahead.setToolTipText("look ahead from current decision");

        ToolBar toolBar_vizualisations = new ToolBar(composite_buttonsGrid, SWT.FLAT | SWT.WRAP);
        toolBar_vizualisations.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));

        ToolItem tltm_vizualize_raw = new ToolItem(toolBar_vizualisations, SWT.NONE);
        tltm_vizualize_raw.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                Job job = PathfinderJobs.job_vizualizeRaw(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tltm_vizualize_raw.setText("Viz Raw...");

        ToolItem tltm_vizualize_all = new ToolItem(toolBar_vizualisations, SWT.NONE);
        tltm_vizualize_all.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                Job job = PathfinderJobs.job_vizualizeAll(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tltm_vizualize_all.setText("Viz All...");

        compTblVw_pending = new Composite(sashForm_current, SWT.EMBEDDED);
        TableColumnLayout tcl_compTblVw_pending = new TableColumnLayout();
        compTblVw_pending.setLayout(tcl_compTblVw_pending);

        tblVw_pending = new TableViewer(compTblVw_pending, SWT.BORDER | SWT.FULL_SELECTION);
        tbl_pending = tblVw_pending.getTable();
        tbl_pending.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                int sele = tbl_pending.getSelectionIndex();
                /* update 'SelectedChoice' in interactionModel */
                interactionModel.setSelectedChoice(interactionModel.getOffers().get(sele));
                /* update 'SourceLine' for editors / Selection listeners */
                SmvChoiceOffer choice = interactionModel.getSelectedChoice();
                int line = extractSourcelineFrom(choice);
                if (line > -1) {
                    EditorSourcelineSelection srcLineSelection = new EditorSourcelineSelection();
                    SourceLine wrappedSrcLine;
                    try {
                        wrappedSrcLine = new SourceLine(interactionModel.getWrappedFile().toPath(), line);
                        SourceLine origSrcLine = interactionModel.getSmvFileWrap().getFileMapping_wrapped2orig()
                                .get(wrappedSrcLine);
                        srcLineSelection.file = origSrcLine.getFilePath().toFile();
                        srcLineSelection.line = origSrcLine.getLine();
                        selectionProvider.setSelection(srcLineSelection);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        });
        tbl_pending.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseDoubleClick(MouseEvent e) {
                int sele = tbl_pending.getSelectionIndex();
                ArrayList<SmvChoiceOffer> decisions = interactionModel.getDecisions();
                decisions.add(interactionModel.getOffers().get(sele));
                /* clear info on "pending decision": */
                interactionModel.setOffers(new ArrayList<SmvChoiceOffer>());
                interactionModel.setRecentOutput("--");
                interactionModel.setFullOutput("--");
                interactionModel.setDecisions(decisions);
                Job job = PathfinderJobs.job_runInteractive(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tbl_pending.setToolTipText("pending decision");
        tbl_pending.setHeaderVisible(true);
        tbl_pending.setLinesVisible(true);

        TableViewerColumn tableViewerColumn = new TableViewerColumn(tblVw_pending, SWT.NONE);
        TableColumn tblclmn_choice = tableViewerColumn.getColumn();
        tblclmn_choice.setMoveable(true);
        tcl_compTblVw_pending.setColumnData(tblclmn_choice, new ColumnPixelData(16, true, true));
        tblclmn_choice.setText("choice");

        TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tblVw_pending, SWT.NONE);
        TableColumn tblclmn_proc = tableViewerColumn_1.getColumn();
        tcl_compTblVw_pending.setColumnData(tblclmn_proc, new ColumnPixelData(16, true, true));
        tblclmn_proc.setMoveable(true);
        tblclmn_proc.setText("proc");

        TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tblVw_pending, SWT.NONE);
        TableColumn tblclmn_machine = tableViewerColumn_2.getColumn();
        tcl_compTblVw_pending.setColumnData(tblclmn_machine, new ColumnPixelData(60, true, true));
        tblclmn_machine.setMoveable(true);
        tblclmn_machine.setText("machine");

        TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tblVw_pending, SWT.NONE);
        TableColumn tblclmn_label = tableViewerColumn_3.getColumn();
        tcl_compTblVw_pending.setColumnData(tblclmn_label, new ColumnPixelData(80, true, true));
        tblclmn_label.setMoveable(true);
        tblclmn_label.setText("label");

        TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tblVw_pending, SWT.NONE);
        TableColumn tblclmn_fullText = tableViewerColumn_4.getColumn();
        tcl_compTblVw_pending.setColumnData(tblclmn_fullText, new ColumnPixelData(200, true, true));
        tblclmn_fullText.setMoveable(true);
        tblclmn_fullText.setText("full text");

        Composite compTblVw_histDecisions = new Composite(sashForm_current, SWT.NONE);
        TableColumnLayout tcl_compTblVw_histDecisions = new TableColumnLayout();
        compTblVw_histDecisions.setLayout(tcl_compTblVw_histDecisions);

        tblVw_histDecisions = new TableViewer(compTblVw_histDecisions, SWT.BORDER | SWT.FULL_SELECTION);
        tbl_histDecisions = tblVw_histDecisions.getTable();
        tbl_histDecisions.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                int sele = tbl_histDecisions.getSelectionIndex();
                /* update 'SelectedChoice' in interactionModel */
                interactionModel.setSelectedChoice(interactionModel.getDecisions().get(sele));
                /* update 'SourceLine' for editors */
                SmvChoiceOffer choice = interactionModel.getSelectedChoice();
                int line = extractSourcelineFrom(choice);
                if (line > -1) {
                    EditorSourcelineSelection srcLineSelection = new EditorSourcelineSelection();
                    SourceLine wrappedSrcLine;
                    try {
                        wrappedSrcLine = new SourceLine(interactionModel.getWrappedFile().toPath(), line);
                        SourceLine origSrcLine = interactionModel.getSmvFileWrap().getFileMapping_wrapped2orig()
                                .get(wrappedSrcLine);
                        srcLineSelection.file = origSrcLine.getFilePath().toFile();
                        srcLineSelection.line = origSrcLine.getLine();
                        selectionProvider.setSelection(srcLineSelection);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }

            }
        });
        tbl_histDecisions.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseDoubleClick(MouseEvent e) {
                int sele = tbl_histDecisions.getSelectionIndex();
                ArrayList<SmvChoiceOffer> decisions = interactionModel.getDecisions();
                decisions.subList(sele + 1, decisions.size()).clear();
                interactionModel.setDecisions(decisions);
                Job job = PathfinderJobs.job_runInteractive(getDisplay(), interactionModel);
                job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
                job.schedule();
            }
        });
        tbl_histDecisions.setToolTipText("decision history");
        tbl_histDecisions.setHeaderVisible(true);
        tbl_histDecisions.setLinesVisible(true);

        TableViewerColumn tableViewerColumn_10 = new TableViewerColumn(tblVw_histDecisions, SWT.NONE);
        TableColumn tblclmn_histDecisions_choice = tableViewerColumn_10.getColumn();
        tblclmn_histDecisions_choice.setMoveable(true);
        tcl_compTblVw_histDecisions.setColumnData(tblclmn_histDecisions_choice,
                new ColumnPixelData(16, true, true));
        tblclmn_histDecisions_choice.setText("choice");

        TableViewerColumn tableViewerColumn_11 = new TableViewerColumn(tblVw_histDecisions, SWT.NONE);
        TableColumn tblclmn_histDecisions_proc = tableViewerColumn_11.getColumn();
        tblclmn_histDecisions_proc.setMoveable(true);
        tcl_compTblVw_histDecisions.setColumnData(tblclmn_histDecisions_proc, new ColumnPixelData(16, true, true));
        tblclmn_histDecisions_proc.setText("proc");

        TableViewerColumn tableViewerColumn_12 = new TableViewerColumn(tblVw_histDecisions, SWT.NONE);
        TableColumn tblclmn_histDecisions_machine = tableViewerColumn_12.getColumn();
        tblclmn_histDecisions_machine.setMoveable(true);
        tcl_compTblVw_histDecisions.setColumnData(tblclmn_histDecisions_machine,
                new ColumnPixelData(60, true, true));
        tblclmn_histDecisions_machine.setText("machine");

        TableViewerColumn tableViewerColumn_13 = new TableViewerColumn(tblVw_histDecisions, SWT.NONE);
        TableColumn tblclmn_histDecisions_label = tableViewerColumn_13.getColumn();
        tblclmn_histDecisions_label.setMoveable(true);
        tcl_compTblVw_histDecisions.setColumnData(tblclmn_histDecisions_label, new ColumnPixelData(80, true, true));
        tblclmn_histDecisions_label.setText("label");

        TableViewerColumn tableViewerColumn_14 = new TableViewerColumn(tblVw_histDecisions, SWT.NONE);
        TableColumn tblclmn_histDecisions_fullText = tableViewerColumn_14.getColumn();
        tblclmn_histDecisions_fullText.setMoveable(true);
        tcl_compTblVw_histDecisions.setColumnData(tblclmn_histDecisions_fullText,
                new ColumnPixelData(200, true, true));
        tblclmn_histDecisions_fullText.setText("full text");

        Composite compTblVw_decisionDetails = new Composite(sashForm_current, SWT.NONE);
        compTblVw_decisionDetails.setLayout(new TableColumnLayout());

        TableViewer tblVw_decisionDetails = new TableViewer(compTblVw_decisionDetails,
                SWT.BORDER | SWT.FULL_SELECTION);
        tbl_decisionDetails = tblVw_decisionDetails.getTable();
        tbl_decisionDetails.setToolTipText("decision details");
        tbl_decisionDetails.setHeaderVisible(true);
        tbl_decisionDetails.setLinesVisible(true);
        sashForm_current.setWeights(new int[] { 6, 4, 3, 2 });

        Composite compTblVw_steps = new Composite(sashForm_horz, SWT.NONE);
        TableColumnLayout tcl_compTblVw_steps = new TableColumnLayout();
        compTblVw_steps.setLayout(tcl_compTblVw_steps);

        tblVw_steps = new TableViewer(compTblVw_steps, SWT.BORDER | SWT.FULL_SELECTION);
        tbl_steps = tblVw_steps.getTable();
        tbl_steps.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                int sele = tbl_steps.getSelectionIndex();
                /* update 'SelectedSimStep' in interactionModel */
                interactionModel.setSelectedSimStep(interactionModel.getSteps().get(sele));
                /* update 'SourceLine' for editors */
                SimStepWithDbg sstep = interactionModel.getSelectedSimStep();
                int line = extractSourcelineFrom(sstep);
                if (line > -1) {
                    EditorSourcelineSelection srcLineSelection = new EditorSourcelineSelection();
                    SourceLine wrappedSrcLine;
                    try {
                        wrappedSrcLine = new SourceLine(interactionModel.getWrappedFile().toPath(), line);
                        SourceLine origSrcLine = interactionModel.getSmvFileWrap().getFileMapping_wrapped2orig()
                                .get(wrappedSrcLine);
                        srcLineSelection.file = origSrcLine.getFilePath().toFile();
                        srcLineSelection.line = origSrcLine.getLine();
                        selectionProvider.setSelection(srcLineSelection);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        });

        tbl_steps.setToolTipText("simulation steps");
        tbl_steps.setHeaderVisible(true);
        tbl_steps.setLinesVisible(true);

        TableViewerColumn tableViewerColumn_16 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_summary = tableViewerColumn_16.getColumn();
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_summary, new ColumnPixelData(300, true, true));
        tblclmn_steps_summary.setText("summary");

        TableViewerColumn tableViewerColumn_6 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_proc = tableViewerColumn_6.getColumn();
        tblclmn_steps_proc.setMoveable(true);
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_proc, new ColumnPixelData(16, true, true));
        tblclmn_steps_proc.setText("proc");

        TableViewerColumn tableViewerColumn_7 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_machine = tableViewerColumn_7.getColumn();
        tblclmn_steps_machine.setMoveable(true);
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_machine, new ColumnPixelData(60, true, true));
        tblclmn_steps_machine.setText("machine");

        TableViewerColumn tableViewerColumn_8 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_label = tableViewerColumn_8.getColumn();
        tblclmn_steps_label.setMoveable(true);
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_label, new ColumnPixelData(80, true, true));
        tblclmn_steps_label.setText("label");

        TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_queue = tableViewerColumn_5.getColumn();
        tblclmn_steps_queue.setMoveable(true);
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_queue, new ColumnPixelData(50, true, true));
        tblclmn_steps_queue.setText("queue");

        TableViewerColumn tableViewerColumn_15 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_type = tableViewerColumn_15.getColumn();
        tblclmn_steps_type.setMoveable(true);
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_type, new ColumnPixelData(40, true, true));
        tblclmn_steps_type.setText("type");

        TableViewerColumn tableViewerColumn_9 = new TableViewerColumn(tblVw_steps, SWT.NONE);
        TableColumn tblclmn_steps_fullText = tableViewerColumn_9.getColumn();
        tblclmn_steps_fullText.setMoveable(true);
        tcl_compTblVw_steps.setColumnData(tblclmn_steps_fullText, new ColumnPixelData(200, true, true));
        tblclmn_steps_fullText.setText("full text");

        SashForm sashForm_dbgValues = new SashForm(sashForm_horz, SWT.VERTICAL);

        Composite compTblVw_dbgQueues = new Composite(sashForm_dbgValues, SWT.NONE);
        TableColumnLayout tcl_compTblVw_dbgQueues = new TableColumnLayout();
        compTblVw_dbgQueues.setLayout(tcl_compTblVw_dbgQueues);

        tblVw_dbgQueues = new TableViewer(compTblVw_dbgQueues, SWT.BORDER | SWT.FULL_SELECTION);
        tbl_dbgQueues = tblVw_dbgQueues.getTable();
        tbl_dbgQueues.setToolTipText("Queues debug ino - as of after step");
        tbl_dbgQueues.setHeaderVisible(true);
        tbl_dbgQueues.setLinesVisible(true);

        TableViewerColumn tableViewerColumn_21 = new TableViewerColumn(tblVw_dbgQueues, SWT.NONE);
        TableColumn tblclmn_dbgQueues_ID = tableViewerColumn_21.getColumn();
        tblclmn_dbgQueues_ID.setMoveable(true);
        tcl_compTblVw_dbgQueues.setColumnData(tblclmn_dbgQueues_ID, new ColumnPixelData(20, true, true));
        tblclmn_dbgQueues_ID.setText("ID");

        TableViewerColumn tableViewerColumn_18 = new TableViewerColumn(tblVw_dbgQueues, SWT.NONE);
        TableColumn tblclmn_dbgQueues_name = tableViewerColumn_18.getColumn();
        tblclmn_dbgQueues_name.setMoveable(true);
        tcl_compTblVw_dbgQueues.setColumnData(tblclmn_dbgQueues_name, new ColumnPixelData(150, true, true));
        tblclmn_dbgQueues_name.setText("queue");

        TableViewerColumn tableViewerColumn_17 = new TableViewerColumn(tblVw_dbgQueues, SWT.NONE);
        TableColumn tblclmn_dbgQueues_value = tableViewerColumn_17.getColumn();
        tblclmn_dbgQueues_value.setMoveable(true);
        tcl_compTblVw_dbgQueues.setColumnData(tblclmn_dbgQueues_value, new ColumnPixelData(150, true, true));
        tblclmn_dbgQueues_value.setText("value");

        Composite compTblVw_dbgVariables = new Composite(sashForm_dbgValues, SWT.NONE);
        TableColumnLayout tcl_compTblVw_dbgVariables = new TableColumnLayout();
        compTblVw_dbgVariables.setLayout(tcl_compTblVw_dbgVariables);

        tblVw_dbgVariables = new TableViewer(compTblVw_dbgVariables, SWT.BORDER | SWT.FULL_SELECTION);
        tbl_dbgVariables = tblVw_dbgVariables.getTable();
        tbl_dbgVariables.setToolTipText("Variables debug ino - as of after step");
        tbl_dbgVariables.setHeaderVisible(true);
        tbl_dbgVariables.setLinesVisible(true);

        TableViewerColumn tableViewerColumn_19 = new TableViewerColumn(tblVw_dbgVariables, SWT.NONE);
        TableColumn tblclmn_dbgVariables_name = tableViewerColumn_19.getColumn();
        tblclmn_dbgVariables_name.setMoveable(true);
        tcl_compTblVw_dbgVariables.setColumnData(tblclmn_dbgVariables_name, new ColumnPixelData(150, true, true));
        tblclmn_dbgVariables_name.setText("variable");

        TableViewerColumn tableViewerColumn_20 = new TableViewerColumn(tblVw_dbgVariables, SWT.NONE);
        TableColumn tblclmn_dbgVariables_value = tableViewerColumn_20.getColumn();
        tblclmn_dbgVariables_value.setMoveable(true);
        tcl_compTblVw_dbgVariables.setColumnData(tblclmn_dbgVariables_value, new ColumnPixelData(80, true, true));
        tblclmn_dbgVariables_value.setText("value");
        sashForm_dbgValues.setWeights(new int[] { 1, 1 });
        sashForm_horz.setWeights(new int[] { 162, 150, 130 });

        SashForm sashForm = new SashForm(sash_vert, SWT.NONE);

        styledText_fullOutput = new StyledText(sashForm, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
        styledText_fullOutput.setToolTipText("exploration tree as text");
        styledText_fullOutput.setAlwaysShowScrollBars(false);

        TextViewer textViewer_recentOutput = new TextViewer(sashForm, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
        textViewer_recentOutput.setEditable(false);
        styledText_recentOutput = textViewer_recentOutput.getTextWidget();
        styledText_recentOutput.setToolTipText("progression until nondeterminism as text");
        styledText_recentOutput.setLeftMargin(0);
        styledText_recentOutput.setAlwaysShowScrollBars(false);
        styledText_recentOutput.setEditable(false);
        sashForm.setWeights(new int[] { 1, 1 });
        sash_vert.setWeights(new int[] { 20, 1 });
        makeActions();
        contributeToActionBars();
        initDataBindings();
    }

    /**
     * 
     * @param choice
     * @return line as numbered by SPIN. If no line is referenced by SPIN,
     *         returns "-1"
     */
    protected int extractSourcelineFrom(SmvChoiceOffer choice) {
        int res;
        String fullText = choice.getLineText();
        /**
         * sample line text
         * 
         * <pre>
         * choice 1: proc  1 (machineFrtpTX) C:\Users\deeder\Documents\dev\gitDeSpIDE\SpinExperiments1\gen\ISO10681_2_2010_06_technical.arr.INTERACTIVE_tmpWrap.pml:451 (state 109) [IF]
         * choice 2: proc  0 (:init:) C:\Users\deeder\Documents\dev\gitDeSpIDE\SpinExperiments1\gen\ISO10681_2_2010_06_technical.arr.INTERACTIVE_tmpWrap.pml:513 (state 2) [(run machineFrtpRX(rxClient_frtpServiceIF_calls))]
         * </pre>
         */
        if (fullText.matches("\\s*.*\\s*.+\\.pml\\:\\p{Digit}+\\s+.*\\s*")) {
            res = Integer.parseInt(fullText.split("\\s*.*\\s*.+\\.pml\\:", 2)[1].split("\\s+", 2)[0]);
        } else {
            res = -1;
        }
        return res;
    }

    /**
     * 
     * @param sstep
     * @return line as numbered by SPIN. If no line is referenced by SPIN,
     *         returns "-1"
     */
    protected int extractSourcelineFrom(SimStep sstep) {
        int res;
        String fullText = sstep.getLineText();
        /**
         * sample line text
         * 
         * <pre>
         * 3:   proc  0 (:init:) C:\Users\deeder\Documents\dev\gitDeSpIDE\SpinExperiments1\gen\functionModeling3and4.arr.INTERACTIVE_tmpWrap.pml:47 (state 3)   [result = 0]
         * </pre>
         */
        if (fullText.matches("\\s*.*\\s*.+\\.pml\\:\\p{Digit}+\\s+.*\\s*")) {
            res = Integer.parseInt(fullText.split("\\s*.*\\s*.+\\.pml\\:", 2)[1].split("\\s+", 2)[0]);
        } else {
            res = -1;
        }
        return res;
    }

    protected Display getDisplay() {
        return m_parent.getShell().getDisplay();
    }

    private Spinner spinner_maxTransitions;
    private Text combo;
    private Table tbl_pending;
    private TableViewer tblVw_pending;
    private Composite compTblVw_pending;
    private Table tbl_histDecisions;
    private Table tbl_decisionDetails;
    private Table tbl_steps;
    private TableViewer tblVw_steps;
    private StyledText styledText_fullOutput;
    private TableViewer tblVw_histDecisions;
    private Table tbl_dbgQueues;
    private Table tbl_dbgVariables;
    private TableViewer tblVw_dbgVariables;
    private TableViewer tblVw_dbgQueues;

    public File getActiveInputFile() {
        return this.interactionModel.getInputFile().getRawLocation().toFile();
    }

    private void contributeToActionBars() {
        IActionBars bars = getViewSite().getActionBars();
        fillLocalPullDown(bars.getMenuManager());
        fillLocalToolBar(bars.getToolBarManager());
    }

    private void fillLocalPullDown(IMenuManager manager) {
        manager.add(action_refresh);
        manager.add(action_syncToEditorFile);
        manager.add(new Separator());
    }

    private void fillLocalToolBar(IToolBarManager manager) {
        manager.add(action_refresh);
        manager.add(action_syncToEditorFile);
    }

    private void action_syncToEditor() {
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage page = window == null ? null : window.getActivePage();
        IEditorPart editorPart = page == null ? null : page.getActiveEditor();
        IEditorInput editorInput = editorPart == null ? null : editorPart.getEditorInput();
        try {
            Object o = editorInput == null ? null : editorInput.getAdapter(IFile.class);
            IFile file = o == null ? null : (IFile) o;
            if (file != null && file.getFileExtension().equalsIgnoreCase("ARR")) {
                this.interactionModel.setInputFile(file);
                System.out.println(String.format("new input file is: %s",
                        this.interactionModel.getInputFile().getRawLocation().toOSString()));
            }
        } catch (Exception ex) {
            System.err.println(ex.getStackTrace());
        }
    }

    private void action_refresh() {
        // container.notifyAll();
    }

    public IFile getActiveInputFileResource() {
        return this.interactionModel.getInputFile();
    }

    private void makeActions() {

        // ---------------------------
        action_resetProblemReporting = new Action() {
            public void run() {
                action_resetProblemReporting();
            }
        };
        action_resetProblemReporting.setText("Reset Problem Markers");
        action_resetProblemReporting.setToolTipText("resets Problem Markers for current file");
        // ---------------------------
        action_syncToEditorFile = new Action() {
            public void run() {
                action_syncToEditor();
            }
        };
        action_syncToEditorFile.setText("Sync<<Editor");
        action_syncToEditorFile.setToolTipText("synchronizes from currently active file in editor");
        // ---------------------------
        action_refresh = new Action() {
            public void run() {
                action_refresh();
            }
        };
        action_refresh.setText("Refresh");
        action_refresh.setToolTipText("synchronizes to updates on active file in this window");
        // ---------------------------

    }

    private void action_resetProblemReporting() {
        try {
            BadBank.reset4resource(getActiveInputFileResource());
        } catch (CoreException e2) {
            e2.printStackTrace();
        }
    }

    // private void showMessage(String message) {
    // MessageDialog.openInformation(container.getShell(),
    // "Pathfiner (DeSpIDE)", message);
    // }

    /**
     * Passing the focus request to the viewer's control.
     */
    public void setFocus() {
        this.text_inputFilePath.setFocus();
    }

    protected DataBindingContext initDataBindings() {
        DataBindingContext bindingContext = new DataBindingContext();
        //
        IObservableValue observeTextText_inputFilePathObserveWidget = WidgetProperties.text(SWT.Modify)
                .observe(text_inputFilePath);
        IObservableValue inputFileInteractionModelObserveValue = BeanProperties.value("inputFile")
                .observe(interactionModel);
        UpdateValueStrategy strategy = new UpdateValueStrategy();
        strategy.setConverter(new Converter_IFile2HumanReadablePathAsString());
        bindingContext.bindValue(observeTextText_inputFilePathObserveWidget, inputFileInteractionModelObserveValue,
                null, strategy);
        //
        IObservableValue observeTextStyledTextObserveWidget = WidgetProperties.text(SWT.Modify)
                .observe(styledText_recentOutput);
        IObservableValue recentOutputInteractionModelObserveValue = BeanProperties.value("recentOutput")
                .observe(interactionModel);
        bindingContext.bindValue(observeTextStyledTextObserveWidget, recentOutputInteractionModelObserveValue, null,
                null);
        //
        IObservableValue observeSelectionSpinner_lookbehindObserveWidget = WidgetProperties.selection()
                .observe(spinner_lookbehind);
        IObservableValue lookbehindInteractionModelObserveValue = BeanProperties.value("lookbehind")
                .observe(interactionModel);
        bindingContext.bindValue(observeSelectionSpinner_lookbehindObserveWidget,
                lookbehindInteractionModelObserveValue, null, null);
        //
        IObservableValue observeSelectionSpinner_lookasideObserveWidget = WidgetProperties.selection()
                .observe(spinner_lookaside);
        IObservableValue lookasideInteractionModelObserveValue = BeanProperties.value("lookaside")
                .observe(interactionModel);
        bindingContext.bindValue(observeSelectionSpinner_lookasideObserveWidget,
                lookasideInteractionModelObserveValue, null, null);
        //
        IObservableValue observeSelectionSpinner_lookaheadObserveWidget = WidgetProperties.selection()
                .observe(spinner_lookahead);
        IObservableValue lookaheadInteractionModelObserveValue = BeanProperties.value("lookahead")
                .observe(interactionModel);
        bindingContext.bindValue(observeSelectionSpinner_lookaheadObserveWidget,
                lookaheadInteractionModelObserveValue, null, null);
        //
        IObservableValue observeSelectionSpinner_maxTransitionsObserveWidget = WidgetProperties.selection()
                .observe(spinner_maxTransitions);
        IObservableValue maxTransitionCountInteractionModelObserveValue = BeanProperties.value("maxTransitionCount")
                .observe(interactionModel);
        bindingContext.bindValue(observeSelectionSpinner_maxTransitionsObserveWidget,
                maxTransitionCountInteractionModelObserveValue, null, null);
        //
        ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
        IObservableMap[] observeMaps_1 = PojoObservables.observeMaps(listContentProvider.getKnownElements(),
                SmvChoiceOffer.class, new String[] { "choiceID", "processID", "machineName", "label", "lineText" });
        tblVw_pending.setLabelProvider(new ObservableMapLabelProvider(observeMaps_1));
        tblVw_pending.setContentProvider(listContentProvider);
        //
        IObservableList offersInteractionModelObserveList = BeanProperties.list("offers").observe(interactionModel);
        tblVw_pending.setInput(offersInteractionModelObserveList);
        //
        ObservableListContentProvider listContentProvider_1 = new ObservableListContentProvider();
        IObservableMap[] observeMaps = PojoObservables.observeMaps(listContentProvider_1.getKnownElements(),
                SimStep.class, new String[] { "textualSummary", "processID", "machineName", "label", "ioQueue",
                        "type", "lineText" });
        tblVw_steps.setLabelProvider(new ObservableMapLabelProvider(observeMaps));
        tblVw_steps.setContentProvider(listContentProvider_1);
        //
        IObservableList stepsInteractionModelObserveList = BeanProperties.list("steps").observe(interactionModel);
        tblVw_steps.setInput(stepsInteractionModelObserveList);
        //
        ObservableListContentProvider listContentProvider_2 = new ObservableListContentProvider();
        IObservableMap[] observeMaps_2 = PojoObservables.observeMaps(listContentProvider_2.getKnownElements(),
                SmvChoiceOffer.class, new String[] { "choiceID", "processID", "machineName", "label", "lineText" });
        tblVw_histDecisions.setLabelProvider(new ObservableMapLabelProvider(observeMaps_2));
        tblVw_histDecisions.setContentProvider(listContentProvider_2);
        //
        IObservableList decisionsInteractionModelObserveList = BeanProperties.list("decisions")
                .observe(interactionModel);
        tblVw_histDecisions.setInput(decisionsInteractionModelObserveList);
        //
        ObservableListContentProvider listContentProvider_3 = new ObservableListContentProvider();
        IObservableMap[] observeMaps_3 = PojoObservables.observeMaps(listContentProvider_3.getKnownElements(),
                QueueContentDebugInfo.class, new String[] { "queueID", "queueSymbol", "queueContent" });
        tblVw_dbgQueues.setLabelProvider(new ObservableMapLabelProvider(observeMaps_3));
        tblVw_dbgQueues.setContentProvider(listContentProvider_3);
        //
        IObservableList queueContentDebugInfosInteractionModelObserveList = BeanProperties
                .list("queueContentDebugInfos").observe(interactionModel);
        tblVw_dbgQueues.setInput(queueContentDebugInfosInteractionModelObserveList);
        //
        ObservableListContentProvider listContentProvider_4 = new ObservableListContentProvider();
        IObservableMap[] observeMaps_4 = PojoObservables.observeMaps(listContentProvider_4.getKnownElements(),
                VariableValueDebugInfo.class, new String[] { "variableSymbol", "variableValue" });
        tblVw_dbgVariables.setLabelProvider(new ObservableMapLabelProvider(observeMaps_4));
        tblVw_dbgVariables.setContentProvider(listContentProvider_4);
        //
        IObservableList variableValueDebugInfosInteractionModelObserveList = BeanProperties
                .list("variableValueDebugInfos").observe(interactionModel);
        tblVw_dbgVariables.setInput(variableValueDebugInfosInteractionModelObserveList);
        //
        IObservableValue observeTextStyledText_fullOutputObserveWidget = WidgetProperties.text(SWT.Modify)
                .observe(styledText_fullOutput);
        IObservableValue fullOutputInteractionModelObserveValue = BeanProperties.value("fullOutput")
                .observe(interactionModel);
        bindingContext.bindValue(observeTextStyledText_fullOutputObserveWidget,
                fullOutputInteractionModelObserveValue, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
                null);
        //
        IObservableValue observeTextComboObserveWidget = WidgetProperties.text(SWT.Modify).observe(combo);
        IObservableValue selectedTestIDInteractionModelObserveValue = BeanProperties.value("selectedTestID")
                .observe(interactionModel);
        bindingContext.bindValue(observeTextComboObserveWidget, selectedTestIDInteractionModelObserveValue, null,
                null);
        //
        return bindingContext;
    }
}