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.roussev.http4e.httpclient.ui.dialog.example.DumbUser.java

License:Apache License

/**
 * Creates the buttons/*from   w  ww.ja v a 2s  .  c  o  m*/
 * 
 * @param parent the parent composite
 */
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    createButton(parent, I_DUNNO_ID, I_DUNNO_LABEL, false);
}

From source file:org.rssowl.ui.internal.dialogs.AggregateNewsDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    getButton(IDialogConstants.YES_ID).setFocus();
}

From source file:org.rssowl.ui.internal.dialogs.importer.ImportWizard.java

License:Open Source License

private boolean doImport() {

    /* Collect Elements to Import */
    List<IFolderChild> folderChilds = fImportElementsPage.getFolderChildsToImport();
    boolean isRSSOwlOPML = isRSSOwlOPMLImport(folderChilds);
    if (fImportElementsPage.excludeExisting())
        folderChilds = excludeExisting(folderChilds);

    /* Check for Errors First */
    if (StringUtils.isSet(fImportElementsPage.getErrorMessage())) {
        getContainer().showPage(fImportElementsPage);
        return false;
    }/*w  w w. j  a v a 2 s .  c  o m*/

    List<ILabel> labels = fImportElementsPage.getLabelsToImport();
    List<ISearchFilter> filters = fImportElementsPage.getFiltersToImport();
    List<IPreference> preferences = fImportElementsPage.getPreferencesToImport();

    /* Normalize Elements to Import */
    CoreUtils.normalize(folderChilds);

    /* Get Target Location (may be null) */
    IFolder target = fIsWelcome ? null : fImportTargetPage.getTargetLocation();

    /* Get Options */
    boolean importLabels = fImportOptionsPage.importLabels();
    if (!importLabels)
        labels = null;

    boolean importFilters = fImportOptionsPage.importFilters();
    if (!importFilters)
        filters = null;

    boolean importPreferences = fImportOptionsPage.importPreferences();
    if (!importPreferences)
        preferences = null;

    /* Show warning and ask for confirmation if preferences should be imported */
    if (!fIsWelcome && importPreferences && preferences != null && !preferences.isEmpty()) {
        MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportWizard_ATTENTION, null,
                Messages.ImportWizard_PREFERENCE_OVERWRITE, MessageDialog.WARNING,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
        if (dialog.open() != 0)
            return false;
    }

    /* Run Import */
    ImportUtils.doImport(target, folderChilds, labels, filters, preferences, !fIsWelcome);

    /* Add Default Saved Searches if this is from Welcome Wizard */
    if (fIsWelcome && !isRSSOwlOPML && !importLabels && !importFilters && !importPreferences)
        addDefaultSearches();

    /* Save Settings of Pages */
    fImportSourcePage.saveSettings();

    /* Ask for a restart if preferences have been imported */
    if (importPreferences && preferences != null && !preferences.isEmpty()) {
        boolean restart = MessageDialog.openQuestion(getShell(), Messages.ImportWizard_RESTART_RSSOWL,
                Messages.ImportWizard_RESTART_RSSOWL_INFO);
        if (restart) {
            BookMarkExplorer explorer = OwlUI.getOpenedBookMarkExplorer();
            if (explorer != null)
                explorer.saveStateOnDispose(false);

            Controller.getDefault().restart();
            return true;
        }
    }

    /* Reveal and Select Target Folder */
    if (target != null && target.getParent() != null) {
        BookMarkExplorer explorer = OwlUI.getOpenedBookMarkExplorer();
        if (explorer != null)
            explorer.reveal(target, true);
    }

    /* Reload Imported Elements */
    new ReloadTypesAction(new StructuredSelection(folderChilds), OwlUI.getPrimaryShell()).run();

    /* Force to rerun saved searches */
    JobRunner.runDelayedInBackgroundThread(new Runnable() {
        public void run() {
            Controller.getDefault().getSavedSearchService().updateSavedSearches(true);
        }
    });

    return true;
}

