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:com.ceteva.mosaic.MessageDialogWithToggle.java

License:Open Source License

/**
 * Convenience method to open a standard warning dialog.
 *
 * @param parent the parent shell of the dialog, or <code>null</code> if none
 * @param title the dialog's title, or <code>null</code> if none
 * @param message the message//from  w  w  w. j  a va2  s  . com
 * @param toggleMessage the message for the toggle control, or <code>null</code> 
 *   for the default message ("Don't show me this message again").
 * @param toggleState the initial state for the toggle 
 * @return the dialog, after being closed by the user, which the client can
 *       only call <code>getReturnCode()</code> or <code>getToggleState()</code>
 */
public static MessageDialogWithToggle openWarning(Shell parent, String title, String message,
        String toggleMessage, boolean toggleState) {
    MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent, title, null, // accept the default window icon
            message, WARNING, new String[] { IDialogConstants.OK_LABEL }, 0, // ok is the default
            toggleMessage, toggleState);
    dialog.open();
    return dialog;
}

From source file:com.cloudbees.eclipse.dev.ui.views.build.DeployWarAppDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*  w  ww.  j a v a  2s  .  co  m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.cloudbees.eclipse.dtp.internal.actions.ShowPasswordAction.java

License:Open Source License

@Override
public void run(IAction action) {
    if (action instanceof ObjectPluginAction) {
        ObjectPluginAction pluginAction = (ObjectPluginAction) action;
        ISelection selection = pluginAction.getSelection();

        if (selection instanceof IStructuredSelection) {
            IStructuredSelection structSelection = (IStructuredSelection) selection;
            Object element = structSelection.getFirstElement();

            if (element instanceof DatabaseInfo) {
                DatabaseInfo db = (DatabaseInfo) element;
                try {
                    final DatabaseInfo dbi = BeesSDK.getDatabaseInfo(db.getName(), true);
                    final String psw = dbi.getPassword();

                    Dialog pswd = new Dialog(Display.getCurrent().getActiveShell()) {

                        @Override
                        protected void configureShell(Shell newShell) {
                            super.configureShell(newShell);
                            newShell.setText("Password for database '" + dbi.getName() + "'");
                        }//from ww w.  j a  v  a2s .c  o m

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

                        @Override
                        protected Control createDialogArea(Composite parent) {
                            Composite container = (Composite) super.createDialogArea(parent);
                            GridLayout layout = new GridLayout();
                            layout.numColumns = 2;
                            container.setLayout(layout);
                            GridData gridData = new GridData();
                            gridData.grabExcessHorizontalSpace = true;
                            gridData.horizontalAlignment = GridData.FILL;

                            Label dbLabel = new Label(container, SWT.NONE);
                            dbLabel.setText("Database: ");

                            Text dbNameText = new Text(container, SWT.BORDER);
                            dbNameText.setText(dbi.getName());
                            dbNameText.setLayoutData(gridData);
                            dbNameText.setEditable(false);
                            dbNameText.setEnabled(true);

                            Label pswLabel = new Label(container, SWT.NONE);
                            pswLabel.setText("Password: ");
                            gridData = new GridData();
                            gridData.grabExcessHorizontalSpace = true;
                            gridData.horizontalAlignment = GridData.FILL;
                            Text pswText = new Text(container, SWT.BORDER);
                            pswText.setText(psw);
                            pswText.setEditable(false);
                            pswText.setEnabled(true);
                            pswText.setLayoutData(gridData);

                            pswText.setFocus();
                            pswText.selectAll();
                            return container;
                        }
                    };
                    pswd.create();
                    pswd.open();

                    //MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Password for database '"+dbi.getName()+"'", "Database: "+dbi.getName()+"\nPassword: "+dbi.getPassword());
                } catch (Exception e) {
                    CloudBeesUIPlugin.showError("Failed to fetch database password!", e);
                }

            }
        }
    }
}

