Example usage for org.eclipse.jface.action ActionContributionItem getWidget

List of usage examples for org.eclipse.jface.action ActionContributionItem getWidget

Introduction

In this page you can find the example usage for org.eclipse.jface.action ActionContributionItem getWidget.

Prototype

public Widget getWidget() 

Source Link

Document

Return the widget associated with this contribution item.

Usage

From source file:com.aptana.ide.core.ui.actions.AbstractWorkbenchWindowPulldownDelegate.java

License:Open Source License

/**
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 *///from  w w w  .j  a va  2  s.co m
public void run(IAction action) {
    String id = action.getId();
    ToolItem widget = null;

    WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    CoolBarManager manager = window.getCoolBarManager();
    CoolBar parent = manager.getControl();
    // this returns the list of actionSets groups
    IContributionItem[] items = manager.getItems();
    for (IContributionItem item : items) {
        if (item instanceof IToolBarContributionItem) {
            IToolBarContributionItem toolbarItem = (IToolBarContributionItem) item;
            // this returns the list of actual items for the actions
            IContributionItem[] children = toolbarItem.getToolBarManager().getItems();
            for (IContributionItem child : children) {
                if (child.getId().equals(id)) {
                    // found the toolbar item that corresponds to the action
                    ActionContributionItem actionItem = (ActionContributionItem) child;
                    if (CoreUIUtils.inEclipse34orHigher) {
                        // uses the 3.4 API
                        widget = (ToolItem) actionItem.getWidget();
                    }
                    break;
                }
            }
        }
    }
    Menu menu = getMenu(parent);
    if (widget != null) {
        // sets the location of where the menu is displayed to be the same
        // as when the dropdown arrow is clicked
        Rectangle bounds = widget.getBounds();
        Point point = widget.getParent().toDisplay(bounds.x, bounds.y + bounds.height);
        menu.setLocation(point);
    }
    menu.setVisible(true);
}

From source file:gov.redhawk.frontend.ui.internal.section.FrontendSection.java

License:Open Source License

private void setComponentName(IAction action) {
    ActionContributionItem item = (ActionContributionItem) getToolbar().find(action.getId());
    if (item == null) {
        return;/*www . j av a  2 s  . c o m*/
    }
    Widget w = item.getWidget();
    if (w != null) {
        w.setData("TEST_COMP_NAME", action.getId());
    }
}

From source file:org.dawnsci.algorithm.ui.datareduction.DataReductionFileSelectionPage.java

License:Open Source License

@Override
public Composite createPartControl(Composite parent) {

    createPersistenceActions(algorithmViewPart.getViewSite());

    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(new GridLayout(1, true));
    GridUtils.removeMargins(mainComposite);

    SashForm mainSash = new SashForm(mainComposite, SWT.HORIZONTAL);
    mainSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    SashForm leftSash = new SashForm(mainSash, SWT.VERTICAL);
    leftSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    SashForm middleSash = new SashForm(mainSash, SWT.VERTICAL);
    middleSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    SashForm rightSash = new SashForm(mainSash, SWT.VERTICAL);
    rightSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // Composite to put the main controls in
    Composite mainRecapComp = new Composite(leftSash, SWT.BORDER);
    mainRecapComp.setLayout(new GridLayout(1, false));
    mainRecapComp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));

    Label helpLabel = new Label(mainRecapComp, SWT.WRAP);
    helpLabel.setText("Select a file in the Project Explorer and lock the type. "
            + "Make sure that all your selected data has the same shape.");
    helpLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true));

    recapComp = new Composite(mainRecapComp, SWT.NONE);
    recapComp.setLayout(new GridLayout(1, false));
    recapComp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));

    viewer = new TableViewer(recapComp,
            SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    createColumns(viewer);/*w w  w.  j av  a 2s  .  co  m*/
    viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    viewer.getTable().setLinesVisible(true);
    viewer.getTable().setHeaderVisible(true);
    algorithmViewPart.getSite().setSelectionProvider(viewer);
    rows = createSelectedDataRows();
    viewer.setContentProvider(new IStructuredContentProvider() {
        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            // TODO Auto-generated method stub
        }

        @Override
        public void dispose() {
            // TODO Auto-generated method stub
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return rows.toArray(new SelectedData[rows.size()]);
        }
    });
    viewer.setInput(rows);

    // add the Run workflow action as a button
    ActionContributionItem aci = (ActionContributionItem) algorithmViewPart.getViewSite().getActionBars()
            .getToolBarManager().find(IAlgorithmProcessContext.RUN_ID_STUB + getTitle());
    aci = new ActionContributionItem(aci.getAction());
    aci.fill(mainRecapComp);
    Button runWorkflowButton = (Button) aci.getWidget();
    runWorkflowButton.setText("Run Data Reduction Process");
    runWorkflowButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

    plottingSystems.get(1).createPlotPart(leftSash, types[1], null, PlotType.IMAGE,
            algorithmViewPart.getSite().getPart());
    plottingSystems.get(1).setTitle(titles[1]);

    plottingSystems.get(0).createPlotPart(middleSash, types[0], null, PlotType.IMAGE,
            algorithmViewPart.getSite().getPart());
    plottingSystems.get(0).setTitle(titles[0]);

    plottingSystems.get(3).createPlotPart(middleSash, types[3], null, PlotType.IMAGE,
            algorithmViewPart.getSite().getPart());
    plottingSystems.get(3).setTitle(titles[3]);

    plottingSystems.get(2).createPlotPart(rightSash, types[2], null, PlotType.IMAGE,
            algorithmViewPart.getSite().getPart());
    plottingSystems.get(2).setTitle(titles[2]);

    plottingSystems.get(4).createPlotPart(rightSash, types[4], null, PlotType.IMAGE,
            algorithmViewPart.getSite().getPart());
    plottingSystems.get(4).setTitle(titles[4]);

    algorithmViewPart.getSite().getWorkbenchWindow().getSelectionService()
            .addSelectionListener(fileSelectionListener);

    // try to load the previous data saved in the memento
    for (int i = 0; i < keys.length; i++) {
        if (filePaths[i] != null)
            loadAndPlotData(plottingSystems.get(i), keys[i], filePaths[i], titles[i], true, locks[i], i);
    }

    viewer.refresh();

    return mainComposite;
}

