Example usage for org.eclipse.jface.dialogs IDialogConstants FINISH_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants FINISH_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants FINISH_ID.

Prototype

int FINISH_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants FINISH_ID.

Click Source Link

Document

Button id for a "Finish" button (value 16).

Usage

From source file:org.eclipse.emf.henshin.interpreter.ui.wizard.HenshinWizardDialog.java

License:Open Source License

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    if (id == IDialogConstants.FINISH_ID) {
        label = "Transform";
    }/*w w w. j  av  a 2s .  c  o  m*/
    return super.createButton(parent, id, label, defaultButton);
}

From source file:org.eclipse.equinox.p2.tests.ui.dialogs.InstallWizardTest.java

License:Open Source License

public void testInstallWizardResolved() {
    ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
    iusInvolved.add(toInstall);// w w  w  .j a v  a2s  . c  o  m
    InstallOperation op = new InstallOperation(getSession(), iusInvolved);
    op.setProfileId(TESTPROFILE);
    PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved,
            null);
    ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
    dialog.setBlockOnOpen(false);
    dialog.open();
    ProfileModificationJob longOp = null;

    try {
        SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
        // should already have a plan
        assertTrue("1.0", page1.isPageComplete());
        // simulate the next button by getting next page and showing
        IWizardPage page = page1.getNextPage();
        dialog.showPage(page);
        // we should be ok
        assertTrue("1.1", page.isPageComplete());

        // if another operation is scheduled for this profile, we should not be allowed to proceed
        longOp = getLongTestOperation();
        getProvisioningUI().schedule(longOp, StatusManager.LOG);
        // causes recalculation of plan and status
        wizard.recomputePlan(dialog);
        // can't move to next page while op is running
        assertFalse("1.2", page.isPageComplete());
        longOp.cancel();

        // op is no longer running, recompute plan
        wizard.recomputePlan(dialog);

        // license needs approval
        assertFalse("1.4", wizard.canFinish());
        // finish button should be disabled
        dialog.updateButtons();
        Button finishButton = dialog.testGetButton(IDialogConstants.FINISH_ID);
        assertFalse("1.5", finishButton.isEnabled());
    } finally {
        dialog.getShell().close();
        if (longOp != null)
            longOp.cancel();
    }
}

From source file:org.eclipse.equinox.p2.tests.ui.dialogs.UpdateWizardTest.java

License:Open Source License

public void testUpdateWizardResolvedWithLicense() {
    ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
    iusInvolved.add(main);// w w  w .ja  v  a2 s  . co  m
    UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
    op.resolveModal(getMonitor());
    UpdateWizard wizard = new UpdateWizard(getProvisioningUI(), op, op.getSelectedUpdates(), null);
    ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
    dialog.setBlockOnOpen(false);
    dialog.open();

    try {
        SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
        // should already have a plan
        assertTrue("1.0", page1.isPageComplete());
        // simulate the next button by getting next page and showing
        IWizardPage page = page1.getNextPage();
        dialog.showPage(page);
        // license needs approval
        assertFalse("1.1", wizard.canFinish());
        // finish button should be disabled
        while (dialog.getShell().getDisplay().readAndDispatch()) {
            // run event loop
        }
        Button finishButton = dialog.testGetButton(IDialogConstants.FINISH_ID);
        assertFalse("1.2", finishButton.isEnabled());
    } finally {
        dialog.getShell().close();
    }
}

From source file:org.eclipse.jface.tests.wizards.TheTestWizardDialog.java

License:Open Source License

public Button getFinishedButton() {
    return getButton(IDialogConstants.FINISH_ID);
}

From source file:org.eclipse.jst.jsf.common.ui.internal.dialogs.CommonWizardDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    IWizard wizard = getWizard();/*from  ww  w . j a  v  a  2 s  .  com*/
    if (!wizard.needsPreviousAndNextButtons()) {
        getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.OK_LABEL);
    }
}

From source file:org.eclipse.jubula.client.ui.preferences.DatabaseConnectionPreferencePage.java

License:Open Source License

/**
 * Displays a dialog for the given wizard.
 * //from  w  w  w . ja  v a  2s  .  c om
 * @param databaseConnectionWizard The wizard to display in the dialog.
 * @param display Used for registering/deregistering global listeners.
 * @return the result of {@link Window#open()}.
 */
private static int showDialog(DatabaseConnectionDialog databaseConnectionWizard, Display display) {
    WizardDialog dialog = new WizardDialog(display.getActiveShell(), databaseConnectionWizard) {
        protected void createButtonsForButtonBar(Composite parent) {
            super.createButtonsForButtonBar(parent);
            Button finishButton = getButton(IDialogConstants.FINISH_ID);
            finishButton.setText(JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY));
        }
    };
    databaseConnectionWizard.setWindowTitle(Messages.DatabaseConnectionDialogTitle);
    dialog.setHelpAvailable(true);

    display.addFilter(SWT.FocusIn, SELECT_ALL_LISTENER);
    display.addFilter(SWT.FocusOut, SELECT_ALL_LISTENER);
    display.addFilter(SWT.Traverse, SELECT_ALL_LISTENER);

    try {
        return dialog.open();
    } finally {
        display.removeFilter(SWT.FocusIn, SELECT_ALL_LISTENER);
        display.removeFilter(SWT.FocusOut, SELECT_ALL_LISTENER);
        display.removeFilter(SWT.Traverse, SELECT_ALL_LISTENER);
    }
}

