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

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

Introduction

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

Prototype

int INTERNAL_ID

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

Click Source Link

Document

Starting button id reserved for internal use by JFace (value 256).

Usage

From source file:org.eclipse.tcf.te.launch.ui.viewer.dnd.CommonDnD.java

License:Open Source License

private String askForLaunchMode(ILaunchConfigurationType type, String[] modes) {
    List<String> modeLabels = new ArrayList<String>();
    int defaultIndex = 0;
    for (String mode : modes) {
        ILaunchMode launchMode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(mode);
        modeLabels.add(launchMode.getLabel());
        if (mode.equals(ILaunchManager.DEBUG_MODE)) {
            defaultIndex = modeLabels.size() - 1;
        }//from w ww  . j  ava 2s.  c o m
    }
    if (modeLabels.size() > 0) {
        modeLabels.add(IDialogConstants.CANCEL_LABEL);
        OptionalMessageDialog dialog = new OptionalMessageDialog(
                UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
                Messages.CommonDnD_launchMode_dialog_title, null,
                NLS.bind(Messages.CommonDnD_launchMode_dialog_message, type.getName()), MessageDialog.QUESTION,
                modeLabels.toArray(new String[modeLabels.size()]), defaultIndex, null, null);
        int result = dialog.open();
        if (result >= IDialogConstants.INTERNAL_ID) {
            return modes[result - IDialogConstants.INTERNAL_ID];
        }
    }
    return null;
}

From source file:org.jeelee.filemanager.core.FileUtils.java

License:Open Source License

public static void moveTo(String[] paths, FileDelegate target) throws IOException {
    PluginResources r = FileManagerActivator.RESOURCES;

    boolean needPrompt = true;
    int handleType = IDialogConstants.CANCEL_ID;
    for (final String file : paths) {
        Path sourcePath = Paths.get(file);
        Path targetPath = target.getSource().resolve(Paths.get(file).getFileName());

        if (Files.exists(targetPath)) {
            if (targetPath.equals(sourcePath)) {
                continue;
            }/*from   w  w  w  .  j a  v a 2s  .co m*/
            if (needPrompt) {
                MessageDialogWithToggle dialog = new MessageDialogWithToggle(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        r.getFormatted(Messages.FILE_ALREADY_EXISTS), null,
                        r.getFormatted(Messages.FILE_ALREADY_EXISTS, targetPath), MessageDialog.QUESTION,
                        new String[] { r.getString(Messages.REPLACE),
                                //                              r.getString(Messages.REPLACE_ALL),
                                r.getString(Messages.KEEP),
                                //                              r.getString(Messages.KEEP_ALL),
                                IDialogConstants.CANCEL_LABEL },
                        1, r.getString(Messages.DO_THIS_FOR_THE_NEXT_CONFLICTS), false);
                dialog.open();
                needPrompt = !dialog.getToggleState();
                handleType = dialog.getReturnCode();
            }

            if (handleType == IDialogConstants.CANCEL_ID) {
                return;
            }
            if (handleType == IDialogConstants.INTERNAL_ID) { // REPLACE
                delete(targetPath);
            } else if (handleType == IDialogConstants.INTERNAL_ID + 1) { // KEEP
                Path newTarget = targetPath;

                for (int i = 1; Files.exists(newTarget); i++) {
                    newTarget = target.getSource().resolve(NameGenerator.createNewFilename(targetPath, i));
                }
                targetPath = newTarget;
            }
        }
        Files.move(sourcePath, targetPath);
    }
}

From source file:org.jkiss.dbeaver.ui.controls.resultset.ValidateUniqueKeyUsageDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    executionContext.getDataSource().getContainer().getPreferenceStore()
            .setValue(DBeaverPreferences.RS_EDIT_USE_ALL_COLUMNS, getToggleState());
    switch (buttonId) {
    case IDialogConstants.CANCEL_ID:
        super.buttonPressed(buttonId);
        break;//  w w w.j a v  a2  s  . c  om
    case IDialogConstants.INTERNAL_ID:
        if (useAllColumns(getShell(), viewer)) {
            super.buttonPressed(IDialogConstants.OK_ID);
        }

        break;
    case IDialogConstants.INTERNAL_ID + 1:
        editCustomKey();

        break;
    }
    executionContext.getDataSource().getContainer().persistConfiguration();
}

