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

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

Introduction

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

Prototype

String NO_LABEL

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

Click Source Link

Document

The label for no buttons.

Usage

From source file:org.talend.mdm.repository.ui.wizards.imports.ImportServerObjectWizard.java

License:Open Source License

private int isOveride(String name, String obTypeName) {

    final MessageDialog dialog = new MessageDialog(getShell(), Messages.Confirm_Overwrite, null,
            Messages.bind(Messages.Confirm_Overwrite_Info, obTypeName, name), MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
            0);// ww  w. j av a2 s. com
    dialog.open();
    int result = dialog.getReturnCode();
    if (result == 0) {
        return IDialogConstants.YES_ID;
    }
    if (result == 1) {
        return IDialogConstants.YES_TO_ALL_ID;
    }
    if (result == 2) {
        return IDialogConstants.NO_ID;
    }
    return IDialogConstants.CANCEL_ID;

}

From source file:org.talend.repository.hdfs.ui.HDFSFileSelectorForm.java

License:Open Source License

private synchronized void showTableIsExistConfirmDialog(final MetadataTable existTable) {
    if (notShowAgain == false) {
        // orgomg.cwm.objectmodel.core.Package pack = (orgomg.cwm.objectmodel.core.Package) existTable.eContainer();
        MessageDialogWithToggle dialog = new MessageDialogWithToggle(Display.getDefault().getActiveShell(),
                Messages.getString("HDFSFileSelectorForm.title.confirm"), null, Messages.getString( //$NON-NLS-1$
                        "HDFSFileSelectorForm.tableIsExist.new", existTable.getLabel()), //$NON-NLS-1$
                MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL },
                1, Messages.getString("HDFSFileSelectorForm.tableIsExist.notShowAgain"), //$NON-NLS-1$
                false);//from  ww  w. j  a va2s .c om
        int result = dialog.open();
        notShowAgain = dialog.getToggleState();
        if (result == IDialogConstants.YES_ID) {
            userConfirmed = true;
        } else {
            userConfirmed = false;
        }
    }
}

From source file:org.talend.repository.ui.actions.AContextualAction.java

License:Open Source License

/**
 * Display a prompt dialog to ask the user if we should save the job before duplicating.
 * //from   w w w.ja  va  2 s . com
 * @param part
 * @return
 */
protected int promptForSavingDialog(IEditorPart part) {
    String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    // String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion, part.getTitle());
    String message = Messages.getString("AContextualAction.EditorManager_saveChangesQuestion", //$NON-NLS-1$
            new Object[] { part.getTitle() });
    // Dialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), WorkbenchMessages.Save_Resource,
    // null, message,
    // MessageDialog.QUESTION, buttons, 0) {
    Dialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(),
            Messages.getString("AContextualAction.Save_Resource"), null, message, //$NON-NLS-1$
            MessageDialog.QUESTION, buttons, 0) {

        @Override
        protected int getShellStyle() {
            return SWT.NONE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | getDefaultOrientation();
        }
    };
    return dialog.open();
}

From source file:org.talend.repository.ui.actions.importproject.ImportDemoProjectItemsPage.java

License:Open Source License

public boolean performFinish() {
    List<DemoProjectBean> checkedElements = getCheckedElements();
    final List<ResourcesManager> finalCheckManagers = getResourceManagers(checkedElements);
    String warnMessage = populateExistItemRecords(finalCheckManagers);
    if (!warnMessage.equals("")) {
        MessageDialog dialog = new MessageDialog(getShell(),
                Messages.getString("ImportDemoProjectPage.overwrite"), null, warnMessage,
                MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL },
                0);//from  w  w  w .j  av a2 s .  c  o m
        dialog.open();
        int result = dialog.getReturnCode();
        if (result != MessageDialog.OK) {
            return false;
        }
    }

    ProgressDialog progressDialog = new ProgressDialog(getShell()) {

        private IProgressMonitor monitorWrap;

        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitorWrap = new EventLoopProgressMonitor(monitor);
            try {
                for (ResourcesManager resManager : finalCheckManagers) {
                    List<ImportItem> projectRecords = importManager.populateImportingItems(resManager, true,
                            monitorWrap);
                    // clearOverWriteErrorMessages(projectRecords, overwrite);
                    importManager.importItemRecords(monitorWrap, resManager, projectRecords, true,
                            projectRecords.toArray(new ImportItem[0]), null);
                }
            } catch (Exception e) {
                ExceptionHandler.process(e);
            }
            monitorWrap.done();
            if (monitor.isCanceled()) {
                MessageDialog.openInformation(getShell(),
                        Messages.getString("ImportDemoProjectAction.messageDialogTitle.demoProjectCancel"),
                        Messages.getString(
                                "ImportDemoProjectAction.messageDialogContent.demoProjectImportedIncompletely"));
                return;
            } else {
                MessageDialog.openInformation(getShell(),
                        Messages.getString("ImportDemoProjectAction.messageDialogTitle.demoProject"), //$NON-NLS-1$
                        Messages.getString(
                                "ImportDemoProjectAction.messageDialogContent.demoProjectImportedSuccessfully")); //$NON-NLS-1$

            }
        }
    };

    try {
        progressDialog.executeProcess();
    } catch (InvocationTargetException e) {
        MessageBoxExceptionHandler.process(e.getTargetException(), getShell());
    } catch (InterruptedException e) {
        // Nothing to do
    }

    return true;
}

