List of usage examples for org.eclipse.jface.dialogs IDialogConstants YES_ID
int YES_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants YES_ID.
Click Source Link
From source file:org.symbian.tools.tmw.previewer.preview.PreviewView.java
License:Open Source License
public boolean promptUserToToggle(IProject project, boolean toggle) { IPreferenceStore preferenceStore = PreviewerPlugin.getDefault().getPreferenceStore(); String value = preferenceStore.getString(IEditingPreferences.PREF_AUTO_REFRESH); synchronized (autorefresh) { if (!autorefresh.containsKey(project)) { if (value == null || value.trim().length() == 0 || MessageDialogWithToggle.PROMPT.equals(value)) { boolean setting = MessageDialogWithToggle.open(MessageDialogWithToggle.QUESTION, getSite().getShell(), "Preview", "The preview window can refresh (reinitialize and restart) whenever a project file is saved.\n" + "This setting for each project can be toggled from the preview toolbar.\n\n" + "Do you want to enable automatic refresh for this project?", "Keep this setting for new projects", false, preferenceStore, IEditingPreferences.PREF_AUTO_REFRESH, SWT.SHEET) .getReturnCode() == IDialogConstants.YES_ID; setProjectAutorefresh(project, setting); return setting; }/*from w ww .j a v a 2 s.c o m*/ } } return toggle; }
From source file:org.talend.designer.core.ui.action.GEFDeleteAction.java
License:Open Source License
@Override public Command createDeleteCommand(List objects) { objects = filterSameObject(objects); if (objects.isEmpty()) { return null; }//from w w w. ja v a 2s.c om if (!(objects.get(0) instanceof EditPart)) { return null; } EditPart object = (EditPart) objects.get(0); // for TUP-1015 boolean isConnAttachedJLTriggerComp = false; ConnectionPart connectionPart = null; if (object instanceof ConnectionPart) { connectionPart = (ConnectionPart) object; } else if (object instanceof ConnLabelEditPart) { connectionPart = (ConnectionPart) object.getParent(); } if (connectionPart != null) { Node srcNode = null; Object srcModel = connectionPart.getSource().getModel(); if (srcModel instanceof Node) { srcNode = (Node) srcModel; } Node tarNode = null; Object tarModel = connectionPart.getTarget().getModel(); if (tarModel instanceof Node) { tarNode = (Node) tarModel; } if (srcNode == null || tarNode == null) { return null; } IProcess process = srcNode.getProcess(); if (AbstractProcessProvider.isExtensionProcessForJoblet(process)) { IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault() .getService(IJobletProviderService.class); if (service != null && (service.isTriggerNode(srcNode) || service.isTriggerNode(tarNode))) { isConnAttachedJLTriggerComp = true; } } } IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore(); String preKey = TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT; if (isConnAttachedJLTriggerComp && !preferenceStore.getBoolean(preKey)) { MessageDialogWithToggle jlTriggerConfirmDialog = new MessageDialogWithToggle(null, Messages.getString("GEFDeleteAction.deleteConnectionDialog.title"), //$NON-NLS-1$ null, // accept the default window icon Messages.getString("GEFDeleteAction.deleteConnectionDialog.msg"), MessageDialog.WARNING, //$NON-NLS-1$ new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, Messages.getString("GEFDeleteAction.deleteConnectionDialog.toggleMsg"), //$NON-NLS-1$ preferenceStore.getDefaultBoolean(preKey)); jlTriggerConfirmDialog.setPrefStore(preferenceStore); jlTriggerConfirmDialog.setPrefKey(preKey); if (jlTriggerConfirmDialog.open() != IDialogConstants.YES_ID) { return null; } preferenceStore.setValue(preKey, jlTriggerConfirmDialog.getToggleState()); } List nodeParts = new ArrayList(); List noteParts = new ArrayList(); List others = new ArrayList(objects); for (Object o : objects) { if (o instanceof NodePart) { others.remove(o); Node model = (Node) ((NodePart) o).getModel(); if (model.getJobletNode() != null) { continue; } nodeParts.add(o); } else if (o instanceof NoteEditPart) { noteParts.add(o); others.remove(o); } else if (o instanceof SubjobContainerPart) { others.remove(o); SubjobContainerPart subjob = (SubjobContainerPart) o; for (Iterator iterator = subjob.getChildren().iterator(); iterator.hasNext();) { NodeContainerPart nodeContainerPart = (NodeContainerPart) iterator.next(); if (nodeContainerPart instanceof JobletContainerPart) { JobletContainer jobletCon = (JobletContainer) ((JobletContainerPart) nodeContainerPart) .getModel(); JobletContainerFigure jobletFigure = (JobletContainerFigure) ((JobletContainerPart) nodeContainerPart) .getFigure(); if (!jobletCon.isCollapsed()) { jobletFigure.doCollapse(); } } NodePart nodePart = nodeContainerPart.getNodePart(); if (nodePart != null) { nodeParts.add(nodePart); } } } } if (others.size() == 0) { // so notes & nodes only CompoundCommand cpdCmd = new CompoundCommand(); cpdCmd.setLabel(Messages.getString("GEFDeleteAction.DeleteItems")); //$NON-NLS-1$ if (nodeParts.size() != 0) { GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE); deleteReq.setEditParts(nodeParts); cpdCmd.add(((NodePart) nodeParts.get(0)).getCommand(deleteReq)); } if (noteParts.size() != 0) { GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE); deleteReq.setEditParts(noteParts); cpdCmd.add(((NoteEditPart) noteParts.get(0)).getCommand(deleteReq)); } return cpdCmd; } else { GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE); deleteReq.setEditParts(objects); Command cmd = object.getCommand(deleteReq); return cmd; } }
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);/*www . ja v a2s. c om*/ 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.metadata.managment.ui.wizard.metadata.ShowAddedContextdialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { if (IDialogConstants.YES_ID == buttonId) { okPressed();/*from www . j a v a 2s . com*/ } else if (IDialogConstants.NO_ID == buttonId) { cancelPressed(); } }
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 w ww . j ava 2 s . co m*/ int result = dialog.open(); notShowAgain = dialog.getToggleState(); if (result == IDialogConstants.YES_ID) { userConfirmed = true; } else { userConfirmed = false; } } }
From source file:org.talend.repository.ui.dialog.PaletteSettingsDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.YES_ID, "Restore &Defaults", false); //$NON-NLS-1$ super.createButtonsForButtonBar(parent); getButton(IDialogConstants.OK_ID).setText("&Apply"); //$NON-NLS-1$ getButton(IDialogConstants.OK_ID).setEnabled(false); }
From source file:org.talend.repository.ui.dialog.PaletteSettingsDialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); if (IDialogConstants.YES_ID == buttonId) { retoreDefaultSettings();/*from w w w . j a v a 2s.c o m*/ } }
From source file:org.teiid.designer.ui.editors.ModelEditorManager.java
License:Open Source License
/** * Show Dialog asking user if the editor should be opened. * @param shell the shell// w ww . j a v a 2 s . c o m * @return 'true' if should be opened, 'false' if not */ public static boolean showDialogShouldOpenEditor(Shell shell) { boolean shouldOpen = false; // Show the dialog MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(shell, OPEN_EDITOR_TITLE, OPEN_EDITOR_MESSAGE, ALWAY_FORCE_OPEN_MESSAGE, false, UiPlugin.getDefault().getPreferenceStore(), AUTO_OPEN_EDITOR_IF_NEEDED); int result = dialog.getReturnCode(); switch (result) { // yes, ok case IDialogConstants.YES_ID: case IDialogConstants.OK_ID: shouldOpen = true; break; // no case IDialogConstants.NO_ID: shouldOpen = false; break; } return shouldOpen; }
From source file:org.tigris.subversion.subclipse.ui.actions.CommitAction.java
License:Open Source License
/** * prompt commit of selected resources./* w ww. j a va2 s . co m*/ * @throws SVNException */ protected boolean confirmCommit(IResource[] modifiedResources, ProjectProperties projectProperties) throws SVNException { IPreferenceStore preferenceStore = SVNUIPlugin.getPlugin().getPreferenceStore(); boolean commitToTagsPathWithoutWarning = preferenceStore .getBoolean(ISVNUIConstants.PREF_COMMIT_TO_TAGS_PATH_WITHOUT_WARNING); if (!commitToTagsPathWithoutWarning && onTagPath(modifiedResources)) { // Warning - working copy appears to be on a tag path. CommitToTagsWarningDialog dialog = new CommitToTagsWarningDialog(getShell()); if (dialog.open() != CommitToTagsWarningDialog.OK) { return false; } } int highestProblemSeverity = getHighestProblemSeverity(modifiedResources); switch (highestProblemSeverity) { case IMarker.SEVERITY_WARNING: String allowCommitsWithWarnings = preferenceStore .getString(ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS); if (MessageDialogWithToggle.PROMPT.equals(allowCommitsWithWarnings) || MessageDialogWithToggle.NEVER.equals(allowCommitsWithWarnings)) { MessageDialogWithToggle warningDialog = MessageDialogWithToggle.openYesNoQuestion(shell, Policy.bind("CommitWizard.commitResources"), Policy.bind("CommitWizard.warningMarkers"), //$NON-NLS-1$//$NON-NLS-2$ Policy.bind("CommitWizard.warningQuestion"), false, preferenceStore, //$NON-NLS-1$ ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS); if (IDialogConstants.YES_ID != warningDialog.getReturnCode()) { return false; } } break; case IMarker.SEVERITY_ERROR: String allowCommitsWithErrors = preferenceStore .getString(ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS); if (MessageDialogWithToggle.PROMPT.equals(allowCommitsWithErrors) || MessageDialogWithToggle.NEVER.equals(allowCommitsWithErrors)) { MessageDialogWithToggle errorDialog = MessageDialogWithToggle.openYesNoQuestion(shell, Policy.bind("CommitWizard.commitResources"), Policy.bind("CommitWizard.errorMarkers"), //$NON-NLS-1$//$NON-NLS-2$ Policy.bind("CommitWizard.errorQuestion"), false, preferenceStore, //$NON-NLS-1$ ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS); if (IDialogConstants.YES_ID != errorDialog.getReturnCode()) { return false; } } break; } SvnWizardCommitPage commitPage = new SvnWizardCommitPage(modifiedResources, url, projectProperties, statusMap, null, false); // commitPage.setSharing(sharing); SvnWizard wizard = new SvnWizard(commitPage); SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard); if (proposedComment == null || proposedComment.length() == 0) { commitPage.setComment(getProposedComment(modifiedResources)); } else { commitPage.setComment(proposedComment); } wizard.setParentDialog(dialog); boolean commitOK = (dialog.open() == SvnWizardDialog.OK); url = null; commitComment = commitPage.getComment(); resourcesToCommit = commitPage.getSelectedResources(); keepLocks = commitPage.isKeepLocks(); return commitOK; }
From source file:org.tigris.subversion.subclipse.ui.comments.CommitCommentArea.java
License:Open Source License
public String getCommentWithPrompt(Shell shell) { final String comment = getComment(false); if (comment.length() == 0) { final IPreferenceStore store = SVNUIPlugin.getPlugin().getPreferenceStore(); final String value = store.getString(ISVNUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS); if (MessageDialogWithToggle.NEVER.equals(value)) return null; if (MessageDialogWithToggle.PROMPT.equals(value)) { final String title = Policy.bind("CommitCommentArea_2"); final String message = Policy.bind("CommitCommentArea_3"); final String toggleMessage = Policy.bind("CommitCommentArea_4"); final MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(shell, title, message, toggleMessage, false, store, ISVNUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS); if (dialog.getReturnCode() != IDialogConstants.YES_ID) { fTextBox.setFocus();/*from w w w . j a v a 2s. c o m*/ return null; } } } return getComment(true); }