From source file:org.fusesource.ide.foundation.ui.util.Widgets.java

License:Open Source License

public static Button createActionButton(Composite parent, Action action) {
    ActionContributionItem aci = new ActionContributionItem(action);
    aci.fill(parent);/*w w w .  jav a 2 s . c  o  m*/
    Button button = (Button) aci.getWidget();
    if (button != null) {
        // lets try make sure we get the text and the image
        button.setText(action.getText());
    }
    return button;
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.views.nexus.DataSetPlotView.java

License:Apache License

protected void setActionSelected(ActionContributionItem action, boolean selected) {
    if (action.getWidget() instanceof ToolItem) {
        ((ToolItem) action.getWidget()).setSelection(selected);
    } else if (action.getWidget() instanceof MenuItem) {
        ((MenuItem) action.getWidget()).setSelection(selected);
    }/* www . j  a  v  a 2s  .  com*/
}

From source file:uk.ac.diamond.scisoft.feedback.FeedbackView.java

License:Open Source License

/**
 * This is a callback that will allow us to create the viewer and initialise it.
 *///w w w .  j  a  va  2s .  co m
@Override
public void createPartControl(Composite parent) {
    final ScrolledComposite scrollComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    final Composite content = new Composite(scrollComposite, SWT.NONE);
    content.setLayout(new GridLayout(1, false));
    content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    makeActions();

    Composite radioSelection = new Composite(content, SWT.NONE);
    radioSelection.setLayout(new GridLayout(3, false));
    Label label = new Label(radioSelection, SWT.NONE);
    label.setText("Send Feedback to :");

    RadioGroupWidget mailToRadios = new RadioGroupWidget(radioSelection);
    mailToRadios.setActions(createEmailRadioActions());
    Label lblEmailAddress = new Label(content, SWT.NONE);
    lblEmailAddress.setText("Your email address for Feedback");

    emailAddress = new Text(content, SWT.BORDER | SWT.SINGLE);
    emailAddress.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    final String email = Activator.getDefault() != null
            ? Activator.getDefault().getPreferenceStore().getString(FeedbackConstants.FROM_PREF)
            : null;
    if (email != null && !"".equals(email))
        emailAddress.setText(email);

    Label lblSubject = new Label(content, SWT.NONE);
    lblSubject.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblSubject.setText("Summary");

    subjectText = new Text(content, SWT.BORDER | SWT.SINGLE);
    subjectText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    final String subject = Activator.getDefault() != null
            ? Activator.getDefault().getPreferenceStore().getString(FeedbackConstants.SUBJ_PREF)
            : null;
    if (subject != null && !"".equals(subject))
        subjectText.setText(subject);

    Label lblComment = new Label(content, SWT.NONE);
    lblComment.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblComment.setText("Comment");

    messageText = new Text(content, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.minimumHeight = 200;
    messageText.setLayoutData(gd);

    attachLabel = new Label(content, SWT.NONE);
    attachLabel.setText("Attached Files");

    tableViewer = new TableViewer(content, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER);
    createColumns(tableViewer);
    // tableViewer.getTable().setLinesVisible(true);
    tableViewer.getTable().setToolTipText("Delete the file by clicking on the X");
    tableViewer.setContentProvider(new AttachedFileContentProvider());
    tableViewer.setLabelProvider(new AttachedFileLabelProvider());
    tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    attachedFiles = new ArrayList<File>();
    tableViewer.setInput(attachedFiles);
    tableViewer.refresh();

    Composite actionComp = new Composite(content, SWT.NONE);
    actionComp.setLayout(new GridLayout(3, false));
    actionComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    ActionContributionItem attachAci = new ActionContributionItem(attachAction);
    attachAci = new ActionContributionItem(attachAci.getAction());
    attachAci.fill(actionComp);
    Button btnBrowseFile = (Button) attachAci.getWidget();
    btnBrowseFile.setText("Attach Files");
    btnBrowseFile.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));

    Label emptyLabel = new Label(actionComp, SWT.SINGLE);
    emptyLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    ActionContributionItem sendAci = new ActionContributionItem(feedbackAction);
    sendAci = new ActionContributionItem(sendAci.getAction());
    sendAci.fill(actionComp);
    btnSendFeedback = (Button) sendAci.getWidget();
    btnSendFeedback.setText("Send Feedback");
    btnSendFeedback.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    scrollComposite.setContent(content);
    scrollComposite.setExpandVertical(true);
    scrollComposite.setExpandHorizontal(true);
    scrollComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Rectangle r = scrollComposite.getClientArea();
            int height = content.computeSize(r.width, SWT.DEFAULT).y;
            scrollComposite.setMinHeight(height);
            scrollComposite.setMinWidth(content.computeSize(SWT.DEFAULT, r.height).x);
        }
    });

    hookContextMenu();
    contributeToActionBars();
    getSite().getPage().addPartListener(this);
}

From source file:uk.ac.diamond.scisoft.mappingexplorer.test.TwoDSecondaryOpenOneDPluginTest.java

License:Open Source License

/**
 * @throws Exception/*from   w w w  . j  a  va2s. co  m*/
 */
