Example usage for org.eclipse.jface.wizard IWizardContainer showPage

List of usage examples for org.eclipse.jface.wizard IWizardContainer showPage

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizardContainer showPage.

Prototype

public void showPage(IWizardPage page);

Source Link

Document

Makes the given page visible.

Usage

From source file:org.eclipse.ice.client.common.wizards.ImportItemWizardPage.java

License:Open Source License

/**
 * Override the default behavior to add a <code>ListViewer</code> with the
 * available item types./*from  ww  w  .  j  av  a  2s  .c  o  m*/
 */
@Override
public void createControl(Composite parent) {

    // Get the client.
    IClient client = null;
    try {
        client = IClient.getClient();
    } catch (CoreException e) {
        logger.error("Error getting IClient instance", e);
    }

    if (client != null) {
        // Get the list of available Items from the client
        final ArrayList<String> itemTypes = client.getAvailableItemTypes();
        // Sort the list so that items are displayed lexographically.
        Collections.sort(itemTypes);

        // Create the Text and browse Button.
        super.createControl(parent);

        if (parent != null) {
            GridData gridData;

            // Create a label for the Project Combo
            Label label = new Label(wizardPageComposite, SWT.NONE);
            label.setText("Please select the Project where this Item should be created");

            // Create the Combo
            projectCombo = new Combo(wizardPageComposite, SWT.READ_ONLY);
            gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
            gridData.horizontalSpan = 2;
            projectCombo.setLayoutData(gridData);

            // Get a list of all Project Names
            ArrayList<String> projectNames = new ArrayList<String>();
            for (IProject p : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
                projectNames.add(p.getName());
            }

            // Set the possible 
            projectCombo.setItems(projectNames.toArray(new String[projectNames.size()]));
            if (selectedProject != null) {
                projectCombo.select(projectNames.indexOf(selectedProject));
            } else {
                projectCombo.select(0);
            }

            // Create a label above the list.
            label = new Label(wizardPageComposite, SWT.NONE);
            label.setText("Please select an Item that this file represents");
            gridData = new GridData(SWT.LEFT, SWT.END, false, false);
            gridData.horizontalSpan = 2;
            label.setLayoutData(gridData);

            // Create the list.
            ListViewer itemList = new ListViewer(wizardPageComposite,
                    SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
            gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
            gridData.horizontalSpan = 2;
            itemList.getControl().setLayoutData(gridData);

            // Add the label provider for the list viewer
            itemList.setLabelProvider(new LabelProvider() {
                @Override
                public String getText(Object element) {
                    return (String) element;
                }
            });

            // Add the content provider for the list viewer
            itemList.setContentProvider(new IStructuredContentProvider() {
                @Override
                public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
                    // Nothing to do
                }

                @Override
                public void dispose() {
                    // Nothing to do
                }

                @Override
                public Object[] getElements(Object inputElement) {
                    return ((ArrayList<?>) inputElement).toArray();
                }
            });

            // Create the selection listener
            itemList.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(SelectionChangedEvent event) {
                    // Get and store the selection
                    String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement();
                    if (selection != null) {
                        selectedItemType = selection;
                    }
                    // Validate the file and Item selection to enable
                    // the finish button
                    ImportItemWizardPage.this.setPageComplete(checkSelection());
                }
            });
            // Set the input to the list from the client
            itemList.setInput(itemTypes);

            // Add a double-click listener to the ListViewer. If the file
            // was already selected, then a double-click can advance or
            // finish the wizard.
            itemList.addDoubleClickListener(new IDoubleClickListener() {
                @Override
                public void doubleClick(DoubleClickEvent event) {

                    // If the page is complete, we can try to finish the
                    // wizard.
                    if (isPageComplete()) {
                        // Get the wizard and its container.
                        IWizard wizard = getWizard();
                        IWizardContainer container = wizard.getContainer();
                        // If the container is a WizardDialog, we can try to
                        // finish the wizard and close the dialog.
                        if (container instanceof WizardDialog) {
                            if (wizard.performFinish()) {
                                ((WizardDialog) container).close();
                            }
                        }
                        // Otherwise, we can try to advance to the next page
                        // if one exists.
                        else {
                            // Get the next page.
                            IWizardPage nextPage = wizard.getNextPage(ImportItemWizardPage.this);
                            // If it exists, move to it.
                            if (nextPage != null) {
                                container.showPage(nextPage);
                            }
                        }
                    }

                    return;
                }
            });

            // Force the parent Composite to repaint.
            parent.layout();
        }

    } else {
        MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR);
        errorMessage.setMessage("The ICE Client is not available. " + "Please file a bug report.");
    }

    return;
}

