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.aptana.ide.installer.wizard.InstallerWizardDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.wizard.WizardDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *//*from  w  ww  . j  a  v a  2 s  . co  m*/
protected void createButtonsForButtonBar(Composite parent) {
    // adds the "Do not show again" checkbox
    GridLayout layout = (GridLayout) parent.getLayout();
    // makes necessary adjustment to the layout
    // 1. increment the number of columns in the button bar
    layout.numColumns++;
    layout.numColumns++; // For Manage Plugins... button
    // 2. makes the columns unequal widths
    layout.makeColumnsEqualWidth = false;
    // adjusts the layout data
    GridData gridData = (GridData) parent.getLayoutData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;

    Composite button = new Composite(parent, SWT.NONE);
    button.setLayout(new GridLayout());
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    // calculates the minimum width the composite should have
    GC gc = new GC(button);
    gridData.widthHint = gc.stringExtent(Messages.InstallerWizardDialog_DoNotShowNote).x + 10;
    gc.dispose();
    button.setLayoutData(gridData);
    fDoNotShowButton = new Button(button, SWT.CHECK);
    fDoNotShowButton.setText(Messages.InstallerWizardDialog_DoNotShowLabel);
    fDoNotShowButton.setFont(JFaceResources.getDialogFont());
    boolean donotshow;
    IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
    if (prefs.contains(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN)) {
        donotshow = prefs.getBoolean(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN);
    } else {
        donotshow = prefs.getBoolean(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN_DEFAULT);
    }
    fDoNotShowButton.setSelection(donotshow);
    fDoNotShowButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, true));
    fDoNotShowButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            saveStates();
            updateDoNotShowLayout();
        }
    });

    Button managePluginsButton = new Button(parent, SWT.PUSH);
    managePluginsButton.setText(Messages.InstallerWizardDialog_Manage_Plugins);
    managePluginsButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        public void widgetSelected(SelectionEvent e) {
            try {
                close();
                CoreUIUtils.showView("com.aptana.ide.ui.ViewPlugins"); //$NON-NLS-1$
            } catch (PartInitException e1) {
                // Do nothing, view didn't open
            }
        }

    });

    super.createButtonsForButtonBar(parent);
    // changes the "Finish" text to "Install" and disables it by default
    getFinishButton().setText(INSTALL_LABEL);
    // changes the "Cancel" text to "Close"
    getButton(IDialogConstants.CANCEL_ID).setText(CLOSE_LABEL);
}

From source file:com.aptana.ide.security.internal.linux.StorageLoginDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, Messages.buttonLogin, true);
    okButton.setEnabled(false);//  w  w w .ja va  2s  . c  o  m
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.buttonExit, false);
}

From source file:com.aptana.ide.syncing.ui.old.views.SmartSyncDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    startSync = createButton(parent, IDialogConstants.PROCEED_ID, Messages.SmartSyncDialog_StartSync, true);
    GridData gridData = new GridData(SWT.FILL, SWT.END, false, false);
    GC gc = new GC(startSync);
    // calculates the ideal width
    gridData.widthHint = Math.max(gc.stringExtent(Messages.SmartSyncDialog_StartSync).x,
            gc.stringExtent(Messages.SmartSyncDialog_RunInBackground).x) + 50;
    gc.dispose();/*from w  w  w. j  a v a 2s .  c  o  m*/
    startSync.setLayoutData(gridData);
    startSync.addSelectionListener(this);

    saveLog = createButton(parent, IDialogConstants.DETAILS_ID, "Save Log...", false); //$NON-NLS-1$
    saveLog.addSelectionListener(this);
    saveLog.setEnabled(false);

    cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    cancel.addSelectionListener(this);
}

From source file:com.aptana.jira.ui.internal.SubmitTicketDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    getButton(IDialogConstants.OK_ID).setEnabled(false);
}

From source file:com.aptana.php.debug.core.launch.DebugPortNotificationDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
 *///from  ww w  .ja  v  a  2s .  co m
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);
    if (buttonId != IDialogConstants.CANCEL_ID && getToggleState() && getPrefStore() != null
            && getPrefKey() != null) {

        getPrefStore().setValue(getPrefKey(), NEVER);
    }
}

From source file:com.aptana.radrails.cloud.internal.EndpointDialog.java

License:Open Source License

/**
 * Create contents of the button bar//from  w  w  w . j a  v  a 2  s .  c  o  m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    getButton(IDialogConstants.OK_ID).setText(Messages.EndpointDialog_LBL_Deploy_button);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.aptana.ui.dialogs.InputURLDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    //do this here because setting the text will set enablement on the ok button
    loadList();//from   w w w . j  av  a 2 s.  c  om
    combo.setFocus();
    if (value != null) {
        combo.setText(value);
        setErrorMessage(null);
        if (validator.isValid(value) != null) {
            Control button = getButton(IDialogConstants.OK_ID);
            if (button != null) {
                button.setEnabled(false);
            }

        }
    }
}

From source file:com.archimatetool.editor.diagram.dialog.NewNestedRelationDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.NewNestedRelationDialog_3, false);
}

From source file:com.arm.cmsis.pack.installer.CopyExampleDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fCopyButton = createButton(parent, IDialogConstants.OK_ID, "Copy", true); //$NON-NLS-1$
    if (fShowAttention) {
        fCopyButton.setEnabled(false);//from w  ww  .  j  a  v  a 2  s  .co  m
    }
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.asakusafw.shafu.internal.ui.dialogs.PropertyEntryInputDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    this.buttonOk = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    if (defaultKey == null) {
        textKey.setFocus();/*from   w w w . j ava2s.  com*/
        buttonOk.setEnabled(false);
    } else {
        if (defaultKey.isEmpty()) {
            textKey.setFocus();
        } else {
            textValue.setFocus();
            textValue.selectAll();
        }
        validate();
    }
}