Java Code Examples for org.eclipse.core.resources.IMarker#SEVERITY_INFO

The following examples show how to use org.eclipse.core.resources.IMarker#SEVERITY_INFO . 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: GraphStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
 *      int)
 */
@Override
public Image getColumnImage(Object obj, int index) {
  Image image = null;
  IMarker marker = (IMarker) obj;

  if (index == 0) {
    int severity = MarkerUtilities.getSeverity(marker);
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();

    if (IMarker.SEVERITY_ERROR == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    } else if (IMarker.SEVERITY_WARNING == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    } else if (IMarker.SEVERITY_INFO == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }
  }
  return image;
}
 
Example 2
Source File: MarkerStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Image getColumnImage(Object obj, int index) {
  Image image = null;
  MarkerStat stat = (MarkerStat) obj;

  if (index == 0) {
    int severity = stat.getMaxSeverity();
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();

    if (IMarker.SEVERITY_ERROR == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    } else if (IMarker.SEVERITY_WARNING == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    } else if (IMarker.SEVERITY_INFO == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }
  }
  return image;
}
 
Example 3
Source File: AnalysisPreferencesStub.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public AnalysisPreferencesStub() {
    severityForUnusedImport = IMarker.SEVERITY_WARNING;
    severityForUnusedVariable = IMarker.SEVERITY_WARNING;
    severityForUndefinedVariable = IMarker.SEVERITY_ERROR;
    severityForDuplicatedSignature = IMarker.SEVERITY_ERROR;
    severityForReimport = IMarker.SEVERITY_WARNING;
    severityForUnresolvedImport = IMarker.SEVERITY_ERROR;
    severityForNoSelf = IMarker.SEVERITY_ERROR;
    severityForUnusedWildImport = IMarker.SEVERITY_WARNING;
    severityForUndefinedImportVariable = IMarker.SEVERITY_WARNING;
    severityForUnusedParameter = IMarker.SEVERITY_WARNING;
    severityForNoEffectStmt = IMarker.SEVERITY_WARNING;
    severityForIndentationProblem = IMarker.SEVERITY_WARNING;
    severityForInvalidModuleName = IMarker.SEVERITY_WARNING;
    severityForAssignmentToBuiltInSymbol = IMarker.SEVERITY_WARNING;
    severityForArgumentsMismatch = IMarker.SEVERITY_INFO;
}
 
Example 4
Source File: CrossflowMarkerNavigationProvider.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public static IMarker addMarker(IFile file, String elementId, String location, String message, int statusSeverity) {
	IMarker marker = null;
	try {
		marker = file.createMarker(MARKER_TYPE);
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.LOCATION, location);
		marker.setAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
		int markerSeverity = IMarker.SEVERITY_INFO;
		if (statusSeverity == IStatus.WARNING) {
			markerSeverity = IMarker.SEVERITY_WARNING;
		} else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
			markerSeverity = IMarker.SEVERITY_ERROR;
		}
		marker.setAttribute(IMarker.SEVERITY, markerSeverity);
	} catch (CoreException e) {
		CrossflowDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
	}
	return marker;
}
 
Example 5
Source File: ExternalResourceManager.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private static void createLinkProblemMarkers(IProject p, Collection<IStatus> linkStatuses) throws CoreException {
	for (IStatus status : linkStatuses) {
		if (!status.isOK()) {
			int statusSeverity = status.getSeverity();
			int markerSeverity;
			if (statusSeverity == IStatus.ERROR) {
				markerSeverity = IMarker.SEVERITY_ERROR;
			}
			else if (statusSeverity == IStatus.WARNING) {
				markerSeverity = IMarker.SEVERITY_WARNING;
			}
			else {
				markerSeverity = IMarker.SEVERITY_INFO;
			}
			
			IMarker marker = p.createMarker(LINK_DIRECTORY_PROBLEM_MARKER_TYPE);
			marker.setAttribute(IMarker.MESSAGE, String.format(Messages.ExternalResourceManager_ErrorWhenLinkingExternalDirectory, status.getMessage()));
			marker.setAttribute(IMarker.SEVERITY, markerSeverity);
		}
	}
}
 
Example 6
Source File: OccurrencesVisitor.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public OccurrencesVisitor(IPythonNature nature, String moduleName, IModule current, IAnalysisPreferences prefs,
        IDocument document, IProgressMonitor monitor) {
    super(nature, moduleName, current, document, monitor);
    this.messagesManager = new MessagesManager(prefs, moduleName, document);
    this.prefs = prefs;

    this.analyzeArgumentsMismatch = prefs
            .getSeverityForType(IAnalysisPreferences.TYPE_ARGUMENTS_MISATCH) > IMarker.SEVERITY_INFO; //Don't even run checks if we don't raise at least a warning.
    if (this.analyzeArgumentsMismatch) {
        this.argumentsChecker = new ArgumentsChecker(this);
    } else {
        //Don't even create it if we're not going to use it.
        this.argumentsChecker = null;
    }

    this.duplicationChecker = new DuplicationChecker(this);
    this.noSelfChecker = new NoSelfChecker(this);
}
 