From source file:org.eclipse.ice.client.common.wizards.NewItemWizardPage.java

License:Open Source License

/**
 * This operation draws the wizard on the screen.
 *
 * @param itemSelectionComposite/*from ww w .j  a va2s.  c  o  m*/
 *            The composite that should hold the contents of the wizard
 * @param client
 *            The ICE Client
 */
private void drawWizard(Composite itemSelectionComposite, IClient client) {

    // Get the list of available Items from the client
    final List<String> itemTypeList = client.getAvailableItemTypes();
    // Sort the list so that items are displayed lexographically.
    Collections.sort(itemTypeList);

    // Create the item selection label
    Label itemLabel = new Label(itemSelectionComposite, SWT.NONE);
    itemLabel.setText("Please select an Item type.");
    // Add the list for selecting an Item
    ListViewer itemListViewer = new ListViewer(itemSelectionComposite,
            SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    // Set the layout data so that it fills the space
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    itemListViewer.getControl().setLayoutData(data);
    // Add the label provider for the list viewer
    itemListViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return (String) element;
        }
    });
    // Add the content provider for the list viewer
    itemListViewer.setContentProvider(new IStructuredContentProvider() {

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            // Nothing to do
        }

        @Override
        public void dispose() {
            // Nothing to do
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return ((List<?>) inputElement).toArray();
        }
    });
    // Create the selection listener
    itemListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            // Get and store the selection
            String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (selection != null) {
                selectedItemType = selection;
            }
            // Validate the file and Item selection to enable
            // the finish button
            NewItemWizardPage.this.setPageComplete(checkSelection());
        }
    });
    // Set the input to the list from the client
    itemListViewer.setInput(itemTypeList);

    // Add a double-click listener to the ListViewer. If the file was
    // already selected, then a double-click can advance or finish the
    // wizard.
    itemListViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {

            // If the page is complete, we can try to finish the wizard.
            if (isPageComplete()) {
                // Get the wizard and its container.
                IWizard wizard = getWizard();
                IWizardContainer container = wizard.getContainer();
                // If the container is a WizardDialog, we can try to
                // finish the wizard and close the dialog.
                if (container instanceof WizardDialog) {
                    if (wizard.performFinish()) {
                        ((WizardDialog) container).close();
                    }
                }
                // Otherwise, we can try to advance to the next page if
                // one exists.
                else {
                    // Get the next page.
                    IWizardPage nextPage = wizard.getNextPage(NewItemWizardPage.this);
                    // If it exists, move to it.
                    if (nextPage != null) {
                        container.showPage(nextPage);
                    }
                }
            }

            return;
        }
    });

}

From source file:org.eclipse.ice.client.widgets.wizards.ImportItemWizardPage.java

License:Open Source License

/**
 * Override the default behavior to add a <code>ListViewer</code> with the
 * available item types.// ww w .  j a  v  a  2  s .  c  o m
 */