From source file:org.talend.repository.ui.wizards.exportjob.JobScriptsExportWizardPage.java

License:Open Source License

/**
 * The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false
 * is returned then the wizard will not close.
 * /*from  w  w w  . j  a  va 2 s  .com*/
 * @returns boolean
 */
@Override
public boolean finish() {
    // TODO
    if (treeViewer != null) {
        treeViewer.removeCheckStateListener(checkStateListener);
    }

    saveWidgetValues();

    if (!ensureTargetIsValid()) {
        return false;
    }

    if (ensureLog4jSettingIsValid()) {
        MessageDialog dialog = new MessageDialog(getShell(), "Question", null,
                Messages.getString("Log4jSettingPage.IlleagalBuild"), MessageDialog.QUESTION,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
        dialog.open();
        int result = dialog.getReturnCode();
        if (result != MessageDialog.OK) {
            return false;
        }
    }

    JobExportType jobExportType = getCurrentExportType1();
    if (JobExportType.POJO.equals(jobExportType)) {
        IRunnableWithProgress worker = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                buildJobWithMaven(JobExportType.POJO, monitor);
            }
        };

        try {
            getContainer().run(false, true, worker);
        } catch (InvocationTargetException e) {
            MessageBoxExceptionHandler.process(e.getCause(), getShell());
            return false;
        } catch (InterruptedException e) {
            return false;
        }

    } else {

        List<ContextParameterType> contextEditableResultValuesList = null;
        if (manager != null) {
            contextEditableResultValuesList = manager.getContextEditableResultValuesList();
        }
        manager = createJobScriptsManager();
        if (nodes.length == 1) {
            RepositoryNode node = nodes[0];
            if (node.getType() == ENodeType.SYSTEM_FOLDER) {
                manager.setTopFolderName(ProjectManager.getInstance().getCurrentProject().getLabel());
            } else {
                manager.setTopFolderName(getDefaultFileNameWithType());
            }
        } else {
            manager.setTopFolderName(getDefaultFileNameWithType());
        }

        // for feature:11976, recover back the old default manager value with ContextParameters
        if (contextEditableResultValuesList == null) {
            manager.setContextEditableResultValuesList(new ArrayList<ContextParameterType>());
        } else {
            manager.setContextEditableResultValuesList(contextEditableResultValuesList);
        }

        manager.setMultiNodes(isMultiNodes());
        // achen modify to fix bug 0006222

        IRunnableWithProgress worker = new JobExportAction(Arrays.asList(getCheckNodes()),
                getSelectedJobVersion(), manager, originalRootFolderName, getProcessType());

        try {
            getContainer().run(false, true, worker);
        } catch (InvocationTargetException e) {
            MessageBoxExceptionHandler.process(e.getCause(), getShell());
            return false;
        } catch (InterruptedException e) {
            return false;
        }
    }

    // see bug 7181
    if (zipOption != null && zipOption.equals("true")) { //$NON-NLS-1$
        // unzip
        try {
            String zipFile;
            if (manager != null) {
                zipFile = manager.getDestinationPath();
            } else {
                zipFile = getDestinationValue();
                int separatorIndex = zipFile.lastIndexOf(File.separator);
                if (separatorIndex == -1) {
                    String userDir = System.getProperty("user.dir"); //$NON-NLS-1$
                    zipFile = userDir + File.separator + zipFile;
                }
            }
            // Added by Marvin Wang on Feb.1, 2012 for bug TDI-18824
            File file = new File(zipFile);
            if (file.exists()) {
                ZipToFile.unZipFile(zipFile, file.getParentFile().getAbsolutePath());
            }
        } catch (Exception e) {
            MessageBoxExceptionHandler.process(e, getShell());
            return false;
        }
    }

    if (treeViewer != null) {
        treeViewer.dispose();
    }

    // end
    return true;
}