From source file:org.rssowl.ui.internal.dialogs.properties.GeneralPropertyPage.java

License:Open Source License

private boolean internalPerformSingle(Set<IEntity> entitiesToSave) {
    IEntity entity = fEntities.get(0);/*  ww  w . ja  v  a  2 s .c  o  m*/

    /* Require a Link */
    if (entity instanceof IBookMark && fFeedInput.getText().length() == 0) {
        fSite.select(this);
        fFeedInput.setFocus();

        fSite.setMessage(Messages.GeneralPropertyPage_ENTER_LINK, IPropertyDialogSite.MessageType.ERROR);

        return false;
    }

    /* Require a Name */
    if (fNameInput.getText().length() == 0) {
        fSite.select(this);
        fNameInput.setFocus();

        if (entity instanceof IFolder)
            fSite.setMessage(Messages.GeneralPropertyPage_ENTER_NAME_FOLDER,
                    IPropertyDialogSite.MessageType.ERROR);
        else if (entity instanceof IBookMark)
            fSite.setMessage(Messages.GeneralPropertyPage_ENTER_NAME_BOOKMARK,
                    IPropertyDialogSite.MessageType.ERROR);
        else if (entity instanceof INewsBin)
            fSite.setMessage(Messages.GeneralPropertyPage_ENTER_NAME_BIN,
                    IPropertyDialogSite.MessageType.ERROR);

        return false;
    }

    /* Update Folder */
    if (entity instanceof IFolder) {
        IFolder folder = (IFolder) entity;

        /* Name */
        if (!folder.getName().equals(fNameInput.getText())) {
            folder.setName(fNameInput.getText());
            entitiesToSave.add(folder);
        }
    }

    /* Update BookMark */
    else if (entity instanceof IBookMark) {
        IBookMark bookmark = (IBookMark) entity;

        /* Check for changed Name */
        if (!bookmark.getName().equals(fNameInput.getText())) {
            bookmark.setName(fNameInput.getText());
            entitiesToSave.add(bookmark);
        }

        /* Append "http" to Link if missing */
        String uriAsString = URIUtils.fastEncode(fFeedInput.getText());
        if (URIUtils.looksLikeLink(uriAsString))
            uriAsString = URIUtils.ensureProtocol(uriAsString);

        /* Check for changed Feed */
        if (!fIsSingleSynchronizedBookMark
                && !bookmark.getFeedLinkReference().getLinkAsText().equals(uriAsString)) {

            /* Check if this operation has the potential of deleting existing news */
            boolean containsNews = ModelUtils.countNews(bookmark) > 0;
            if (containsNews) {
                String msg = Messages.GeneralPropertyPage_CHANGE_LINK_WARNING;
                MessageDialog dialog = new MessageDialog(fParent.getShell(),
                        Messages.GeneralPropertyPage_WARNING, null, msg, MessageDialog.WARNING,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1);
                if (dialog.open() == IDialogConstants.CANCEL_ID)
                    return false;
            }

            try {
                DAOService daoService = Owl.getPersistenceService().getDAOService();

                /* Create URL */
                URI newFeedLink = new URI(uriAsString.trim());
                fReloadRequired = true;

                /* This is a new Feed, so create it! */
                if (!daoService.getFeedDAO().exists(newFeedLink)) {
                    IFeed feed = Owl.getModelFactory().createFeed(null, newFeedLink);
                    feed = DynamicDAO.save(feed);
                }

                /* Check if the old reference can be deleted now */
                FeedLinkReference oldFeedRef = bookmark.getFeedLinkReference();
                if (daoService.getBookMarkDAO().loadAll(oldFeedRef).size() == 1)
                    DynamicDAO.delete(oldFeedRef.resolve());

                /* Apply the new Reference */
                bookmark.setFeedLinkReference(new FeedLinkReference(newFeedLink));
                entitiesToSave.add(bookmark);

                /* Delete the Favicon since the feed has changed */
                OwlUI.deleteImage(bookmark.getId());
            }

            /* Supplied Feed Link not valid */
            catch (URISyntaxException e) {
                fSite.select(this);
                fFeedInput.selectAll();
                fFeedInput.setFocus();
                fSite.setMessage(Messages.GeneralPropertyPage_INVALID_LINK,
                        IPropertyDialogSite.MessageType.ERROR);
                return false;
            }
        }
    }

    /* Update NewsBin */
    else if (entity instanceof INewsBin) {
        INewsBin newsbin = (INewsBin) entity;

        /* Check for changed Name */
        if (!newsbin.getName().equals(fNameInput.getText())) {
            newsbin.setName(fNameInput.getText());
            entitiesToSave.add(newsbin);
        }
    }

    return true;
}