@Override
public void createControl(Composite parent) {

    // Get the client.
    IClient client = ClientHolder.getClient();

    if (client != null) {
        // Get the list of available Items from the client
        final ArrayList<String> itemTypes = client.getAvailableItemTypes();
        // Sort the list so that items are displayed lexographically.
        Collections.sort(itemTypes);

        // Create the Text and browse Button.
        super.createControl(parent);

        if (parent != null) {
            GridData gridData;

            // Create a label above the list.
            Label label = new Label(wizardPageComposite, SWT.NONE);
            label.setText("Please select an item that this file represents");
            gridData = new GridData(SWT.LEFT, SWT.END, false, false);
            gridData.horizontalSpan = 2;
            label.setLayoutData(gridData);

            // Create the list.
            ListViewer itemList = new ListViewer(wizardPageComposite,
                    SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
            gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
            gridData.horizontalSpan = 2;
            itemList.getControl().setLayoutData(gridData);

            // Add the label provider for the list viewer
            itemList.setLabelProvider(new LabelProvider() {
                @Override
                public String getText(Object element) {
                    return (String) element;
                }
            });

            // Add the content provider for the list viewer
            itemList.setContentProvider(new IStructuredContentProvider() {
                @Override
                public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
                    // Nothing to do
                }

                @Override
                public void dispose() {
                    // Nothing to do
                }

                @Override
                public Object[] getElements(Object inputElement) {
                    return ((ArrayList<?>) inputElement).toArray();
                }
            });

            // Create the selection listener
            itemList.addSelectionChangedListener(new ISelectionChangedListener() {
                public void selectionChanged(SelectionChangedEvent event) {
                    // Get and store the selection
                    String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement();
                    if (selection != null) {
                        selectedItemType = selection;
                    }
                    // Validate the file and Item selection to enable
                    // the finish button
                    ImportItemWizardPage.this.setPageComplete(checkSelection());
                }
            });
            // Set the input to the list from the client
            itemList.setInput(itemTypes);

            // Add a double-click listener to the ListViewer. If the file
            // was already selected, then a double-click can advance or
            // finish the wizard.
            itemList.addDoubleClickListener(new IDoubleClickListener() {
                public void doubleClick(DoubleClickEvent event) {

                    // If the page is complete, we can try to finish the
                    // wizard.
                    if (isPageComplete()) {
                        // Get the wizard and its container.
                        IWizard wizard = getWizard();
                        IWizardContainer container = wizard.getContainer();
                        // If the container is a WizardDialog, we can try to
                        // finish the wizard and close the dialog.
                        if (container instanceof WizardDialog) {
                            if (wizard.performFinish()) {
                                ((WizardDialog) container).close();
                            }
                        }
                        // Otherwise, we can try to advance to the next page
                        // if one exists.
                        else {
                            // Get the next page.
                            IWizardPage nextPage = wizard.getNextPage(ImportItemWizardPage.this);
                            // If it exists, move to it.
                            if (nextPage != null) {
                                container.showPage(nextPage);
                            }
                        }
                    }

                    return;
                }
            });

            // Force the parent Composite to repaint.
            parent.layout();
        }

    } else {
        MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR);
        errorMessage.setMessage("The ICE Client is not available. " + "Please file a bug report.");
    }

    return;
}

From source file:org.eclipse.ice.client.widgets.wizards.NewItemWizardPage.java

License:Open Source License

/**
 * This operation creates the view that shows the list of Items that can be
 * created by the user.//from  w w w  . j av  a 2  s  .  com
 */
@Override
public void createControl(Composite parent) {

    // Set the parent reference
    parentComposite = parent;

    // Get the client
    IClient client = ClientHolder.getClient();

    // Only create the wizard if the client is available
    if (client != null) {
        // Create the composite for file selection pieces
        Composite itemSelectionComposite = new Composite(parentComposite, SWT.NONE);
        // Set its layout
        GridLayout layout = new GridLayout(1, true);
        itemSelectionComposite.setLayout(layout);
        // Set its layout data
        GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        itemSelectionComposite.setLayoutData(data);

        // Get the list of available Items from the client
        final List<String> itemTypeList = client.getAvailableItemTypes();
        // Sort the list so that items are displayed lexographically.
        Collections.sort(itemTypeList);

        // Create the item selection label
        Label itemLabel = new Label(itemSelectionComposite, SWT.NONE);
        itemLabel.setText("Please select an Item type.");
        // Add the list for selecting an Item
        ListViewer itemListViewer = new ListViewer(itemSelectionComposite,
                SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
        // Set the layout data so that it fills the space
        data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        itemListViewer.getControl().setLayoutData(data);
        // Add the label provider for the list viewer
        itemListViewer.setLabelProvider(new LabelProvider() {
            public String getText(Object element) {
                return (String) element;
            }
        });
        // Add the content provider for the list viewer
        itemListViewer.setContentProvider(new IStructuredContentProvider() {

            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
                // Nothing to do
            }

            public void dispose() {
                // Nothing to do
            }

            public Object[] getElements(Object inputElement) {
                return ((List<?>) inputElement).toArray();
            }
        });
        // Create the selection listener
        itemListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                // Get and store the selection
                String selection = (String) ((IStructuredSelection) event.getSelection()).getFirstElement();
                if (selection != null) {
                    selectedItemType = selection;
                }
                // Validate the file and Item selection to enable
                // the finish button
                NewItemWizardPage.this.setPageComplete(checkSelection());
            }
        });
        // Set the input to the list from the client
        itemListViewer.setInput(itemTypeList);

        // Add a double-click listener to the ListViewer. If the file was
        // already selected, then a double-click can advance or finish the
        // wizard.
        itemListViewer.addDoubleClickListener(new IDoubleClickListener() {
            public void doubleClick(DoubleClickEvent event) {

                // If the page is complete, we can try to finish the wizard.
                if (isPageComplete()) {
                    // Get the wizard and its container.
                    IWizard wizard = getWizard();
                    IWizardContainer container = wizard.getContainer();
                    // If the container is a WizardDialog, we can try to
                    // finish the wizard and close the dialog.
                    if (container instanceof WizardDialog) {
                        if (wizard.performFinish()) {
                            ((WizardDialog) container).close();
                        }
                    }
                    // Otherwise, we can try to advance to the next page if
                    // one exists.
                    else {
                        // Get the next page.
                        IWizardPage nextPage = wizard.getNextPage(NewItemWizardPage.this);
                        // If it exists, move to it.
                        if (nextPage != null) {
                            container.showPage(nextPage);
                        }
                    }
                }

                return;
            }
        });

        // Set the control
        setControl(itemSelectionComposite);
        // Disable the finished condition to start
        setPageComplete(false);

        // Otherwise throw an error
    } else {
        MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR);
        errorMessage.setMessage("The ICE Client is not available. " + "Please file a bug report.");
    }

    return;

}