From source file:org.eclipse.jubula.client.ui.rcp.handlers.project.ImportProjectHandler.java

License:Open Source License

/**
 * brings up the ImportDiaog/*ww  w  . j a v  a 2 s.  c  om*/
 */
void showImportDialog() {
    ImportProjectDialog importProjectWizard = new ImportProjectDialog();
    WizardDialog dialog = new WizardDialog(getActiveShell(), importProjectWizard) {
        protected void createButtonsForButtonBar(Composite parent) {
            super.createButtonsForButtonBar(parent);
            Button finishButton = getButton(IDialogConstants.FINISH_ID);
            finishButton.setText(IDialogConstants.OK_LABEL);
        }
    };
    importProjectWizard.setWindowTitle(Messages.ImportProjectDialogTitle);
    dialog.setHelpAvailable(true);

    int val = dialog.open();
    if (val == Window.OK) {
        importProjects(importProjectWizard.getImportInfoProvider());
    }
}

From source file:org.eclipse.ltk.ui.refactoring.actions.CreateRefactoringScriptAction.java

License:Open Source License

/**
 * Shows the create script wizard.//from w w w.jav  a  2  s.  c  o  m
 *
 * @param window
 *            the workbench window
 */
private static void showCreateScriptWizard(final IWorkbenchWindow window) {
    Assert.isNotNull(window);
    final CreateRefactoringScriptWizard wizard = new CreateRefactoringScriptWizard();
    try {
        IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (context == null)
            context = PlatformUI.getWorkbench().getProgressService();
        context.run(false, true, new IRunnableWithProgress() {

            public void run(final IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                final IRefactoringHistoryService service = RefactoringCore.getHistoryService();
                try {
                    service.connect();
                    wizard.setRefactoringHistory(service.getWorkspaceHistory(monitor));
                } finally {
                    service.disconnect();
                }
            }
        });
    } catch (InvocationTargetException exception) {
        RefactoringUIPlugin.log(exception);
    } catch (InterruptedException exception) {
        return;
    }
    final WizardDialog dialog = new WizardDialog(window.getShell(), wizard) {

        protected final void createButtonsForButtonBar(final Composite parent) {
            super.createButtonsForButtonBar(parent);
            getButton(IDialogConstants.FINISH_ID)
                    .setText(ScriptingMessages.CreateRefactoringScriptAction_finish_button_label);
        }
    };
    dialog.create();
    dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
            SIZING_WIZARD_HEIGHT);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
            IRefactoringHelpContextIds.REFACTORING_CREATE_SCRIPT_PAGE);
    dialog.open();
}

From source file:org.eclipse.ltk.ui.refactoring.actions.ShowRefactoringHistoryAction.java

License:Open Source License

/**
 * Shows the refactoring history wizard.
 *
 * @param window/*from www .  j  a  va 2  s  .  co  m*/
 *            the workbench window
 */
private static void showRefactoringHistoryWizard(final IWorkbenchWindow window) {
    Assert.isNotNull(window);
    final ShowRefactoringHistoryWizard wizard = new ShowRefactoringHistoryWizard();
    IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (context == null)
        context = PlatformUI.getWorkbench().getProgressService();
    try {
        context.run(false, true, new IRunnableWithProgress() {

            public void run(final IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                final IRefactoringHistoryService service = RefactoringCore.getHistoryService();
                try {
                    service.connect();
                    wizard.setRefactoringHistory(service.getWorkspaceHistory(monitor));
                } finally {
                    service.disconnect();
                }
            }
        });
    } catch (InvocationTargetException exception) {
        RefactoringUIPlugin.log(exception);
    } catch (InterruptedException exception) {
        return;
    }
    final WizardDialog dialog = new WizardDialog(window.getShell(), wizard) {

        protected final void createButtonsForButtonBar(final Composite parent) {
            super.createButtonsForButtonBar(parent);
            getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.OK_LABEL);
        }
    };
    dialog.create();
    dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
            SIZING_WIZARD_HEIGHT);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
            IRefactoringHelpContextIds.REFACTORING_SHOW_HISTORY_PAGE);
    dialog.open();
}

From source file:org.eclipse.oomph.setup.internal.installer.ExtensionPage.java

License:Open Source License

public void install() {
    setButtonState(IDialogConstants.FINISH_ID, false);
    setButtonState(IDialogConstants.CANCEL_ID, false);

    installOperation = enablementComposite.install(new InstallHandler() {
        public void installSucceeded() {
            installOperation = null;/*from  w ww .java2 s  .c  om*/

            IWizardContainer container = getContainer();
            if (container instanceof InstallerDialog) {
                InstallerDialog dialog = (InstallerDialog) container;
                dialog.restart();
            }
        }

        public void installFailed(Throwable t) {
            ErrorDialog.open(t);
            installCanceled();
        }

        public void installCanceled() {
            setButtonState(IDialogConstants.FINISH_ID, true);
            setButtonState(IDialogConstants.CANCEL_ID, true);
            installOperation = null;
        }
    });
}