List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.
Click Source Link
From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.DeleteAtomCommand.java
License:Open Source License
private void deleteMarker() { try {//from www .j ava 2 s. c om final IMarker beDeleted = marker; if (beDeleted != null && beDeleted.exists()) { final MessageDialog warningDialog = new MessageDialog(Activator.getShell(), "Warning!", null, "If you delete marker, all relations of this marker has been removed! Do you want to continue to delete marker?", MessageDialog.WARNING, new String[] { "YES", "NO" }, 0); if (warningDialog.open() != 0) { return; } findCandidateToTypeChangingMarkers(beDeleted); final String sourceIdOfSelectedMarker = MarkUtilities.getSourceId(beDeleted); for (final IMarker iMarker : candidateToTypeChanging) { AnnotationFactory.convertAnnotationType(iMarker, true, MarkUtilities.compare(MarkUtilities.getSourceId(iMarker), sourceIdOfSelectedMarker), AlloyUtilities.getTotalTargetCount(iMarker)); } final String markerText = MarkUtilities.getText(beDeleted); if (MarkUtilities.getLeaderId(beDeleted) != null) { final String markerGroupId = MarkUtilities.getGroupId(beDeleted); final List<IMarker> markers = MarkerFactory.findMarkersByGroupId(beDeleted.getResource(), markerGroupId); for (int i = markers.size() - 1; i >= 0; i--) { deleteFromAlloyXML(markers.get(i)); AnnotationFactory.removeAnnotation(markers.get(i)); markers.get(i).delete(); } } else { deleteFromAlloyXML(beDeleted); AnnotationFactory.removeAnnotation(beDeleted); beDeleted.delete(); } final MessageDialog dialog = new MessageDialog(Activator.getShell(), "Mark will be deleted by this wizard", null, "\"" + markerText + "\" has been selected to be unmarked", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); } } catch (final CoreException e) { e.printStackTrace(); } }
From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.DeleteAtomCommand.java
License:Open Source License
@Override public void run() { // FIXME/* w w w . j av a 2 s . co m*/ // editor = MarkerFactory.getOpenEditorOfMarker(marker); if (AlloyUtilities.isExists()) { candidateToTypeChanging = new ArrayList<IMarker>(); deleteMarker(); // this.refresh(); } else { final MessageDialog infoDialog = new MessageDialog(Activator.getShell(), "System Information", null, "You dont have any registered alloy file to system.", MessageDialog.INFORMATION, new String[] { "OK" }, 0); infoDialog.open(); } }
From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.MappingCommand.java
License:Open Source License
@Override public void run() { if (AlloyUtilities.isExists()) { if (this.marker != null && this.marker.exists()) { MappingCommand.chooseForAction(this.marker); } else {//from w ww . j a va 2s . c om final MessageDialog dialog = new MessageDialog(Activator.getShell(), "There is no marker in this position", null, "Please select valid marker", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); } } else { final MessageDialog infoDialog = new MessageDialog(Activator.getShell(), "System Information", null, "You dont have any registered alloy file to system.", MessageDialog.INFORMATION, new String[] { "OK" }, 0); infoDialog.open(); } }
From source file:eu.modelwriter.marker.ui.internal.wizards.mappingwizard.MarkerMapping.java
License:Open Source License
private void run() { if (MarkerMapping.marker != null && MarkerMapping.marker.exists()) { chooseForAction(MarkerMapping.marker); } else {/* w w w .ja v a 2 s . co m*/ final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "There is no marker in this position", null, "Please select valid marker", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); } }
From source file:eu.modelwriter.marker.ui.internal.wizards.markallinwswizard.MarkAllInWsWizard.java
License:Open Source License
@Override public boolean performFinish() { final Object[] checkedElements = MarkAllInWsPage.checkboxTreeViewer.getCheckedElements(); final String text = this.textSelection.getText(); final String leader_id = UUID.randomUUID().toString(); boolean success = false; final Image image = MarkerActivator.getDefault().getImageRegistry() .get(MarkerActivator.Images.IMAGE_MODELWRITER_ID); final ProgressMonitorDialog pmd = new ProgressMonitorDialog( Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell()); ProgressMonitorDialog.setDefaultImage(image); pmd.open();//from ww w. jav a 2s . c o m final IProgressMonitor pmdmoni = pmd.getProgressMonitor(); try { pmdmoni.beginTask("Marking", checkedElements.length); for (int i = 0; i < checkedElements.length && !pmdmoni.isCanceled(); i++) { try { if (checkedElements[i] instanceof IFile) { final IFile iFile = (IFile) checkedElements[i]; pmdmoni.subTask(iFile.getName()); pmdmoni.worked(1); if (!iFile.getFileExtension().equals("xmi") && !iFile.getFileExtension().equals("ecore") && !iFile.getFileExtension().equals("reqif")) { final String charSet = iFile.getCharset(); final Scanner scanner = new Scanner(iFile.getContents(), charSet); final IDocument document = new Document(scanner.useDelimiter("\\A").next()); scanner.close(); final String fullText = document.get(); boolean hasLeader = false; int index = 0; int offset = 0; final int lenght = this.textSelection.getLength(); final String id = UUID.randomUUID().toString(); if (lenght != 0) { while ((offset = fullText.indexOf(text, index)) != -1) { final TextSelection nextSelection = new TextSelection(document, offset, lenght); if (MarkerFactory.findMarkerByOffset(iFile, offset) == null) { final IMarker mymarker = MarkerFactory.createMarker(iFile, nextSelection); MarkUtilities.setGroupId(mymarker, id); if (!iFile.equals(this.file)) { if (hasLeader == false) { MarkUtilities.setLeaderId(mymarker, leader_id); hasLeader = true; } } else { if (this.textSelection.getOffset() == offset) { MarkUtilities.setLeaderId(mymarker, leader_id); } } this.addToAlloyXML(mymarker); AnnotationFactory.addAnnotation(mymarker, AnnotationFactory.ANNOTATION_MARKING); } index = offset + lenght; } } success = true; } else { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark All In Workspace", null, iFile.getName() + " doesn't supported for this command.", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); MarkAllInWsPage.checkboxTreeViewer.setChecked(iFile, false); } } } catch (final CoreException e) { e.printStackTrace(); } } } finally { pmdmoni.done(); } pmd.close(); if (success == true) { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark All In Workspace", null, "Selected project(s) have been marked by selected text", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); return true; } else { return false; } }
From source file:eu.modelwriter.marker.ui.internal.wizards.markerwizard.MarkerWizard.java
License:Open Source License
@Override public boolean performFinish() { AlloyOtherSolutionReasoning.getInstance().finish(); this.candidateToTypeChanging = new ArrayList<IMarker>(); if (MarkerPage.markTreeViewer.getTree().getSelection().length == 1) { if (MarkerPage.markTreeViewer.getTree().getSelection()[0].getText().endsWith("{abs}")) { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Trace Type Information", null, "Selected type is not appropriate because it is marked as Abstact", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open();// ww w . j a v a2 s. c o m return false; } if (!MarkerPage.markTreeViewer.getTree().getItems()[0] .equals(MarkerPage.markTreeViewer.getTree().getSelection()[0])) { if (this.selection != null) { CreateMarkerWithType.createMarker(this.file, this.selection, MarkerPage.markTreeViewer.getTree().getSelection()[0].getText()); // MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), // "Marker Type Information", null, "Marker has been created with selected type", // MessageDialog.INFORMATION, new String[] {"OK"}, 0); // dialog.open(); } else { this.findCandidateToTypeChangingMarkers(this.selectedMarker); this.selectedMarker = AnnotationFactory.convertAnnotationType(this.selectedMarker, true, true, AlloyUtilities.getTotalTargetCount(this.selectedMarker)); IMarker marker = null; for (int i = 1; i < this.candidateToTypeChanging.size(); i++) { marker = this.candidateToTypeChanging.get(i); AnnotationFactory.convertAnnotationType(marker, true, MarkUtilities.compare(marker, this.selectedMarker), AlloyUtilities.getTotalTargetCount(marker)); } AlloyUtilities.removeAllRelationsOfMarker(this.selectedMarker); AlloyUtilities.removeRelationOfMarker(this.selectedMarker); if (MarkUtilities.getGroupId(this.selectedMarker) != null) { final List<IMarker> list = MarkerFactory.findMarkersByGroupId( this.selectedMarker.getResource(), MarkUtilities.getGroupId(this.selectedMarker)); for (final IMarker iMarker : list) { AlloyUtilities.removeTypeFromMarker(iMarker); MarkUtilities.setType(iMarker, MarkerPage.markTreeViewer.getTree().getSelection()[0].getText()); if (MarkUtilities.getLeaderId(iMarker) != null) { AlloyUtilities.addTypeToMarker(iMarker); } AlloyUtilities.addMarkerToRepository(this.selectedMarker); } } else { AlloyUtilities.removeTypeFromMarker(this.selectedMarker); MarkUtilities.setType(this.selectedMarker, MarkerPage.markTreeViewer.getTree().getSelection()[0].getText()); AlloyUtilities.addTypeToMarker(this.selectedMarker); AlloyUtilities.addMarkerToRepository(this.selectedMarker); } // MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), // "Marker Type Information", null, "Selected type added to selected marker", // MessageDialog.INFORMATION, new String[] {"OK"}, 0); // dialog.open(); } return true; } else { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Trace Type Information", null, "Please select a valid marker type.", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); return false; } } else { final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Trace Type Information", null, "Please select one trace type.", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); return false; } }
From source file:eu.skillpro.ams.pscm.connector.amsservice.ui.CheckConnectionHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { String message = ""; try {//from w ww .ja v a2s .c o m message = checkConnection(); } catch (ClientProtocolException e) { message += e.getMessage(); e.printStackTrace(); } catch (IOException e) { message += e.getMessage(); e.printStackTrace(); } MessageDialog.open(MessageDialog.INFORMATION, HandlerUtil.getActiveShell(event), "Connection check result", message, SWT.SHEET); return null; }
From source file:ext.org.eclipse.jdt.internal.ui.javadocexport.JavadocWizard.java
License:Open Source License
@Override public boolean performFinish() { updateStore();//ww w . j a va 2 s . c om IJavaProject[] checkedProjects = fTreeWizardPage.getCheckedProjects(); fStore.updateDialogSettings(getDialogSettings(), checkedProjects); // Wizard should not run with dirty editors if (!new RefactoringSaveHelper(RefactoringSaveHelper.SAVE_ALL_ALWAYS_ASK).saveEditors(getShell())) { return false; } fDestination = Path.fromOSString(fStore.getDestination()); fDestination.toFile().mkdirs(); fOpenInBrowser = fStore.doOpenInBrowser(); //Ask if you wish to set the javadoc location for the projects (all) to //the location of the newly generated javadoc if (fStore.isFromStandard()) { try { URL newURL = fDestination.toFile().toURI().toURL(); String newExternalForm = newURL.toExternalForm(); List<IJavaProject> projs = new ArrayList<IJavaProject>(); //get javadoc locations for all projects for (int i = 0; i < checkedProjects.length; i++) { IJavaProject curr = checkedProjects[i]; URL currURL = JavaUI.getProjectJavadocLocation(curr); if (currURL == null || !newExternalForm.equals(currURL.toExternalForm())) { //if not all projects have the same javadoc location ask if you want to change //them to have the same javadoc location projs.add(curr); } } if (!projs.isEmpty()) { setAllJavadocLocations(projs.toArray(new IJavaProject[projs.size()]), newURL); } } catch (MalformedURLException e) { JavaPlugin.log(e); } } if (fLastWizardPage.generateAnt()) { //@Improve: make a better message OptionalMessageDialog.open(JAVADOC_ANT_INFORMATION_DIALOG, getShell(), JavadocExportMessages.JavadocWizard_antInformationDialog_title, null, JavadocExportMessages.JavadocWizard_antInformationDialog_message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); try { Element javadocXMLElement = fStore.createXML(checkedProjects); if (javadocXMLElement != null) { if (!fTreeWizardPage.getCustom()) { for (int i = 0; i < fContributedJavadocWizardPages.length; i++) { fContributedJavadocWizardPages[i].updateAntScript(javadocXMLElement); } } File file = fStore.writeXML(javadocXMLElement); IFile[] files = fRoot.findFilesForLocationURI(file.toURI()); if (files != null) { for (int i = 0; i < files.length; i++) { files[i].refreshLocal(IResource.DEPTH_ONE, null); } } } } catch (CoreException e) { ExceptionHandler.handle(e, getShell(), JavadocExportMessages.JavadocWizard_error_writeANT_title, JavadocExportMessages.JavadocWizard_error_writeANT_message); } } if (!executeJavadocGeneration()) return false; return true; }
From source file:ext.org.eclipse.jdt.internal.ui.search.SearchUtil.java
License:Open Source License
public static void warnIfBinaryConstant(IJavaElement element, Shell shell) { if (isPrimitiveConstantOrString(element)) OptionalMessageDialog.open(BIN_PRIM_CONST_WARN_DIALOG_ID, shell, SearchMessages.Search_FindReferencesAction_BinPrimConstWarnDialog_title, null, SearchMessages.Search_FindReferencesAction_BinPrimConstWarnDialog_message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); }
From source file:gov.nasa.ensemble.core.plan.editor.MultiPagePlanEditor.java
License:Open Source License
/** * Check to see if this plan was upgraded to the current AD * //from ww w .ja va 2s . com * @param plan the plan being checked * @param workbenchWindow the parent for a warning message dialog * @return true if compatibility feedback is present, false otherwise */ private static boolean checkPlanCompatibility(EPlan plan, IWorkbenchWindow workbenchWindow) { String upgradeNotes = (String) WrapperUtils.getRegistered(plan) .getTransientProperty(EditorPlugin.ATTRIBUTE_UPGRADE_NOTES); if ((upgradeNotes != null) && upgradeNotes.trim().length() > 0) { Shell parent = workbenchWindow.getShell(); String title = "Plan Compatibility"; String message = "The plan has been upgraded to the latest AD."; String version_ad = ActivityDictionary.getInstance().getVersion(); if (version_ad != null) { message += "\nversion: " + version_ad; } URL url = null; if (upgradeNotes.startsWith("http:") || upgradeNotes.endsWith("html")) { try { url = new URL(upgradeNotes); } catch (MalformedURLException e) { // fall out with url = null } } if (url != null) { MessageDialog dialog = new MessageDialog(parent, title, null, message + "\n\nDo you wish to open the report?\n" + upgradeNotes, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); int result = dialog.open(); if (result == 0) { IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); try { IWebBrowser browser = browserSupport.getExternalBrowser(); browser.openURL(url); } catch (PartInitException e) { MessageDialog.openError(parent, "Error", "Failed to open external browser on URL:\n" + url); } } } else { MessageDialog dialog = new MessageDialog(parent, title, null, message + "\n\n" + upgradeNotes, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); } return true; } return false; }