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.appnativa.studio.dialogs.BackgroundColorDialog.java

License:Open Source License

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

From source file:com.appnativa.studio.dialogs.BordersPopup.java

License:Open Source License

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

From source file:com.appnativa.studio.dialogs.ColorChooserDialog.java

License:Open Source License

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

    Button b = createButton(parent, IDialogConstants.CLIENT_ID, "None", false);

    b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setReturnCode(IDialogConstants.CLIENT_ID);
            selectedColor = null;
            ColorChooserDialog.this.close();
        }
    });
}

From source file:com.appnativa.studio.dialogs.FontChooserDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from w  w w  .j  a  va  2s . co m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    Button b = createButton(parent, IDialogConstants.CLIENT_ID, "None", false);

    b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setReturnCode(IDialogConstants.CLIENT_ID);
            rareFont = fontPanel.getSelectedFont();
            rareFont.spot_clear();
            FontChooserDialog.this.close();
        }
    });
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:com.appnativa.studio.dialogs.FormsLayout.java

License:Open Source License

void closeForm(boolean ok) {
    if (ok) {//from  w w  w.ja  va 2s  .c o m
        if (applyButton.isEnabled()) {
            this.apply();
        }
        setReturnCode(IDialogConstants.OK_ID);
    } else {
        setReturnCode(IDialogConstants.CANCEL_ID);
    }

    close();
}

From source file:com.appnativa.studio.dialogs.FormsLayout.java

License:Open Source License

/**
 * Create contents of the button bar.//from w ww . j  a v  a2s.c  om
 *
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    applyButton = createButton(parent, IDialogConstants.CLIENT_ID, string("Studio.text.apply"), true);
    applyButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            apply();
        }
    });
    applyButton.setEnabled(false);
    createButton(parent, IDialogConstants.OK_ID, string("Studio.text.save"), true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.aptana.git.ui.internal.actions.CommitDialog.java

License:Open Source License

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    if (id == IDialogConstants.OK_ID) {
        label = Messages.CommitDialog_CommitButton_Label;
    } else if (id == IDialogConstants.CANCEL_ID) {
        label = Messages.CommitDialog_CloseButton_Label;
    }//from www .j a  v a2s .  co  m
    return super.createButton(parent, id, label, defaultButton);
}

From source file:com.aptana.git.ui.internal.actions.CommitDialog.java

License:Open Source License

@Override
protected void okPressed() {
    // if there are still unstaged changes don't set return code and close.
    if (unstagedTable.getItemCount() > 0) {
        // disable the buttons until commit is done
        getButton(IDialogConstants.CANCEL_ID).setEnabled(false);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        boolean success = gitRepository.index().commit(getCommitMessage());
        if (success) {
            // commit worked, wipe commit message and staged files in table
            commitMessage.setText(StringUtil.EMPTY);
            stagedTable.removeAll();//from   w w  w.  ja va  2s  .  c om
            // TODO Show some sort of success message?
        }
        // TODO What if the commit failed for some reason?!
        // Re-enable buttons
        getButton(IDialogConstants.CANCEL_ID).setEnabled(true);
        getButton(IDialogConstants.OK_ID).setEnabled(true);
    } else {
        super.okPressed();
    }
}

From source file:com.aptana.ide.core.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/*  ww  w  .  j av a  2  s  .  c  om*/
    loadList();
    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.aptana.ide.editors.preferences.CodeAssistExpressionInfoDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *//*from ww w  . j av  a2s.co  m*/
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    okButton.setEnabled(validateErrorDescriptor());
}