Example 7
Source File: Problem.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String toString()
{
	StringBuffer buf = new StringBuffer();
	buf.append("problem "); //$NON-NLS-1$
	if (isError())
	{
		buf.append("ERROR"); //$NON-NLS-1$
	}
	else if (isWarning())
	{
		buf.append("WARNING"); //$NON-NLS-1$
	}
	else if (severity == IMarker.SEVERITY_INFO)
	{
		buf.append("INFO"); //$NON-NLS-1$
	}
	else
	{
		buf.append("severity="); //$NON-NLS-1$
		buf.append(severity);
	}
	buf.append(": "); //$NON-NLS-1$
	buf.append(getSourcePath());
	buf.append(" line="); //$NON-NLS-1$
	buf.append(getLineNumber());
	buf.append(" offset="); //$NON-NLS-1$
	buf.append(getOffset());
	buf.append(" length="); //$NON-NLS-1$
	buf.append(getLength());
	buf.append(' ');
	buf.append(message);
	return buf.toString();
}
 
Example 8
Source File: VerySimpleBuilder.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
private int getMarkerSeverity(Severity problemSeverity) {
    switch (problemSeverity) {
    case ERROR:
        return IMarker.SEVERITY_ERROR;
    case WARNING:
        return IMarker.SEVERITY_WARNING;
    }
    // not supported yet
    return IMarker.SEVERITY_INFO;
}
 
Example 9
Source File: Auditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private int getSeverityValue(SeverityLevel severity) {
  int result = IMarker.SEVERITY_WARNING;

  if (severity.equals(SeverityLevel.INFO)) {
    result = IMarker.SEVERITY_INFO;
  } else if (severity.equals(SeverityLevel.WARNING)) {
    result = IMarker.SEVERITY_WARNING;
  } else if (severity.equals(SeverityLevel.ERROR)) {
    result = IMarker.SEVERITY_ERROR;
  }

  return result;
}
 
Example 10
Source File: GeneratorMarkerSupport.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createMarker(Resource res, String message, Severity severity) {

	final int severityEclipse;
	switch (severity) {
	case INFO:
		severityEclipse = IMarker.SEVERITY_INFO;
		break;
	case WARNING:
		severityEclipse = IMarker.SEVERITY_WARNING;
		break;
	default:
		severityEclipse = IMarker.SEVERITY_ERROR;
		break;
	}

	try {
		IMarker marker = toIFile(res).createMarker(MARKER__ORG_ECLIPSE_IDE_N4JS_UI_COMPILER_ERROR);
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.SEVERITY, severityEclipse);
		marker.setAttribute(IMarker.LINE_NUMBER, 1);
	} catch (CoreException e) {
		LOGGER.error(e.getStatus());
		String resInfo = "";
		if (res != null) {
			if (res.getURI() != null) {
				resInfo = "on resource with uri=" + res.getURI();
			} else {
				resInfo = "on resource=" + res;
			}
		}
		throw new RuntimeException("Cannot create error marker with message='" + message + "' " + resInfo + ".", e);
	}
}
 
Example 11
Source File: IssueUtil.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Translates IMarker.SEVERITY to Severity
 * @param severity Severity to translate
 * @return Translated severity or <code>null</code>
 * @since 2.9
 */
protected Severity translateSeverity(int severity) {
	switch (severity) {
		case IMarker.SEVERITY_ERROR:
			return Severity.ERROR;
		case IMarker.SEVERITY_WARNING:
			return Severity.WARNING;
		case IMarker.SEVERITY_INFO:
			return Severity.INFO;
		default:
			return null;
	}
}
 
Example 12
Source File: SeverityColumnLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param status
 * @return
 */
private Image getImageForSeverity(final int status) {
    switch (status) {
        case IMarker.SEVERITY_WARNING:
            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
        case IMarker.SEVERITY_INFO:
            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
        case IMarker.SEVERITY_ERROR:
            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
        default:
            break;
    }

    return null;
}
 
Example 13
Source File: AnnotationIssueProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected int getMarkerSeverity(Severity severity) {
	switch (severity) {
		case ERROR:
			return IMarker.SEVERITY_ERROR;
		case WARNING:
			return IMarker.SEVERITY_WARNING;
		case INFO:
			return IMarker.SEVERITY_INFO;
		default:
			throw new IllegalArgumentException();
	}
}
 
