List of usage examples for org.eclipse.jface.dialogs MessageDialog ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.
Click Source Link
From source file:org.wso2.developerstudio.mss.artifact.util.MSSMavenDependencyResolverJob.java
License:Open Source License
@Override protected IStatus run(IProgressMonitor monitor) { String operationText = DEPENDENCY_RESOLVING_TASK; IStatus status = Status.OK_STATUS;/*from w w w . j a v a2 s .co m*/ try { String mavenHome = getMavenHome(); monitor.beginTask(operationText, 100); monitor.subTask(READING_POM_TASK); monitor.worked(10); InvocationRequest request = new DefaultInvocationRequest(); File pomFile = FileUtils.getMatchingFiles(project.getLocation().toOSString(), POM_FILE_PREFIX, XML_EXTENTION)[0]; request.setPomFile(pomFile); request.setGoals(Collections.singletonList(MAVEN_ECLIPSE_ECLIPSE_GOAL)); monitor.subTask(SETTING_MAVEN_INVOKER_TASK); monitor.worked(25); Invoker invoker = new DefaultInvoker(); invoker.setMavenHome(new File(mavenHome)); monitor.subTask(EXECUTING_MAVEN_REQUEST_TASK); monitor.worked(70); InvocationResult result = invoker.execute(request); if (result.getExitCode() != 0) { throw new MavenInvocationException("Maven Invoker was unable to execute the request"); } monitor.subTask(PROJECT_REFRESH_TASK); monitor.worked(90); } catch (MavenInvocationException e) { log.error("Error while resolving dependencies from the project pom file", e); status = new Status(0, Activator.PLUGIN_ID, "Error occured while resolving dependencies of the file in eclipse.\n" + " Please execute \"mvn eclipse:eclipse\" command in the generated project " + "folder to resolve dependencies.", e); } catch (NoSuchFieldException e) { log.error("Maven Home system variable is not set as a environment variable"); status = new Status(0, Activator.PLUGIN_ID, "Maven Home system variable is not set." + " Please execute \"mvn eclipse:eclipse\" command in the generated project " + "folder to resolve dependencies."); } try { project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (CoreException e) { log.error("Error while refreshing the project", e); } finally { monitor.done(); } if (status != Status.OK_STATUS) { final String message = status.getMessage(); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog errorDialog = new MessageDialog(shell, ERROR_TAG, null, message, MessageDialog.ERROR, new String[] { OK_BUTTON }, 0); errorDialog.open(); } }); } return status; }
From source file:pl.robakowski.repository.Repository.java
License:Open Source License
@Override public List<JSONObject> getNextResults(final IProgressMonitor monitor) { moreResults = false;/*from w ww. j ava 2 s . com*/ List<JSONObject> list = new ArrayList<JSONObject>(30); if (!checkRuntime()) { sync.asyncExec(new Runnable() { @Override public void run() { MessageDialog dialog = new MessageDialog(shell, "Wrong paths", null, "Invalid path to PHP or composer.phar", MessageDialog.ERROR, new String[] { "OK" }, 0); dialog.setBlockOnOpen(true); dialog.open(); Map<String, String> params = new HashMap<String, String>(); params.put("preferencePageId", "pl.robakowski.composer.plugin.page1"); ParameterizedCommand command = commandService.createCommand("org.eclipse.ui.window.preferences", params); handlerService.executeHandler(command); } }); return list; } writeJson(json); try { final Process exec = new ProcessBuilder().command(phpPath, composerPath, "search", query).start(); Thread killer = new Thread() { private boolean terminated(Process exec) { try { exec.exitValue(); return true; } catch (IllegalThreadStateException e) { return false; } } @Override public void run() { while (!terminated(exec)) { if (monitor.isCanceled()) { exec.destroy(); } try { Thread.sleep(50); } catch (InterruptedException e) { } } }; }; killer.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(exec.getInputStream())); String line; while ((line = reader.readLine()) != null) { int space = line.indexOf(' '); String name = line.substring(0, space); String repository = line.substring(space + 1); JSONObject obj = new JSONObject(); obj.put("name", name); obj.put("description", repository); list.add(obj); } exec.waitFor(); } catch (Exception e) { e.printStackTrace(); } return list; }
From source file:pt.org.aguiaj.core.exceptions.ExceptionHandler.java
License:Open Source License
public void handleException(Object target, Member member, String[] args, Throwable exception) { if (exception.getCause() != null) exception = exception.getCause(); String message = exception.getMessage(); if (message == null) message = ""; if (target != null) { if (objectsWithProblems.contains(target)) return; else// www. java 2 s . c o m objectsWithProblems.add(target); } String title = StandardNamePolicy.prettyClassName(exception.getClass()); int icon = MessageDialog.ERROR; if (exception instanceof IllegalArgumentException || exception instanceof IllegalStateException || exception instanceof NullPointerException && exception.getMessage() != null || exception instanceof ContractException) { icon = MessageDialog.WARNING; } else if (exception instanceof StackOverflowError) { title = UIText.STACK_OVERFLOW.get(); String methodText = member.getDeclaringClass().getSimpleName() + "." + member.getName() + "(..)"; message = UIText.CHECK_METHOD_RECURSION.get(methodText); if (member != null) previousMethodErrors.add(member); } else if (exception instanceof OutOfMemoryError) { title = UIText.OUT_OF_MEMORY.get(); String methodText = member.getDeclaringClass().getSimpleName() + "." + member.getName() + "(..)"; message = "Check method " + methodText + "."; if (member != null) previousMethodErrors.add(member); } else if (exception instanceof Error) { title = UIText.COMPILATION_ERRORS.get(); int line = exception.getStackTrace()[0].getLineNumber(); String className = exception.getStackTrace()[0].getClassName(); message = UIText.CHECK_CLASS_AT.get(className, line, exception.getMessage()); if (member != null) previousMethodErrors.add(member); } else { for (SpecificExceptionHandler handler : handlers) if (handler.getClass().getAnnotation(PluggableExceptionHandler.class).value() .equals(exception.getClass())) message = handler.getMessage(exception); } ExceptionTrace exceptionTrace = new ExceptionTrace(exception, message, args); List<TraceLocation> trace = exceptionTrace.getTrace(); boolean goToError = !trace.isEmpty() && trace.get(0).line != 1; String[] buttons = goToError ? new String[] { "OK", "Go to error" } : new String[] { "OK" }; MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), title, null, message, icon, buttons, 0); int result = dialog.open(); if (!trace.isEmpty()) { for (ExceptionListener l : listeners) l.newException(exceptionTrace, result != 0); } }
From source file:ro.ieat.jmodex.integration.GenerateAslanppAction.java
License:Open Source License
@Override public void run(IAction action) { if (theSelection instanceof IStructuredSelection) { if (((IStructuredSelection) theSelection).getFirstElement() instanceof IJavaProject) { IJavaProject theProject = (IJavaProject) ((IStructuredSelection) theSelection).getFirstElement(); final Job jb = jModexFacade.getInstance().inferModel(theProject); final Shell theShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final Display disp = Display.getCurrent(); jb.setUser(true);/*from w ww. j a va 2 s.c o m*/ jb.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { if (!event.getResult().isOK()) { if (event.getResult().getSeverity() != IStatus.CANCEL) { disp.asyncExec(new Runnable() { @Override public void run() { MessageDialog md = new MessageDialog(theShell, "jModex Error", null, jb.getResult().getMessage() + "\n" + jb.getResult().getException().toString() + Arrays.toString( jb.getResult().getException().getStackTrace()), MessageDialog.ERROR, new String[] { "Ok" }, 0); md.open(); } }); } } } }); jb.schedule(); } } }
From source file:scouter.client.configuration.views.AlertScriptingView.java
License:Apache License
private static void openSaveFailDialog() { MessageDialog.open(MessageDialog.ERROR, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Fail", "Save failed!\n" + "(Server problem or alert editing unsupported version)\n" + "Alert script editor in client UI supported\n" + "@Since : v1.8.0", SWT.NONE);/* w w w . j a v a 2 s .com*/ }
From source file:se.aceone.mediatek.linkit.importWizards.ImportLinkIt10ProjectWizardPage.java
License:Open Source License
/** * Creates a new project resource with the selected name. * <p>// w w w .j a v a 2 s. c om * In normal usage, this method is invoked after the user has pressed Finish on the wizard; the enablement of the * Finish button implies that all controls on the pages currently contain valid values. * </p> * * @return the created project resource, or <code>null</code> if the project was not created */ IProject createExistingProject() { String projectName = projectNameField.getText(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject project = workspace.getRoot().getProject(projectName); final IPath locationPath = getLocationPath(); final boolean copyResources = copyResources(); this.description = workspace.newProjectDescription(projectName); // If it is under the root use the default location if (isPrefixOfRoot(locationPath) || copyResources) { this.description.setLocation(null); } else { this.description.setLocation(locationPath); } // create the new project operation WorkspaceModifyOperation op = new WorkspaceModifyOperation() { protected void execute(IProgressMonitor monitor) throws CoreException { monitor.beginTask("", 2000); //$NON-NLS-1$ project.create(description, new SubProgressMonitor(monitor, 1000)); if (monitor.isCanceled()) { throw new OperationCanceledException(); } IPath configPath = locationPath.append("config.xml"); LinkItHelper helper; se.aceone.mediatek.linkit.tools.Compiler compiler = new CompilerRVCT(); boolean staticLib = isStaticLib(new File(configPath.toOSString())); if (staticLib) { helper = new LinkIt10HelperLib(project, compiler); } else { helper = new LinkIt10Helper(project, compiler); } // helper = new LinkIt10HelperRVTC(project); if (!helper.checkEnvironment()) { Common.log(new Status(IStatus.ERROR, LinkItConst.CORE_PLUGIN_ID, "Enviroment for LinkIt SDK 1.0 are not configuerd.")); throw new OperationCanceledException("Enviroment for LinkIt SDK 1.0 are not configuerd."); } project.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000)); if (copyResources) { copyProjectToWorkspace(project, locationPath, monitor); } IPathVariableManager manager = project.getWorkspace().getPathVariableManager(); if (manager.getURIValue(LinkIt10Helper.LINK_IT_SDK10) == null) { manager.setURIValue(LinkIt10Helper.LINK_IT_SDK10, URIUtil.toURI(helper.getEnvironmentPath())); } if (monitor.isCanceled()) { throw new OperationCanceledException(); } project.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000)); // Creates the .cproject file with the configurations ICProjectDescription projectDescription = helper.setCProjectDescription(project, true, monitor); // Add the C C++ AVR and other needed Natures to the project helper.addTheNatures(project); // Set the environment variables // ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project); ICConfigurationDescription defaultConfigDescription = projectDescription .getConfigurationByName(LinkItConst.LINKIT_CONFIGURATION_NAME); projectDescription.setActiveConfiguration(defaultConfigDescription); ICResourceDescription resourceDescription = defaultConfigDescription .getResourceDescription(new Path(""), true); String devBoard = "__LINKIT_SDK__"; try { helper.setEnvironmentVariables(resourceDescription, devBoard); } catch (IOException e) { String message = "Failed to set environmet variables " + project.getName(); Common.log(new Status(IStatus.ERROR, LinkItConst.CORE_PLUGIN_ID, message, e)); throw new OperationCanceledException(message); } helper.buildPathVariables(project, resourceDescription); if (!staticLib && !project.getFolder("LinkIt").exists()) { helper.createNewFolder(project, "LinkIt", null); } helper.setIncludePaths(projectDescription, resourceDescription); helper.setMacros(projectDescription, devBoard); helper.setSourcePaths(projectDescription, false); projectDescription.setActiveConfiguration(defaultConfigDescription); projectDescription.setCdtProjectCreated(); CoreModel.getDefault().getProjectDescriptionManager().setProjectDescription(project, projectDescription, true, monitor); monitor.done(); } }; // run the new project creation operation try { getContainer().run(true, true, op); } catch (InterruptedException e) { return null; } catch (InvocationTargetException e) { // ie.- one of the steps resulted in a core exception Throwable t = e.getTargetException(); if (t instanceof CoreException) { if (((CoreException) t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) { MessageDialog.open(MessageDialog.ERROR, getShell(), DataTransferMessages.WizardExternalProjectImportPage_errorMessage, NLS.bind(DataTransferMessages.WizardExternalProjectImportPage_caseVariantExistsError, projectName), SWT.SHEET); } else { ErrorDialog.openError(getShell(), DataTransferMessages.WizardExternalProjectImportPage_errorMessage, null, ((CoreException) t).getStatus()); } } return null; } return project; }
From source file:sernet.gs.ui.rcp.main.bsi.dialogs.XMLImportDialog.java
License:Open Source License
private void createErrorMessage(int caseNumber) { String titel = Messages.XMLImportDialog_18; String messageBody = Messages.XMLImportDialog_19; switch (caseNumber) { case 1:/* w w w . j a v a 2s . c o m*/ messageBody = Messages.XMLImportDialog_20; break; case 2: messageBody = Messages.XMLImportDialog_21; break; case 3: messageBody = Messages.XMLImportDialog_22; break; case 4: messageBody = Messages.XMLImportDialog_23; break; default: messageBody = Messages.XMLImportDialog_19; break; } MessageDialog messageDialog = new MessageDialog(this.getShell(), titel, null, messageBody, MessageDialog.ERROR, new String[] { Messages.XMLImportDialog_24 }, 1); messageDialog.open(); }
From source file:sernet.verinice.rcp.accountgroup.DeleteGroupAction.java
License:Open Source License
@Override public void run() { if (this.groupView.isStandardGroup()) { this.groupView.openStandardGroupWarningDialog(Messages.GroupView_22); return;/* w w w . ja v a2 s . com*/ } GroupView.getDisplay().syncExec(new Runnable() { @Override public void run() { try { int connectedAccounts = DeleteGroupAction.this.groupView.accountGroupDataService .getAccountNamesForGroup(DeleteGroupAction.this.groupView.getSelectedGroup()).length; long connectedObjects = DeleteGroupAction.this.groupView.accountService .countConnectObjectsForGroup(DeleteGroupAction.this.groupView.getSelectedGroup()); String message = String.format(Messages.GroupView_25, connectedAccounts, connectedObjects); MessageDialog dialog = new MessageDialog(DeleteGroupAction.this.groupView.parent.getShell(), Messages.GroupView_16, null, message, MessageDialog.ERROR, new String[] { Messages.GroupView_26, Messages.GroupView_27 }, 0); int result = dialog.open(); if (result == 0) { if (!isGroupEmptyAndNotConnectedToObject()) { openSecondWarningDialog(); } else { deleteGroup(); } } } catch (Exception ex) { LOG.error("error while deleting group", ex); } } }); }
From source file:sernet.verinice.rcp.accountgroup.DeleteGroupAction.java
License:Open Source License
private void openSecondWarningDialog() { new Thread(new Runnable() { @Override//from w w w.j av a 2s .c o m public void run() { GroupView.getDisplay().syncExec(new Runnable() { @Override public void run() { try { MessageDialog dialog = new MessageDialog( DeleteGroupAction.this.groupView.parent.getShell(), Messages.GroupView_28, null, Messages.GroupView_29, MessageDialog.ERROR, new String[] { Messages.GroupView_26, Messages.GroupView_27 }, 0); int result = dialog.open(); if (result == 0) { deleteGroup(); } } catch (Exception ex) { LOG.error("error while deleting group", ex); } } }); } }).start(); }
From source file:skillpro.vc.csclient.VCClient.java
License:Open Source License
private void handleError() { MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "VIS-Server not running!", null, "Please launch the VIS-Server", MessageDialog.ERROR, new String[] { "OK" }, 0); dialog.open();/*from w w w . j a v a 2s.c om*/ }