List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation
public static void openInformation(Shell parent, String title, String message)
From source file:codeOrchestra.lcs.license.PlimusSubscriptionExpirationStrategy.java
public boolean showSerialNumberDialog() { InputDialog inputDialog = new InputDialog(Display.getDefault().getActiveShell(), "Serial number", "Please type the serial number purchased", null, null); if (inputDialog.open() == Window.CANCEL) { return false; }/*from www . j a v a2s . c o m*/ String serialNumber = inputDialog.getValue(); if (serialNumber != null) { PlimusResponse keyRegistrationResponse; try { keyRegistrationResponse = PlimusHelper.registerKey(serialNumber); } catch (IOException e) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "Can't reach the validation server. Make sure your internet connection is active."); ErrorHandler.handle(e); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_INVALIDKEY) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered is invalid."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_INVALIDPRODUCT) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered can't be validated."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_EXPIREDKEY) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered had expired " + Math.abs(keyRegistrationResponse.getDaysTillExpiration()) + " days ago."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_MAXCOUNT) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The key entered has already been registered the maximum number of times."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.SUCCESS) { MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Serial number", "Thank you for choosing the Code Orchestra Livecoding Tool!"); registerProduct(serialNumber, keyRegistrationResponse); return true; } else { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered can't be validated (" + keyRegistrationResponse.getStatus() + ")."); return showSerialNumberDialog(); } } return false; }
From source file:codesnippetapp.handlers.AboutHandler.java
License:Open Source License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) { MessageDialog.openInformation(shell, "About", "Snippets Repository Sample Application for the book\n" + "'Eclipse 4 RCP Development How-to'"); }
From source file:com.actuate.development.tool.task.InstallBRDPro.java
private void cancelTask() { monitorAntProcess = false;//from www. j a va 2 s . c o m Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog.openInformation(null, "Information", "Canceled installing the BRDPro Development Environment."); Windows.flashWindow(UIUtil.getShell().handle, false); } }); }
From source file:com.actuate.development.tool.task.InstallBRDPro.java
private void finishTask(final IProgressMonitor monitor, final List<Module> failedList) { monitorAntProcess = false;/*from w w w. jav a 2 s . c o m*/ monitor.subTask(""); monitor.setTaskName("Finished installing the BRDPro Development Environment"); Display.getDefault().syncExec(new Runnable() { public void run() { if (UIUtil.getShell().getMinimized()) Windows.flashWindow(UIUtil.getShell().handle, true); StringBuffer buffer = new StringBuffer(); buffer.append("Install the Actuate BRDPro Development Environment sucessfully."); if (failedList.size() > 0) { buffer.append("\n\nDetails:\n"); for (int i = 0; i < failedList.size(); i++) { buffer.append((i + 1) + ". Install the " + failedList.get(i).getValue() + " " + failedList.get(i).getType().getValue() + " failed.\n"); } } MessageDialog.openInformation(null, "Information", buffer.toString()); Windows.flashWindow(UIUtil.getShell().handle, false); StringBuffer uninstallBuffer = new StringBuffer(); if (installBuffer != null && installBuffer.length() > 0) { uninstallBuffer.append("[BRDPro]\n"); uninstallBuffer.append(installBuffer); } if (sourceBuffer != null && sourceBuffer.length() > 0) { uninstallBuffer.append("[Source]\n"); uninstallBuffer.append(sourceBuffer); } if (linkBuffer != null && linkBuffer.length() > 0) { uninstallBuffer.append("[Link]\n"); uninstallBuffer.append(linkBuffer); } FileUtil.writeToFile(new File(data.getDirectory(), "uninstall.data"), uninstallBuffer.toString().trim()); } }); }
From source file:com.aerospike.udf.actions.DeregisterUDF.java
License:Apache License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI.//from w w w . j av a2 s . c o m * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { if (selection != null && selection instanceof TreeSelection) { TreeSelection ts = (TreeSelection) selection; Object element = ts.getFirstElement(); if (element instanceof Module) { Module udfModule = (Module) element; try { AerospikeClient client = CoreActivator.getClient(udfModule.getPackage()); if (client == null) { CoreActivator.log(IStatus.WARNING, "Aerospike client is null"); return; } final ResultsConsoleView results = new ResultsConsoleView(); // find the Aerospike console and display it IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW); view.display(results.getConsole()); Node[] nodes = client.getNodes(); StringBuilder message = new StringBuilder(); for (Node node : nodes) { String msg = Info.request(node, "udf-remove:filename=" + udfModule.getName()); if (msg.contains("error")) { message.append("Could not delete module: " + udfModule.getName()); CoreActivator.showError("Could remove UDF module: " + udfModule.getName()); return; } else { message.append("UDF "); message.append(udfModule.getName()); message.append(" removed from:\n "); message.append("\t"); message.append(node.getHost()); message.append(" "); message.append(node.getName()); message.append("\n"); } } results.report(message.toString()); MessageDialog.openInformation(shell, "Aerospike UDF", message.toString()); ClusterRefreshJob job = new ClusterRefreshJob(udfModule.getCluster()); job.schedule(); } catch (CoreException e) { CoreActivator.showError(e, "Could not deregister UDF in file: " + udfModule.getName()); } catch (NumberFormatException e) { CoreActivator.showError(e, "Could not deregister UDF in file: " + udfModule.getName()); } catch (AerospikeException e) { CoreActivator.showError(e, "Could not deregister UDF in file: " + udfModule.getName()); } } } }
From source file:com.aerospike.udf.actions.RegisterUDF.java
License:Apache License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI./*w w w . j a v a2s. co m*/ * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { if (selection != null && selection instanceof TreeSelection) { TreeSelection ts = (TreeSelection) selection; Object element = ts.getFirstElement(); if (element instanceof IFile && ((IFile) element).getFileExtension().equalsIgnoreCase("lua")) { IFile udfFile = (IFile) element; try { udfFile.deleteMarkers(AEROSPIKE_UDF_PROBLEM, false, IResource.DEPTH_ONE); AerospikeClient client = CoreActivator.getClient(udfFile.getProject()); if (client == null) { CoreActivator.log(IStatus.WARNING, "Aerospike client is null"); return; } ClientPolicy policy = new ClientPolicy(); policy.failIfNotConnected = true; final ResultsConsoleView results = new ResultsConsoleView(); // find the Aerospike console and display it IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW); view.display(results.getConsole()); RegisterTask task = client.register(new Policy(), udfFile.getRawLocation().toOSString(), udfFile.getName(), Language.LUA); //UDF language task.waitTillComplete(); Node[] nodes = client.getNodes(); StringBuilder message = new StringBuilder(); message.append("UDF "); message.append(udfFile.getName()); message.append(" registered successfully on nodes:\n "); for (Node node : nodes) { message.append("\t"); message.append(node.getHost()); message.append(" "); message.append(node.getName()); message.append("\n"); } results.report(message.toString()); MessageDialog.openInformation(shell, "Aerospike UDF", message.toString()); udfFile.setPersistentProperty(CoreActivator.UDF_REGISTERED, "true"); ClusterRefreshJob job = new ClusterRefreshJob(udfFile.getProject()); job.schedule(); } catch (CoreException e) { CoreActivator.showError(e, "Could not register UDF in file: " + udfFile.getName()); } catch (NumberFormatException e) { CoreActivator.showError(e, "Could not register UDF in file: " + udfFile.getName()); } catch (AerospikeException e) { String message = e.getMessage(); if (message.contains("compile_error")) { /* * Registration failed: compile_error * File: bad.lua * Line: 3 * Message: null */ Matcher matcher = udfErrorPattern.matcher(message); if (matcher.matches()) { String error = matcher.group(2); int line = Integer.parseInt(matcher.group(1)); addMarker(udfFile, error, line); } MessageDialog.openInformation(shell, "Aerospike UDF", message); } else { CoreActivator.showError(e, "Could not register UDF in file: " + udfFile.getName()); } } } } }
From source file:com.aerospike.udf.handlers.UDFHandler.java
License:Apache License
/** * the command has been executed, so extract extract the needed information * from the application context./*from w ww . j a v a 2 s . c o m*/ */ public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); MessageDialog.openInformation(window.getShell(), "AerospikeUDF", "UDF Handler action"); return null; }
From source file:com.aiziyuer.bundle.handlers.SampleHandler.java
License:Open Source License
/** * the command has been executed, so extract extract the needed information from the application * context.//from w ww.ja v a 2s . c o m */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); MessageDialog.openInformation(window.getShell(), "Bundle", "Hello, Eclipse world"); return null; }
From source file:com.alex.example.fixlicense.actions.SampleAction.java
License:Open Source License
public void run(IAction action) { license = getLicenseContent(LICENSE_FILE_NAME); license_inline = getLicenseContent(LICENSE_INLINE_FILE_NAME); if (license_inline.endsWith("\n")) { license_inline = license_inline.substring(0, license_inline.length() - 1); }//from w ww .j a va 2s . c o m sum = 0; IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); IProject[] projects = root.getProjects(); for (IProject project : projects) { try { if (project.isOpen()) { processProject(project); } } catch (Exception e) { MessageDialog.openInformation(window.getShell(), "Fix License", "Exception happened, please check the console log."); e.printStackTrace(); return; } } MessageDialog.openInformation(window.getShell(), "Fix License", "All java source files have been processed. Total = " + sum); }
From source file:com.aliyun.odps.eclipse.utils.DialogUtil.java
License:Apache License
public static void inform(String title, String msg) { MessageDialog.openInformation(Display.getDefault().getActiveShell(), title, msg); }