List of usage examples for org.eclipse.jface.dialogs IDialogConstants YES_LABEL
String YES_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants YES_LABEL.
Click Source Link
From source file:org.eclipse.m2m.internal.qvt.oml.samples.ui.SampleProjectsCreationOperation.java
License:Open Source License
protected IOverwriteQuery createProjectOverwriteQuery(final Shell shell) { return new OverwriteQuery(shell) { @Override/* w w w . j av a 2 s . c o m*/ protected String[] getOptions() { return new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; } @Override protected String[] getReturnCodes() { return new String[] { YES, NO, CANCEL }; } }; }
From source file:org.eclipse.mdht.uml.ui.navigator.internal.actions.CloseModelAction.java
License:Open Source License
protected static void closeModel(Resource resource) { try {/* ww w .ja v a 2 s .co m*/ ModelDocument saveable = ModelManager.getManager().getModelDocument(resource); if (saveable != null) { if (saveable.isDirty()) { String fileName = resource.getURI().lastSegment(); String message = NLS.bind(Messages.CloseModelAction_dialogMessage, fileName); // Yes, No, Cancel MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.CloseModelAction_dialogTitle, null, // accept message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); // yes is the default int result = dialog.open(); if (2 == result) { // Cancel return; } if (0 == result) { // Yes saveable.doSave(new NullProgressMonitor()); } } // if not canceled, the resource is closed saveable.doClose(new NullProgressMonitor()); return; } // if saveable not found, the resource is unloaded resource.unload(); } catch (Exception e) { String message = NLS.bind(Messages.CloseModelAction_errorMessage, new String[] { e.getLocalizedMessage() }); Logger.logException(message, e); MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.CloseModelAction_errorTitle, message); } }
From source file:org.eclipse.mylyn.internal.tasks.ui.actions.DeleteAction.java
License:Open Source License
protected void doDelete(final List<?> toDelete) { boolean allLocalTasks = true; boolean allSupportRepositoryDeletion = true; boolean allElementsAreTasks = true; // determine what repository elements are to be deleted so that we can present the correct message to the user for (Object object : toDelete) { if (object instanceof ITask) { ITask task = (ITask) object; AbstractRepositoryConnector repositoryConnector = TasksUi .getRepositoryConnector(task.getConnectorKind()); TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), task.getRepositoryUrl()); if (repository != null && repositoryConnector != null) { allSupportRepositoryDeletion &= repositoryConnector.canDeleteTask(repository, task); } else { allSupportRepositoryDeletion = false; }/*from w w w. j av a 2 s . c om*/ allLocalTasks &= task instanceof LocalTask; } else { allElementsAreTasks = false; } } String elements = buildElementListString(toDelete); String message = buildMessage(toDelete, elements, allElementsAreTasks); if (toDelete.isEmpty()) { MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.DeleteAction_Delete_failed, Messages.DeleteAction_Nothing_selected); } else { boolean deleteConfirmed = false; boolean deleteOnServer = false; final boolean allTasksDeletable = allSupportRepositoryDeletion; if (allLocalTasks || !allElementsAreTasks) { deleteConfirmed = MessageDialog.openQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.DeleteAction_Delete_Tasks, message); } else { String toggleMessage = Messages.DeleteAction_Also_delete_from_repository_X; if (allTasksDeletable) { toggleMessage = NLS.bind(toggleMessage, ""); //$NON-NLS-1$ } else { toggleMessage = NLS.bind(toggleMessage, Messages.DeleteAction_Not_supported); } final MessageDialogWithToggle dialog = new MessageDialogWithToggle(WorkbenchUtil.getShell(), Messages.DeleteAction_Delete_Tasks, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, toggleMessage, false) { @Override protected Control createContents(Composite parent) { Control createdControl = super.createContents(parent); getToggleButton().setEnabled(allTasksDeletable); return createdControl; } }; deleteConfirmed = dialog.open() == IDialogConstants.YES_ID; deleteOnServer = dialog.getToggleState() && allTasksDeletable; } if (deleteConfirmed) { deleteElements(toDelete, deleteOnServer); } } }
From source file:org.eclipse.net4j.util.ui.confirmation.ConfirmationDialog.java
License:Open Source License
private static String getLabel(Confirmation confirmation) { switch (confirmation) { case OK://from w w w . jav a2s . co m return IDialogConstants.OK_LABEL; case CANCEL: return IDialogConstants.CANCEL_LABEL; case YES: return IDialogConstants.YES_LABEL; case NO: return IDialogConstants.NO_LABEL; } throw new IllegalArgumentException(confirmation.name()); }
From source file:org.eclipse.oomph.setup.internal.installer.SimpleVariablePage.java
License:Open Source License
public boolean promptLaunchProduct(String currentAction) { if (installButton != null && installButton.getCurrentState() == State.LAUNCH) { MessageDialog prompt = new MessageDialog(dialog, "Launch Product", null, currentAction/* w w w .j a v a 2 s . c om*/ + " without having launched the installed product.\n\nDo you want to launch it now?", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int result = prompt.open(); if (result == 0) { // Yes: Do launch; then continue. launchProduct(false); return true; } if (result == 1) { // No: Do not launch; but continue. return true; } // Cancel: Do not launch; and do not continue. return false; } // Nothing to launch; just continue. return true; }
From source file:org.eclipse.oomph.setup.ui.synchronizer.SynchronizerWelcomeDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.NO_LABEL, false); }
From source file:org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.GeneralBranchHandler.java
License:Open Source License
@Override public Object executeWithException(ExecutionEvent arg0, IStructuredSelection selection) throws OseeCoreException { List<Branch> selectedBranches = Handlers.getBranchesFromStructuredSelection(selection); Iterator<Branch> iterator = selectedBranches.iterator(); List<Branch> hasChildren = new LinkedList<Branch>(); while (iterator.hasNext()) { Branch branch = iterator.next(); Collection<Branch> childBranches = branch.getChildBranches(); if (!childBranches.isEmpty()) { iterator.remove();/* ww w . j av a2s . co m*/ hasChildren.add(branch); } } if (!hasChildren.isEmpty()) { StringBuilder children = new StringBuilder(); children.append( String.format("The following branches have children and cannot be %sd:\n", type.dialogType)); for (Branch b : hasChildren) { List<Branch> branches = new LinkedList<Branch>(b.getChildBranches(true)); children.append(String.format("Branch %s has children: %s\n", b.getName(), Strings.buildStatment(branches))); } MessageDialog.openError(Displays.getActiveShell(), type.dialogTitle, children.toString()); } if (!selectedBranches.isEmpty()) { StringBuilder branchesStatement = new StringBuilder(); branchesStatement.append(String.format("Are you sure you want to %s branch(es): ", type.dialogType)); branchesStatement.append(Strings.buildStatment(selectedBranches)); branchesStatement.append(" \u003F"); MessageDialog dialog = new MessageDialog(Displays.getActiveShell(), type.dialogTitle, null, branchesStatement.toString(), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); if (dialog.open() == 0) { performOperation(selectedBranches); } } return null; }
From source file:org.eclipse.osee.framework.ui.skynet.commandHandlers.DeleteArtifactHandler.java
License:Open Source License
@Override public Object executeWithException(ExecutionEvent event, IStructuredSelection selection) throws OseeCoreException { if (!artifacts.isEmpty()) { MessageDialog dialog = new MessageDialog(Displays.getActiveShell(), "Confirm Artifact Deletion", null, " Are you sure you want to delete this artifact and all of the default hierarchy children?", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1);//from www.ja v a 2 s . c o m if (dialog.open() == 0) { Artifact[] artifactsArray = artifacts.toArray(new Artifact[artifacts.size()]); SkynetTransaction transaction = TransactionManager.createTransaction(artifactsArray[0].getBranch(), "Delete artifact handler"); ArtifactPersistenceManager.deleteArtifact(transaction, false, artifactsArray); transaction.execute(); } } return null; }
From source file:org.eclipse.osee.framework.ui.skynet.handler.RemoveTrackChangesHandler.java
License:Open Source License
@Override public Object handleStatus(IStatus status, Object source) { final MutableBoolean isOkToRemove = new MutableBoolean(false); final String message = (String) source; final Pair<MutableBoolean, Integer> answer = new Pair<MutableBoolean, Integer>(isOkToRemove, NO); if (RenderingUtil.arePopupsAllowed()) { Displays.pendInDisplayThread(new Runnable() { @Override/*w w w. j a v a 2 s . c o m*/ public void run() { MoreChangesHandlingDialog dialog = new MoreChangesHandlingDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Confirm Removal Of Track Changes ", null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL }, 0); dialog.updateStyle(); boolean doesUserConfirm = dialog.open() == YES || dialog.open() == YES_TO_ALL; isOkToRemove.setValue(doesUserConfirm); answer.setSecond(dialog.open()); } }); } else { // For Test Purposes isOkToRemove.setValue(true); OseeLog.log(Activator.class, Level.INFO, "Test - accept track change removal."); } return answer; }
From source file:org.eclipse.papyrus.customization.properties.ui.CustomizationDialog.java
License:Open Source License
protected void deleteAction() { RemoveContextAction action = new RemoveContextAction(); IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection(); if (selection.isEmpty()) { return;/*from w w w . ja v a 2 s . co m*/ } Object element = selection.getFirstElement(); if (element instanceof Context) { Context sourceContext = (Context) element; if (ConfigurationManager.instance.isPlugin(sourceContext)) { Activator.log.warn(Messages.CustomizationDialog_cannotDeletePluginContext); //Plugin context cannot be deleted return; } MessageDialog dialog = new MessageDialog(getShell(), Messages.CustomizationDialog_deleteContext, null, Messages.CustomizationDialog_deleteContextConfirmation1 + sourceContext.getName() + Messages.CustomizationDialog_deleteContextConfirmation2, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); int result = dialog.open(); if (result == 0) { //0 is "Yes" (It is *not* the same 0 as Window.OK) action.removeContext(sourceContext); availableContextsViewer.setInput(ConfigurationManager.instance.getContexts()); } } }