Example 14
Source File: AdapterFactory.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Retrieves the text representation of the TLA+ parse problem
 * @param problem
 * @return
 */
public static String getSeverityAsText(int severity)
{
    switch (severity) {
    case IMarker.SEVERITY_ERROR:
        return "Error";
    case IMarker.SEVERITY_WARNING:
        return "Warning";
    case IMarker.SEVERITY_INFO:
    default:
        return "Info";
    }
}
 
Example 15
Source File: IDETypeScriptProject.java    From typescript.java with MIT License 5 votes vote down vote up
private int getSeverity(DiagnosticCategory category) {
	switch (category) {
	case Message:
		return IMarker.SEVERITY_INFO;
	case Warning:
		return IMarker.SEVERITY_WARNING;
	default:
		return IMarker.SEVERITY_ERROR;
	}
}
 
Example 16
Source File: IDETypeScriptCompilerMessageHandler.java    From typescript.java with MIT License 5 votes vote down vote up
private int getSeverity(Severity severity) {
	switch (severity) {
	case error:
		return IMarker.SEVERITY_ERROR;
	case info:
		return IMarker.SEVERITY_INFO;
	default:
		return IMarker.SEVERITY_WARNING;
	}
}
 
Example 17
Source File: AbstractLiveValidationMarkerConstraint.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void addMarker(final DiagramEditor editor, final EditPartViewer viewer, final IFile target,
        final String elementId, final String location, final String message,
        final int statusSeverity) {
    if (target == null) {
        return;
    }
    IMarker marker = null;
    try {
        marker = target.createMarker(getMarkerType(editor));
        marker.setAttribute(IMarker.MESSAGE, message);
        marker.setAttribute(IMarker.LOCATION, location);
        marker.setAttribute(
                org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID,
                elementId);
        marker.setAttribute(CONSTRAINT_ID, getConstraintId());
        int markerSeverity = IMarker.SEVERITY_INFO;
        if (statusSeverity == IStatus.WARNING) {
            markerSeverity = IMarker.SEVERITY_WARNING;
        } else if (statusSeverity == IStatus.ERROR
                || statusSeverity == IStatus.CANCEL) {
            markerSeverity = IMarker.SEVERITY_ERROR;
        }
        marker.setAttribute(IMarker.SEVERITY, markerSeverity);
    } catch (final CoreException e) {
        ProcessDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
    }
}
 
Example 18
Source File: ReporterMessagePlacementStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static int severityFromIMarkerSeverity(int imarkerSeverity) {
  switch (imarkerSeverity) {
    case IMarker.SEVERITY_ERROR:
      return IMessage.HIGH_SEVERITY;

    case IMarker.SEVERITY_WARNING:
      return IMessage.NORMAL_SEVERITY;

    case IMarker.SEVERITY_INFO:
      return IMessage.LOW_SEVERITY;

    default:
      return IMessage.LOW_SEVERITY;
  }
}
 
Example 19
Source File: JsonSchemaValidator.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public static int getLevel(JsonNode message) {
    if (message == null || !message.has("level")) {
        return IMarker.SEVERITY_INFO;
    }

    switch (message.get("level").asText()) {
    case "error":
    case "fatal":
        return IMarker.SEVERITY_ERROR;
    case "warning":
        return IMarker.SEVERITY_WARNING;
    default:
        return IMarker.SEVERITY_INFO;
    }
}
 
Example 20
Source File: ProblemCollector.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
public void refreshProblems() {
	if (resource == null) {
		// Collector is not active.
		return;
	}
	try {
		resource.deleteMarkers(markerType, true, IResource.DEPTH_ZERO);
		for (IValidationProblem problem : problems) {
			IMarker marker = resource.createMarker(problem.getMarkerType());
			marker.setAttribute(IMarker.CHAR_START, problem.getSourceStart());
			marker.setAttribute(IMarker.CHAR_END, problem.getSourceEnd());
			int severity;
			if (problem.isError()) {
				severity = IMarker.SEVERITY_ERROR;
			} else if (problem.isWarning()) {
				severity = IMarker.SEVERITY_WARNING;
			} else {
				severity = IMarker.SEVERITY_INFO;
			}
			marker.setAttribute(IMarker.SEVERITY, severity);
			marker.setAttribute(IMarker.MESSAGE, problem.getMessage());
		}
		problems.clear();
	} catch (CoreException e) {
		Logger.sys.error("Error while refreshing problem markers", e); //$NON-NLS-1$
	}
}