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

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

Introduction

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

Prototype

int CANCEL_ID

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

Click Source Link

Document

Button id for a "Cancel" button (value 1).

Usage

From source file:com.clustercontrol.notify.mail.dialog.MailTemplateCreateDialog.java

License:Open Source License

/**
 * ????<BR>/*from w  ww. j  ava  2 s. c  om*/
 * ??<code> true </code>???????<code> false </code>?????????
 *
 * @param parent ??
 *
 * @see #createButtonsForButtonBar(Composite)
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {

    if (this.mode != PropertyDefineConstant.MODE_SHOW) {
        super.createButtonsForButtonBar(parent);
    } else {
        // ?
        // TODO Remove the following hard-code. IDialogConstants.*_LABEL will causes IncompatibleClassChangeError on RAP
        this.createButton(parent, IDialogConstants.CANCEL_ID, "Close", false);
    }
}

From source file:com.codesourcery.installer.ui.ChoiceDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    if (getSelection() != null) {
        // Select OK by default
        getButton(IDialogConstants.OK_ID).setFocus();
    } else {//  w ww .  jav  a2 s  .  co  m
        // Select Cancel by default
        getButton(IDialogConstants.CANCEL_ID).setFocus();
    }
    updateButtons();
}

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

License:Open Source License

@Override
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException {
    // Set focust to cancel button
    this.getButton(IDialogConstants.CANCEL_ID).setFocus();

    super.run(fork, cancelable, runnable);
}

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 {/*  ww w .j a v  a  2  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

public void setButtonsEnabled(boolean enable) {
    // Restore enabled state
    if (enable) {
        Button button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(true);//from  w w w. 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

/**
 * Creates the Cancel button for this wizard dialog. Creates a standard (<code>SWT.PUSH</code>)
 * button and registers for its selection events. Note that the number of
 * columns in the button bar composite is incremented. The Cancel button is
 * created specially to give it a removeable listener.
 * //from  ww  w . j av a  2 s  .  c  o m
 * @param parent
 *            the parent button bar
 * @return the new Cancel button
 */
private Button createCancelButton(Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(IDialogConstants.CANCEL_LABEL);
    setButtonLayoutData(button);
    button.setFont(parent.getFont());
    button.setData(new Integer(IDialogConstants.CANCEL_ID));
    button.addSelectionListener(cancelListener);
    return button;
}

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

License:Open Source License

/**
 * Return the cancel button if the id is a the cancel id.
 * //  ww  w .  ja v  a 2 s  .  co m
 * @param id
 *            the button id
 * @return the button corresponding to the button id
 */
protected Button getButton(int id) {
    if (id == IDialogConstants.CANCEL_ID) {
        return cancelButton;
    }
    return super.getButton(id);
}

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

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    if (yesNo) {/*  w  w  w .  jav a2 s  .  c o m*/
        Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
        if (cancelButton != null)
            cancelButton.setText(Messages.MergeWizardDialog_no);
    }
}

From source file:com.ecfeed.ui.dialogs.AddTestCaseDialog.java

License:Open Source License

/**
 * Create contents of the button bar./* ww  w  . j a va  2  s  . c  o  m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.ecfeed.ui.dialogs.GeneratorSetupDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (fGenerateExecutableContent) {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            EImplementationStatus parameterStatus = fStatusResolver.getImplementationStatus(parameter);
            if ((parameter.getChoices().isEmpty()
                    && (parameter.isExpected() == false || JavaTypeHelper.isUserType(parameter.getType())))
                    || parameterStatus == EImplementationStatus.NOT_IMPLEMENTED) {
                setOkButtonStatus(false);
                break;
            }//ww  w.  j a va2s.  c o m
        }
    } else {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            if (parameter.getChoicesWithCopies().isEmpty()
                    && (parameter.isExpected() == false || JavaTypeHelper.isUserType(parameter.getType()))) {
                setOkButtonStatus(false);
                break;
            }
        }
    }

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    updateOkButtonAndErrorMsg();
}