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.predic8.plugin.membrane.dialogs.rule.AbstractProxyConfigurationEditDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.BACK_ID, "Reset", false);
    createButton(parent, IDialogConstants.OK_ID, "OK", false);
    createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", true);
}

From source file:com.python.pydev.ui.search.ReplaceDialog2.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CANCEL_ID) {
        super.buttonPressed(buttonId);
        return;//  w ww  .  java2 s  . co  m
    }

    final String replaceText = fTextField.getText();
    statusMessage(false, ""); //$NON-NLS-1$
    try {
        switch (buttonId) {
        case SKIP:
            skip();
            break;
        case SKIP_FILE:
            skipFile();
            break;
        case REPLACE:
            run(new ReplaceOperation() {
                protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
                    replace(pm, replaceText);
                }
            }, (IResource) getCurrentMarker().getElement());
            gotoCurrentMarker();
            break;
        case REPLACE_ALL_IN_FILE:
            run(new ReplaceOperation() {
                protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
                    replaceInFile(pm, replaceText);
                }
            }, (IResource) getCurrentMarker().getElement());
            gotoCurrentMarker();
            break;
        case REPLACE_ALL:
            run(new ReplaceOperation() {
                protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
                    replaceAll(pm, replaceText);
                }
            }, ResourcesPlugin.getWorkspace().getRoot());
            gotoCurrentMarker();
            break;
        default: {
        }
        }
    } catch (InvocationTargetException e) {
        Throwable targetException = e.getTargetException();
        if (targetException instanceof PatternSyntaxException) {
            String format = SearchMessages.ReplaceDialog2_regexError_format;
            String message = MessageFormat.format(format,
                    new Object[] { targetException.getLocalizedMessage() });
            statusMessage(true, message);
        } else {
            String message = Messages.format(SearchMessages.ReplaceDialog_error_unable_to_replace,
                    ((IFile) getCurrentMarker().getElement()).getName());
            ExceptionHandler.handle(e, getParentShell(), getDialogTitle(), message);
        }
    } catch (InterruptedException e) {
        // means operation canceled
    } finally {
        if (!canReplace())
            close();
        else {
            enableButtons();
        }
    }
}

From source file:com.redhat.ceylon.eclipse.code.preferences.InputDialog.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/*from w w w .ja  v  a2  s .  c  o m*/
    text.setFocus();
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }
}

From source file:com.redhat.ceylon.eclipse.code.refactor.RefactoringStarter.java

License:Open Source License

public boolean activate(RefactoringWizard wizard, Shell parent, String dialogTitle, int saveMode) {
    RefactoringSaveHelper saveHelper = new RefactoringSaveHelper(saveMode);
    if (!canActivate(saveHelper, parent))
        return false;

    try {//from   ww  w .  ja v  a2s .com
        RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
        int result = op.run(parent, dialogTitle);
        fStatus = op.getInitialConditionCheckingStatus();
        if (result == IDialogConstants.CANCEL_ID || result == INITIAL_CONDITION_CHECKING_FAILED) {
            saveHelper.triggerIncrementalBuild();
            return false;
        } else {
            return true;
        }
    } catch (InterruptedException e) {
        return false; // User action got cancelled
    }
}

From source file:com.redhat.ea.archimate.strategyexport.dialog.ExportDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from   w  ww  .  j  av a  2  s . co m*/
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button button_1 = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    button_1.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            if (_listSelection.getSelectionCount() == 0) {
                MessageDialog.openError(getParentShell(), "Missing Status Selection",
                        "Please select at least one status.");
            } else {
                close();
                _cancelled = false;
            }
        }
    });
    Button button = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    button.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            _cancelled = true;
            close();
        }
    });
}

From source file:com.rohanclan.snippets.core.SnipFileDialog.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
    snippetNameText.setFocus();//from ww w .  j  a v a 2s .com

    if (snippetNameValue != null) {
        snippetNameText.setText(snippetNameValue);
        snippetNameText.selectAll();
    }

    if (snippetKeyComboValue != null) {
        snippetKeyComboText.setText(snippetKeyComboValue);
    }

    if (snippetDescriptionValue != null) {
        snippetDescriptionText.setText(snippetDescriptionValue);
    }

    if (snippetStartValue != null) {
        snippetStartText.setText(snippetStartValue);
    }

    if (snippetEndValue != null) {
        snippetEndText.setText(snippetEndValue);
    }
}

From source file:com.runwaysdk.manager.view.ExportDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    Button ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    ok.addListener(SWT.Selection, new Listener() {

        @Override//  ww  w  .java  2  s .c o m
        public void handleEvent(Event e) {
            bean.validate();

            close();

            controller.exportTransactions(bean);
        }

    });

}

From source file:com.runwaysdk.manager.view.ImportDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    Button ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    ok.addListener(SWT.Selection, new Listener() {

        @Override//from   w w w .j a  v  a 2 s . com
        public void handleEvent(Event e) {
            bean.validate();

            close();

            controller.importTransaction(bean);
        }
    });

}

From source file:com.runwaysdk.manager.widgets.ReferenceDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, NO_VALUE_ID, Localizer.getMessage("NO_VALUE"), true);
    createButton(parent, IDialogConstants.CANCEL_ID, Localizer.getMessage("CANCEL"), true);
}

From source file:com.safi.workshop.sqlexplorer.dialogs.FilterStructureDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

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