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

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

Introduction

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

Prototype

int NEXT_ID

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

Click Source Link

Document

Button id for a "Next" button (value 15).

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 {// w w w .ja v  a  2 s.  com
            ((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));
    }/* w  w w. j  a v  a  2s . c  o  m*/
}

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);//from  ww w .  ja  va 2  s .c  o 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();//  w w  w  .  ja v  a  2s.c  o 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 Previous and Next buttons for this wizard dialog. Creates
 * standard (<code>SWT.PUSH</code>) buttons and registers for their
 * selection events. Note that the number of columns in the button bar
 * composite is incremented. These buttons are created specially to prevent
 * any space between them.//  w  ww  .  ja  v a 2 s .  c  o  m
 * 
 * @param parent
 *            the parent button bar
 * @return a composite containing the new buttons
 */
private Composite createPreviousAndNextButtons(Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // will be incremented by createButton
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);

    // make sure screen readers skip visual '<', '>' chars on buttons:
    final String backReaderText = IDialogConstants.BACK_LABEL.replace('<', ' ');
    backButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(AccessibleEvent e) {
            e.result = backReaderText;
        }
    });
    final String nextReaderText = IDialogConstants.NEXT_LABEL.replace('>', ' ');
    nextButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(AccessibleEvent e) {
            e.result = nextReaderText;
        }
    });
    return composite;
}

From source file:com.google.dart.tools.ui.internal.dialogs.MultiElementListSelectionDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.BACK_ID) {
        turnPage(false);//from  w  w w. j ava2 s. c  o  m
    } else if (buttonId == IDialogConstants.NEXT_ID) {
        turnPage(true);
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:com.google.dart.tools.ui.internal.dialogs.MultiElementListSelectionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
    fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.google.dart.tools.ui.internal.dialogs.MultiElementListSelectionDialog.java

License:Open Source License

/**
 * @see AbstractElementListSelectionDialog#handleDefaultSelected()
 *//*from  w w w .  j a  va 2s  .  c  o m*/
@Override
protected void handleDefaultSelected() {
    if (validateCurrentSelection()) {
        if (fCurrentPage == fNumberOfPages - 1) {
            buttonPressed(IDialogConstants.OK_ID);
        } else {
            buttonPressed(IDialogConstants.NEXT_ID);
        }
    }
}

From source file:com.nokia.carbide.internal.updater.ui.ProjectUpdateDialog.java

License:Open Source License

/**
 * Create contents of the button bar (change OK to Update)
 * @param parent/*ww w  .j  a  va 2s .co m*/
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button ok = createButton(parent, IDialogConstants.OK_ID,
            Messages.getString("ProjectUpdateDialog.UpdateButtonTitle"), true); //$NON-NLS-1$
    ok.setToolTipText(Messages.getString("ProjectUpdateDialog.OkButtonTooltip")); //$NON-NLS-1$
    Button skip = createButton(parent, IDialogConstants.NEXT_ID,
            Messages.getString("ProjectUpdateDialog.SkipButtonTitle"), false); //$NON-NLS-1$
    skip.setToolTipText(Messages.getString("ProjectUpdateDialog.SkipButtonTooltip")); //$NON-NLS-1$
    Button cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    cancel.setToolTipText(Messages.getString("ProjectUpdateDialog.CancelButtonTooltip")); //$NON-NLS-1$
    updateEnabled();
}

From source file:com.nokia.carbide.internal.updater.ui.ProjectUpdateDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.NEXT_ID) {
        setReturnCode(buttonId);/*from  w w  w.j  a v a  2 s  .c  o m*/
        close();
    }

    super.buttonPressed(buttonId);
}