@Test
public final void testShowView() throws Exception {
    final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    // Create a project called 'Test Project' in the workspace
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Test Project");
    if (!project.exists()) {
        project.create(null);
    }
    project.open(null);
    // Import the file system that contains the nexus files into 'Test Project'
    ImportOperation op = new ImportOperation(project.getFullPath(), new FileSystemStructureProvider(),
            new IOverwriteQuery() {

                @Override
                public String queryOverwrite(String pathString) {
                    return pathString;
                }
            }, Arrays.asList(new File[] { getSourceDirectory() }));

    op.setCreateContainerStructure(false);
    op.run(null);

    window.getActivePage().showView(TwoDMappingView.ID);

    // Get a handle to the file '2495.nxs' within the 'Test Project'
    IFile file = ResourcesPlugin.getWorkspace().getRoot().getProject("Test Project").getFolder("mappingexptest")
            .getFile("2495.nxs");
    IEditorPart editor = window.getActivePage().openEditor(new FileEditorInput(file), HDF5TreeEditor.ID);

    PluginTestHelpers.delay(2000);
    if (editor instanceof HDF5TreeEditor) {
        HDF5TreeEditor hdf5treeed = (HDF5TreeEditor) editor;
        NodeLink link = getElement05(hdf5treeed);

        HDF5TableTree tableTree = hdf5treeed.getHDF5TreeExplorer().getTableTree();
        tableTree.expandAll();
        Event event = new Event();
        event.button = 1;
        event.display = Display.getCurrent();
        event.count = 2;
        event.time = (int) System.currentTimeMillis();
        event.widget = ((TreeViewer) tableTree.getViewer()).getTree();
        event.x = 82;
        event.y = 165;
        event.type = SWT.MouseDoubleClick;
        link = ((GroupNode) link.getDestination()).iterator().next();
        tableTree.setSelection(new StructuredSelection(link));
        // Simulate the mouse double click on the tree viewer in the HDF5TreeEditor
        ((TreeViewer) tableTree.getViewer()).getTree().notifyListeners(SWT.MouseDoubleClick, event);
        PluginTestHelpers.delay(1000);

        IViewReference[] viewReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                .getViewReferences();
        boolean exectued = false;
        for (IViewReference vr : viewReferences) {
            if (vr.getId().equals(TwoDMappingView.ID)) {
                IViewPart view = vr.getView(false);

                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(view);
                IContributionItem[] items = view.getViewSite().getActionBars().getToolBarManager().getItems();
                for (IContributionItem iContributionItem : items) {
                    if (iContributionItem instanceof ActionContributionItem) {
                        ActionContributionItem act = (ActionContributionItem) iContributionItem;
                        Event ev = new Event();
                        ev.widget = act.getWidget();
                        ev.type = SWT.Selection;
                        ev.time = (int) System.currentTimeMillis();
                        // Open the TwoD Independent view using the toolbar widget.
                        act.getAction().runWithEvent(ev);
                        exectued = true;
                        break;
                    }
                }
                if (exectued) {
                    break;
                }
            }
        }
        PluginTestHelpers.delay(1000);
        // Open the 2D Dataset in the two d view using the mouse double click simulation
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(editor);
        NodeLink link1 = getElement05Duma(hdf5treeed);
        tableTree.setSelection(new StructuredSelection(link1));
        ((TreeViewer) tableTree.getViewer()).getTree().notifyListeners(SWT.MouseDoubleClick, event);
        PluginTestHelpers.delay(1000);

        IViewPart vf2 = null;
        for (IViewReference vf : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                .getViewReferences()) {
            if (vf.getId().equals(TwoDMappingView.ID) && vf.getSecondaryId() != null) {
                vf2 = vf.getView(true);
                break;
            }
        }
        // Open the One D view from the 2D independent view.
        if (vf2 != null) {
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(vf2);

            IContributionItem[] items = vf2.getViewSite().getActionBars().getToolBarManager().getItems();

            for (IContributionItem iContributionItem : items) {
                if (iContributionItem.getId().equals(ONED_COMMAND_ID)) {
                    IHandlerService service = (IHandlerService) vf2.getSite().getService(IHandlerService.class);
                    service.executeCommand(ONED_COMMAND_ID, null);
                }
            }
        }
    }

    PluginTestHelpers.delay(3000000);
}

From source file:uk.ac.diamond.scisoft.ncd.rcp.edna.views.NcdModelBuilderParametersView.java

License:Apache License