From source file:org.tigris.subversion.subclipse.ui.authentication.SVNPromptUserPassword.java

License:Open Source License

public boolean askYesNo(String realm, String askQuestion, boolean askYesIsDefault) {
    question = askQuestion;//from   w  w w. j  a  v a2 s.  c o  m
    yesIsDefault = askYesIsDefault;
    SVNUIPlugin.getStandardDisplay().syncExec(new Runnable() {
        public void run() {
            int defaultButton = 0;
            if (!yesIsDefault)
                defaultButton = 1;
            MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(),
                    Policy.bind("SVNPromptUserPassword.authentication"), //$NON-NLS-1$
                    null, question, MessageDialog.QUESTION,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, defaultButton);
            yesNoAnswer = (dialog.open() == 0);
        }
    });
    return yesNoAnswer;
}

From source file:org.tigris.subversion.subclipse.ui.operations.SVNOperation.java

License:Open Source License

/**
 * This method prompts the user to overwrite an existing resource. It uses the
 * <code>involvesMultipleResources</code> to determine what buttons to show.
 * @param project/* w  ww .j  a  v  a2 s. co  m*/
 * @return
 */
protected boolean promptToOverwrite(final String title, final String msg) {
    if (!confirmOverwrite) {
        return true;
    }
    final String buttons[];
    if (involvesMultipleResources()) {
        buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
    } else {
        buttons = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
    }
    final Shell displayShell = getShell();
    if (displayShell == null) {
        // We couldn't get a shell (perhaps due to shutdown)
        return false;
    }

    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    final int[] code = new int[] { 0 };
    displayShell.getDisplay().syncExec(new Runnable() {
        public void run() {
            MessageDialog dialog = new MessageDialog(displayShell, title, null, msg, MessageDialog.QUESTION,
                    buttons, 0);
            dialog.open();
            code[0] = dialog.getReturnCode();
        }
    });
    if (involvesMultipleResources()) {
        switch (code[0]) {
        case 0://Yes
            return true;
        case 1://Yes to all
            confirmOverwrite = false;
            return true;
        case 2://No
            return false;
        case 3://Cancel
        default:
            throw new OperationCanceledException();
        }
    } else {
        return code[0] == 0;
    }
}

From source file:org.tigris.subversion.subclipse.ui.subscriber.CommitSynchronizeOperation.java

License:Open Source License

/**
 * Prompts the user to determine how conflicting changes should be handled.
 * Note: This method is designed to be overridden by test cases.
 * @return 0 to sync conflicts, 1 to sync all non-conflicts, 2 to cancel
 *//* w  ww  . j a  va 2 s  .  co  m*/
private int promptForConflicts(Shell shell, SyncInfoSet syncSet) {
    String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    String title = Policy.bind("SyncAction.commit.conflict.title"); //$NON-NLS-1$
    String question = Policy.bind("SyncAction.commit.conflict.question"); //$NON-NLS-1$
    final MessageDialog dialog = new MessageDialog(shell, title, null, question, MessageDialog.QUESTION,
            buttons, 0);
    shell.getDisplay().syncExec(new Runnable() {
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode();
}

From source file:org.tigris.subversion.subclipse.ui.util.PromptingDialog.java

License:Open Source License

/**
 * Prompt for the given resources using the specific condition. The prompt dialog will
 * have the title specified.//w w  w  .ja v  a  2s.c  o  m
 */
public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) {
    this.condition = condition;
    this.resources = resources;
    this.title = title;
    this.shell = shell;
    this.hasMultipleResources = resources.length > 1;
    if (hasMultipleResources) {
        buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
    } else {
        buttons = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
    }
}

From source file:org.tigris.subversion.subclipse.ui.util.SimpleDialogsHelper.java

License:Open Source License

public boolean promptYesNo(String title, String question, boolean yesIsDefault) {
    MessageDialogRunnable mdr = new MessageDialogRunnable(null, title, null, question, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, yesIsDefault ? 0 : 1);
    SVNUIPlugin.getStandardDisplay().syncExec(mdr);
    return mdr.getResult() == 0;
}