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:net.refractions.udig.ui.ZoomingDialog.java

License:Open Source License

public static void openErrorMessage(Rectangle start, Shell parentShell, String dialogTitle,
        String dialogMessage) {/*  www . j  av  a2 s.  c  om*/
    openMessageDialog(start, parentShell, dialogTitle, null, dialogMessage, MessageDialog.ERROR,
            new String[] { IDialogConstants.OK_LABEL }, 1);
}

From source file:net.refractions.udig.ui.ZoomingDialog.java

License:Open Source License

public static void openWarningMessage(Rectangle start, Shell parentShell, String dialogTitle,
        String dialogMessage) {/*from www .  j av a  2s . c o m*/
    openMessageDialog(start, parentShell, dialogTitle, null, dialogMessage, MessageDialog.WARNING,
            new String[] { IDialogConstants.OK_LABEL }, 1);
}

From source file:net.refractions.udig.ui.ZoomingDialog.java

License:Open Source License

public static void openInformationMessage(Rectangle start, Shell parentShell, String dialogTitle,
        String dialogMessage) {/* w ww .j a  va  2  s .  co  m*/
    openMessageDialog(start, parentShell, dialogTitle, null, dialogMessage, MessageDialog.INFORMATION,
            new String[] { IDialogConstants.OK_LABEL }, 1);
}

From source file:net.rim.ejde.internal.signing.ImportSignKeysAction.java

License:Open Source License

@Override
public void run(IAction action) {
    // Open file dialog to allow user select the parent folder of *.csk and *.db files
    SigningSearchDialog oldKeyDialog = new SigningSearchDialog(ContextManager.getActiveWorkbenchShell());
    try {/*  ww w.  j  a  va 2s . c  o  m*/
        ArrayList<File> oldKeyFiles = oldKeyDialog.search();
        if (oldKeyFiles != null) {
            oldKeyDialog.copyFileIntoSignToolDir(oldKeyFiles);
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle1, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg1, MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg9);
        }
    } catch (IllegalArgumentException ex) {
        MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                Messages.CodeSigningPrefsPage_MessageDialogTitle1, null, ex.getMessage(), MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL }, 0);
        dialog.open();
    }
}

From source file:net.rim.ejde.internal.signing.RemoveSignKeysAction.java

License:Open Source License

private void removeKeys() {
    try {/*  w ww . j av a2s  . c  o m*/
        File cskFile = new File(
                VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME);
        File dbFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME);
        if ((!cskFile.exists()) && (!dbFile.exists())) {
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle3, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg3, MessageDialog.WARNING,
                    new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            return;
        }
        if (cskFile.exists()) {
            cskFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator
                    + IConstants.CSK_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis()));
        }
        if (dbFile.exists()) {
            dbFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator
                    + IConstants.DB_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis()));
        }
        if ((!cskFile.exists()) && (!dbFile.exists())) {
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle3, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg5
                            + Messages.CodeSigningPrefsPage_MessageDialogMsg6,
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg7);
        }
    } catch (IOException e) {
        _log.error(e.getMessage());
    }
}

From source file:net.rim.ejde.internal.signing.SignatureToolLaunchAction.java

License:Open Source License

/**
 * Displays a warning dialog indicating that the signature tool is already running.
 *///from   w  w w . j  av a 2 s .  c  om
private static void warnSignatureToolRunning() {
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.SignCommandHandler_SigToolRunningDialogTitleMsg, null,
                    Messages.SignCommandHandler_SigToolRunningDialogMsg, MessageDialog.WARNING,
                    new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
        }
    });
}