From source file:org.sf.feeling.decompiler.update.DecompilerUpdateHandler.java

License:Open Source License

private void updateDecompiler(IProgressMonitor monitor) throws Exception {
    if (version == null) {
        version = getUpdateVersion(monitor);
    }/*from   w w  w. j av a 2s.  co m*/

    final String versionString = getVersion(version);
    final boolean force = isForce(monitor);
    if (versionString != null && (!versionString.equals(DecompilerUpdatePlugin.getDefault().getPreferenceStore()
            .getString(DecompilerUpdatePlugin.NOT_UPDATE_VERSION)) || force)) {
        Display.getDefault().asyncExec(new Runnable() {

            public void run() {
                MessageDialogWithToggle dialog = new MessageDialogWithToggle(
                        Display.getDefault().getActiveShell(),
                        Messages.getString("DecompilerUpdateHandler.ConfirmDialog.Title"), //$NON-NLS-1$
                        null, // accept the default window icon
                        Messages.getString("DecompilerUpdateHandler.ConfirmDialog.Message"), //$NON-NLS-1$
                        MessageDialog.CONFIRM,
                        new String[] {
                                Messages.getString("DecompilerUpdateHandler.ConfirmDialog.Button.NotNow"), //$NON-NLS-1$
                                Messages.getString("DecompilerUpdateHandler.ConfirmDialog.Button.Continue") //$NON-NLS-1$
                }, 1, Messages.getString("DecompilerUpdateHandler.ConfirmDialog.Button.NotAskAgain"), //$NON-NLS-1$
                        false) {

                    protected Button createToggleButton(Composite parent) {
                        Button button = super.createToggleButton(parent);
                        if (force) {
                            button.setVisible(false);
                        }
                        return button;
                    }
                };

                int result = dialog.open();

                if (!force && dialog.getToggleState()) {
                    DecompilerUpdatePlugin.getDefault().getPreferenceStore()
                            .setValue(DecompilerUpdatePlugin.NOT_UPDATE_VERSION, versionString);
                }

                if (result - IDialogConstants.INTERNAL_ID == 1) {
                    String installUrl = "http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=472922"; //$NON-NLS-1$
                    if (MarsDecompilerMarketplace.isInteresting()) {
                        new MarsMarketClientHandler().proceedInstallation(installUrl);
                    } else if (LunaDecompilerMarketplace.isInteresting()) {
                        new LunaDecompilerMarketplace().proceedInstallation(installUrl);
                    }
                }
            }
        });
    }
}

From source file:org.xmind.ui.internal.dnd.FileDndClient.java

License:Open Source License

private void askForConfirmation(Shell shell, String itemName, String prefKey, String dialogMessage,
        List<FileDropHandler> handlers, String... paths) {
    String active = getPref().getString(prefKey);
    if ("".equals(active) || PrefConstants.ASK_USER.equals(active)) { //$NON-NLS-1$
        active = null;/*from w w  w  .  j  a  v  a  2  s.c  o m*/
    }
    if (active == null) {
        shell.forceActive();
        MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell,
                NLS.bind(DialogMessages.DND_ConfirmDroppingFileDialog_title_with_type, itemName), null, //
                dialogMessage, //
                SWT.ICON_QUESTION, //
                new String[] { //
                        DialogMessages.DND_ConfirmDroppingFileDialog_LinkButton_text, //
                        DialogMessages.DND_ConfirmDroppingFileDialog_CopyButton_text, //
                        IDialogConstants.CANCEL_LABEL //
                }, 0, //
                NLS.bind(DialogMessages.DND_ConfirmDroppingFileDialog_RememberCheck_text_with_type, itemName),
                false);
        int ret = dialog.open();
        if (ret == IDialogConstants.INTERNAL_ID) {
            active = PrefConstants.CREATE_HYPERLINK;
        } else if (ret == IDialogConstants.INTERNAL_ID + 1) {
            active = PrefConstants.CREATE_ATTACHMENT;
        }
        if (dialog.getToggleState() && active != null) {
            getPref().setValue(prefKey, active);
        }
    }
    if (active != null) {
        createFileDropHandlers(handlers, active, paths);
    }
}