From source file:com.codesourcery.internal.installer.ui.InstallWizardDialog.java

License:Open Source License

@Override
public void showPage(IWizardPage page) {
    // Set new page
    super.showPage(page);

    // Set page active
    if (page instanceof IInstallWizardPage) {
        try {/*  www  .ja v  a 2  s .  com*/
            ((IInstallWizardPage) getCurrentPage()).setActive(getInstallWizard().getInstallData());
        } catch (Exception e) {
            Installer.log(e);
        }
    }

    IWizardPage[] pages = getInstallWizard().getPages();
    // If final page, update buttons so that only
    // OK is enabled.
    if ((pages.length > 0) && (page == pages[pages.length - 1])) {
        Button button = getButton(IDialogConstants.BACK_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.NEXT_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.OK_LABEL);
    }
}

From source file:com.codesourcery.internal.installer.ui.WizardDialog.java

License:Open Source License

/**
 * Creates and return a new wizard closing dialog without opening it.
 * /*from w  ww . ja v  a 2s.  com*/
 * @return MessageDalog
 */
private MessageDialog createWizardClosingDialog() {
    MessageDialog result = new MessageDialog(getShell(), JFaceResources.getString("WizardClosingDialog.title"), //$NON-NLS-1$
            null, JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$
            MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0) {
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    return result;
}

From source file:com.drgarbage.bytecode.jdi.dialogs.SelectDebugTargetDialog.java

License:Apache License

/**
  * Creates a new clean dialog.//from w  w w  . j a v a  2 s .c  o m
  * 
  * @param className the name of the class
  * @param displayCandidates array of java types
 * @see IJavaType
  */
public SelectDebugTargetDialog(String className, ArrayList<IJavaType[]> displayCandidates) {
    super(null, BytecodeVisualizerMessages.SelectDebugTargetDialog_title, null,
            MessageFormat.format(BytecodeVisualizerMessages.SelectDebugTargetDialog_text,
                    new Object[] { className }),
            NONE, new String[] { IDialogConstants.OK_LABEL,
                    BytecodeVisualizerMessages.SelectDebugTargetDialog_act_Filesystem },
            0);
    this.displayCandidates = displayCandidates;
}

From source file:com.drgarbage.bytecode.jdi.dialogs.SelectJavaTypeDialog.java

License:Apache License

/**
  *///from  ww w . j a  va  2  s. c o m
public SelectJavaTypeDialog(String className, String debugTargetName, IJavaType[] displayCandidates) {
    super(null, BytecodeVisualizerMessages.SelectJavaTypeDialog_title, null,
            MessageFormat.format(BytecodeVisualizerMessages.SelectJavaTypeDialog_text,
                    new Object[] { className, debugTargetName }),
            NONE, new String[] { IDialogConstants.OK_LABEL }, 0);
    this.displayCandidates = displayCandidates;
}

From source file:com.drgarbage.bytecodevisualizer.actions.DebugFunctionalityInfoDialog.java

License:Apache License

/**
  * Creates a new clean dialog.//from w  w w .  j a v a 2  s.c o m
  */
public DebugFunctionalityInfoDialog() {
    super(null,
            BytecodeVisualizerMessages.ToggleBreakpointAction_tooltipText_Debug_functionality_is_unavailable_in_this_context_,
            null, null, WARNING, new String[] { IDialogConstants.OK_LABEL }, 0,
            DebugFunctionalityInfoDialog.class.getName());

}

From source file:com.drgarbage.utils.Messages.java

License:Apache License

public static int info(Shell shell, String title, String message) {
    MessageDialog dlg = new MessageDialog(shell, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(), message,
            MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
    return dlg.open();
}

From source file:com.drgarbage.utils.Messages.java

License:Apache License

public static int warning(Shell shell, String title, String message) {
    MessageDialog dlg = new MessageDialog(shell, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(), message,
            MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
    return dlg.open();
}