From source file:org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryWizard.java

License:Open Source License

/**
 * {@inheritDoc}//from   w w  w  .ja v a  2  s .c  o  m
 */
public boolean performFinish() {
    if (fHeadlessErrorStatus)
        return true;
    if (fOverviewPage != null)
        fOverviewPage.performFinish();
    final IWizardContainer wizard = getContainer();
    final RefactoringStatus status = new RefactoringStatus();
    final RefactoringDescriptorProxy[] proxies = getRefactoringDescriptors();
    final List list = new ArrayList(proxies.length);
    for (int index = fCurrentRefactoring; index < proxies.length; index++)
        list.add(proxies[index]);
    final RefactoringDescriptorProxy[] descriptors = new RefactoringDescriptorProxy[list.size()];
    list.toArray(descriptors);
    final boolean last = isLastRefactoring();
    if (wizard.getCurrentPage() == fPreviewPage && last) {
        final Refactoring refactoring = fPreviewPage.getRefactoring();
        final Change change = fPreviewPage.getChange();
        if (refactoring != null && change != null) {
            status.merge(performPreviewChange(change, refactoring));
            if (!status.isOK()) {
                final RefactoringStatusEntry entry = status.getEntryWithHighestSeverity();
                if (entry.getSeverity() == RefactoringStatus.INFO
                        && entry.getCode() == RefactoringHistoryWizard.STATUS_CODE_INTERRUPTED)
                    return false;
                fErrorPage.setStatus(status);
                fErrorPage.setNextPageDisabled(true);
                fErrorPage.setTitle(RefactoringUIMessages.RefactoringHistoryPreviewPage_apply_error_title);
                fErrorPage.setDescription(RefactoringUIMessages.RefactoringHistoryPreviewPage_apply_error);
                wizard.showPage(fErrorPage);
                return false;
            }
        }
    } else {
        final IPreferenceStore store = RefactoringUIPlugin.getDefault().getPreferenceStore();
        if (!store.getBoolean(PREFERENCE_DO_NOT_WARN_FINISH) && proxies.length > 0) {
            final MessageDialogWithToggle dialog = new MessageDialogWithToggle(getShell(),
                    wizard.getShell().getText(), null,
                    Messages.format(RefactoringUIMessages.RefactoringHistoryWizard_warning_finish,
                            LegacyActionTools.removeMnemonics(IDialogConstants.FINISH_LABEL)),
                    MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0,
                    RefactoringUIMessages.RefactoringHistoryWizard_do_not_show_message, false);
            dialog.open();
            store.setValue(PREFERENCE_DO_NOT_WARN_FINISH, dialog.getToggleState());
            if (dialog.getReturnCode() == IDialogConstants.CANCEL_ID)
                return false;
        }
        final PerformRefactoringHistoryOperation operation = new PerformRefactoringHistoryOperation(
                new RefactoringHistoryImplementation(descriptors)) {

            protected RefactoringContext createRefactoringContext(final RefactoringDescriptor descriptor,
                    final RefactoringStatus state, IProgressMonitor monitor) throws CoreException {
                return RefactoringHistoryWizard.this.createRefactoringContext(descriptor, state, monitor);
            }

            protected void refactoringPerformed(final Refactoring refactoring, final IProgressMonitor monitor) {
                SafeRunner.run(new ISafeRunnable() {

                    public void handleException(final Throwable exception) {
                        RefactoringUIPlugin.log(exception);
                    }

                    public final void run() throws Exception {
                        RefactoringHistoryWizard.this.refactoringPerformed(refactoring, monitor);
                    }
                });
            }

            public void run(final IProgressMonitor monitor) throws CoreException {
                try {
                    monitor.beginTask(RefactoringUIMessages.RefactoringHistoryWizard_preparing_refactorings,
                            100);
                    if (!fAboutToPerformFired) {
                        try {
                            status.merge(fireAboutToPerformHistory(new SubProgressMonitor(monitor, 20,
                                    SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
                        } finally {
                            fAboutToPerformFired = true;
                        }
                    }
                    if (!status.isOK()) {
                        final int severity = status.getSeverity();
                        throw new CoreException(
                                new Status(severity != RefactoringStatus.FATAL ? severity : IStatus.ERROR,
                                        RefactoringUIPlugin.getPluginId(), 0, null, null));
                    }
                    super.run(new SubProgressMonitor(monitor, 80, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
                } finally {
                    monitor.done();
                }
            }
        };
        try {
            wizard.run(false, false,
                    new WorkbenchRunnableAdapter(operation, ResourcesPlugin.getWorkspace().getRoot()));
        } catch (InvocationTargetException exception) {
            RefactoringUIPlugin.log(exception);
            final Throwable throwable = exception.getTargetException();
            if (throwable != null) {
                final String message = throwable.getLocalizedMessage();
                if (message != null && !"".equals(message)) //$NON-NLS-1$
                    status.merge(RefactoringStatus.createFatalErrorStatus(message));
                fErrorPage.setStatus(status);
                fErrorPage.setNextPageDisabled(status.hasFatalError());
                fErrorPage.setTitle(RefactoringUIMessages.RefactoringHistoryPreviewPage_apply_error_title);
                fErrorPage.setDescription(RefactoringUIMessages.RefactoringHistoryPreviewPage_apply_error);
                wizard.showPage(fErrorPage);
                return false;
            }
        } catch (InterruptedException exception) {
            // Does not happen
        }
        final RefactoringStatus result = operation.getExecutionStatus();
        if (!result.isOK()) {
            fHeadlessErrorStatus = true;
            fErrorPage.setStatus(result);
            fErrorPage.setNextPageDisabled(true);
            fErrorPage.setTitle(RefactoringUIMessages.RefactoringHistoryPreviewPage_finish_error_title);
            fErrorPage.setDescription(
                    RefactoringUIMessages.RefactoringHistoryPreviewPage_finish_error_description);
            wizard.showPage(fErrorPage);
            return false;
        }
    }
    return true;
}

From source file:org.eclipse.oomph.setup.ui.wizards.SetupWizardPage.java

License:Open Source License

private void gotoPage(String methodName, IWizardPage page) {
    IWizardContainer container = getContainer();
    if (container instanceof WizardDialog) {
        try {/*  ww w.  j  a  v  a 2s.  co  m*/
            ReflectUtil.invokeMethod(methodName, container);
            return;
        } catch (Throwable ex) {
            //$FALL-THROUGH$
        }
    }

    container.showPage(page);
}

From source file:org.kalypso.kalypsomodel1d2d.sim.RMA10ResultPage.java

License:Open Source License

public void runResultProcessing() {
    m_statusComp.setStatus(new Status(IStatus.INFO, KalypsoModel1D2DPlugin.PLUGIN_ID,
            Messages.getString("org.kalypso.kalypsomodel1d2d.sim.RMA10ResultPage.13"))); //$NON-NLS-1$
    setMessage(Messages.getString("org.kalypso.kalypsomodel1d2d.sim.RMA10ResultPage.14")); //$NON-NLS-1$

    final ProcessResultsBean bean = new ProcessResultsBean();

    // Remark: if not restart, always delete everything, in that
    // case do not ask the user either
    // TODO: make ui for the bean
    bean.evaluateFullResults = m_evaluateFullResults;
    bean.deleteAll = m_deleteAllResults;
    bean.deleteFollowers = true;//from   w w  w  .  j  a v  a2s.c  o  m

    bean.userCalculatedSteps = m_selection;
    if (m_selection == null) {
        try {
            bean.userCalculatedSteps = m_resultManager.findCalculatedSteps();
        } catch (final IOException e) {
            e.printStackTrace();
        }
    }

    /* Result processing */
    final ResultProcessingOperation processingOperation = new ResultProcessingOperation(m_resultManager, bean);

    m_isProcessing = true;

    final IWizardContainer container = getContainer();
    if (container instanceof WizardDialog2) {
        final WizardDialog2 wd2 = (WizardDialog2) container;
        m_resultStatus = wd2.executeUnblocked(true, false, processingOperation);
    } else {
        m_resultStatus = RunnableContextHelper.execute(container, true, true, processingOperation);
    }

    // if anything happened during the processing, restore the original results db from disk
    if (m_resultStatus.isOK() != true) {
        try {
            // set the dirty flag of the results model
            ((ICommandPoster) m_caseDataProvider).postCommand(IScenarioResultMeta.class.getName(),
                    new EmptyCommand("", false)); //$NON-NLS-1$
        } catch (final InvocationTargetException e) {
            e.printStackTrace();
        }

        m_caseDataProvider.reloadModel();
    }

    // otherwise move the new results data to the results folder
    // this operation is not cancelable
    if (m_resultStatus.isOK()) {
        // processing finished without problems, prepare the data-operation
        final ResultManagerOperation dataOperation = new ResultManagerOperation(m_resultManager,
                m_unitFolder.getLocation().toFile(), m_simulationStatus, processingOperation.getOutputDir(),
                processingOperation.getCalcUnitMeta(), processingOperation.getOriginalStepsToDelete());

        if (container instanceof WizardDialog2) {
            final WizardDialog2 wd2 = (WizardDialog2) container;
            m_resultStatus = wd2.executeUnblocked(false, false, dataOperation);
        } else {
            m_resultStatus = RunnableContextHelper.execute(container, true, false, dataOperation);
        }
        try {
            m_unitFolder.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
            ((ICommandPoster) m_caseDataProvider).postCommand(IScenarioResultMeta.class.getName(),
                    new EmptyCommand("", false)); //$NON-NLS-1$
            m_caseDataProvider.saveModel(IScenarioResultMeta.class.getName(), new NullProgressMonitor());
        } catch (final CoreException e) {
            // ignore
        } catch (final InvocationTargetException e) {
            m_resultStatus = StatusUtilities.statusFromThrowable(e);
        }
    }

    /* The user may have changed the page meanwhile, return now to this page */
    if (container.getShell() != null) {
        container.showPage(this);

        m_statusComp.setStatus(m_resultStatus);

        setMessage(Messages.getString("org.kalypso.kalypsomodel1d2d.sim.RMA10ResultPage.15")); //$NON-NLS-1$

        m_isProcessing = false;
    }
}

From source file:org.kalypso.kalypsomodel1d2d.ui.map.flowrel.FlowRelCalcWizard.java

License:Open Source License

/**
 * @see org.eclipse.jface.wizard.Wizard#performFinish()
 *//*from  w  w w  . j  a va  2  s.c o m*/
@Override
public boolean performFinish() {
    final IWizardContainer container = getContainer();

    if (m_simulationPage.simulationWasRun()) {
        // Only really change the data on OK
        m_simulationPage.applyResults();
        return true;
    }

    /* Simulation was not yet run, do it now. */
    container.showPage(m_simulationPage);
    m_simulationPage.runSimulation();

    if (container instanceof WizardDialog2) {
        final Button button = ((WizardDialog2) container).getButton(IDialogConstants.FINISH_ID);
        if (button != null)
            button.setText(IDialogConstants.OK_LABEL);
    }
    return false;
}