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:com.codesourcery.internal.installer.ui.InstallWizardDialog.java

License:Open Source License

@Override
public void showPage(IWizardPage page) {
    // Set new page
    super.showPage(page);

    // Set page active
    if (page instanceof IInstallWizardPage) {
        try {/*from w  w w.  ja va2 s. c  o  m*/
            ((IInstallWizardPage) getCurrentPage()).setActive(getInstallWizard().getInstallData());
        } catch (Exception e) {
            Installer.log(e);
        }
    }

    IWizardPage[] pages = getInstallWizard().getPages();
    // If final page, update buttons so that only
    // OK is enabled.
    if ((pages.length > 0) && (page == pages[pages.length - 1])) {
        Button button = getButton(IDialogConstants.BACK_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.NEXT_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.OK_LABEL);
    }
}

From source file:com.codesourcery.internal.installer.ui.InstallWizardDialog.java

License:Open Source License

@Override
public void updateButtons() {
    super.updateButtons();

    // Rename 'Finish' button to 'Install or 'Uninstall'
    getButton(IDialogConstants.FINISH_ID)
            .setText(getInstallWizard().isInstall() ? InstallMessages.Install : InstallMessages.Uninstall);

    // Override the wizard dialog default behavior to set the finish button
    // as default.  Always set the next button as default.
    IWizardPage currentPage = getCurrentPage();
    if ((currentPage != null) && currentPage.canFlipToNextPage()) {
        getShell().setDefaultButton(this.getButton(IDialogConstants.NEXT_ID));
    }//from w w  w.  j a  v  a 2  s . c om
}

From source file:com.codesourcery.internal.installer.ui.InstallWizardDialog.java

License:Open Source License

public void setButtonsEnabled(boolean enable) {
    // Restore enabled state
    if (enable) {
        Button button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(true);/*  www  . j  ava  2  s .co  m*/
        }
        updateButtons();
    }
    // Disable
    else {
        Button button = getButton(IDialogConstants.BACK_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.NEXT_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.FINISH_ID);
        if (button != null) {
            button.setEnabled(false);
        }
    }
}

From source file:com.codesourcery.internal.installer.ui.WizardDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.HELP_ID: {
        helpPressed();/*from ww w. ja  va2s. co m*/
        break;
    }
    case IDialogConstants.BACK_ID: {
        backPressed();
        break;
    }
    case IDialogConstants.NEXT_ID: {
        nextPressed();
        break;
    }
    case IDialogConstants.FINISH_ID: {
        finishPressed();
        break;
    }
    // The Cancel button has a listener which calls cancelPressed
    // directly
    }
}

From source file:com.codesourcery.internal.installer.ui.WizardDialog.java

License:Open Source License

/**
 * Creates the buttons for this dialog's button bar.
 * <p>/*  w  w  w.j ava 2  s .  c o  m*/
 * The <code>WizardDialog</code> implementation of this framework method
 * prevents the parent composite's columns from being made equal width in
 * order to remove the margin between the Back and Next buttons.
 * </p>
 * 
 * @param parent
 *            the parent composite to contain the buttons
 */
protected void createButtonsForButtonBar(Composite parent) {
    ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false;
    if (wizard.isHelpAvailable()) {
        helpButton = createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false);
    }
    if (wizard.needsPreviousAndNextButtons()) {
        createPreviousAndNextButtons(parent);
    }
    finishButton = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, true);
    cancelButton = createCancelButton(parent);

    if (parent.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
        // Make the default button the right-most button.
        // See also special code in org.eclipse.jface.dialogs.Dialog#initializeBounds()
        finishButton.moveBelow(null);
    }
}

From source file:com.collabnet.subversion.merge.wizards.MergeWizardDialog.java

License:Open Source License

protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    String customLabel;/*from   w  w w . j a  v a  2 s.co  m*/
    if (id == IDialogConstants.FINISH_ID) {
        if (yesNo)
            customLabel = Messages.MergeWizardDialog_yes;
        else
            customLabel = Messages.MergeWizardDialog_ok;
    } else
        customLabel = label;
    return super.createButton(parent, id, customLabel, defaultButton);
}

From source file:com.gigaspaces.azure.wizards.DeployWizardDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    getButton(IDialogConstants.FINISH_ID).setText(finishText);
}

From source file:com.microsoft.azuretools.core.ui.SrvPriCreationStatusDialog.java

License:Open Source License

/**
 * Create contents of the button bar.// w  w  w.  java 2  s .  c o m
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button button = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            onOk();
        }
    });
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.microsoft.azuretools.core.ui.SrvPriSettingsDialog.java

License:Open Source License

/**
 * Create contents of the button bar.// ww w . j a  v a  2s . c  om
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button btnOk = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true);
    btnOk.setEnabled(true);
    btnOk.setText("Start");
    btnOk.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            onOk();
        }
    });
    Button btnCancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    btnCancel.setEnabled(true);
    btnCancel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
        }
    });
}

From source file:com.microsoft.tfs.client.common.ui.teambuild.teamexplorer.sections.TeamExplorerBuildsVNextDefinitionSection.java

License:Open Source License

private void createNewDefinition() {
    final TFSTeamProjectCollection connection = context.getServer().getConnection();
    final BuildHttpClient buildClient = new BuildHttpClient(new TeeClientHandler(connection.getHTTPClient()),
            connection.getBaseURI());//from w  w w .  j  a  v a  2s.  c  om

    final String projectName = context.getCurrentProjectInfo().getName();
    final List<BuildDefinitionTemplate> templates = buildClient.getTemplates(projectName);

    final Shell shell = context.getWorkbenchPart().getSite().getShell();
    final BuildDefinitionTemplateSelectionDialog dialog = new BuildDefinitionTemplateSelectionDialog(shell,
            templates);

    final BuildDefinitionTemplate template;
    switch (dialog.open()) {
    case IDialogConstants.FINISH_ID:
        template = null;
        break;
    case IDialogConstants.OK_ID:
        template = dialog.getSelectedTemplate();
        break;
    default:
        return;
    }

    new NewBuildDefinitionVNextTask(shell, connection, projectName, template).run();
}