public String getIssueCode() { return issue.getCode(); }
public boolean apply(Issue input) { return issuecode.equals(input.getCode()); } });
public boolean apply(Issue input) { return issuecode.equals(input.getCode()); } });
protected List<Method> getFixMethods(final Issue issue) { return Lists.newArrayList(collectMethods(getClass(), issue.getCode())); }
@Override public void accept(Issue issue) { //XXX This is a workaround of some classpath validation issue reported, but there is no available reproduction if (ignoredIssues.contains(issue.getCode())) { // Ignored issue kinds are not added to the sets return; } switch (issue.getSeverity()) { case ERROR: foundErrors.add(issue); break; case WARNING: foundWarnings.add(issue); break; case INFO: case IGNORE: break; } }
@Override public boolean apply(Issue input) { if (issuecode.equals(input.getCode())) { return userData == null || Arrays.contains(input.getData(), userData); } return false; } });
/** * @since 2.4 */ protected StringBuilder getIssuesAsString(final EObject model, final Iterable<Issue> issues, StringBuilder result) { for(Issue issue: issues) { EObject eObject = model.eResource().getResourceSet().getEObject(issue.getUriToProblem(), true); result.append(issue.getSeverity()) .append(" (") .append(issue.getCode()) .append(") '") .append(issue.getMessage()) .append("' on ") .append(eObject.eClass().getName()) .append("\n"); } return result; }
/** * @since 2.8 */ protected StringBuilder doGetIssuesAsString(Resource resource, final Iterable<Issue> issues, StringBuilder result) { for (Issue issue : issues) { URI uri = issue.getUriToProblem(); result.append(issue.getSeverity()); result.append(" ("); result.append(issue.getCode()); result.append(") '"); result.append(issue.getMessage()); result.append("'"); if (uri != null) { EObject eObject = resource.getResourceSet().getEObject(uri, true); result.append(" on "); result.append(eObject.eClass().getName()); } result.append(", offset " + issue.getOffset() + ", length " + issue.getLength()); result.append("\n"); } return result; }
@Override public List<IssueResolution> getResolutions(Issue issue) { StopWatch stopWatch = new StopWatch(logger); try { if (Diagnostic.LINKING_DIAGNOSTIC.equals(issue.getCode())) { List<IssueResolution> result = new ArrayList<IssueResolution>(); result.addAll(getResolutionsForLinkingIssue(issue)); result.addAll(super.getResolutions(issue)); return result; } else return super.getResolutions(issue); } finally { stopWatch.resetAndLog("#getResolutions"); } }
@Override public boolean apply(Issue input) { if (issuecode.equals(input.getCode())) { EObject object = resource.getEObject(input.getUriToProblem().fragment()); if (objectType.isInstance(object)) { return true; } } return false; } });
public boolean apply(Issue input) { if (issuecode.equals(input.getCode())) { EObject object = root.eResource().getEObject(input.getUriToProblem().fragment()); if (objectType.isInstance(object)) { return true; } } return false; } });
public boolean apply(Issue input) { if (Strings.equal(input.getCode(), code) && input.getSeverity()==severity) { EObject object = model.eResource().getResourceSet().getEObject(input.getUriToProblem(), true); if (objectType.isInstance(object)) { for (String messagePart : messageParts) { if (!input.getMessage().toLowerCase().contains(messagePart.toLowerCase())) { return false; } } return true; } } return false; } });
public boolean apply(Issue input) { if (Strings.equal(input.getCode(), code) && input.getSeverity()==severity) { EObject object = model.eResource().getResourceSet().getEObject(input.getUriToProblem(), true); if (objectType.isInstance(object)) { for (String messagePart : messageParts) { if (!input.getMessage().toLowerCase().contains(messagePart.toLowerCase())) { return false; } } return true; } } return false; } });
@Override public boolean apply(Issue input) { if (Strings.equal(input.getCode(), code) && input.getSeverity()==severity) { if ((offset < 0 || offset == input.getOffset()) && (length < 0 || length == input.getLength())) { EObject object = resource.getResourceSet().getEObject(input.getUriToProblem(), true); if (objectType.isInstance(object)) { for (String messagePart : messageParts) { if (!input.getMessage().toLowerCase().contains(messagePart.toLowerCase())) { return false; } } return true; } } } return false; } });
protected Map<Annotation, Position> getAnnotationsToAdd(Multimap<Position, Annotation> positionToAnnotations, List<Issue> issues, IProgressMonitor monitor) { if (monitor.isCanceled()) { return HashBiMap.create(); } Map<Annotation, Position> annotationToPosition = Maps.newHashMapWithExpectedSize(issues.size()); for (Issue issue : issues) { if (monitor.isCanceled()) { return annotationToPosition; } if (isSet(issue.getOffset()) && isSet(issue.getLength()) && issue.getMessage() != null) { String type = lookup.getAnnotationType(EValidator.MARKER, getMarkerSeverity(issue.getSeverity())); boolean isQuickfixable = false; if (issueResolutionProvider instanceof IssueResolutionProviderExtension) { isQuickfixable = ((IssueResolutionProviderExtension)issueResolutionProvider).hasResolutionFor(issue); } else { isQuickfixable = issueResolutionProvider.hasResolutionFor(issue.getCode()); } Annotation annotation = new XtextAnnotation(type, false, xtextDocument, issue, isQuickfixable); if (issue.getOffset() < 0 || issue.getLength() < 0) { LOG.error("Invalid annotation position offset=" + issue.getOffset() + " length = " + issue.getLength()); } Position position = new Position(Math.max(0, issue.getOffset()), Math.max(0, issue.getLength())); annotationToPosition.put(annotation, position); positionToAnnotations.put(position, annotation); } } return annotationToPosition; }
/** Create a message for the issue. * * @param issue the issue. * @return the message. */ protected String createIssueMessage(Issue issue) { final IssueMessageFormatter formatter = getIssueMessageFormatter(); final org.eclipse.emf.common.util.URI uriToProblem = issue.getUriToProblem(); if (formatter != null) { final String message = formatter.format(issue, uriToProblem); if (message != null) { return message; } } if (uriToProblem != null) { final org.eclipse.emf.common.util.URI resourceUri = uriToProblem.trimFragment(); return MessageFormat.format(Messages.SarlBatchCompiler_4, issue.getSeverity(), resourceUri.lastSegment(), resourceUri.isFile() ? resourceUri.toFileString() : "", //$NON-NLS-1$ issue.getLineNumber(), issue.getColumn(), issue.getCode(), issue.getMessage()); } return MessageFormat.format(Messages.SarlBatchCompiler_5, issue.getSeverity(), issue.getLineNumber(), issue.getColumn(), issue.getCode(), issue.getMessage()); }
private Diagnostic toDiagnostic(final Issue issue) { Diagnostic _diagnostic = new Diagnostic(); final Procedure1<Diagnostic> _function = (Diagnostic it) -> { it.setCode(issue.getCode()); DiagnosticSeverity _switchResult = null; Severity _severity = issue.getSeverity();
/** * @since 2.0 */ protected void setMarkerAttributes(Issue issue, IResource resource, IMarker marker) throws CoreException { String lineNR = ""; if (issue.getLineNumber() != null) { lineNR = "line: " + issue.getLineNumber() + " "; } marker.setAttribute(IMarker.LOCATION, lineNR + resource.getFullPath().toString()); marker.setAttribute(Issue.CODE_KEY, issue.getCode()); marker.setAttribute(IMarker.SEVERITY, getSeverity(issue)); marker.setAttribute(IMarker.CHAR_START, issue.getOffset()); if(issue.getOffset() != null && issue.getLength() != null) marker.setAttribute(IMarker.CHAR_END, issue.getOffset()+issue.getLength()); marker.setAttribute(IMarker.LINE_NUMBER, issue.getLineNumber()); marker.setAttribute(IMarker.MESSAGE, issue.getMessage()); if (issue.getUriToProblem()!=null) marker.setAttribute(Issue.URI_KEY, issue.getUriToProblem().toString()); if(issue.getData() != null && issue.getData().length > 0) { marker.setAttribute(Issue.DATA_KEY, Strings.pack(issue.getData())); } if (resolutionProvider != null && resolutionProvider.hasResolutionFor(issue.getCode())) { marker.setAttribute(FIXABLE_KEY, true); } }