List of usage examples for org.eclipse.jface.dialogs MessageDialog QUESTION
int QUESTION
To view the source code for org.eclipse.jface.dialogs MessageDialog QUESTION.
Click Source Link
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 ava2s .c o m 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.mylyn.internal.tasks.ui.context.CopyContextHandler.java
License:Open Source License
public static void run(ITask sourceTask) { if (sourceTask == null) { MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE_DIALOG, Messages.CopyContextHandler_No_source_task_selected); return;/*from w w w . ja v a 2 s . c o m*/ } TaskSelectionDialog dialog = new TaskSelectionDialog(WorkbenchUtil.getShell()); dialog.setNeedsCreateTask(false); dialog.setTitle(Messages.CopyContextHandler_Select_Target_Task); dialog.setMessage(Messages.CopyContextHandler_Select_the_target_task__); if (dialog.open() != Window.OK) { return; } Object result = dialog.getFirstResult(); if (result instanceof ITask) { ITask targetTask = (ITask) result; TasksUi.getTaskActivityManager().deactivateActiveTask(); if (targetTask.equals(sourceTask)) { MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE_DIALOG, Messages.CopyContextHandler_TARGET_TASK_CON_NOT_BE_THE_SAME_AS_SOURCE_TASK); } else { final int REPLACE = 0; final int MERGE = 1; final int CANCEL = 2; int action = REPLACE; if (TasksUiPlugin.getContextStore().hasContext(targetTask)) { MessageDialog dialog2 = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE_DIALOG, null, Messages.CopyContextHandler_SELECTED_TASK_ALREADY_HAS_CONTEXT, MessageDialog.QUESTION, new String[] { Messages.CopyContextHandler_Replace, Messages.CopyContextHandler_Merge, IDialogConstants.CANCEL_LABEL }, 1); action = dialog2.open(); } switch (action) { case REPLACE: IAdaptable context = TasksUiPlugin.getContextStore().copyContext(sourceTask, targetTask); if (context == null) { MessageDialog.openInformation( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE_DIALOG, Messages.CopyContextHandler_SOURCE_TASK_DOES_HAVE_A_CONTEXT); return; } break; case MERGE: TasksUiPlugin.getContextStore().mergeContext(sourceTask, targetTask); break; case CANCEL: return; } TasksUiInternal.activateTaskThroughCommand(targetTask); } } else { MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE_DIALOG, Messages.CopyContextHandler_No_target_task_selected); } }
From source file:org.eclipse.nebula.widgets.xviewer.customize.ColumnFilterDataUI.java
License:Open Source License
public void promptSetFilter(String colId) { DialogWithEntry ed = new DialogWithEntry(Display.getCurrent().getActiveShell(), XViewerText.get("ColumnFilterDataUI.title"), null, //$NON-NLS-1$ XViewerText.get("ColumnFilterDataUI.prompt", colId), MessageDialog.QUESTION, new String[] { //$NON-NLS-1$ XViewerText.get("button.ok"), //$NON-NLS-1$ XViewerText.get("button.clear"), //$NON-NLS-1$ XViewerText.get("button.clear_all"), //$NON-NLS-1$ XViewerText.get("button.cancel") }, //$NON-NLS-1$ 0);//from w w w. ja v a 2s . com String str = xViewer.getCustomizeMgr().getColumnFilterData().getFilterText(colId); if (str != null && !str.equals("")) { //$NON-NLS-1$ ed.setEntry(str); } int result = ed.open(); if (result == 0) { xViewer.getCustomizeMgr().setColumnFilterText(colId, ed.getEntry()); } else if (result == 1) { xViewer.getCustomizeMgr().setColumnFilterText(colId, null); } else if (result == 2) { xViewer.getCustomizeMgr().clearAllColumnFilters(); } }
From source file:org.eclipse.nebula.widgets.xviewer.util.internal.dialog.ColumnFilterDialog.java
License:Open Source License
public ColumnFilterDialog(Shell shell, String dialogTitle, String dialogMessage, int question, String[] strings, int i, XViewerColumn column) { super(shell, dialogTitle, null, dialogMessage, MessageDialog.QUESTION, strings, 0); this.column = column; }
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/*from w ww .j a v a 2 s.c o m*/ + " 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.osee.ats.actions.PrivilegedEditAction.java
License:Open Source License
@Override public void runWithException() throws OseeCoreException { if (sma.isReadOnly()) { new ReadOnlyHyperlinkListener(sma).linkActivated(null); }// w ww.j ava2 s. c o m if (editor.isPrivilegedEditModeEnabled()) { if (MessageDialog.openQuestion(Displays.getActiveShell(), "Diable Privileged Edit", "Privileged Edit Mode Enabled.\n\nDisable?\n\nNote: (changes will be saved)")) { editor.setPrivilegedEditMode(false); } } else { Set<IAtsUser> users = PrivilegedUserManager.getPrivilegedUsers(sma); if (AtsUtilClient.isAtsAdmin()) { users.add(AtsClientService.get().getUserService().getCurrentUser()); } StringBuffer stringBuffer = new StringBuffer(); for (IAtsUser user : users) { stringBuffer.append(user.getName()); stringBuffer.append("\n"); } String buttons[]; boolean iAmPrivileged = users.contains(AtsClientService.get().getUserService().getCurrentUser()); if (iAmPrivileged) { buttons = new String[] { "Override and Edit", "Cancel" }; } else { buttons = new String[] { "Cancel" }; } MessageDialog dialog = new MessageDialog(Displays.getActiveShell(), "Privileged Edit", null, "The following users have the ability to edit this " + sma.getArtifactTypeName() + " in case of emergency.\n\n" + stringBuffer.toString(), MessageDialog.QUESTION, buttons, 0); int result = dialog.open(); if (iAmPrivileged && result == 0) { editor.setPrivilegedEditMode(true); } } }
From source file:org.eclipse.osee.ats.navigate.AtsRemoteEventTestItem.java
License:Open Source License
@Override public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException { if (AtsUtil.isProductionDb()) { AWorkbench.popup("ERROR", "This should not to be run on production DB"); return;//from w w w . j av a 2 s . c om } MessageDialog dialog = new MessageDialog(Displays.getActiveShell(), getName(), null, getName() + "\n\nSelect Source or Destination Client", MessageDialog.QUESTION, new String[] { "Source Client", "Destination Client - Start", "Destination Client - End", "Cancel" }, 2); int result = dialog.open(); resultData = new XResultData(); if (result == 0) { runClientTest(); } else if (result == 1) { EntryDialog diag = new EntryDialog(getName(), "Enter tt number of Source Client created Action"); if (diag.open() == 0) { runDestinationTestStart(diag.getEntry()); } } else if (result == 2) { EntryDialog diag = new EntryDialog(getName(), "Enter tt number of Source Client created Action"); if (diag.open() == 0) { runDestinationTestEnd(diag.getEntry()); } } }
From source file:org.eclipse.osee.ats.navigate.CreateNewUsersByNameItem.java
License:Open Source License
@Override public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException { EntryDialog ed = new EntryDialog(Displays.getActiveShell(), "Create New User(s)", null, "Enter User name(s) one per line", MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); ed.setFillVertically(true);/*from w w w. jav a2 s . c o m*/ if (ed.open() == 0) { Set<String> newUserNames = new HashSet<String>(); for (String str : ed.getEntry().split(System.getProperty("line.separator"))) { newUserNames.add(str); } XResultData resultData = new XResultData(false); for (String newUserName : newUserNames) { if (!Strings.isValid(newUserName)) { resultData.logError("user name can't be blank"); } try { if (AtsClientService.get().getUserService().getUserByName(newUserName) != null) { resultData.logError(String.format("User [%s] already exists", newUserName)); } } catch (UserNotInDatabase ex) { // do nothing } } if (!resultData.isEmpty()) { resultData.log("\nErrors found while creating users.\nPlease resolve and try again."); XResultDataUI.report(resultData, "Create New User(s) Error"); return; } try { SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), "Create New User(s)"); Set<Artifact> newUsers = createNewUserItemTx(transaction, newUserNames); transaction.execute(); if (newUsers.size() == 1) { RendererManager.open(newUsers.iterator().next(), PresentationType.DEFAULT_OPEN); } else { MassArtifactEditor.editArtifacts("New Users", newUsers, TableLoadOption.None); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }
From source file:org.eclipse.osee.ats.util.widgets.commit.CommitXManager.java
License:Open Source License
private void handleCommittedWithMerge(IOseeBranch branch) throws OseeCoreException { MessageDialog dialog = new MessageDialog(Displays.getActiveShell(), "Select Report", null, "Both Change Report and Merge Manager exist.\n\nSelect to open.", MessageDialog.QUESTION, new String[] { "Show Change Report", "Show Merge Manager", "Cancel" }, 0); int result = dialog.open(); if (result == 2) { return;/*from www . j av a 2 s. c o m*/ } // change report if (result == 0) { AtsBranchManager.showChangeReportForBranch(xCommitManager.getTeamArt(), branch); } // merge manager else { AtsBranchManager.showMergeManager(xCommitManager.getTeamArt(), branch); } }
From source file:org.eclipse.osee.ats.util.widgets.defect.XDefectViewer.java
License:Open Source License
public void handleImportDefectsViaList() { try {//from w w w .ja v a 2s. c o m EntryDialog ed = new EntryDialog(Displays.getActiveShell(), "Create Defects", null, "Enter task titles, one per line.", MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); ed.setFillVertically(true); if (ed.open() == 0) { SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), "Import Review Defects"); for (String str : ed.getEntry().split("\n")) { str = str.replaceAll("\r", ""); if (!str.equals("")) { defectManager.addDefectItem(str, false, transaction); } } transaction.execute(); loadTable(); notifyXModifiedListeners(); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }