Search in sources :

Example 1 with SCTIssue

use of org.yakindu.sct.model.sgraph.ui.validation.SCTIssue in project statecharts by Yakindu.

the class DefaultResourceChangeToIssueProcessor method removeSCTIssue.

protected void removeSCTIssue(final IMarkerDelta iMarkerDelta, final String elementID) {
    final String message = (String) iMarkerDelta.getAttributes().get(IMarker.MESSAGE);
    final Iterator<SCTIssue> iterator = currentIssues.get(elementID).iterator();
    while (iterator.hasNext()) {
        final SCTIssue sctIssue = iterator.next();
        if (sctIssue.getMessage().equals(message)) {
            iterator.remove();
        }
    }
    changedIssuesElementIDs.add(elementID);
}
Also used : SCTIssue(org.yakindu.sct.model.sgraph.ui.validation.SCTIssue)

Example 2 with SCTIssue

use of org.yakindu.sct.model.sgraph.ui.validation.SCTIssue in project statecharts by Yakindu.

the class DefaultValidationIssueStore method processIssues.

@Override
public synchronized void processIssues(List<Issue> issues, IProgressMonitor monitor) {
    final Multimap<String, SCTIssue> newVisibleIssues = ArrayListMultimap.create();
    for (Issue issue : issues) {
        if (issue instanceof SCTIssue) {
            String semanticURI = ((SCTIssue) issue).getSemanticURI();
            newVisibleIssues.put(semanticURI, (SCTIssue) issue);
        }
    }
    final Multimap<String, SCTIssue> oldVisibleIssues = ArrayListMultimap.create();
    synchronized (visibleIssues) {
        oldVisibleIssues.putAll(visibleIssues);
        // normal and expensive checks will not be executed by the live
        // validation, so persistent markers have to be copied
        Iterable<SCTIssue> persistentIssues = Iterables.filter(visibleIssues.values(), new Predicate<SCTIssue>() {

            public boolean apply(SCTIssue input) {
                CheckType type = input.getType();
                Severity severity = input.getSeverity();
                return CheckType.NORMAL == type || CheckType.EXPENSIVE == type || Severity.INFO == severity;
            }
        });
        for (SCTIssue sctIssue : persistentIssues) {
            newVisibleIssues.put(sctIssue.getSemanticURI(), sctIssue);
        }
        visibleIssues.clear();
        visibleIssues.putAll(newVisibleIssues);
    }
    SetView<String> changes = Sets.symmetricDifference(oldVisibleIssues.keySet(), newVisibleIssues.keySet());
    for (String string : changes) {
        notifyListeners(string);
    }
    SetView<String> intersection = Sets.intersection(oldVisibleIssues.keySet(), newVisibleIssues.keySet());
    for (String string : intersection) {
        if (changedSeverity(string, oldVisibleIssues, newVisibleIssues) || changedErrorCount(string, oldVisibleIssues, newVisibleIssues)) {
            notifyListeners(string);
        }
    }
}
Also used : SCTIssue(org.yakindu.sct.model.sgraph.ui.validation.SCTIssue) Issue(org.eclipse.xtext.validation.Issue) SCTIssue(org.yakindu.sct.model.sgraph.ui.validation.SCTIssue) CheckType(org.eclipse.xtext.validation.CheckType) Severity(org.eclipse.xtext.diagnostics.Severity)

Example 3 with SCTIssue

use of org.yakindu.sct.model.sgraph.ui.validation.SCTIssue in project statecharts by Yakindu.

the class DefaultValidationIssueStore method initFromPersistentMarkers.

protected synchronized void initFromPersistentMarkers() {
    Multimap<String, SCTIssue> newVisibleIssues = ArrayListMultimap.create();
    List<IMarker> markers = getMarkersOfConnectedResource();
    for (IMarker iMarker : markers) {
        SCTIssue issue = issueCreator.createFromMarker(iMarker, iMarker.getAttribute(SCTMarkerType.SEMANTIC_ELEMENT_ID, ""));
        newVisibleIssues.put(issue.getSemanticURI(), issue);
    }
    synchronized (visibleIssues) {
        visibleIssues.clear();
        visibleIssues.putAll(newVisibleIssues);
    }
    notifyListeners();
}
Also used : SCTIssue(org.yakindu.sct.model.sgraph.ui.validation.SCTIssue) IMarker(org.eclipse.core.resources.IMarker)

Aggregations

SCTIssue (org.yakindu.sct.model.sgraph.ui.validation.SCTIssue)3 IMarker (org.eclipse.core.resources.IMarker)1 Severity (org.eclipse.xtext.diagnostics.Severity)1 CheckType (org.eclipse.xtext.validation.CheckType)1 Issue (org.eclipse.xtext.validation.Issue)1