From source file:net.rim.ejde.internal.ui.preferences.SignatureToolPrefsPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite main = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//  www  .  java2  s . co m
    main.setLayout(layout);
    main.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label linkLabel = new Label(main, SWT.NONE);
    linkLabel.setText(Messages.CodeSigningPrefsPage_ClickHereLabel);

    Link keyLink = new Link(main, SWT.NONE);
    keyLink.setText(Messages.CodeSigningPrefsPage_AddNewKeyLabel);
    keyLink.setToolTipText(Messages.CodeSigningPrefsPage_AddNewKeyToolTip);

    keyLink.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            ImportCSIFilesAction action = new ImportCSIFilesAction();
            action.run(null);
        }
    });

    _searchKeyLink = new Link(main, SWT.NONE);
    _searchKeyLink.setText(Messages.CodeSigningPrefsPage_AddOldKeyLabel);
    _searchKeyLink.setToolTipText(Messages.CodeSigningPrefsPage_AddOldKeyToolTip);

    _removeKeyLink = new Link(main, SWT.NONE);
    _removeKeyLink.setText(Messages.CodeSigningPrefsPage_RemoveCurrentKeyLabel);
    _removeKeyLink.setToolTipText(Messages.CodeSigningPrefsPage_RemoveCurrentKeyToolTip);

    File cskFile;
    File dbFile;
    try {
        cskFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME);
        dbFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME);
        if ((cskFile.exists()) && (dbFile.exists())) {
            _searchKeyLink.setEnabled(false);
            _removeKeyLink.setEnabled(true);
        } else {
            _searchKeyLink.setEnabled(true);
            _removeKeyLink.setEnabled(false);
        }
    } catch (IOException io) {
        _log.error(io.getMessage());
    }

    _searchKeyLink.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            // Open file dialog to allow user select the parent folder of *.csk and *.db files
            SigningSearchDialog oldKeyDialog = new SigningSearchDialog(getShell());
            try {
                ArrayList<File> oldKeyFiles = oldKeyDialog.search();
                if (oldKeyFiles != null) {
                    oldKeyDialog.copyFileIntoSignToolDir(oldKeyFiles);
                    MessageDialog dialog = new MessageDialog(getShell(),
                            Messages.CodeSigningPrefsPage_MessageDialogTitle1, null,
                            Messages.CodeSigningPrefsPage_MessageDialogMsg1, MessageDialog.INFORMATION,
                            new String[] { IDialogConstants.OK_LABEL }, 0);
                    dialog.open();
                    _searchKeyLink.setEnabled(false);
                    _removeKeyLink.setEnabled(true);
                    _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg9);
                }
            } catch (IllegalArgumentException ex) {
                MessageDialog dialog = new MessageDialog(getShell(),
                        Messages.CodeSigningPrefsPage_MessageDialogTitle1, null, ex.getMessage(),
                        MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.open();
            }
        }
    });

    _removeKeyLink.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            if (MessageDialog.openQuestion(getShell(), Messages.CodeSigningPrefsPage_MessageDialogTitle3,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg4
                            + Messages.CodeSigningPrefsPage_MessageDialogMsg6)) {
                removeKeys();
            }
        }
    });

    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gridData.verticalIndent = 15;

    _runSignToolAutomatically = new Button(main, SWT.CHECK);
    _runSignToolAutomatically.setText(Messages.SignatureToolPrefsPage_AutomaticallySigningBtnMsg);
    _runSignToolAutomatically.setToolTipText(Messages.SignatureToolPrefsPage_AutomaticallySigningBtnTooltipMsg);
    _runSignToolAutomatically.setLayoutData(gridData);

    _runSignToolSilently = new Button(main, SWT.CHECK);
    _runSignToolSilently.setText(Messages.SignatureToolPrefsPage_SilentToolBtnMsg);
    _runSignToolSilently.setToolTipText(Messages.SignatureToolPrefsPage_SilentToolBtnTooltipMsg);
    _runSignToolSilently.setLayoutData(gridData);

    initValues();

    return parent;
}

From source file:net.rim.ejde.internal.ui.preferences.SignatureToolPrefsPage.java

License:Open Source License

private void removeKeys() {
    try {//from   w w  w. j av  a 2s . c  o m
        File cskFile = new File(
                VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME);
        File dbFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME);
        if ((!cskFile.exists()) && (!dbFile.exists())) {
            MessageDialog dialog = new MessageDialog(getShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle3, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg3, MessageDialog.WARNING,
                    new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            return;
        }
        if (cskFile.exists()) {
            cskFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator
                    + IConstants.CSK_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis()));
        }
        if (dbFile.exists()) {
            dbFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator
                    + IConstants.DB_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis()));
        }
        if ((!cskFile.exists()) && (!dbFile.exists())) {
            MessageDialog dialog = new MessageDialog(getShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle3, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg5
                            + Messages.CodeSigningPrefsPage_MessageDialogMsg6,
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            _searchKeyLink.setEnabled(true);
            _removeKeyLink.setEnabled(false);
            _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg7);
        }
    } catch (IOException e) {
        _log.error(e.getMessage());
    }
}

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

License:Open Source License

public PromptDialog(Shell parentShell, String title, String initialAnswer, boolean obscure) {
    super(parentShell, title, null, title + ":", QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    _obscure = obscure;/*from  w  w  w  .j av  a  2 s .  c  o m*/
    _response = null;
    _initialAnswer = initialAnswer;
}

From source file:net.sf.eclipse.tomcat.TomcatProjectChangeListener.java

License:Open Source License

public void resourceChanged(IResourceChangeEvent event) {
    if (event.getResource() instanceof IProject) {
        final TomcatProject project = TomcatProject.create((IProject) event.getResource());
        if (project != null) {

            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

                    String[] labels = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
                    MessageDialog dialog = new MessageDialog(window.getShell(), WIZARD_PROJECT_REMOVE_TITLE,
                            null, WIZARD_PROJECT_REMOVE_DESCRIPTION, MessageDialog.QUESTION, labels, 1);

                    if (dialog.open() == MessageDialog.OK) {
                        try {
                            project.removeContext();
                        } catch (Exception ex) {
                            TomcatLauncherPlugin.log(ex.getMessage());
                        }// www .ja v  a 2s.  co  m
                    }
                }
            });

        }
    }
}