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.osee.ats.util.widgets.role.NewRoleDialog.java
License:Open Source License
public NewRoleDialog() { super(Displays.getActiveShell(), "New Role", null, "Enter New Roles", MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); }
From source file:org.eclipse.osee.ats.version.CreateNewVersionItem.java
License:Open Source License
@Override public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException { IAtsTeamDefinition teamDefHoldingVersions = null; try {//from ww w . j av a 2s . c om teamDefHoldingVersions = getReleaseableTeamDefinition(); } catch (Exception ex) { // do nothing } if (teamDefHoldingVersions == null) { return; } EntryDialog ed = new EntryDialog(Displays.getActiveShell(), "Create New Version", null, "Enter Version name(s) one per line", MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); ed.setFillVertically(true); if (ed.open() == 0) { Set<String> newVersionNames = new HashSet<String>(); for (String str : ed.getEntry().split(System.getProperty("line.separator"))) { newVersionNames.add(str); } XResultData resultData = new XResultData(false); AtsChangeSet changes = new AtsChangeSet("Create New Version(s)"); Collection<IAtsVersion> newVersions = createVersions(resultData, changes, teamDefHoldingVersions, newVersionNames); if (resultData.isErrors()) { resultData.log(String.format( "\nErrors found while creating version(s) for [%s].\nPlease resolve and try again.", teamDefHoldingVersions)); XResultDataUI.report(resultData, "Create New Version Error"); return; } changes.execute(); if (newVersions.size() == 1) { RendererManager.open(AtsClientService.get().getConfigArtifact(newVersions.iterator().next()), PresentationType.DEFAULT_OPEN); } else { MassArtifactEditor.editArtifacts(String.format("New Versions for [%s]", teamDefHoldingVersions), AtsClientService.get().getConfigArtifacts(newVersions), TableLoadOption.None); } } }
From source file:org.eclipse.osee.coverage.action.DeleteCoveragePackageAction.java
License:Open Source License
@Override public void run() { try {//from w w w. j a va 2 s .com if (!CoverageUtil.getBranchFromUser(false)) { return; } IOseeBranch branch = CoverageUtil.getBranch(); CoveragePackageArtifactListDialog dialog = new CoveragePackageArtifactListDialog("Delete Package", "Select Package"); dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(branch)); if (dialog.open() == Window.OK) { if (dialog.getResult().length == 0) { AWorkbench.popup("Must select coverage package."); return; } Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0]; CoveragePackage coveragePackage = OseeCoveragePackageStore.get(coveragePackageArtifact); MessageDialog cDialog = new MessageDialog(Displays.getActiveShell(), "Delete Package", null, String.format( "This will delete Coverage Package and all related Coverage Units and Test Units.\n\nDelete Package [%s]?", coveragePackage.getName()), MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); if (cDialog.open() == Window.OK) { SkynetTransaction transaction = TransactionManager.createTransaction(branch, "Delete Coverage Package - " + coveragePackage.getName()); CoveragePackageEvent coverageEvent = new CoveragePackageEvent(coveragePackage, CoverageEventType.Deleted); OseeCoveragePackageStore.get(coveragePackage, branch).delete(transaction, coverageEvent, false); transaction.execute(); CoverageEventManager.instance.sendRemoteEvent(coverageEvent); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
From source file:org.eclipse.osee.framework.ui.skynet.artifact.prompt.BooleanHandlePromptChange.java
License:Open Source License
public BooleanHandlePromptChange(Collection<? extends Artifact> artifacts, IAttributeType attributeType, String displayName, boolean persist, String toggleMessage) { super();/* w w w. ja v a 2 s .co m*/ this.artifacts = artifacts; this.attributeType = attributeType; this.persist = persist; boolean set = false; if (artifacts.size() == 1) { try { set = artifacts.iterator().next().getSoleAttributeValue(attributeType, false); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } this.dialog = new MessageDialogWithToggle(Displays.getActiveShell(), displayName, null, displayName, MessageDialog.QUESTION, new String[] { "Ok", "Cancel" }, Window.OK, toggleMessage != null ? toggleMessage : displayName, set); }
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();/*from w w w. j a v a2 s . c o 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);//w w w . ja v a2 s . co 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.group.GroupExplorer.java
License:Open Source License
private void handleNewGroup() { if (branch == null) { AWorkbench.popup("Must select branch first"); return;//from ww w . j av a 2s . co m } EntryDialog ed = new EntryDialog(Displays.getActiveShell(), "Create New Group", null, "Enter Group Name", MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); if (ed.open() == 0) { try { SkynetTransaction transaction = TransactionManager.createTransaction(branch, GroupExplorer.class.getSimpleName() + ".handleNewGroup"); UniversalGroup.addGroup(ed.getEntry(), branch, transaction); transaction.execute(); treeViewer.refresh(); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }
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//from www . jav 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.osee.framework.ui.skynet.update.InterArtifactExplorerDropHandlerOperation.java
License:Open Source License
@Override protected void doWork(IProgressMonitor monitor) throws Exception { if (destinationParentArtifact == null || sourceArtifacts == null || sourceArtifacts.isEmpty()) { throw new OseeArgumentException("Invalid arguments"); }/*from ww w . j av a2 s . c o m*/ Branch sourceBranch = sourceArtifacts.iterator().next().getFullBranch(); final Branch destinationBranch = destinationParentArtifact.getFullBranch(); if (isUpdateFromParent(sourceBranch, destinationBranch)) { Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, UPDATE_FROM_PARENT_ERROR_MSG); } }); } else if (isAccessAllowed(sourceBranch, destinationBranch)) { Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { try { if (prompt) { CheckBoxDialog confirm = new CheckBoxDialog(Displays.getActiveShell(), "Introduce Artifact(s)", null, "Introduce " + sourceArtifacts.size() + " Artifact(s)", "Include Children", MessageDialog.QUESTION, 0); if (confirm.open() == 0) { if (confirm.isChecked()) { sourceArtifacts.addAll(getRecurseChildren()); } } } SkynetTransaction transaction = TransactionManager.createTransaction(destinationBranch, String.format("Introduce %d artifact(s)", sourceArtifacts.size())); List<Artifact> destinationArtifacts = new IntroduceArtifactOperation(destinationBranch) .introduce(sourceArtifacts); for (Artifact destinationArtifact : destinationArtifacts) { transaction.addArtifact(destinationArtifact); } transaction.execute(); } catch (OseeCoreException ex) { OseeLog.log(InterArtifactExplorerDropHandlerOperation.class, Level.WARNING, ex.getLocalizedMessage()); } } }); } else { Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, ACCESS_ERROR_MSG); } }); } monitor.done(); }
From source file:org.eclipse.osee.framework.ui.skynet.util.MergeInProgressHandler.java
License:Open Source License
private static int promptUserMutlipleChoices(ConflictManagerExternal conflictManager) throws OseeCoreException { boolean isAllConflictsResolved = !conflictManager.remainingConflictsExist(); Messages = constructMessage(conflictManager, isAllConflictsResolved); Choices = constructChoices(conflictManager, isAllConflictsResolved); final MutableInteger result = new MutableInteger(CANCEL); Displays.pendInDisplayThread(new Runnable() { @Override//from w ww . ja v a2 s. c o m public void run() { MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE, null, Messages, MessageDialog.QUESTION, Choices, CANCEL); result.setValue(dialog.open()); } }); if (!isAllConflictsResolved) { // Since all conflicts were not resolved, options start with Launch Merge Manager(1) instead of Commit(0) result.getValueAndInc(); } return result.getValue(); }