List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation
public static void openInformation(Shell parent, String title, String message)
From source file:com.archimatetool.templates.dialog.TemplateManagerDialog.java
License:Open Source License
/** * Add a Template file//from w w w. j av a 2 s. com */ protected void openTemplate() { FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); dialog.setText(Messages.TemplateManagerDialog_13); dialog.setFilterExtensions(new String[] { "*" + fTemplateManager.getTemplateFileExtension(), "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ String path = dialog.open(); if (path == null) { return; } final File file = new File(path); if (hasUserTemplate(file)) { MessageDialog.openInformation(getShell(), Messages.TemplateManagerDialog_16, Messages.TemplateManagerDialog_17); return; } BusyIndicator.showWhile(null, new Runnable() { @Override public void run() { try { ITemplate template = fTemplateManager.createTemplate(file); template.setFile(file); fTemplateManager.addUserTemplate(template); fTableViewer.refresh(); } catch (IOException ex) { MessageDialog.openError(getShell(), Messages.TemplateManagerDialog_18, ex.getMessage()); } } }); }
From source file:com.archimatetool.zest.CopyZestViewAsImageToClipboardAction.java
License:Open Source License
@Override public void run() { BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override/*from ww w .ja va 2 s . c o m*/ public void run() { Image image = null; Clipboard cb = null; try { image = DiagramUtils.createImage(fGraphViewer.getGraphControl().getContents(), 1, 10); ImageData imageData = image.getImageData(); cb = new Clipboard(Display.getDefault()); cb.setContents(new Object[] { imageData }, new Transfer[] { ImageTransfer.getInstance() }); MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.CopyZestViewAsImageToClipboardAction_0, Messages.CopyZestViewAsImageToClipboardAction_1); } catch (Throwable ex) { // Catch Throwable for SWT errors ex.printStackTrace(); MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.CopyZestViewAsImageToClipboardAction_0, Messages.CopyZestViewAsImageToClipboardAction_2 + " " + ex.getMessage()); //$NON-NLS-1$ } finally { if (image != null && !image.isDisposed()) { image.dispose(); } if (cb != null) { cb.dispose(); // If memory is low this will crash the JVM } } } }); }
From source file:com.arm.cmsis.pack.refclient.ui.ConfigView.java
License:Open Source License
void showMessage(String title, String message) { MessageDialog.openInformation(viewer.getControl().getShell(), title, message); }
From source file:com.arm.cmsis.pack.refclient.ui.DeviceTreeView.java
License:Open Source License
void showMessage(String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "DeviceView", //$NON-NLS-1$ message); }
From source file:com.arm.cmsis.pack.refclient.ui.PackView.java
License:Open Source License
void showMessage(String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "PackView", //$NON-NLS-1$ message); }
From source file:com.asakusafw.shafu.internal.ui.wizards.SelectProjectTemplatePage.java
License:Apache License
String selectUrl(String oldValue) { Map<String, URL> templates = prepareTemplates(); if (templates.isEmpty()) { MessageDialog.openInformation(getShell(), Messages.SelectProjectTemplatePage_urlNoTemplateTitle, Messages.SelectProjectTemplatePage_urlNoTemplateMessage); return null; }/*from w w w . j av a 2 s . co m*/ FilteredListDialog dialog = new FilteredListDialog(getShell()); dialog.setTitle(Messages.SelectProjectTemplatePage_urlSelectTemplateTitle); dialog.setMessage(Messages.SelectProjectTemplatePage_urlSelectTemplateMessage); dialog.setContentProvider(new ArrayContentProvider()); dialog.setLabelProvider(new LabelProvider()); dialog.setFilter(new RegexFilter(PATTERN_TEMPLATE_FILTER), Messages.SelectProjectTemplatePage_disableTemplateFilterLabel); dialog.setFilterEnabled(true); dialog.setInputData(templates.keySet().toArray()); dialog.setBlockOnOpen(true); for (Map.Entry<String, URL> entry : templates.entrySet()) { String value = entry.getValue().toExternalForm(); if (value.equals(oldValue)) { dialog.setInitialElementSelections(Collections.singletonList(entry.getKey())); break; } } if (dialog.open() != Window.OK) { return null; } Object[] results = dialog.getResult(); if (results.length == 0) { return null; } URL resolved = templates.get(results[0]); if (resolved == null) { return null; } return resolved.toExternalForm(); }
From source file:com.asegno.demo.base.handlers.AboutHandler.java
License:Open Source License
@Execute public void execute(Shell shell) { MessageDialog.openInformation(shell, "About", getMessage()); }
From source file:com.asteria.rental.eap.handlers.AboutHandler.java
License:Open Source License
@Execute public void execute(Shell shell) { MessageDialog.openInformation(shell, "About", "Eclipse 4 RCP Application"); }
From source file:com.astra.ses.spell.dev.scheck.ui.handlers.GenerateReportCommand.java
License:Open Source License
/** * the command has been executed, so extract extract the needed information * from the application context.//from w ww . j a va 2s . c o m */ @SuppressWarnings("unchecked") public Object execute(ExecutionEvent event) throws ExecutionException { // Gather all markers // Get the list of known issues List<IMarker> markers = null; IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); ISelectionService sservice = window.getSelectionService(); ISelection selection = sservice.getSelection(); // If nothing selected, generate all issues known if ((selection == null) || (selection.isEmpty())) { markers = MarkerManager.getAllMarkers(); } else { List<IResource> selectedItems = null; // The selection may be a structured selection or text selected in an editor part if (selection instanceof IStructuredSelection) { IStructuredSelection sselection = (IStructuredSelection) selection; selectedItems = (List<IResource>) sselection.toList(); } else if ((selection instanceof ITextSelection)) { IEditorPart editor = window.getActivePage().getActiveEditor(); // If an editor is selected if (editor != null) { SpellEditorInfo info = (SpellEditorInfo) editor.getAdapter(SpellEditorInfo.class); // If the editor could adapt if (info != null) { selectedItems = new ArrayList<IResource>(); selectedItems.add(info.getFile()); } } } // Gather only the resources selected for processing if (selectedItems != null) { markers = new ArrayList<IMarker>(); for (IResource res : selectedItems) { markers.addAll(MarkerManager.getAllMarkers(res)); } } } // If no issues known, dont continue if (markers.size() == 0) { MessageDialog.openWarning(window.getShell(), "Report generation", "No semantic issues to report"); return null; } String output = ""; DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell(), SWT.SAVE); dialog.setText("Select directory for generated report files"); dialog.setFilterPath(System.getProperty("user.home")); output = dialog.open(); if ((output != null) && (!output.isEmpty())) { File dir = new File(output); if (!dir.exists()) { MessageDialog.openError(window.getShell(), "Cannot generate reports", "Given directory does not exist"); return null; } if (!dir.canWrite()) { MessageDialog.openError(window.getShell(), "Cannot generate reports", "Cannot write to given directory"); return null; } GenerateReportFilesJob job = new GenerateReportFilesJob(output, markers); JobHelper.executeJob(job, true, true); if (job.numGenerated > 0) { MessageDialog.openInformation(window.getShell(), "Reports generated", "Generated " + job.numGenerated + " files in '" + output + "'"); } } return null; }
From source file:com.astra.ses.spell.dev.scheck.ui.handlers.PerformCheckCommand.java
License:Open Source License
/** * the command has been executed, so extract extract the needed information * from the application context.//ww w . ja va2s . c om */ @SuppressWarnings("unchecked") public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); ISelectionService sservice = window.getSelectionService(); ISelection selection = sservice.getSelection(); List<IResource> items = null; // The selection may be a structured selection or text selected in an editor part if (selection instanceof IStructuredSelection) { IStructuredSelection sselection = (IStructuredSelection) selection; items = (List<IResource>) sselection.toList(); } else if ((selection instanceof ITextSelection)) { IEditorPart editor = window.getActivePage().getActiveEditor(); // If an editor is selected if (editor != null) { SpellEditorInfo info = (SpellEditorInfo) editor.getAdapter(SpellEditorInfo.class); // If the editor could adapt if (info != null) { items = new ArrayList<IResource>(); items.add(info.getFile()); } } } // If we have items to process if (items.size() > 0) { PerformCheckJob job = new PerformCheckJob(items); JobHelper.executeJob(job, true, true); String message = ""; if (job.numProcessedItems > 0) { message = "Checked " + job.numProcessedItems + " files"; if (job.notProcessed.size() > 0) { message += "\n\nThe following files have not been processed:\n\n"; for (String reason : job.notProcessed) { message += " " + reason + "\n"; } } } else { message = "No check was carried out"; if (job.notProcessed.size() > 0) { message += "\n\nThe following files have not been processed:\n\n"; for (String reason : job.notProcessed) { message += " " + reason + "\n"; } } } MessageDialog.openInformation(window.getShell(), "Semantic check", message); } return null; }