Java Code Examples for org.eclipse.core.runtime.IStatus#ERROR
The following examples show how to use
org.eclipse.core.runtime.IStatus#ERROR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrganizationValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private IStatus checkManagerCycles(final Organization organization, final User u) { String managerUsername = u.getManager(); final List<String> managers = new ArrayList<String>(); managers.add(u.getUserName()); managers.add(managerUsername); while (managerUsername != null) { managerUsername = getManagerOf(organization, managerUsername); if (managerUsername != null) { if (!managers.contains(managerUsername)) { managers.add(managerUsername); } else { managers.add(managerUsername); return new Status(IStatus.ERROR, ActorsPlugin.PLUGIN_ID, Messages.bind(Messages.managerCycleDetected, managers.toString())); } } } return ValidationStatus.ok(); }
Example 2
Source File: JarsSelectionDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
public IStatus validate( Object[] selections ) { if ( selections != null && selections.length > 0 ) { for ( Object o : selections ) { if ( o instanceof File ) { if ( ( (File) o ).isFile( ) ) { return new Status( IStatus.OK, Activator.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$ null ); } } } } return new Status( IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "", //$NON-NLS-1$ null ); }
Example 3
Source File: NamespaceXMLFileValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public IStatus validate(Object value) { try { File file = new File((String) value); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(file); Element documentElement = document.getDocumentElement(); if (!isValid(documentElement)) { switch (severity) { case IStatus.ERROR: return ValidationStatus.error(message); case IStatus.WARNING: return ValidationStatus.warning(message); default: return ValidationStatus.info(message); } } } catch (SAXException | IOException | ParserConfigurationException e) { throw new RuntimeException(e); } return ValidationStatus.ok(); }
Example 4
Source File: ResourceDropAdapterAssistant.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * Opens an error dialog if necessary. Takes care of complex rules necessary * for making the error dialog look nice. */ private void openError(IStatus status) { if (status == null) { return; } String genericTitle = WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_title; int codes = IStatus.ERROR | IStatus.WARNING; // simple case: one error, not a multistatus if (!status.isMultiStatus()) { ErrorDialog .openError(getShell(), genericTitle, null, status, codes); return; } // one error, single child of multistatus IStatus[] children = status.getChildren(); if (children.length == 1) { ErrorDialog.openError(getShell(), status.getMessage(), null, children[0], codes); return; } // several problems ErrorDialog.openError(getShell(), genericTitle, null, status, codes); }
Example 5
Source File: RocketchatMessageTransporter.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
private IStatus sendFromStationSender(TransientMessage message){ String integrationToken = configService.getLocal(CFG_ROCKETCHAT_STATION_INTEGRATION_TOKEN, null); if (integrationToken != null) { try { URL integrationUrl = new URL( elexisEnvironmentService.getRocketchatIntegrationBaseUrl() + integrationToken); String jsonMessage = prepareRocketchatMessage(message); return send(integrationUrl, jsonMessage.getBytes()); } catch (IOException e) { return new Status(IStatus.ERROR, Bundle.ID, e.getMessage()); } } return new Status(IStatus.ERROR, Bundle.ID, "No webhook integration token [" + CFG_ROCKETCHAT_STATION_INTEGRATION_TOKEN + "] found in local config or malformed url."); }
Example 6
Source File: EclipseLogAppender.java From n4js with Eclipse Public License 1.0 | 6 votes |
private int mapLevel(Level level) { switch (level.toInt()) { case Priority.DEBUG_INT: case Priority.INFO_INT: return IStatus.INFO; case Priority.WARN_INT: return IStatus.WARNING; case Priority.ERROR_INT: case Priority.FATAL_INT: return IStatus.ERROR; default: return IStatus.INFO; } }
Example 7
Source File: WebAppProjectCreator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void jobSetupFacets(final IProject project) { // Facet setup is done in a workspace job since this can be long running, // hence shouldn't be from the UI thread. WorkspaceJob setupFacetsJob = new WorkspaceJob("Setting up facets") { @Override public IStatus runInWorkspace(IProgressMonitor monitor) { try { // Create faceted project IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, monitor); // Add Java facet by default IProjectFacet javaFacet = ProjectFacetsManager.getProjectFacet(FACET_JST_JAVA); facetedProject.installProjectFacet(javaFacet.getDefaultVersion(), null, monitor); return Status.OK_STATUS; } catch (CoreException e) { // Log and continue GdtPlugin.getLogger().logError(e); return new Status(IStatus.ERROR, GdtPlugin.PLUGIN_ID, e.toString(), e); } } }; setupFacetsJob.schedule(); }
Example 8
Source File: FileFolderSelectionDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public IStatus validate(Object[] selection) { int nSelected = selection.length; String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH; if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) { return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, IDEResourceInfoUtils.EMPTY_STRING, null); } for (int i = 0; i < selection.length; i++) { Object curr = selection[i]; if (curr instanceof IFileStore) { IFileStore file = (IFileStore) curr; if (acceptFolders == false && file.fetchInfo().isDirectory()) { return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, IDEResourceInfoUtils.EMPTY_STRING, null); } } } return Status.OK_STATUS; }
Example 9
Source File: EnginePropertyPage.java From thym with Eclipse Public License 1.0 | 6 votes |
@Override public boolean isValid() { setMessage(null); setErrorMessage(null); IStructuredSelection sel = (IStructuredSelection) engineSection.getSelection(); if(sel != null){ for (Iterator<?> iterator = sel.iterator(); iterator.hasNext();) { HybridMobileEngine engine = (HybridMobileEngine) iterator.next(); try { List<CordovaPlugin> installedPlugins = getProject().getPluginManager().getInstalledPlugins(); for (CordovaPlugin cordovaPlugin : installedPlugins) { IStatus status = cordovaPlugin.isEngineCompatible(engine); if( !status.isOK()) { setMessage(status.getMessage(), status.getSeverity()); return status.getSeverity() != IStatus.ERROR; } } } catch (CoreException e) { HybridUI.log(IStatus.WARNING, "Error while checking engine and plug-in compatability ", e); } } } return true; }
Example 10
Source File: FixCorrectionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public Object getAdditionalProposalInfo(IProgressMonitor monitor) { StringBuffer result= new StringBuffer(); IStatus status= getFixStatus(); if (status != null && !status.isOK()) { result.append("<b>"); //$NON-NLS-1$ if (status.getSeverity() == IStatus.WARNING) { result.append(CorrectionMessages.FixCorrectionProposal_WarningAdditionalProposalInfo); } else if (status.getSeverity() == IStatus.ERROR) { result.append(CorrectionMessages.FixCorrectionProposal_ErrorAdditionalProposalInfo); } result.append("</b>"); //$NON-NLS-1$ result.append(status.getMessage()); result.append("<br><br>"); //$NON-NLS-1$ } String info= fFix.getAdditionalProposalInfo(); if (info != null) { result.append(info); } else { result.append(super.getAdditionalProposalInfo(monitor)); } return result.toString(); }
Example 11
Source File: CheckstyleUIPlugin.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Open an error dialog for an exception that occurred within the plugin. * * @param shell * the shell * @param message * the exception message * @param t * the exception * @param log * <code>true</code> if the exception should be logged */ public static void errorDialog(Shell shell, String message, Throwable t, boolean log) { Status status = new Status(IStatus.ERROR, CheckstyleUIPlugin.PLUGIN_ID, IStatus.OK, message != null ? message : "", t); //$NON-NLS-1$ String msg = NLS.bind(Messages.errorDialogMainMessage, message); ErrorDialog.openError(shell, Messages.CheckstyleLog_titleInternalError, msg, status); if (log) { CheckstyleLog.log(t); } }
Example 12
Source File: MessageService.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public ObjectStatus send(TransientMessage message){ String receiver = message.getReceiver(); int indexOf = receiver.indexOf(':'); if (indexOf <= 0) { return new ObjectStatus(IStatus.ERROR, Bundle.ID, "No transporter uri scheme found in receiver [" + receiver + "]", null); } String uriScheme = receiver.substring(0, indexOf); IMessageTransporter messageTransporter = null; if (uriScheme.equals(INTERNAL_MESSAGE_URI_SCHEME)) { messageTransporter = selectInternalSchemeTransporter(); } else { messageTransporter = messageTransporters.get(uriScheme); } if (messageTransporter == null) { return new ObjectStatus(IStatus.ERROR, Bundle.ID, "No transporter found for uri scheme [" + uriScheme + "]", null); } if (messageTransporter.isExternal()) { if (!message.isAlllowExternal()) { return new ObjectStatus(IStatus.ERROR, Bundle.ID, "Selected transporter is external, but message not marked as allowExternal, rejecting send.", null); } } return new ObjectStatus(messageTransporter.send(message), messageTransporter.getUriScheme()); }
Example 13
Source File: SpellingConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Validates that the specified locale is available. * * @param localeString the locale to validate * @return The status of the validation */ private static IStatus validateLocale(final String localeString) { if (PREF_VALUE_NO_LOCALE.equals(localeString)) return new StatusInfo(); Locale locale= SpellCheckEngine.convertToLocale(localeString); if (SpellCheckEngine.findClosestLocale(locale) != null) return new StatusInfo(); return new StatusInfo(IStatus.ERROR, PreferencesMessages.SpellingPreferencePage_locale_error); }
Example 14
Source File: ImportHandler.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void initializeTraceResource(final LttngRelaydConnectionInfo connectionInfo, final String tracePath, final IProject project) throws CoreException, TmfTraceImportException { final TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true); final TmfTraceFolder tracesFolder = projectElement.getTracesFolder(); if (tracesFolder != null) { IFolder folder = tracesFolder.getResource(); IFolder traceFolder = folder.getFolder(connectionInfo.getSessionName()); Path location = new Path(tracePath); IStatus result = ResourcesPlugin.getWorkspace().validateLinkLocation(folder, location); if (result.isOK()) { traceFolder.createLink(location, IResource.REPLACE, new NullProgressMonitor()); } else { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, result.getMessage())); } TraceTypeHelper selectedTraceType = TmfTraceTypeUIUtils.selectTraceType(location.toOSString(), null, null); // No trace type was determined. TmfTraceTypeUIUtils.setTraceType(traceFolder, selectedTraceType); TmfTraceElement found = null; final List<TmfTraceElement> traces = tracesFolder.getTraces(); for (TmfTraceElement candidate : traces) { if (candidate.getName().equals(connectionInfo.getSessionName())) { found = candidate; } } if (found == null) { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_LiveTraceElementError)); } // Properties used to be able to reopen a trace in live mode traceFolder.setPersistentProperty(CtfConstants.LIVE_HOST, connectionInfo.getHost()); traceFolder.setPersistentProperty(CtfConstants.LIVE_PORT, Integer.toString(connectionInfo.getPort())); traceFolder.setPersistentProperty(CtfConstants.LIVE_SESSION_NAME, connectionInfo.getSessionName()); final TmfTraceElement finalTrace = found; Display.getDefault().syncExec(() -> TmfOpenTraceHelper.openFromElement(finalTrace)); } }
Example 15
Source File: NegotiationHandler.java From saros with GNU General Public License v2.0 | 4 votes |
@Override protected IStatus run(IProgressMonitor monitor) { try { SessionNegotiation.Status status = negotiation.start(ProgressMonitorAdapterFactory.convert(monitor)); switch (status) { case CANCEL: return Status.CANCEL_STATUS; case ERROR: return new Status(IStatus.ERROR, Saros.PLUGIN_ID, negotiation.getErrorMessage()); case OK: break; case REMOTE_CANCEL: SarosView.showNotification( Messages.NegotiationHandler_canceled_invitation, MessageFormat.format(Messages.NegotiationHandler_canceled_invitation_text, peer)); return new Status( IStatus.CANCEL, Saros.PLUGIN_ID, MessageFormat.format(Messages.NegotiationHandler_canceled_invitation_text, peer)); case REMOTE_ERROR: SarosView.showNotification( Messages.NegotiationHandler_error_during_invitation, MessageFormat.format( Messages.NegotiationHandler_error_during_invitation_text, peer, negotiation.getErrorMessage())); return new Status( IStatus.ERROR, Saros.PLUGIN_ID, MessageFormat.format( Messages.NegotiationHandler_error_during_invitation_text, peer, negotiation.getErrorMessage())); } } catch (Exception e) { log.error("This exception is not expected here: ", e); return new Status(IStatus.ERROR, Saros.PLUGIN_ID, e.getMessage(), e); } sessionManager.startSharingReferencePoints(negotiation.getPeer()); return Status.OK_STATUS; }
Example 16
Source File: SVNException.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public static SVNException wrapException(IResource resource, String message, CoreException e) { return new SVNException(new SVNStatus(IStatus.ERROR, e.getStatus().getCode(), message, e)); }
Example 17
Source File: GwtWtpPlugin.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
public static void logError(String msg, Throwable e) { msg = msg == null ? "GWT Error" : "GWT: " + msg; Status status = new Status(IStatus.ERROR, PLUGIN_ID, 1, msg, e); getInstance().getLog().log(status); }
Example 18
Source File: BonitaErrorDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public BonitaErrorDialog(final Shell parentShell, final String dialogTitle, final String message, final Throwable t) { super(parentShell, dialogTitle, message, new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, t), IStatus.ERROR); this.message = message; status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, t); setStatus(status); }
Example 19
Source File: ConverterUtils.java From translationstudio8 with GNU General Public License v2.0 | 3 votes |
/** * Throw converter exception. * @param plugin * the plugin * @param message * the message * @param e * the e * @throws ConverterException * the converter exception * @author John Zhu */ public static void throwConverterException(String plugin, String message, Throwable e) throws ConverterException { if (e instanceof OperationCanceledException) { return; } IStatus status = new Status(IStatus.ERROR, plugin, IStatus.ERROR, message, e); ConverterException ce = new ConverterException(status); throw ce; }
Example 20
Source File: StatusInfo.java From editorconfig-eclipse with Apache License 2.0 | 2 votes |
/** * Sets the status to ERROR. * * @param errorMessage * The error message (can be empty, but not null) */ public void setError(String errorMessage) { Assert.isNotNull(errorMessage); fStatusMessage = errorMessage; fSeverity = IStatus.ERROR; }