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:com.google.dart.tools.ui.internal.projects.CreateApplicationWizard.java
License:Open Source License
private void createFolder(IPath path) { final ProjectType projectType = page.getProjectType(); final boolean hasPubSupport = page.hasPubSupport(); IPath containerPath = path.removeLastSegments(1); IResource container = ResourceUtil.getResource(containerPath.toFile()); IPath newFolderPath = container.getFullPath().append(path.lastSegment()); final IFolder newFolderHandle = IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFolder(newFolderPath); IRunnableWithProgress op = new IRunnableWithProgress() { @Override//w ww .j a v a 2 s . c o m public void run(IProgressMonitor monitor) throws InvocationTargetException { AbstractOperation op; op = new CreateFolderOperation(newFolderHandle, null, IDEWorkbenchMessages.WizardNewFolderCreationPage_title); try { IStatus status = op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); if (status.isOK() && projectType != ProjectType.NONE) { createdFile = createProjectContent(newProject, newFolderHandle.getLocation().toOSString(), newFolderHandle.getName(), projectType, hasPubSupport); } } catch (ExecutionException e) { throw new InvocationTargetException(e); } catch (CoreException e) { throw new InvocationTargetException(e); } } }; try { getContainer().run(true, true, op); } catch (InterruptedException e) { } catch (InvocationTargetException e) { // ExecutionExceptions are handled above, but unexpected runtime // exceptions and errors may still occur. IDEWorkbenchPlugin.log(getClass(), "createNewFolder()", e.getTargetException()); //$NON-NLS-1$ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), IDEWorkbenchMessages.WizardNewFolderCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFolder_internalError, e.getTargetException().getMessage()), SWT.SHEET); } newProject = newFolderHandle.getProject(); }
From source file:com.google.dart.tools.ui.internal.text.dart.CompletionProposalComputerRegistry.java
License:Open Source License
private void informUserModal(CompletionProposalComputerDescriptor descriptor, IStatus status) { String title = DartTextMessages.CompletionProposalComputerRegistry_error_dialog_title; CompletionProposalCategory category = descriptor.getCategory(); IContributor culprit = descriptor.getContributor(); Set affectedPlugins = getAffectedContributors(category, culprit); final String avoidHint; final String culpritName = culprit == null ? null : culprit.getName(); if (affectedPlugins.isEmpty()) { avoidHint = Messages.format(DartTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] { culpritName, category.getDisplayName() }); } else {//from w w w. j a v a 2 s . c o m avoidHint = Messages.format( DartTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] { culpritName, category.getDisplayName(), toString(affectedPlugins) }); } String message = status.getMessage(); // inlined from MessageDialog.openError MessageDialog dialog = new MessageDialog(DartToolsPlugin.getActiveWorkbenchShell(), title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) { @Override protected Control createCustomArea(Composite parent) { Link link = new Link(parent, SWT.NONE); link.setText(avoidHint); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(getShell(), "com.google.dart.tools.ui.internal.preferences.CodeAssistPreferenceAdvanced", null, //$NON-NLS-1$ null).open(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); return link; } }; dialog.open(); }
From source file:com.google.gdt.eclipse.core.browser.BrowserMenuPopulator.java
License:Open Source License
/** * Find a browser to open url// w ww. j a va 2 s . c o m */ private void findBrowser() { MessageDialog md = new MessageDialog(SWTUtilities.getShell(), "No browsers found", null, null, MessageDialog.ERROR, new String[] { "Ok" }, 0) { @Override protected Control createMessageArea(Composite parent) { super.createMessageArea(parent); Link link = new Link(parent, SWT.NONE); link.setText("There are no browsers defined, please add one (Right-click on URL -> " + "Open with -> Add a Browser, or <a href=\"#\">Window -> Preferences -> General -> Web Browser</a>)."); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( Display.getCurrent().getActiveShell(), "org.eclipse.ui.browser.preferencePage", new String[] { "org.eclipse.ui.browser.preferencePage" }, null); if (dialog != null) { dialog.open(); } } }); return parent; } }; md.open(); }
From source file:com.google.gdt.eclipse.login.GoogleLogin.java
License:Open Source License
private static void showNoBrowsersMessageDialog() { MessageDialog noBrowsersMd = new MessageDialog(Display.getDefault().getActiveShell(), "No browsers found", null, null, MessageDialog.ERROR, new String[] { "Ok" }, 0) { @Override/* www.j a v a 2s . com*/ protected Control createMessageArea(Composite parent) { super.createMessageArea(parent); Link link = new Link(parent, SWT.WRAP); link.setText("An embedded browser could not be created for signing in." + "\nAn external browser is needed to sign in, however, none are defined in Eclipse." + "\nPlease add a browser in <a href=\"#\">Window -> Preferences -> General -> Web Browser</a> and sign in again."); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( Display.getDefault().getActiveShell(), "org.eclipse.ui.browser.preferencePage", new String[] { "org.eclipse.ui.browser.preferencePage" }, null); if (dialog != null) { dialog.open(); } } }); return parent; } }; noBrowsersMd.open(); }
From source file:com.hangum.tadpole.rdb.core.util.GrantCheckerUtils.java
License:Open Source License
/** * execute query/* w w w. ja va 2 s . c o m*/ * * @param userDB * @return * @throws Exception */ public static boolean ifExecuteQuery(UserDBDAO userDB) throws Exception { // security check. if (!TadpoleSecurityManager.getInstance().isLock(userDB)) { throw new Exception(Messages.get().ResultMainComposite_1); } if (PublicTadpoleDefine.YES_NO.YES.name().equals(userDB.getQuestion_dml()) || PermissionChecker.isProductBackup(userDB)) { MessageDialog dialog = new MessageDialog(null, Messages.get().Confirm, null, Messages.get().GrantCheckerUtils_0, MessageDialog.ERROR, new String[] { Messages.get().YES, Messages.get().NO }, 1); if (dialog.open() == 1) return false; } return true; }
From source file:com.iauto.mist.spec.m2t.uml2html.launch.UML2HtmlDynamicSpecificationLaunch.java
License:Open Source License
private void giveErrorMessage(List<StateMachine> stateMachines) { // ??/* www.j a v a 2 s .co m*/ StringBuffer opendFilesb = new StringBuffer(); FileOutputStream out = null; for (StateMachine sm : stateMachines) { try { File filePath = new File(XlsRender2.write_path); if (!filePath.exists()) { filePath.mkdirs(); } String fileName = XlsRender2.write_path + File.separator + sm.getName() + Define.FILE_SUFFIX_XLS; File file = new File(fileName); if (file.exists()) { out = new FileOutputStream(fileName); } } catch (FileNotFoundException e) { // ??? opendFilesb.append(sm.getName()); opendFilesb.append("\r\n"); } finally { if (out != null) { try { out.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } } // ??? String dialogMessageFixed = "The excel file corresponding to the following model(s) is opening now, please close it(them) and click \"Retry\"."; if ("".equals(opendFilesb.toString())) { retryFlg = false; return; } final String dialogMessage = dialogMessageFixed + "\r\n\r\n" + opendFilesb.toString(); // ?? Display.getDefault().syncExec(new Runnable() { @Override public void run() { MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", null, dialogMessage, MessageDialog.ERROR, new String[] { IDialogConstants.RETRY_LABEL }, 0); dialog.open(); if (dialog.getReturnCode() == Window.OK) { retryFlg = true; } } }); }
From source file:com.jaspersoft.studio.model.style.command.CreateStyleTemplateCommand.java
License:Open Source License
private void createObject() { if (jrTemplate == null) { FilteredResourcesSelectionDialog fd = new FilteredHelpDialog(Display.getCurrent().getActiveShell(), false, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE); fd.setInitialPattern("*.jrtx");//$NON-NLS-1$ if (fd.open() == Dialog.OK) { IFile file = (IFile) fd.getFirstResult(); File fileToBeOpened = file.getRawLocation().makeAbsolute().toFile(); boolean showErrorMessage = false; //Check if the file is a valid template before add it to the model if (fileToBeOpened != null && fileToBeOpened.exists() && fileToBeOpened.isFile()) { try { //Try to load the file to see if it is a valid template JRXmlTemplateLoader.load(fileToBeOpened); this.jrTemplate = MStyleTemplate.createJRTemplate(); JRDesignExpression jre = new JRDesignExpression(); jre.setText("\"" + getStylePath(file) + "\"");//$NON-NLS-1$ //$NON-NLS-2$ ((JRDesignReportTemplate) jrTemplate).setSourceExpression(jre); } catch (Exception ex) { showErrorMessage = true; }/* w w w .java 2 s.c om*/ } else { showErrorMessage = true; } if (showErrorMessage) { MessageDialog.open(MessageDialog.ERROR, Display.getCurrent().getActiveShell(), Messages.UIUtils_ExceptionTitle, Messages.CreateStyleTemplateCommand_loadStyleError, SWT.NONE); } } } }
From source file:com.javapathfinder.vjp.config.editors.ModePropertyEditorComposite.java
License:Open Source License
private Composite createFileInfoUI(Composite parent) { Group group = new Group(parent, SWT.NULL); group.setText("Configuration file location:"); group.setLayout(new FormLayout()); Button button = new Button(group, SWT.NULL); button.setText("Move/Rename"); FormData buttonData = new FormData(); buttonData.right = new FormAttachment(100, -5); button.setLayoutData(buttonData);/* w w w . j av a 2s .com*/ button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IPath path = getNewPath(); if (path == null) return; int matches = path.matchingFirstSegments(ResourcesPlugin.getWorkspace().getRoot().getLocation()); path = path.removeFirstSegments(matches).makeAbsolute(); try { properties.getIFile().move(path, true, null); properties.getIFile().refreshLocal(IFile.DEPTH_INFINITE, null); refreshDialog(properties.getIFile()); } catch (CoreException e1) { VJP.logError("Could not move property file.", e1); } } private void refreshDialog(IFile file) { ((LaunchDialog) (getShell().getData())).updateTree(); } private IPath getNewPath() { ModePropertyFileDialog dialog = new ModePropertyFileDialog(getShell(), properties); IFile file = dialog.getFile(); IProject project = dialog.getFileProject(); if (project == null) { new MessageDialog(getShell(), "Invalid Mode Property Location", null, "Mode Property Files must be kept within a project", MessageDialog.ERROR, new String[] { "OK" }, 0).open(); return null; } if (file.equals(properties.getIFile())) return null; return file.getLocation(); } }); Text configPathField = new Text(group, SWT.SINGLE | SWT.LEFT); configPathField.setText(properties.getIFile().getProjectRelativePath().toOSString()); configPathField.setEditable(false); FormData textData = new FormData(); textData.left = new FormAttachment(0, 10); textData.right = new FormAttachment(button, -5); Point buttonsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); Point textsize = configPathField.computeSize(SWT.DEFAULT, SWT.DEFAULT); int diff = Math.abs(buttonsize.y - textsize.y); diff /= 2; textData.top = new FormAttachment(0, diff); configPathField.setLayoutData(textData); return group; }
From source file:com.javapathfinder.vjp.config.LaunchDialog.java
License:Open Source License
private boolean shouldVerify() { if (VerifyJob.isRunning()) { new MessageDialog(getShell(), "Program being verified.", null, "Only one program can be verified at a time.", MessageDialog.ERROR, new String[] { "OK" }, 0) .open();//from w w w .ja va2 s .c o m return false; } if (!editor.isDirty()) return true; MessageDialog dialog = new MessageDialog(getShell(), "Save Changes?", null, "Before the program can be verified changes made to the configuration must first be saved.", MessageDialog.ERROR, new String[] { "&Save New Properties and Verify", "&Revert to Old Properties and Verify", "&Cancel" }, 2); int option = dialog.open(); if (option == 0) editor.saveProperties(); else if (option == 1) editor.revertProperties(); else return false; return true; }
From source file:com.javapathfinder.vjp.config.LaunchDialog.java
License:Open Source License
private void handleNewFile() { ModePropertyFileDialog dialog = new ModePropertyFileDialog(getShell()); IFile file = dialog.getFile();/* w w w . j av a 2 s . c om*/ if (file == null) return; IProject project = dialog.getFileProject(); if (project == null) { new MessageDialog(getShell(), "Invalid Mode Property File location", null, "Mode Property Files can only be stored within a project.", MessageDialog.ERROR, new String[] { "OK" }, 0).open(); return; } if (file.exists()) { new MessageDialog(getShell(), "File already exists.", null, "This file location chosen already exists.", MessageDialog.ERROR, new String[] { "OK" }, 0).open(); return; } try { file.getLocation().toFile().getParentFile().mkdirs(); file.getLocation().toFile().createNewFile(); file.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (Exception e) { VJP.logError("File could not be created or refreshed", e); } updateTree(); }