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

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

Introduction

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

Prototype

String CANCEL_LABEL

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

Click Source Link

Document

The label for cancel buttons.

Usage

From source file:nc.uap.lfw.funnode.FuncRegisterDialog.java

protected void createButtonsForButtonBar(Composite parent) {
    Button apply = createButton(parent, 50, "Apply", false);
    apply.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            processApply();//from  w  w  w .  jav  a 2 s.com
        }
    });
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:net.bioclipse.ui.dialogs.PickWorkspaceDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    // clone workspace needs a lot of checks
    Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone Selected", false);
    clone.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event arg0) {
            try {
                String txt = _workspacePathCombo.getText();
                File workspaceDirectory = new File(txt);
                if (!workspaceDirectory.exists()) {
                    MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                            "The currently entered workspace path does not exist. Please enter a valid path.");
                    return;
                }//from   ww w .  j  a  va2 s.  co m

                if (!workspaceDirectory.canRead()) {
                    MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                            "The currently entered workspace path is not readable. Please check file system permissions.");
                    return;
                }

                DirectoryDialog dd = new DirectoryDialog(Display.getDefault().getActiveShell());
                dd.setText("Select folder for clone");
                dd.setFilterPath(new File(txt).getParentFile().getAbsolutePath());
                String directory = dd.open();
                if (directory == null) {
                    return;
                }

                File targetDirectory = new File(directory);
                if (targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath())) {
                    MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                            "Source and target workspaces are the same");
                    return;
                }

                // recursive check, if new directory is a subdirectory of our workspace, that's a big no-no or we'll
                // create directories forever
                if (isTargetSubdirOfDir(workspaceDirectory, targetDirectory)) {
                    MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                            "Target folder is a subdirectory of the current workspace");
                    return;
                }

                try {
                    copyFiles(workspaceDirectory, targetDirectory);
                } catch (Exception err) {
                    MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                            "There was an error cloning the workspace: " + err.getMessage());
                    return;
                }

                boolean setActive = MessageDialog.openQuestion(Display.getDefault().getActiveShell(),
                        "Workspace Cloned",
                        "Would you like to set the newly cloned workspace to be the active one?");
                if (setActive) {
                    _workspacePathCombo.setText(directory);
                }
            } catch (Exception err) {
                MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                        "There was an internal error, please check the logs");
                err.printStackTrace();
            }
        }
    });
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:net.bioclipse.ui.dialogs.SaveAsDialog.java

License:Open Source License

protected void okPressed() {
    // Get new path.
    IPath path = resourceGroup.getContainerFullPath().append(resourceGroup.getResource());

    //If the user does not supply a file extension and if the save 
    //as dialog was provided a default file name append the extension 
    //of the default filename to the new name
    if (path.getFileExtension() == null) {
        if (originalFile != null && originalFile.getFileExtension() != null) {
            path = path.addFileExtension(originalFile.getFileExtension());
        } else if (originalName != null) {
            int pos = originalName.lastIndexOf('.');
            if (++pos > 0 && pos < originalName.length()) {
                path = path.addFileExtension(originalName.substring(pos));
            }/*from   w w w. j  a v a 2  s . c o m*/
        }
    }

    // If the path already exists then confirm overwrite.
    IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
    if (file.exists()) {
        String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
        String question = NLS.bind(IDEWorkbenchMessages.SaveAsDialog_overwriteQuestion, path.toString());
        MessageDialog d = new MessageDialog(getShell(), IDEWorkbenchMessages.Question, null, question,
                MessageDialog.QUESTION, buttons, 0);
        int overwrite = d.open();
        switch (overwrite) {
        case 0: // Yes
            break;
        case 1: // No
            return;
        case 2: // Cancel
        default:
            cancelPressed();
            return;
        }
    }

    // Store path and close.
    result = path;
    close();
}

From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.dialogs.SheetAskSizeDialog.java

License:Open Source License

/**
 * Create contents of the button bar.// ww w .j a v a 2 s .  c o m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {

    final Button button_1 = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    final Button button = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
            false);
}

From source file:net.refractions.udig.internal.ui.SendLogDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.PROCEED_ID, Messages.SendLogDialog_submit, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    refreshButtons();// www .j  a  va  2s  . c o  m
}

From source file:net.refractions.udig.internal.ui.SubmitIssueDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.PROCEED_ID, Messages.SubmitIssueDialog_copy, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    refreshButtons();/*from   w w  w. j  a  va 2 s  .  c  o m*/
}

From source file:net.refractions.udig.project.ui.internal.SaveDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
}

From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.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);
    getShell().setDefaultButton(okButton);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    if (isHelpAvailable) {
        createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false);
    }/* w  ww. jav a  2 s .  c  o  m*/
}

From source file:net.rim.ejde.internal.ui.dialogs.PreprocessHookInstallDialog.java

License:Open Source License

/**
 * Creates a new dialog/*  w w  w.ja va  2  s . com*/
 *
 * @see MessageDialog#MessageDialog(org.eclipse.swt.widgets.Shell, java.lang.String, org.eclipse.swt.graphics.Image,
 *      java.lang.String, int, java.lang.String[], int)
 */
public PreprocessHookInstallDialog(String title, String message) {
    super(ContextManager.getActiveWorkbenchShell(), title, null, message, QUESTION,
            new String[] { Messages.PreprocessHookInstallDialogButtonLabel, IDialogConstants.CANCEL_LABEL }, 0); // yes is the default
}

From source file:net.rim.ejde.internal.util.BrowseSearchDialog.java

License:Open Source License

/**
 * Constructs the dialog.//  w w  w. jav  a  2s  . com
 *
 * @param parentShell
 *            The parent shell
 * @param fileName
 *            The debug file name
 */
public BrowseSearchDialog(Shell parentShell, String fileName) {

    super(parentShell, Messages.BrowseSearchDialog_browseTitle, null,
            NLS.bind(Messages.BrowseSearchDialog_message, fileName), WARNING,
            new String[] { Messages.BrowseSearchDialog_searchLabel, Messages.BrowseSearchDialog_browseLabel,
                    IDialogConstants.CANCEL_LABEL, Messages.BrowseSearchDialog_dontAskLabel },
            0);

    _fileName = fileName;
    _chosenFilePath = null;
    _parentShell = parentShell;
}