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:de.ovgu.featureide.examples.wizards.ExampleNewWizardPage.java

License:Open Source License

/**
 * The <code>WizardDataTransfer</code> implementation of this
 * <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 * /*from   w w w  . j a v  a  2 s.c o m*/
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
 *         <code>"ALL"</code>, or <code>"CANCEL"</code>
 */
public String queryOverwrite(String pathString) {
    Path path = new Path(pathString);

    String messageString;
    // Break the message up if there is a file name and a directory
    // and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = pathString + " already exists. Would you like to overwrite it?";
    } else {
        messageString = "Overwrite " + path.lastSegment() + " in folder "
                + path.removeLastSegments(1).toOSString() + " ?";
    }

    final MessageDialog dialog = new MessageDialog(getContainer().getShell(), "Question", null, messageString,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0);

    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    getControl().getDisplay().syncExec(new Runnable() {
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:de.topicmapslab.onotoa.search.dialogs.CleanSchemaDialog.java

License:Open Source License

/**
 * Creates button at the bottom of the dialog
 *//*from  w w  w.  j  ava  2 s. c  om*/

@Override
protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, "Clean", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:de.topicmapslab.onotoa.search.dialogs.TopicTypeSearchDialog.java

License:Open Source License

/**
 * Creates button at the bottom of the dialog
 *///from   w  w w . j a v a  2 s  . c o  m

@Override
protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, "Search", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:de.topicmapslab.tmcledit.model.dialogs.NewRoleCombinationConstraintDialog.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, IDialogConstants.CANCEL_LABEL, false);
    validate();// w ww. j a v a 2  s.  com
}

From source file:de.tub.tfs.henshin.editor.ui.dialog.resources.ResourcesDialog.java

License:Open Source License

@Override
protected void okPressed() {
    IPath path = resourceGroup.getResourceFullPath();
    IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);

    if (file.exists() && type == SWT.SAVE) {
        String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
        MessageDialog confirm = new MessageDialog(getShell(), "Overwrite Question", null,
                "The file" + file.getName() + " already exists. Do you want to replace the existing file?",
                MessageDialog.QUESTION, buttons, 0);

        int result = confirm.open();

        switch (result) {
        case 0://from  w  w w. j a v a2 s  .c o  m
            break;
        case 1:
            return;
        default:
            cancelPressed();
            break;
        }
    }

    this.result = file.getRawLocation().toFile();
    super.okPressed();
}

From source file:de.tudarmstadt.dvs.ukuflow.eventbase.utils.UkuInputDialog.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);
    okButton.setEnabled(true);/* ww w  .ja va  2 s  . c o m*/
    if (errorMessageText.getText().length() > 1) {
        System.out.println("set Button enabled = false:'" + errorMessageText.getText() + "'");
        okButton.setEnabled(false);
    }

}

From source file:de.unistuttgart.ipvs.pmp.editor.ui.editors.ais.internals.dialogs.DateTimeDialog.java

License:Apache 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, IDialogConstants.CANCEL_LABEL, false);
}

From source file:de.unistuttgart.ipvs.pmp.editor.ui.editors.ais.internals.dialogs.RequiredPrivacySettingChangeValueDialog.java

License:Apache 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, IDialogConstants.CANCEL_LABEL, false);

    /*/*from   www  .j a v  a2 s  .  c om*/
     * Add the value to the dialog, or enable the empty value checkbox and
     * disable the text field
     */
    if (this.emptyValue) {
        this.checked.setSelection(true);
        this.valueText.setEnabled(false);
    } else if (this.value != null) {
        this.valueText.setFocus();
    }

    if (this.value != null) {
        this.valueText.setText(this.value);
    }
}

From source file:de.uni_jena.iaa.linktype.atomic.core.workspace.PickWorkspaceDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    // clone workspace needs a lot of checks
    Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone", false);
    clone.addListener(SWT.Selection, new Listener() {
        @Override//from  w w  w .j  a va 2  s . c  o  m
        public void handleEvent(Event arg0) {
            try {
                String txt = _workspacePathCombo.getText();
                File workspaceDirectory = new File(txt);
                if (!workspaceDirectory.exists()) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "The currently entered workspace path does not exist. Please enter a valid path.");
                    return;
                }

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

                // check for workspace file (empty indicator that it's a workspace)
                File wsFile = new File(txt + File.separator + WS_IDENTIFIER);
                if (!wsFile.exists()) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "The currently entered workspace path does not contain a valid workspace.");
                    return;
                }

                DirectoryDialog dd = new DirectoryDialog(PickWorkspaceDialog.this.getShell());
                dd.setFilterPath(txt);
                String directory = dd.open();
                if (directory == null) {
                    return;
                }

                File targetDirectory = new File(directory);
                if (targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath())) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "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(PickWorkspaceDialog.this.getShell(), "Error",
                            "Target folder is a subdirectory of the current workspace");
                    return;
                }

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

                boolean setActive = MessageDialog.openConfirm(PickWorkspaceDialog.this.getShell(),
                        "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(PickWorkspaceDialog.this.getShell(), "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:de.uni_jena.iaa.linktype.atomic.model.pepper.wizard.TextInputDialog.java

License:Apache License

/**
 * Legt eine neue Instanz des Typs TextInputDialog an.
 * @param parentShell//from  w ww . j  a  v a 2 s  .  c o m
 * @param dialogTitle
 * @param dialogMessage
 */
public TextInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String labelText,
        String initialText, TextInputVerifier textInputVerifier) {
    super(parentShell, dialogTitle, null, dialogMessage, MessageDialog.QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);

    this.labelText = labelText;
    this.initialText = initialText;
    this.textInputVerifier = textInputVerifier;

    setShellStyle(getShellStyle() | SWT.SHEET);
}