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:eu.geclipse.ui.dialogs.AccessControlRuleDialog.java

License:Open Source License

/**
 * Create the dialog buttons. We override the superclass' method to be able
 * to modify the OK button label if each entry has to be saved individually.
 *//*from w  w w . j  a  v a2s  .c  om*/
@Override
protected void createButtonsForButtonBar(final Composite parent) {

    // We change just the label of the OK button
    String buttonText = null;
    if (this.withSaveButton) {
        buttonText = Messages.getString("AccessControlRuleDialog.save_button_text"); //$NON-NLS-1$
    } else {
        buttonText = IDialogConstants.OK_LABEL;
    }

    // TODO reenable when write support is available
    Button button;
    button = createButton(parent, IDialogConstants.OK_ID, buttonText, true);
    button.setEnabled(false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:eu.geclipse.ui.dialogs.PasswordDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    // create OK and Cancel buttons by default
    this.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/*from w  w w .  ja  va 2s .c om*/
    this.text.setFocus();
    if (this.value != null) {
        this.text.setText(this.value);
        this.text.selectAll();
    }
}

From source file:eu.geclipse.ui.internal.transfer.TransferResumeDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, "Resume selected", true);
    createButton(parent, IDialogConstants.NO_ID, "Abandon all transfers", false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:eu.hydrologis.jgrass.uibuilder.jgrassdependent.GuiBuilderDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    /*/*ww  w.j a  v a  2s.  com*/
     * add the help button
     */
    ((GridLayout) parent.getLayout()).numColumns++;
    Button helpButton = new Button(parent, SWT.PUSH);
    Image helpImg = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    helpButton.setImage(helpImg);
    helpButton.setFont(JFaceResources.getDialogFont());
    helpButton.setData(new Integer(HELP_ID));
    helpButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
}

From source file:eu.hydrologis.stage.libs.utilsrap.LoginDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
    createButton(parent, LOGIN_ID, LOGIN, true);
}

From source file:eu.modelwriter.marker.command.AddRemoveTypeHandler.java

License:Open Source License

private void addRemoveType() {
    if (!MarkerPage.isParsed()) {
        final MessageDialog parseCtrlDialog = new MessageDialog(MarkerActivator.getShell(), "Type Information",
                null,/*from ww  w .  j a v a  2 s .c o  m*/
                "You dont have any marker type registered to system! \n" + "Please parse an alloy file first",
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        parseCtrlDialog.open();
        return;
    }

    final ActionSelectionDialog actionSelectionDialog = new ActionSelectionDialog(MarkerActivator.getShell());
    actionSelectionDialog.open();
    if (actionSelectionDialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
        return;
    }

    if (selectedMarker != null && selectedMarker.exists()) {
        findCandidateToTypeChangingMarkers(selectedMarker);
        if (actionSelectionDialog.getReturnCode() == IDialogConstants.YES_ID) {
            addType(selectedMarker);
        } else if (actionSelectionDialog.getReturnCode() == IDialogConstants.NO_ID) {
            final MessageDialog warningDialog = new MessageDialog(MarkerActivator.getShell(), "Warning!", null,
                    "If you remove marker's type, all relations of this marker has been removed! Do you want to continue to remove marker's type?",
                    MessageDialog.WARNING, new String[] { "Yes", "No" }, 0);
            final int returnCode = warningDialog.open();
            if (returnCode != 0) {
                return;
            }
            removeType(selectedMarker);
        }
        // MarkerUpdater.updateTargets(selectedMarker);
        // MarkerUpdater.updateSources(selectedMarker);
    } else {
        final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(),
                "There is no marker in this position", null, "Please select valid marker",
                MessageDialog.INFORMATION, new String[] { "Ok" }, 0);
        dialog.open();
        return;
    }
}

From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.AddRemoveTypeCommand.java

License:Open Source License

private void addRemoveType() {
    if (!MarkerPage.isParsed()) {
        final MessageDialog parseCtrlDialog = new MessageDialog(Activator.getShell(), "Type Information", null,
                "You dont have any marker type registered to system! \n" + "Please parse an alloy file first",
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        parseCtrlDialog.open();/*from  w w w .  j  a  va2 s  . c o m*/
        return;
    }

    final ActionSelectionDialog actionSelectionDialog = new ActionSelectionDialog(Activator.getShell());
    actionSelectionDialog.open();
    if (actionSelectionDialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
        return;
    }

    IMarker selectedMarker = this.marker;
    selectedMarker = MarkUtilities.getLeaderOfMarker(selectedMarker);

    if (selectedMarker != null && selectedMarker.exists()) {
        this.findCandidateToTypeChangingMarkers(selectedMarker);
        if (actionSelectionDialog.getReturnCode() == IDialogConstants.YES_ID) {
            AddRemoveTypeCommand.addType(selectedMarker);
        } else if (actionSelectionDialog.getReturnCode() == IDialogConstants.NO_ID) {
            final MessageDialog warningDialog = new MessageDialog(Activator.getShell(), "Warning!", null,
                    "If you remove marker's type, all relations of this marker has been removed! Do you want to continue to remove marker's type?",
                    MessageDialog.WARNING, new String[] { "YES", "NO" }, 0);
            final int returnCode = warningDialog.open();
            if (returnCode != 0) {
                return;
            }
            this.removeType(selectedMarker);
        }
    } else {
        final MessageDialog dialog = new MessageDialog(Activator.getShell(),
                "There is no marker in this position", null, "Please select valid marker",
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        dialog.open();
        return;
    }
}

From source file:eu.numberfour.n4js.ui.organize.imports.MultiElementListSelectionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);

    // XXX: Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=279425
    boolean HAS_BUG_279425 = true;
    fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, !HAS_BUG_279425);
    fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, HAS_BUG_279425);

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

From source file:eu.portavita.coverage.handlers.ComboInputDialog.java

License:Open Source License

@Override
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/*from  ww  w  .  ja  v  a2 s  . c o m*/
    combo.setFocus();
    if (value != null) {
        combo.setText(value);
        // combo.selectAll();
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.compare.CompareDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    String buttonLabel = JavaCompareUtilities.getString(fBundle, "buttonLabel", IDialogConstants.OK_LABEL); //$NON-NLS-1$
    createButton(parent, IDialogConstants.CANCEL_ID, buttonLabel, false);
}