From source file:org.rssowl.ui.internal.dialogs.UpdateDialog.java

License:Open Source License

@Override
protected void okPressed() {

    /* Show an Extra Warning if Update will Fail due to missing write Permissions */
    if (!fCanUpdate) {
        MessageDialog dialog = new MessageDialog(getShell(), Messages.UpdateDialog_WARNING, null,
                Messages.UpdateDialog_MISSING_PERMISSIONS_WARNING, MessageDialog.WARNING,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
        if (dialog.open() != 0)
            return;
    }/*from   w w w.ja  va 2s  . c  o  m*/

    super.okPressed();
}

From source file:org.rubypeople.rdt.internal.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected boolean processChanges(IWorkbenchPreferenceContainer container) {
    IScopeContext currContext = fLookupOrder[0];

    List /* <Key>*/ changedOptions = new ArrayList();
    boolean needsBuild = getChanges(currContext, changedOptions);
    if (changedOptions.isEmpty()) {
        return true;
    }/* w ww .  jav  a 2  s. c  o m*/
    if (needsBuild) {
        int count = getRebuildCount();
        if (count > fRebuildCount) {
            needsBuild = false; // build already requested
            fRebuildCount = count;
        }
    }

    boolean doBuild = false;
    if (needsBuild) {
        String[] strings = getFullBuildDialogStrings(fProject == null);
        if (strings != null) {
            MessageDialog dialog = new MessageDialog(getShell(), strings[0], null, strings[1],
                    MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
                            IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                    2);
            int res = dialog.open();
            if (res == 0) {
                doBuild = true;
            } else if (res != 1) {
                return false; // cancel pressed
            }
        }
    }
    if (container != null) {
        // no need to apply the changes to the original store: will be done by the page container
        if (doBuild) { // post build
            incrementRebuildCount();
            container.registerUpdateJob(CoreUtility.getBuildJob(fProject));
        }
    } else {
        // apply changes right away
        try {
            fManager.applyChanges();
        } catch (BackingStoreException e) {
            RubyPlugin.log(e);
            return false;
        }
        if (doBuild) {
            CoreUtility.getBuildJob(fProject).schedule();
        }

    }
    return true;
}

From source file:org.rubypeople.rdt.internal.ui.wizards.buildpaths.BuildPathsBlock.java

License:Open Source License

public static IRemoveOldBinariesQuery getRemoveOldBinariesQuery(final Shell shell) {
    return new IRemoveOldBinariesQuery() {
        public boolean doQuery(final IPath oldOutputLocation) throws OperationCanceledException {
            final int[] res = new int[] { 1 };
            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    Shell sh = shell != null ? shell : RubyPlugin.getActiveWorkbenchShell();
                    String title = NewWizardMessages.BuildPathsBlock_RemoveBinariesDialog_title;
                    String message = Messages.format(
                            NewWizardMessages.BuildPathsBlock_RemoveBinariesDialog_description,
                            oldOutputLocation.toString());
                    MessageDialog dialog = new MessageDialog(sh, title, null, message, MessageDialog.QUESTION,
                            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                                    IDialogConstants.CANCEL_LABEL },
                            0);/*from   w  w w  . jav a2s  .c  o m*/
                    res[0] = dialog.open();
                }
            });
            if (res[0] == 0) {
                return true;
            } else if (res[0] == 1) {
                return false;
            }
            throw new OperationCanceledException();
        }
    };
}