@Override
public Composite createPartControl(final Composite parent) {
    this.parent = parent;
    parent.setLayout(new GridLayout(1, false));
    parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    try {/*  www.  j a  v a 2s.  co  m*/
        qIntensityPlot = PlottingFactory.createPlottingSystem();

    } catch (Exception ne) {
        logger.error("Cannot locate any plotting systems!", ne);
    }

    // Data parameters
    Group dataParametersGroup = new Group(parent, SWT.NONE);
    dataParametersGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    dataParametersGroup.setLayout(new GridLayout());
    dataParametersGroup.setText("Data parameters");

    scrolledComposite = new ScrolledComposite(dataParametersGroup, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrolledComposite.setLayout(new GridLayout());

    dataParameters = new Composite(scrolledComposite, SWT.NONE);
    dataParameters.setLayout(new GridLayout());
    dataParameters.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    final Group dataFileGroup = new Group(dataParameters, SWT.NONE);
    dataFileGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    dataFileGroup.setLayout(new GridLayout(3, false));
    new Label(dataFileGroup, SWT.NONE).setText("Data file");
    dataFile = new Text(dataFileGroup, SWT.BORDER);
    dataFile.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    dataFile.setText(dataFilename);
    dataFile.setToolTipText("Location of input file");
    dataFile.addListener(SWT.KeyUp, new Listener() {
        Color red = new Color(dataFileGroup.getDisplay(), 255, 0, 0);
        Color white = new Color(dataFileGroup.getDisplay(), 255, 255, 255);

        @Override
        public void handleEvent(Event event) {
            if (fileNameIsNotEmptyAndFileExists(dataFile.getText())) {
                dataFile.setBackground(white);
                fileSelected = true;
            } else {
                dataFile.setBackground(red);
                fileSelected = false;
            }
            String filename = dataFile.getText();
            boolean dataFileIsNxsFile = isNxsFile(filename);
            if (dataFileIsNxsFile) {
                findQAndDataPaths();
            }
            enableNexusPathCombos(dataFileIsNxsFile);
            captureGUIInformation();
            checkWhetherPathsAreEmpty();
            refreshRunButton(true);
            checkFilenameAndColorDataFileBox(dataFileGroup.getDisplay());
            updateGuiParameters();
        }
    });

    int style = DND.DROP_COPY | DND.DROP_DEFAULT;
    DropTarget target = new org.eclipse.swt.dnd.DropTarget(dataParameters, style);
    final TextTransfer textTransfer = TextTransfer.getInstance();
    final FileTransfer fileTransfer = FileTransfer.getInstance();
    Transfer[] types = new Transfer[] { fileTransfer, textTransfer };
    target.setTransfer(types);

    target.addDropListener(new DropTargetListener() {

        public void dragEnter(DropTargetEvent event) {
            if (event.detail == DND.DROP_DEFAULT) {
                if ((event.operations & DND.DROP_COPY) != 0) {
                    event.detail = DND.DROP_COPY;
                } else {
                    event.detail = DND.DROP_NONE;
                }
            }
            // will accept text but prefer to have files dropped
            for (int i = 0; i < event.dataTypes.length; i++) {
                if (fileTransfer.isSupportedType(event.dataTypes[i])) {
                    event.currentDataType = event.dataTypes[i];
                    // files should only be copied
                    if (event.detail != DND.DROP_COPY) {
                        event.detail = DND.DROP_NONE;
                    }
                    break;
                }
            }
        }

        public void dragOver(DropTargetEvent event) {
            event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
            if (textTransfer.isSupportedType(event.currentDataType)) {
                // NOTE: on unsupported platforms this will return null
                Object o = textTransfer.nativeToJava(event.currentDataType);
                String t = (String) o;
                if (t != null)
                    System.out.println(t);
            }
        }

        public void dragOperationChanged(DropTargetEvent event) {
            if (event.detail == DND.DROP_DEFAULT) {
                if ((event.operations & DND.DROP_COPY) != 0) {
                    event.detail = DND.DROP_COPY;
                } else {
                    event.detail = DND.DROP_NONE;
                }
            }
            // allow text to be moved but files should only be copied
            if (fileTransfer.isSupportedType(event.currentDataType)) {
                if (event.detail != DND.DROP_COPY) {
                    event.detail = DND.DROP_NONE;
                }
            }
        }

        public void dragLeave(DropTargetEvent event) {
        }

        public void dropAccept(DropTargetEvent event) {
        }

        public void drop(DropTargetEvent event) {
            if (textTransfer.isSupportedType(event.currentDataType)) {
                String[] files = (String[]) event.data;
                for (int i = 0; i < files.length; i++) {
                    if (files[i].toLowerCase().endsWith(DATA_TYPES[0])
                            || files[i].toLowerCase().endsWith(DATA_TYPES[1]))
                        setFilenameString(files[i]);
                }
            }

            if (fileTransfer.isSupportedType(event.currentDataType)) {
                String[] files = (String[]) event.data;
                for (int i = 0; i < files.length; i++) {
                    if (files[i].toLowerCase().endsWith(DATA_TYPES[0])
                            || files[i].toLowerCase().endsWith(DATA_TYPES[1]))
                        setFilenameString(files[i]);
                }
            }
        }
    });

    FileContentProposalProvider prov = new FileContentProposalProvider();
    ContentProposalAdapter ad2 = new ContentProposalAdapter(dataFile, new TextContentAdapter(), prov, null,
            null);
    ad2.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    ad2.addContentProposalListener(new IContentProposalListener() {
        @Override
        public void proposalAccepted(IContentProposal proposal) {
            setFilenameString(proposal.getContent());
        }
    });

    browseDataFile = new Button(dataFileGroup, SWT.NONE);
    browseDataFile.setText("...");
    browseDataFile.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fChooser = new FileDialog(Display.getDefault().getActiveShell());
            fChooser.setText("Choose NXS or DAT file");
            fChooser.setFilterPath(dataFilename);
            String extensions[] = { "*.nxs;*.dat", "*.*" };
            fChooser.setFilterExtensions(extensions);
            String fileStr = fChooser.open();
            if (fileStr != null) {
                final File file = new File(fileStr);
                if (file.isFile()) {
                    setFilenameString(file.toString());
                    isGuiInResetState = false;
                }
            }
        }
    });

    Composite dataParametersComposite = new Composite(dataParameters, SWT.NONE);
    dataParametersComposite.setLayout(new GridLayout(2, false));
    GridData dataParametersGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    dataParametersComposite.setLayoutData(dataParametersGridData);
    new Label(dataParametersComposite, SWT.NONE).setText("Working directory");
    workingDirectory = new Text(dataParametersComposite, SWT.NONE);
    workingDirectory.setToolTipText(
            "Directory where programs leave their files. Must be network accessible (not /scratch or /tmp)");
    workingDirectory.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    ExpandableComposite dataPathAndColumnParametersExpandableComposite = new ExpandableComposite(dataParameters,
            SWT.NONE);
    dataPathAndColumnParametersExpandableComposite.setLayout(new GridLayout());
    dataPathAndColumnParametersExpandableComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    dataPathAndColumnParametersExpandableComposite.setText("Data path and column parameters");

    Composite dataPathAndColumnParametersComposite = new Composite(
            dataPathAndColumnParametersExpandableComposite, SWT.NONE);
    dataPathAndColumnParametersComposite.setLayout(new GridLayout(2, false));
    dataPathAndColumnParametersComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    new Label(dataPathAndColumnParametersComposite, SWT.NONE).setText("Nexus path to q");
    pathToQCombo = new Combo(dataPathAndColumnParametersComposite, SWT.READ_ONLY);
    pathToQCombo.setToolTipText("Path to q data (only used in Nexus file)");
    pathToQCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    pathToQCombo.addListener(SWT.KeyUp, pathListener);
    pathToQCombo.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            currentPathToQ = pathToQCombo.getText();
        }
    });
    new Label(dataPathAndColumnParametersComposite, SWT.NONE).setText("Nexus path to data");
    pathToDataCombo = new Combo(dataPathAndColumnParametersComposite, SWT.READ_ONLY);
    pathToDataCombo.setToolTipText("Path to data (only used in Nexus file)");
    pathToDataCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    pathToDataCombo.addListener(SWT.KeyUp, pathListener);
    pathToDataCombo.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            currentPathToData = pathToDataCombo.getText();
        }
    });

    new Label(dataPathAndColumnParametersComposite, SWT.NONE).setText("Number of data columns");
    numberOfFrames = new Text(dataPathAndColumnParametersComposite, SWT.NONE);
    numberOfFrames.setToolTipText("Number of data columns to use in analysis. For reduced data, this is 1");
    numberOfFrames.addListener(SWT.Verify, verifyInt);
    numberOfFrames.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));

    dataPathAndColumnParametersExpandableComposite.setClient(dataPathAndColumnParametersComposite);
    dataPathAndColumnParametersExpandableComposite.addExpansionListener(expansionAdapter);

    ExpandableComposite dataChoiceExpanderComposite = new ExpandableComposite(dataParameters, SWT.NONE);
    dataChoiceExpanderComposite.setLayout(new GridLayout());
    dataChoiceExpanderComposite.setLayoutData(new GridData(GridData.FILL, SWT.TOP, true, false));
    dataChoiceExpanderComposite.setText("Data range");
    Composite dataChoiceParameters = new Composite(dataChoiceExpanderComposite, SWT.NONE);
    dataChoiceParameters.setLayout(new GridLayout());
    dataChoiceParameters.setLayoutData(new GridData(GridData.FILL, SWT.FILL, true, true));
    SashForm pointsSash = new SashForm(dataChoiceParameters, SWT.HORIZONTAL);
    pointsSash.setLayout(new GridLayout(2, false));
    pointsSash.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Group pointsComposite = new Group(pointsSash, SWT.NONE);
    pointsComposite.setLayout(new GridLayout());
    GridData pointsGroupLayout = new GridData(GridData.FILL, SWT.CENTER, true, false);
    pointsComposite.setLayoutData(pointsGroupLayout);
    Composite firstPointComposite = new Composite(pointsComposite, SWT.NONE);
    firstPointComposite.setLayout(new GridLayout(2, false));
    firstPointComposite.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    new Label(firstPointComposite, SWT.NONE).setText("First point");
    startPoint = new Text(firstPointComposite, SWT.NONE);
    startPoint.setToolTipText("First point of data to be used for calculations.");
    startPoint.addListener(SWT.Verify, verifyInt);
    startPoint.addListener(SWT.DefaultSelection, pointsQKeyListener);
    startPoint.addFocusListener(pointsQFocusListener);
    startPoint.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));

    final String[] qOptionUnits = new String[] { "Angstrom\u207b\u00b9", "nm\u207b\u00b9" };
    final String[] gnomUnits = new String[] { "Angstrom", "nm" };

    Composite qMinComposite = new Composite(pointsComposite, SWT.NONE);
    new Label(qMinComposite, SWT.NONE).setText("q minimum");
    qMinComposite.setLayout(new GridLayout(3, false));
    qMinComposite.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    qMin = new Text(qMinComposite, SWT.NONE);
    qMin.addListener(SWT.Verify, verifyDouble);
    qMin.setToolTipText("Minimum q value to be used for GNOM/DAMMIF");
    qMin.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    qMin.addListener(SWT.DefaultSelection, pointsQKeyListener);
    qMin.addFocusListener(pointsQFocusListener);
    qMinUnits = new Combo(qMinComposite, SWT.READ_ONLY);
    qMinUnits.setItems(qOptionUnits);

    Group pointsGroup2 = new Group(pointsSash, SWT.NONE);
    pointsGroup2.setLayout(new GridLayout());
    pointsGroup2.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    Composite lastPointComposite = new Composite(pointsGroup2, SWT.NONE);
    lastPointComposite.setLayout(new GridLayout(2, false));
    lastPointComposite.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    new Label(lastPointComposite, SWT.NONE).setText("Last point");
    endPoint = new Text(lastPointComposite, SWT.NONE);
    endPoint.setToolTipText("Last point of data to be used for calculations");
    endPoint.addListener(SWT.Verify, verifyInt);
    endPoint.addListener(SWT.DefaultSelection, pointsQKeyListener);
    endPoint.addFocusListener(pointsQFocusListener);
    endPoint.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));

    GridData data = new GridData(GridData.FILL, SWT.CENTER, true, false);
    pointsComposite.setLayoutData(data);
    pointsComposite.setLayout(new GridLayout());
    pointsGroup2.setLayoutData(data);
    pointsGroup2.setLayout(new GridLayout());

    final Composite qMaxComposite = new Composite(pointsGroup2, SWT.NONE);
    new Label(qMaxComposite, SWT.NONE).setText("q maximum");
    qMaxComposite.setLayout(new GridLayout(3, false));
    qMaxComposite.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    qMax = new Text(qMaxComposite, SWT.NONE);
    qMax.addListener(SWT.Verify, verifyDouble);
    qMax.addListener(SWT.DefaultSelection, pointsQKeyListener);
    qMax.addFocusListener(pointsQFocusListener);
    qMax.setToolTipText("Maximum q value to be used for GNOM/DAMMIF");
    qMax.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    qMaxUnits = new Label(qMaxComposite, SWT.NONE);

    startPointBounds = new IntegerDecorator(startPoint);
    startPointBounds.setMinimum(1);
    endPointBounds = new IntegerDecorator(endPoint);
    startPointBounds.addValueChangeListener(valueChangeListener);
    endPointBounds.addValueChangeListener(valueChangeListener);

    qMinBounds = new FloatDecorator(qMin);
    doubleNumberFormat.setMinimumFractionDigits(4);
    qMinBounds.setNumberFormat(null, doubleNumberFormat);
    qMinBounds.setMinimum(0);
    qMaxBounds = new FloatDecorator(qMax);
    qMaxBounds.setNumberFormat(null, doubleNumberFormat);
    qMinBounds.addValueChangeListener(valueChangeListener);
    qMaxBounds.addValueChangeListener(valueChangeListener);

    dataChoiceExpanderComposite.setClient(dataChoiceParameters);
    dataChoiceExpanderComposite.addExpansionListener(expansionAdapter);
    dataChoiceExpanderComposite.setExpanded(true);

    ExpandableComposite plotScrolledExpandableComposite = new ExpandableComposite(dataParameters, SWT.NONE);
    plotScrolledExpandableComposite.setLayout(new GridLayout());
    plotScrolledExpandableComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    plotScrolledExpandableComposite.setText("Data plot");

    plotComposite = new Composite(plotScrolledExpandableComposite, SWT.NONE);
    plotComposite.setLayout(new GridLayout());
    plotComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite plotAndOptionComposite = new Composite(plotComposite, SWT.NONE);
    plotAndOptionComposite.setLayout(new GridLayout(2, false));
    plotAndOptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    final String[] plotOptionNames = new String[] { "logI/logq", "logI/q" };
    plotOptions = new Combo(plotAndOptionComposite, SWT.READ_ONLY);
    plotOptions.setItems(plotOptionNames);
    plotOptions.setToolTipText("Choice of plots to show - logI vs. logq or logI vs. q");
    plotOptions.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (plotOptions.getText().equals(plotOptionNames[0])) {
                xAxisIsLog = true;
            } else {
                xAxisIsLog = false;
            }
            updatePlot();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            //do nothing
        }
    });
    plotOptions.select(1); //default is logI/q
    GridData plotOptionsLayout = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
    plotOptions.setLayoutData(plotOptionsLayout);

    btnResetDataRange = new Button(plotAndOptionComposite, SWT.NONE);
    btnResetDataRange.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
    btnResetDataRange.setText("Reset data range");
    btnResetDataRange.setToolTipText("Reset the data range to include all of the data");
    btnResetDataRange.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (currentQDataset != null) {
                resetRoi();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            //do nothing
        }
    });

    ToolBarManager man = new ToolBarManager(SWT.FLAT | SWT.LEFT | SWT.WRAP);
    ToolBar toolBar = man.createControl(plotComposite);
    toolBar.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

    plotScrollComposite = new ScrolledComposite(plotComposite, SWT.H_SCROLL | SWT.V_SCROLL);
    plotScrollComposite.setLayout(new FillLayout(SWT.FILL));
    Composite child = new Composite(plotScrollComposite, SWT.NONE);
    child.setLayout(new FillLayout(SWT.FILL));

    qIntensityPlot.createPlotPart(child, getTitle(), null, PlotType.XY, null);

    //qIntensityPlot.getPlotActionSystem().fillZoomActions(man);
    qIntensityPlot.getPlotActionSystem().fillPrintActions(man);

    plotScrollComposite.setMinHeight(400);
    plotScrollComposite.setExpandHorizontal(true);
    plotScrollComposite.setExpandVertical(true);
    plotScrollComposite.setContent(child);

    plotScrolledExpandableComposite.setClient(plotComposite);
    plotScrolledExpandableComposite.addExpansionListener(expansionAdapter);
    plotScrolledExpandableComposite.setExpanded(true);

    ExpandableComposite pipelineOptionsExpandableComposite = new ExpandableComposite(dataParameters, SWT.NONE);
    pipelineOptionsExpandableComposite.setLayout(new GridLayout());
    pipelineOptionsExpandableComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    pipelineOptionsExpandableComposite.setText("Pipeline parameters");

    Composite otherOptionsComposite = new Composite(pipelineOptionsExpandableComposite, SWT.NONE);
    otherOptionsComposite.setLayout(new GridLayout(2, false));
    GridData otherOptionsGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    otherOptionsComposite.setLayoutData(otherOptionsGridData);

    new Label(otherOptionsComposite, SWT.NONE).setText("Number of parallel processes");
    numberOfThreads = new Text(otherOptionsComposite, SWT.NONE);
    numberOfThreads.addListener(SWT.Verify, verifyInt);
    numberOfThreads.setToolTipText("The maximum number of cluster processes used to run DAMMIF");
    numberOfThreads.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));

    String[] builderOptionsNames = new String[] { "GNOM", "GNOM+DAMMIF" };
    new Label(otherOptionsComposite, SWT.NONE).setText("Pipeline processes");
    builderOptions = new Combo(otherOptionsComposite, SWT.READ_ONLY);
    builderOptions.setItems(builderOptionsNames);
    builderOptions.setToolTipText("Choice of analysis to run - GNOM only or GNOM followed by DAMMIF");

    pipelineOptionsExpandableComposite.setClient(otherOptionsComposite);
    pipelineOptionsExpandableComposite.addExpansionListener(expansionAdapter);

    ExpandableComposite gnomParametersExpandableComposite = new ExpandableComposite(dataParameters, SWT.NONE);
    gnomParametersExpandableComposite.setLayout(new GridLayout());
    gnomParametersExpandableComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    gnomParametersExpandableComposite.setText("GNOM parameters");
    final Composite gnomParameters = new Composite(gnomParametersExpandableComposite, SWT.NONE);
    GridData gnomLayout = new GridData(SWT.FILL, SWT.TOP, true, false);
    gnomLayout.horizontalSpan = 2;
    gnomParameters.setLayoutData(gnomLayout);
    gnomParameters.setLayout(new GridLayout(3, false));

    new Label(gnomParameters, SWT.NONE).setText("Dmax search point start");
    minDistanceSearch = new Text(gnomParameters, SWT.NONE);
    minDistanceSearch
            .setToolTipText("Initial value for the GNOM program, e.g. minimum possible size of protein");
    minDistanceSearch.addListener(SWT.Verify, verifyDouble);
    minDistanceSearch.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    minDistanceSearch.addListener(SWT.DefaultSelection, distanceKeyListener);
    minDistanceSearch.addFocusListener(distanceFocusListener);
    minDistanceBounds = new FloatDecorator(minDistanceSearch);
    minDistanceUnits = new Label(gnomParameters, SWT.NONE);

    new Label(gnomParameters, SWT.NONE).setText("Dmax search point end");
    maxDistanceSearch = new Text(gnomParameters, SWT.NONE);
    maxDistanceSearch.addListener(SWT.Verify, verifyDouble);
    maxDistanceSearch.setToolTipText("Final value for the GNOM program, e.g. maximum possible size of protein");
    maxDistanceSearch.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));
    maxDistanceSearch.addListener(SWT.DefaultSelection, distanceKeyListener);
    maxDistanceSearch.addFocusListener(distanceFocusListener);
    maxDistanceBounds = new FloatDecorator(maxDistanceSearch);
    maxDistanceUnits = new Label(gnomParameters, SWT.NONE);

    minDistanceBounds.setMinimum(0);
    maxDistanceBounds.setMaximum(Integer.MAX_VALUE);

    minDistanceBounds.addValueChangeListener(valueChangeListener);
    maxDistanceBounds.addValueChangeListener(valueChangeListener);

    qMinUnits.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            modelBuildingParameters.setMainUnitAngstrom(qMinUnits.getText().equals(qOptionUnits[0]));
            qMaxUnits.setText(qMinUnits.getText());
            if (qIntensityPlot.getRegion(Q_REGION_NAME) != null) {
                RectangularROI currentROI = (RectangularROI) qIntensityPlot.getRegion(Q_REGION_NAME).getROI();
                setDoubleBox(qMin, currentROI.getPointX() * getAngstromNmFactor());
                setDoubleBox(qMax, (currentROI.getPointX() + currentROI.getLength(0)) * getAngstromNmFactor());
                qMinBounds.setMinimum(getDatasetMinimumInCurrentUnits() - Math.pow(10, -ROUND_DOUBLES_DIGITS));
                qMinBounds
                        .setMaximum((currentROI.getPointX() + currentROI.getLength(0)) * getAngstromNmFactor());
                qMaxBounds.setMaximum(getDatasetMaximumInCurrentUnits() + Math.pow(10, -ROUND_DOUBLES_DIGITS));
                qMaxBounds.setMinimum(currentROI.getPointX() * getAngstromNmFactor());
            }
            resetDmaxParameters();
            String newUnits = modelBuildingParameters.isMainUnitAngstrom() ? gnomUnits[0] : gnomUnits[1];
            minDistanceUnits.setText(newUnits);
            maxDistanceUnits.setText(newUnits);
            qMaxComposite.layout();
            gnomParameters.layout();
        }
    });

    new Label(gnomParameters, SWT.NONE).setText("Number of iterations");
    numberOfSearch = new Text(gnomParameters, SWT.NONE);
    numberOfSearch.addListener(SWT.Verify, verifyInt);
    GridData searchLayout = new GridData();
    searchLayout.horizontalSpan = 2;
    searchLayout.grabExcessHorizontalSpace = true;
    numberOfSearch.setLayoutData(searchLayout);
    numberOfSearch.setToolTipText("Maximum number of iterations for GNOM to calculate Dmax");

    new Label(gnomParameters, SWT.NONE).setText("Iteration tolerance");
    tolerance = new Text(gnomParameters, SWT.NONE);
    tolerance.addListener(SWT.Verify, verifyDouble);
    tolerance.setToolTipText("Tolerance criteria for completion of GNOM");
    tolerance.setLayoutData(new GridData(GridData.FILL, SWT.CENTER, true, false));

    gnomParametersExpandableComposite.setClient(gnomParameters);
    gnomParametersExpandableComposite.addExpansionListener(expansionAdapter);
    gnomParametersExpandableComposite.setExpanded(true);

    ExpandableComposite dammifParametersExpandableComposite = new ExpandableComposite(dataParameters, SWT.NONE);
    dammifParametersExpandableComposite.setLayout(new GridLayout());
    dammifParametersExpandableComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    dammifParametersExpandableComposite.setText("DAMMIF parameters");
    Composite dammifParameters = new Composite(dammifParametersExpandableComposite, SWT.NONE);
    dammifParameters.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
    dammifParameters.setLayout(new GridLayout(2, true));

    String[] dammifModeOptions = new String[] { "Fast", "Slow" };
    String[] symmetryOptions = getSymmetryOptions();

    new Label(dammifParameters, SWT.NONE).setText("Symmetry");
    symmetry = new Combo(dammifParameters, SWT.READ_ONLY);
    symmetry.setItems(symmetryOptions);
    symmetry.setToolTipText("Symmetry of particle in DAMMIF.");
    new Label(dammifParameters, SWT.NONE).setText("Speed");
    dammifMode = new Combo(dammifParameters, SWT.READ_ONLY);
    dammifMode.setItems(dammifModeOptions);
    dammifMode.setToolTipText("Run DAMMIF analysis in either fast or slow mode");

    dammifParametersExpandableComposite.setClient(dammifParameters);
    dammifParametersExpandableComposite.addExpansionListener(expansionAdapter);

    btnResetParams = new Button(dataParameters, SWT.NONE);
    btnResetParams.setText("Reset all parameters to defaults");
    btnResetParams.setLayoutData(new GridData(GridData.CENTER, SWT.CENTER, false, false));
    btnResetParams.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            resetGUI();
        }
    });

    ActionContributionItem runModelBuilderAction = (ActionContributionItem) algorithmViewPart.getViewSite()
            .getActionBars().getToolBarManager()
            .find(IAlgorithmProcessContext.RUN_ID_STUB + "NCD model building");
    runModelBuilderAction = new ActionContributionItem(runModelBuilderAction.getAction());
    runModelBuilderAction.fill(dataParameters);
    btnRunNcdModelBuilderJob = (Button) runModelBuilderAction.getWidget();
    btnRunNcdModelBuilderJob.setText("Run NCD model building");
    btnRunNcdModelBuilderJob.setLayoutData(new GridData(GridData.CENTER, SWT.CENTER, false, false));
    btnRunNcdModelBuilderJob.setEnabled(false);

    ActionContributionItem stopModelBuilderAction = (ActionContributionItem) algorithmViewPart.getViewSite()
            .getActionBars().getToolBarManager()
            .find(IAlgorithmProcessContext.STOP_ID_STUB + "NCD model building");
    stopModelBuilderAction.setVisible(false);

    scrolledComposite.setContent(dataParameters);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setMinSize(scrollWidth, scrollHeight);
    scrolledComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            scrolledComposite.setMinSize(dataParameters.computeSize(scrollWidth, SWT.DEFAULT));
            plotScrollComposite.setMinWidth(plotComposite.getBounds().width);
            dataParameters.layout();
        }
    });

    if (modelBuildingParameters == null)
        modelBuildingParameters = new ModelBuildingParameters();

    if (memento == null) {
        updatePlot();
    }

    if (memento != null) {
        modelBuildingParameters.loadMementoParameters(memento);
        PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
            @Override
            public void run() {
                try {
                    restoreState();
                } catch (Exception e) {
                    logger.error("Problem while trying to restore the state", e);
                    resetGUI();
                }
            }
        });
        Job job = new Job("Retrieving q values and paths from data file") {
            @Override
            protected IStatus run(IProgressMonitor monitor) {

                final IDataHolder holder;
                try {
                    holder = loadDataFile();
                    Display.getDefault().syncExec(new Runnable() {

                        @Override
                        public void run() {
                            boolean dataFileIsNxsFile = isNxsFile(modelBuildingParameters.getDataFilename());
                            if (dataFileIsNxsFile) {
                                findQAndDataPaths();
                                retrieveQFromHierarchicalData(holder);
                            } else {
                                retrieveQFromData(holder);
                            }
                            enableNexusPathCombos(dataFileIsNxsFile);
                            captureGUIInformation();

                            try {
                                updatePlot(modelBuildingParameters.getDataFilename());
                            } catch (Exception e) {
                                logger.error("exception while updating plot");
                            }
                            qMinBounds.setMinimum(
                                    getDatasetMinimumInCurrentUnits() - Math.pow(10, -ROUND_DOUBLES_DIGITS));
                            qMaxBounds.setMaximum(
                                    getDatasetMaximumInCurrentUnits() + Math.pow(10, -ROUND_DOUBLES_DIGITS));
                            endPointBounds.setMaximum(currentQDataset.getSize());
                            IRegion region = qIntensityPlot.getRegion(Q_REGION_NAME);
                            if (region != null) {
                                RectangularROI roi = (RectangularROI) region.getROI();
                                qMinBounds.setMaximum(roi.getEndPoint()[0] * getAngstromNmFactor());
                                qMaxBounds.setMinimum(roi.getPoint()[0] * getAngstromNmFactor());
                            }
                        }
                    });
                    if (isNxsFile(modelBuildingParameters.getDataFilename())) {
                        checkWhetherPathsAreEmpty();
                    }
                    refreshRunButton(true);
                } catch (Exception e1) {
                    logger.error("Exception while retrieving Q values from data file", e1);
                }
                return Status.OK_STATUS;
            }
        };
        job.schedule();
        isGuiInResetState = false;
    } else {
        resetGUI();
    }

    checkFilenameAndColorDataFileBox(algorithmViewPart.getSite().getShell().getDisplay());

    qIntensityRegionListener = new IROIListener.Stub() {

        @Override
        public void roiDragged(ROIEvent evt) {
            //do nothing here - updating while dragging was slowing things down in HistogramToolPage
        }

        @Override
        public void roiChanged(ROIEvent evt) {
            if (evt.getROI() instanceof RectangularROI) {
                regionDragging = true;
                RectangularROI roi = (RectangularROI) evt.getROI();
                setDoubleBox(qMin, roi.getPoint()[0] * getAngstromNmFactor());
                updatePoint(startPoint, String.valueOf(roi.getPoint()[0] * getAngstromNmFactor()));
                setDoubleBox(qMax, roi.getEndPoint()[0] * getAngstromNmFactor());
                updatePoint(endPoint, String.valueOf(roi.getEndPoint()[0] * getAngstromNmFactor()));
                updateInternalBounds(roi.getPoint()[0], roi.getEndPoint()[0],
                        Integer.parseInt(startPoint.getText()), Integer.parseInt(endPoint.getText()));
                regionDragging = false;
            }
        }
    };

    updatePlot();

    algorithmViewPart.getSite().getWorkbenchWindow().getSelectionService()
            .addSelectionListener(selectionListener);
    // Compute the minimum width size for the first time
    plotScrollComposite.setMinWidth(scrolledComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);

    return parent;
}