/** * Anzeige eines Fehler durch einen MessageDialog. * * @param msg */ public static void showError(String msg) { Shell shell = new Shell(Display.getDefault()); MessageDialog messageDialog = new MessageDialog( shell, "Fehler", null, msg, MessageDialog.ERROR, new String[] {"Schließen"}, 1); int answer = messageDialog.open(); if (answer == 0) messageDialog.close(); }
private void processNonBBProjects( final List<IJavaProject> nonBBProjects, final List<IJavaProject> projectsWithProblem, final boolean fix) { for (IJavaProject javaProject : nonBBProjects) { if (fix && projectsWithProblem.contains(javaProject)) { ImportUtils.initializeProjectOptions(javaProject); } } if (fix) { Shell shell = ContextManager.getActiveWorkbenchWindow().getShell(); String message = Messages.ClasspathChangeManager_rebuildProjectMsg1; StringBuffer projectList = new StringBuffer(); for (IJavaProject javaProject : projectsWithProblem) { projectList.append(javaProject.getProject().getName() + "\n"); } message += projectList.toString(); message += Messages.ClasspathChangeManager_rebuildProjectMsg2; MessageDialog dialog = new MessageDialog( shell, Messages.ClasspathChangeManager_RebuildProjectDialogTitle, null, message, MessageDialog.INFORMATION, new String[] { Messages.IConstants_OK_BUTTON_TITLE, Messages.IConstants_CANCEL_BUTTON_TITLE }, 0); int buttonEventCode = dialog.open(); switch (buttonEventCode) { case Window.OK: { buildProjects(projectsWithProblem); break; } case Window.CANCEL: { break; } default: throw new IllegalArgumentException("Unsupported dialog button event!"); } dialog.close(); } }