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:fr.liglab.adele.cilia.workbench.common.ui.dialog.WorkbenchDialog.java

License:Apache License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (hasCancelButton)
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:fr.lip6.move.coloane.projects.its.dialogs.AddTypeDialog.java

License:Open Source License

/**
 * {@inheritDoc}/* w ww  .  jav  a  2  s  . com*/
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    ((GridLayout) parent.getLayout()).numColumns++;
    ((GridLayout) parent.getLayout()).numColumns++;

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

From source file:fr.obeo.dsl.arduino.preferences.ArduinoSdkDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:gov.nasa.arc.spife.ui.timeline.action.dialog.GoToTimeDialog.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);
    okButton.setEnabled(true);//  w  w w  .j  av  a  2s . c om
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    /*
     * do this here because setting the text will set enablement on the ok
     * button
     */
    textEditor.getEditorControl().setFocus();
}

From source file:gov.nasa.ensemble.common.ui.LogFileDialog.java

License:Open Source License

/**
 * Construct a ScrollableMessageDialog//  w w  w  .  j  a  v  a  2s.c o  m
 * 
 * @param parent
 * @param title
 * @param message
 */
public LogFileDialog(Shell parent, String title, String message) {
    super(parent, title, null, message, MessageDialog.NONE, new String[] { IDialogConstants.OK_LABEL }, 0);

    textStyle = DEFAULT_TEXT_STYLE;
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:gov.nasa.ensemble.core.plan.editor.MultiPagePlanEditor.java

License:Open Source License

/**
 * Check to see if this plan was upgraded to the current AD
 * //  w  w w .j a v  a 2 s.co  m
 * @param plan the plan being checked
 * @param workbenchWindow the parent for a warning message dialog
 * @return true if compatibility feedback is present, false otherwise
 */
private static boolean checkPlanCompatibility(EPlan plan, IWorkbenchWindow workbenchWindow) {
    String upgradeNotes = (String) WrapperUtils.getRegistered(plan)
            .getTransientProperty(EditorPlugin.ATTRIBUTE_UPGRADE_NOTES);
    if ((upgradeNotes != null) && upgradeNotes.trim().length() > 0) {
        Shell parent = workbenchWindow.getShell();
        String title = "Plan Compatibility";
        String message = "The plan has been upgraded to the latest AD.";
        String version_ad = ActivityDictionary.getInstance().getVersion();
        if (version_ad != null) {
            message += "\nversion: " + version_ad;
        }
        URL url = null;
        if (upgradeNotes.startsWith("http:") || upgradeNotes.endsWith("html")) {
            try {
                url = new URL(upgradeNotes);
            } catch (MalformedURLException e) {
                // fall out with url = null
            }
        }
        if (url != null) {
            MessageDialog dialog = new MessageDialog(parent, title, null,
                    message + "\n\nDo you wish to open the report?\n" + upgradeNotes, MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
            int result = dialog.open();
            if (result == 0) {
                IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
                try {
                    IWebBrowser browser = browserSupport.getExternalBrowser();
                    browser.openURL(url);
                } catch (PartInitException e) {
                    MessageDialog.openError(parent, "Error", "Failed to open external browser on URL:\n" + url);
                }
            }
        } else {
            MessageDialog dialog = new MessageDialog(parent, title, null, message + "\n\n" + upgradeNotes,
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
        }
        return true;
    }
    return false;
}

From source file:gov.nasa.ensemble.core.plan.editor.MultiPagePlanEditor.java

License:Open Source License

/**
 * Is the user editing the plan the "custodian" of the plan?
 * @param plan a plan//w  w  w  .j  a v  a2s. c  o m
 * @return whether this editor user is the custodian of the given plan
 */
private boolean checkCustodian(EPlan plan) {
    if (PlanEditorPreferences.isCheckCustodian()) {
        String worldPermissions = WrapperUtils.getAttributeValue(plan,
                PermissionConstants.WORLD_PERMISSIONS_KEY);
        if (worldPermissions == null || !PermissionConstants.PERMISSION_EDIT_BY_ROLE.equals(worldPermissions)) {
            String custodian = WrapperUtils.getAttributeValue(plan, EditorPlugin.ATTRIBUTE_CUSTODIAN);
            String ensembleUser = AuthenticationUtil.getEnsembleUser();
            if ((custodian != null) && (ensembleUser != null) && !custodian.equals(ensembleUser)) {
                IWorkbenchWindow window = getEditorSite().getWorkbenchWindow();
                String message = "The custodian of this plan is " + custodian + ", " + "but your username is "
                        + ensembleUser + ".  " + "Are you sure you want to save?";
                MessageDialog dialog = new MessageDialog(window.getShell(), "Custodian/User mismatch", null,
                        message, MessageDialog.WARNING,
                        new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1);
                return 0 == dialog.open();
            }
        }
    }
    return true;
}

From source file:gov.redhawk.ide.codegen.ui.internal.GeneratorDialog.java

License:Open Source License

/**
 * {@inheritDoc}/*ww  w.  ja v  a2s. c  o  m*/
 */
@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);
    this.okButton.setEnabled(false);
    // do this here because setting the text will set enablement on the ok
    // button
    this.repIdViewer.getControl().setFocus();
    this.repIdViewer.setInput(this.repIds);
    if (this.value != null) {
        for (final String rep : this.repIds) {
            if (this.value.getRepId().equals(rep)) {
                this.repIdViewer.setSelection(new StructuredSelection(Collections.singletonList(rep)));
                break;
            }
        }
    }
}

From source file:gov.redhawk.ide.codegen.ui.internal.PropertyDialog.java

License:Open Source License

/**
 * {@inheritDoc}//from  w w w  . ja  va2 s . c o  m
 */
@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);
    this.okButton.setEnabled(false);
    // do this here because setting the text will set enablement on the ok button
    this.idText.getControl().setFocus();
    this.idText.setInput(this.desc.getPropertyDescriptors());
    if (this.value != null) {
        String id = this.value.getId();
        if (id == null) {
            id = "";
        }
        this.idText.getCombo().setText(id);
        String valueStr = this.value.getValue();
        if (valueStr == null) {
            valueStr = "";
        }
        this.valueText.setText(valueStr);
    }
}

From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java

License:Open Source License

/**
 * Creates the buttons for this dialog's button bar.
 * <p>/*from   ww w  .  ja  v  a  2  s. co  m*/
 * The <code>WizardDialog</code> implementation of this framework method
 * prevents the parent composite's columns from being made equal width in
 * order to remove the margin between the Back and Next buttons.
 * </p>
 * 
 * @param parent
 * the parent composite to contain the buttons
 */
@Override
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false;
    this.cancelButton = createCancelButton(parent);

    // also add cancel operation to the shell
    getShell().addListener(SWT.Traverse, new Listener() {

        public void handleEvent(Event event) {
            switch (event.detail) {
            case SWT.TRAVERSE_ESCAPE:
                cancelPressed();
                break;
            }
        }
    });
}