List of usage examples for org.eclipse.jface.dialogs IMessageProvider ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs IMessageProvider ERROR.
Click Source Link
From source file:com.baremetalstudios.mapleide.handlers.NewFolderDialogHandler.java
License:Open Source License
@Execute public void openNewTextFileDialog(@Named(IServiceConstants.ACTIVE_SHELL) Shell parentShell, @Optional @Named(IServiceConstants.SELECTION) final IResource resource, final IWorkspace workspace, IProgressMonitor monitor, final Logger logger, final INLSLookupFactoryService nlsFactory) { TitleAreaDialog dialog = new TitleAreaDialog(parentShell) { private ResourceViewerControl viewer; private Text text; private Messages messages = nlsFactory.createNLSLookup(Messages.class); @Override//from w w w .ja v a 2s . co m protected Control createDialogArea(Composite parent) { getShell().setText(messages.NewFolderDialogHandler_ShellTitle()); setTitle(messages.NewFolderDialogHandler_Title()); setMessage(messages.NewFolderDialogHandler_Message()); Composite comp = (Composite) super.createDialogArea(parent); Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); Label label = new Label(container, SWT.NONE); label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); label.setText(messages.NewFolderDialogHandler_ParentFolder()); viewer = new ResourceViewerControl(container, SWT.NONE, workspace, resource); viewer.setLayoutData(new GridData(GridData.FILL_BOTH)); label = new Label(container, SWT.NONE); label.setText(messages.NewFolderDialogHandler_FolderName()); text = new Text(container, SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return comp; } @Override protected void okPressed() { IResource resource = viewer.getResource(); if (resource == null) { setMessage(messages.NewFolderDialogHandler_ErrorSelectAParentFolder(), IMessageProvider.ERROR); return; } if (text.getText().trim().length() == 0) { setMessage(messages.NewFolderDialogHandler_ErrorEnterFolderName(), IMessageProvider.ERROR); return; } IPath newFolderPath = resource.getFullPath().append(text.getText()); IFolder folder = workspace.getRoot().getFolder(newFolderPath); try { folder.create(false, true, null); super.okPressed(); } catch (CoreException e) { logger.error(e); setMessage(messages.NewFolderDialogHandler_ErrorFolderCreation(), IMessageProvider.ERROR); } } }; dialog.open(); }
From source file:com.baremetalstudios.mapleide.handlers.NewTextFileDialogHandler.java
License:Open Source License
@Execute public void openNewTextFileDialog(@Named(IServiceConstants.ACTIVE_SHELL) Shell parentShell, @Optional @Named(IServiceConstants.SELECTION) final IResource resource, final IWorkspace workspace, IProgressMonitor monitor) {/*from w w w . ja v a 2s.co m*/ TitleAreaDialog dialog = new TitleAreaDialog(parentShell) { private ResourceViewerControl viewer; private Text text; @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); Composite container = new Composite(comp, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setLayout(new GridLayout(2, false)); Label label = new Label(container, SWT.NONE); label.setText("Folder"); viewer = new ResourceViewerControl(container, SWT.NONE, workspace, resource); viewer.setLayoutData(new GridData(GridData.FILL_BOTH)); label = new Label(container, SWT.NONE); label.setText("File name"); text = new Text(container, SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return comp; } @Override protected void okPressed() { IResource resource = viewer.getResource(); if (resource == null) { setMessage("Select a parent folder", IMessageProvider.ERROR); return; } if (text.getText().trim().length() == 0) { setMessage("Enter a folder name", IMessageProvider.ERROR); return; } parentContainer = (IContainer) resource; name = text.getText(); super.okPressed(); } }; if (dialog.open() == IDialogConstants.OK_ID) { IPath newFilePath = parentContainer.getFullPath().append(name); IFile file = workspace.getRoot().getFile(newFilePath); ByteArrayInputStream out = new ByteArrayInputStream(new byte[0]); try { file.create(out, true, monitor); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { out.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:com.buildml.eclipse.utils.AlertDialog.java
License:Open Source License
/** * Display an error dialog box in the context of the current shell. Both * a general message and an explanatory reason will be display. Given that there's * only an "OK" button, there's no return code needed. * @param title The general error message to be displayed. * @param message The detailed reason for the event. *//*from w w w .j a va2 s. c om*/ public static void displayErrorDialog(final String title, final String message) { openDialog(title, message, IMessageProvider.ERROR, false); }
From source file:com.caucho.resin.eclipse.ResinServerWizardFragment.java
License:Open Source License
private void validate() { IStatus status = getResinServer().getRuntimeDelegate().validate(); if (status != null && status.isOK()) { _wizard.update();//from w w w.j ava2 s .c o m _wizard.setMessage(null, IMessageProvider.NONE); } else { _wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); } }
From source file:com.centurylink.mdw.plugin.server.ServiceMixRuntimeWizardFragment.java
License:Apache License
protected boolean validate(IWizardHandle wizard) { if (runtime == null) { wizard.setMessage("", IMessageProvider.ERROR); return false; }//from w w w . ja v a 2 s. c o m IStatus status = runtime.validate(); if (status == null || status.isOK()) wizard.setMessage(null, IMessageProvider.NONE); else if (status.getSeverity() == IStatus.WARNING) wizard.setMessage(status.getMessage(), IMessageProvider.WARNING); else wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); wizard.update(); return status == null || status.isOK(); }
From source file:com.centurylink.mdw.plugin.server.ServiceMixServerWizardFragment.java
License:Apache License
protected boolean validate(IWizardHandle wizard) { if (server == null) { wizard.setMessage("", IMessageProvider.ERROR); return false; }/*from ww w .j av a2 s . com*/ IStatus status = server.validate(); if (status == null || status.isOK()) wizard.setMessage(null, IMessageProvider.NONE); else if (status.getSeverity() == IStatus.WARNING) wizard.setMessage(status.getMessage(), IMessageProvider.WARNING); else wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); wizard.update(); return status == null || status.isOK(); }
From source file:com.conwet.wirecloud.ide.wizards.AuthenticationWizardPage.java
License:Open Source License
@Override public Composite createComposite(Composite parent, IWizardHandle handle) { handle.setTitle("Authentication"); handle.setDescription("Authenticate in Wirecloud"); container = new Composite(parent, SWT.NULL); container.setLayout(new FillLayout()); this.handle = handle; try {// w ww . j a v a 2 s . c om browser = new Browser(container, SWT.NONE); } catch (SWTError e) { handle.setMessage( "Error loading webview. For more information go to http://www.eclipse.org/swt/faq.php#howdetectmozilla", IMessageProvider.ERROR); } setComplete(false); return container; }
From source file:com.conwet.wirecloud.ide.wizards.AuthenticationWizardPage.java
License:Open Source License
@Override public void enter() { boolean auth_info_available = false; final WirecloudAPI API = getWirecloudAPIFromWizardInstance(); Browser.clearSessions();/*from w ww. j a v a 2 s . c om*/ try { API.getOAuthEndpoints(); auth_info_available = true; } catch (Exception e) { e.printStackTrace(); handle.setMessage( "Error querying basic info to the WireCloud Server. Are you sure there is a WireCloud server running at \"" + API.url + "\" ?", IMessageProvider.ERROR); browser.setUrl("about:blank"); } URL url = null; try { if (auth_info_available) { url = API.getAuthURL(getServer().getAttribute("WIRECLOUDID", "")); } } catch (Exception e) { e.printStackTrace(); handle.setMessage( "Error opening the OAuth2 workflow for authentication. Are you sure the provided authentication parameters (client id and client secret) are valid?", IMessageProvider.ERROR); browser.setUrl("about:blank"); } if (url != null) { browser.setUrl(url.toString()); handle.setMessage("", IMessageProvider.NONE); } final AuthenticationWizardPage page = this; final IWizardHandle wizard_handle = handle; locationListener = new LocationListener() { public void changed(LocationEvent event) { Browser browser = (Browser) event.widget; URL currentURL; try { currentURL = new URL(browser.getUrl()); } catch (MalformedURLException e) { e.printStackTrace(); return; } if (browser.getUrl().startsWith(API.UNIVERSAL_REDIRECT_URI)) { QueryParameters parameters = new QueryParameters(currentURL.getQuery()); page.code = parameters.getParameter("code"); String clientId = getServer().getAttribute("WIRECLOUDID", ""); String clientSecret = getServer().getAttribute("WIRECLOUDSECRET", ""); try { page.token = API.obtainAuthToken(page.code, clientId, clientSecret); } catch (MalformedURLException e) { e.printStackTrace(); } page.setComplete(page.token != null); wizard_handle.update(); getServer().setAttribute("TOKEN", page.token); } } public void changing(LocationEvent event) { } }; browser.addLocationListener(locationListener); this.handle.update(); super.enter(); }
From source file:com.ebmwebsourcing.petals.common.internal.formeditor.JbiFormEditor.java
License:Open Source License
/** * Refreshes the markers/*www.jav a 2 s. c o m*/ * @param markerDeltas */ private void refreshMarkers() { if (this.editedFile == null || !this.editedFile.exists()) return; try { // Prepare the messages final Set<String> warningMessages = new HashSet<String>(); final Set<String> errorMessages = new HashSet<String>(); IMarker[] markers = this.editedFile.findMarkers(PetalsConstants.MARKER_ID_JBI_XML, true, IResource.DEPTH_ZERO); if (markers != null) { for (IMarker marker : markers) { int severity = marker.getAttribute(IMarker.SEVERITY, -1); if (severity == IMarker.SEVERITY_ERROR) errorMessages.add(marker.getAttribute(IMarker.MESSAGE, "")); else if (severity == IMarker.SEVERITY_WARNING) warningMessages.add(marker.getAttribute(IMarker.MESSAGE, "")); } } // Update the message manager Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (JbiFormEditor.this.mainForm.isDisposed()) return; JbiFormEditor.this.mainForm.getMessageManager().removeAllMessages(); int i = 0; for (String msg : errorMessages) JbiFormEditor.this.mainForm.getMessageManager().addMessage("error" + i++, msg, null, IMessageProvider.ERROR); for (String msg : warningMessages) JbiFormEditor.this.mainForm.getMessageManager().addMessage("warning" + i++, msg, null, IMessageProvider.WARNING); } }); } catch (CoreException e) { PetalsCommonPlugin.log(e, IStatus.ERROR); } }
From source file:com.ebmwebsourcing.petals.common.internal.provisional.utils.MarkerUtils.java
License:Open Source License
/** * Gets the {@link IMessageProvider} constant from an {@link IMarker} severity constant. * @param markerSeverity/* www. jav a 2s . c om*/ * @return */ public static int getMessageSeverityFromMarkerSeverity(int markerSeverity) { int type; switch (markerSeverity) { case IMarker.SEVERITY_ERROR: type = IMessageProvider.ERROR; break; case IMarker.SEVERITY_WARNING: type = IMessageProvider.WARNING; break; case IMarker.SEVERITY_INFO: type = IMessageProvider.INFORMATION; break; default: type = IMessageProvider.NONE; } return type; }