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

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

Introduction

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

Prototype

String OK_LABEL

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

Click Source Link

Document

The label for OK buttons.

Usage

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();/*from  w  ww. j a va  2s.  c o  m*/
}

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);/*  www .  j  a  v a  2  s .co  m*/
    if (errorMessageText.getText().length() > 1) {
        System.out.println("set Button enabled = false:'" + errorMessageText.getText() + "'");
        okButton.setEnabled(false);
    }

}

From source file:de.uniluebeck.itm.spyglass.gui.CheckboxErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    final Button button = new Button(parent, SWT.CHECK);
    button.setText("Don't show this message again");
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        @Override/* w  w  w  . j  a  va  2s .  c om*/
        public void widgetSelected(final SelectionEvent event) {
            setDontShowAgain(button.getSelection());
        }
    });
    setButtonLayoutData(button);
    new Label(parent, SWT.NONE);

    // create OK and Details buttons
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createDetailsButton(parent);
}

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);

    /*//  w w w .  ja  v  a  2 s  .  c o m
     * 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 ww.ja va  2s . co  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.exportwizard.PepperExportWizard.java

License:Apache License

@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    initialize();//from  ww w  .j  av a2 s .c  o  m
    if (1 == selection.size()) {
        Object element = selection.getFirstElement();
        if (element instanceof IProject) {
            selectedProject = (IProject) element;
        } else {
            new MessageDialog(this.getShell(), "Error", null, "Selection is not a project!",
                    MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0).open();
        }
    } else {
        new MessageDialog(this.getShell(), "Error", null,
                "To run the Pepper Export Wizard select exactly one project!", MessageDialog.ERROR,
                new String[] { IDialogConstants.OK_LABEL }, 0).open();
    }
}

From source file:de.uni_jena.iaa.linktype.atomic.model.pepper.wizard.AbstractPepperWizard.java

License:Apache License

public List<P> getPepperModules() {
    if (pepperModuleList == null) {
        List<P> modules = null;
        if (pepperConverter != null) {
            PepperModuleResolver pepperModuleResolver = pepperConverter.getPepperModuleResolver();
            if (pepperModuleResolver != null) {
                modules = resolvePepperModules(pepperModuleResolver);
                if (modules != null) {
                    Collections.sort(modules, new Comparator<P>() {
                        @Override
                        public int compare(P o1, P o2) {
                            return o1.getName().compareTo(o2.getName());
                        }// w w w .ja  v  a2 s . co  m
                    });
                } else {
                    new MessageDialog(this.getShell(), "Error", null, "Did not found any Pepper module!",
                            MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0).open();
                }
            } else {
                new MessageDialog(this.getShell(), "Error", null, "Did not found Pepper module resolver!",
                        MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0).open();
            }
        }

        pepperModuleList = modules != null ? modules : Collections.<P>emptyList();
    }

    return pepperModuleList;
}

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/*  ww  w .  j  a  va2 s.c  om*/
 * @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);
}

From source file:de.walware.ecommons.ui.dialogs.ToolPopup.java

License:Open Source License

private void create(final Shell parent) {
    if (UIAccess.isOkToUse(fShell)) {
        if (fShell.getParent() == parent) {
            return;
        }//from  w ww .  ja  v  a  2  s .  c o m
        dispose();
    }

    fToolTabs.clear();

    fShell = new Shell(parent, SWT.ON_TOP | SWT.TOOL); // SWT.RESIZE
    fShell.setText("Color");
    fShell.setFont(JFaceResources.getDialogFont());
    fShell.setSize(320, 300);

    {
        final GridLayout gl = new GridLayout();
        gl.marginHeight = 0;
        gl.marginWidth = 0;
        gl.horizontalSpacing = 0;
        gl.verticalSpacing = 0;
        fShell.setLayout(gl);
    }
    final SWTListener listener = new SWTListener();
    parent.addListener(SWT.Dispose, listener);
    fShell.addListener(SWT.Deactivate, listener);

    fShell.setBackground(fShell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    fShell.setBackgroundMode(SWT.INHERIT_FORCE);

    fTabFolder = new CTabFolder(fShell, SWT.BOTTOM | SWT.FLAT);
    fTabFolder.setSimple(true);
    fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fTabFolder.setSelectionBackground(G_BACKGROUND);

    addTabs(fTabFolder);

    final Composite commonBar = new Composite(fShell, SWT.NONE);
    commonBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    commonBar.setLayout(LayoutUtil.createContentGrid(3));

    //      final Composite status = new Composite(commonBar, SWT.NONE);
    //      status.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    addStatusControls(commonBar);

    fOKButton = new Button(commonBar, SWT.PUSH | SWT.FLAT);
    fOKButton.setText(IDialogConstants.OK_LABEL);
    fOKButton.setFont(fShell.getFont());
    fOKButton.addListener(SWT.Selection, listener);

    fCancelButton = new Button(commonBar, SWT.PUSH | SWT.FLAT);
    fCancelButton.setText(IDialogConstants.CANCEL_LABEL);
    fCancelButton.setFont(fShell.getFont());
    fCancelButton.addListener(SWT.Selection, listener);

    {
        final Point size = fOKButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
        size.x = Math.max(size.x, fCancelButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
        {
            final GridData gd = new GridData(SWT.FILL, SWT.FILL);
            gd.widthHint = size.x;
            gd.heightHint = size.y - 2;
            fOKButton.setLayoutData(gd);
        }
        {
            final GridData gd = new GridData(SWT.FILL, SWT.FILL);
            gd.widthHint = size.x;
            gd.heightHint = size.y - 2;
            fCancelButton.setLayoutData(gd);
        }
    }

    fTabFolder.addListener(SWT.Selection, listener);
    fShell.setDefaultButton(fOKButton);

    fShell.pack();
}