protected void synthesizeIssuesForFollowUpErrors(Resource resource, List<Issue> result) { List<EObject> contents = resource.getContents(); if (!contents.isEmpty()) { IResolvedTypes resolvedTypes = typeResolver.resolveTypes(contents.get(0)); for(ILinkingCandidate linkingCandidate: resolvedTypes.getFollowUpErrors()) { XExpression expression = linkingCandidate.getExpression(); IssueImpl issue = new Issue.IssueImpl(); issue.setUriToProblem(EcoreUtil.getURI(linkingCandidate.getExpression())); if (expression instanceof XAbstractFeatureCall) issue.setMessage(((XAbstractFeatureCall) expression).getConcreteSyntaxFeatureName() + " cannot be resolved"); else { List<INode> nodes = NodeModelUtils.findNodesForFeature(expression, XbasePackage.Literals.XCONSTRUCTOR_CALL__CONSTRUCTOR); if (nodes.size() >= 1) { issue.setMessage(nodes.get(0).getText() + " cannot be resolved"); } } result.add(issue); } } }
@Override public void convertResourceDiagnostic(Diagnostic diagnostic, Severity severity, IAcceptor<Issue> acceptor) { IssueImpl issue = new Issue.IssueImpl(); issue.setSyntaxError(diagnostic instanceof XtextSyntaxDiagnostic); issue.setSeverity(severity); issue.setLineNumber(diagnostic.getLine()); issue.setColumn(diagnostic.getColumn()); issue.setMessage(diagnostic.getMessage()); if (diagnostic instanceof org.eclipse.xtext.diagnostics.Diagnostic) { org.eclipse.xtext.diagnostics.Diagnostic xtextDiagnostic = (org.eclipse.xtext.diagnostics.Diagnostic) diagnostic; issue.setOffset(xtextDiagnostic.getOffset()); issue.setLength(xtextDiagnostic.getLength()); } if (diagnostic instanceof AbstractDiagnostic) { AbstractDiagnostic castedDiagnostic = (AbstractDiagnostic)diagnostic; issue.setUriToProblem(castedDiagnostic.getUriToProblem()); issue.setCode(castedDiagnostic.getCode()); issue.setData(castedDiagnostic.getData()); } issue.setType(CheckType.FAST); acceptor.accept(issue); }
@Override public void convertValidatorDiagnostic(org.eclipse.emf.common.util.Diagnostic diagnostic, IAcceptor<Issue> acceptor) { Severity severity = getSeverity(diagnostic); if (severity == null) return; IssueImpl issue = new Issue.IssueImpl(); issue.setSeverity(severity); IssueLocation locationData = getLocationData(diagnostic); if (locationData != null) { issue.setLineNumber(locationData.lineNumber); issue.setColumn(locationData.column); issue.setOffset(locationData.offset); issue.setLength(locationData.length); } final EObject causer = getCauser(diagnostic); if (causer != null) issue.setUriToProblem(EcoreUtil.getURI(causer)); issue.setCode(getIssueCode(diagnostic)); issue.setType(getIssueType(diagnostic)); issue.setData(getIssueData(diagnostic)); // marker.put(IXtextResourceChecker.DIAGNOSTIC_KEY, diagnostic); issue.setMessage(diagnostic.getMessage()); // marker.put(IMarker.PRIORITY, Integer.valueOf(IMarker.PRIORITY_LOW)); acceptor.accept(issue); }
protected SCTIssue getSubDiagramIssue(View view) { if (SemanticHints.STATE.equals(view.getType())) { BooleanValueStyle style = GMFNotationUtil.getBooleanValueStyle(view, DiagramPartitioningUtil.INLINE_STYLE); if (style == null ? false : !style.isBooleanValue()) { EObject element = view.getElement(); TreeIterator<EObject> eAllContents = element.eAllContents(); while (eAllContents.hasNext()) { EObject next = eAllContents.next(); if(next instanceof Transition && next.eContainer() == element) { eAllContents.prune(); continue; } String semanticURI = EcoreUtil.getURI(next).fragment(); List<SCTIssue> issues = store.getIssues(semanticURI); for (final SCTIssue issue : issues) { if (Severity.ERROR.equals(issue.getSeverity())) { IssueImpl result = new Issue.IssueImpl(); result.setMessage(SUB_DIAGRAM_ERRORS); result.setSeverity(Severity.ERROR); return new SCTIssue(result, issue.getSemanticURI()); } } } } } return null; }