From source file:org.rubypeople.rdt.internal.ui.wizards.buildpaths.newsourcepage.RemoveLinkedFolderDialog.java

License:Open Source License

/**
 * Creates a new remove linked folder dialog.
 * /*from ww w  .j a  v a 2 s  .com*/
 * @param shell the parent shell to use
 * @param folder the linked folder to remove
 */
RemoveLinkedFolderDialog(final Shell shell, final IFolder folder) {
    super(shell, NewWizardMessages.LoadpathModifierQueries_confirm_remove_linked_folder_label, null,
            Messages.format(NewWizardMessages.LoadpathModifierQueries_confirm_remove_linked_folder_message,
                    new Object[] { folder.getFullPath() }),
            MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); // yes is the default
    Assert.isTrue(folder.isLinked());
}

From source file:org.rubypeople.rdt.internal.ui.wizards.buildpaths.VariableBlock.java

License:Open Source License

public boolean performOk() {
    ArrayList removedVariables = new ArrayList();
    ArrayList changedVariables = new ArrayList();
    removedVariables.addAll(Arrays.asList(RubyCore.getLoadpathVariableNames()));

    // remove all unchanged
    List changedElements = fVariablesList.getElements();
    for (int i = changedElements.size() - 1; i >= 0; i--) {
        CPVariableElement curr = (CPVariableElement) changedElements.get(i);
        if (curr.isReserved()) {
            changedElements.remove(curr);
        } else {/*  w  w  w .  j a  va  2 s  . c  o  m*/
            IPath[] path = curr.getPath();
            IPath[] prevPath = RubyCore.getLoadpathVariable(curr.getName());
            if (prevPath != null && prevPath.equals(path)) {
                changedElements.remove(curr);
            } else {
                changedVariables.add(curr.getName());
            }
        }
        removedVariables.remove(curr.getName());
    }
    int steps = changedElements.size() + removedVariables.size();
    if (steps > 0) {

        boolean needsBuild = false;
        if (fAskToBuild && doesChangeRequireFullBuild(removedVariables, changedVariables)) {
            String title = NewWizardMessages.VariableBlock_needsbuild_title;
            String message = NewWizardMessages.VariableBlock_needsbuild_message;

            MessageDialog buildDialog = new MessageDialog(getShell(), title, null, message,
                    MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
                            IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                    2);
            int res = buildDialog.open();
            if (res != 0 && res != 1) {
                return false;
            }
            needsBuild = (res == 0);
        }

        final VariableBlockRunnable runnable = new VariableBlockRunnable(removedVariables, changedElements);
        final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
        try {
            dialog.run(true, true, runnable);
        } catch (InvocationTargetException e) {
            ExceptionHandler.handle(new InvocationTargetException(new NullPointerException()), getShell(),
                    NewWizardMessages.VariableBlock_variableSettingError_titel,
                    NewWizardMessages.VariableBlock_variableSettingError_message);
            return false;
        } catch (InterruptedException e) {
            return false;
        }

        if (needsBuild) {
            CoreUtility.getBuildJob(null).schedule();
        }
    }
    return true;
}

From source file:org.rulez.magwas.zenta.editor.model.impl.EditorModelManager.java

License:Open Source License

@Override
public int saveModelDialog(IZentaModel model) {
    MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(),
            Messages.EditorModelManager_6, null, NLS.bind(Messages.EditorModelManager_7, model.getName()),
            MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0);/*  w  w  w  .java  2s .c  om*/
    return dialog.open();
}