From: Tuukka Lehtonen Date: Fri, 13 Jan 2017 06:56:18 +0000 (+0200) Subject: Preliminary support for purely Variable based dynamic issue sources X-Git-Tag: v1.27.0~21 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F270%2F5;p=simantics%2Fplatform.git Preliminary support for purely Variable based dynamic issue sources refs #6948 Change-Id: I7da7446a57a3da7836b59eb2e2c3dc60858818bf --- diff --git a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveModelIssueSources.java b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveModelIssueSources.java index 40d7f2ec3..1803d4274 100644 --- a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveModelIssueSources.java +++ b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveModelIssueSources.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Association for Decentralized Information Management + * Copyright (c) 2007, 2017 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - #6948 *******************************************************************************/ package org.simantics.issues.common; @@ -16,18 +17,17 @@ import java.util.Collection; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; -import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.common.request.ResourceRead2; import org.simantics.db.exception.DatabaseException; -import org.simantics.issues.ontology.IssueResource; import org.simantics.operation.Layer0X; /** * @author Tuukka Lehtonen */ -public class ActiveModelIssueSources extends ResourceRead> { +public class ActiveModelIssueSources extends ResourceRead2> { - public ActiveModelIssueSources(Resource resource) { - super(resource); + public ActiveModelIssueSources(Resource resource, Resource expectedSourceType) { + super(resource, expectedSourceType); } @Override @@ -36,7 +36,7 @@ public class ActiveModelIssueSources extends ResourceRead> new ObjectsWithType( resource, Layer0X.getInstance(graph).Activates, - IssueResource.getInstance(graph).ContinuousIssueSource) + resource2) ); } diff --git a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveProjectIssueSources.java b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveProjectIssueSources.java index 3f593e643..b44e80f74 100644 --- a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveProjectIssueSources.java +++ b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/ActiveProjectIssueSources.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Association for Decentralized Information Management + * Copyright (c) 2007, 2017 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - #6948 *******************************************************************************/ package org.simantics.issues.common; @@ -16,28 +17,26 @@ import java.util.Collection; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.common.request.ResourceRead2; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.ActiveModels; /** * @author Tuukka Lehtonen */ -public class ActiveProjectIssueSources extends ResourceRead> { +public class ActiveProjectIssueSources extends ResourceRead2> { - public ActiveProjectIssueSources(Resource resource) { - super(resource); + public ActiveProjectIssueSources(Resource resource, Resource expectedType) { + super(resource, expectedType); } @Override public Collection perform(ReadGraph graph) throws DatabaseException { - - ArrayList result = new ArrayList(); - for(Resource model : graph.sync(new ActiveModels(resource))) { - result.addAll(graph.sync(new ActiveModelIssueSources(model))); - } - return result; - + ArrayList result = new ArrayList<>(); + for (Resource model : graph.syncRequest(new ActiveModels(resource))) { + result.addAll(graph.syncRequest(new ActiveModelIssueSources(model, resource2))); + } + return result; } } diff --git a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/DynamicIssueSources.java b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/DynamicIssueSources.java new file mode 100644 index 000000000..c0b0adee6 --- /dev/null +++ b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/DynamicIssueSources.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2017 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.issues.common; + +import java.util.Set; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.request.PossibleVariable; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.issues.ontology.IssueResource; + +import gnu.trove.set.hash.THashSet; + +/** + * @author Tuukka Lehtonen + * @since 1.27 + */ +public class DynamicIssueSources extends ResourceRead> { + + public DynamicIssueSources(Resource project) { + super(project); + } + + @Override + public Set perform(ReadGraph graph) throws DatabaseException { + IssueResource ISSUE = IssueResource.getInstance(graph); + Set result = new THashSet<>(); + for (Resource source : graph.syncRequest(new ActiveProjectIssueSources(resource, ISSUE.DynamicIssueSource))) { + boolean selected = graph.hasStatement(source, ISSUE.IssueSource_Selected); + if (!selected) + continue; + Variable v = graph.syncRequest(new PossibleVariable(source)); + if (v != null) + result.add(v); + } + return result; + } + +} diff --git a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/IssueUtils.java b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/IssueUtils.java index 866323bab..bb0c8a5b1 100644 --- a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/IssueUtils.java +++ b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/IssueUtils.java @@ -278,7 +278,7 @@ public class IssueUtils { public static Disposable listenActiveProjectIssueSources(RequestProcessor processor, Resource project) throws DatabaseException { final AtomicBoolean disposed = new AtomicBoolean(false); processor.syncRequest( - new ActiveProjectIssueSources(project), + new ActiveProjectIssueSources(project, IssueResource.getInstance(processor).ContinuousIssueSource), new ActiveIssueSourceListener(disposed)); return new Disposable() { @Override diff --git a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/SelectedModelBatchIssueSources.java b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/SelectedModelBatchIssueSources.java index 9d2df7a04..9931ec64b 100644 --- a/bundles/org.simantics.issues.common/src/org/simantics/issues/common/SelectedModelBatchIssueSources.java +++ b/bundles/org.simantics.issues.common/src/org/simantics/issues/common/SelectedModelBatchIssueSources.java @@ -33,13 +33,13 @@ public class SelectedModelBatchIssueSources extends ResourceRead perform(ReadGraph graph) throws DatabaseException { - Layer0 L0 = Layer0.getInstance(graph); - IssueResource ISSUE = IssueResource.getInstance(graph); - ArrayList result = new ArrayList(); - for(Resource issueSource : graph.sync(new ObjectsWithType(resource, L0.ConsistsOf, ISSUE.IssueSource))) { - if(graph.hasStatement(issueSource, ISSUE.IssueSource_Selected)) result.add(issueSource); - } - return result; + Layer0 L0 = Layer0.getInstance(graph); + IssueResource ISSUE = IssueResource.getInstance(graph); + ArrayList result = new ArrayList<>(); + for(Resource issueSource : graph.sync(new ObjectsWithType(resource, L0.ConsistsOf, ISSUE.IssueSource))) { + if(graph.hasStatement(issueSource, ISSUE.IssueSource_Selected)) result.add(issueSource); + } + return result; } } diff --git a/bundles/org.simantics.issues.ontology/graph.tg b/bundles/org.simantics.issues.ontology/graph.tg index 23e0bb966..d0ad31bf4 100644 Binary files a/bundles/org.simantics.issues.ontology/graph.tg and b/bundles/org.simantics.issues.ontology/graph.tg differ diff --git a/bundles/org.simantics.issues.ontology/graph/Issue.pgraph b/bundles/org.simantics.issues.ontology/graph/Issue.pgraph index f97f68240..3d428ed59 100644 --- a/bundles/org.simantics.issues.ontology/graph/Issue.pgraph +++ b/bundles/org.simantics.issues.ontology/graph/Issue.pgraph @@ -24,6 +24,9 @@ ISSUE.IssueSource -- ISSUE.ContinuousIssueSource.lastUpdateRevision --> L0.Long -- ISSUE.Issue.HasContext -- ACTIONS.SetSeverityAction.HasSeverity --> ISSUE.Severity -- IBC.SeverityFolderRule.HasSeverity --> ISSUE.Severity -- IBC.SeverityChildRule.HasSeverity --> ISSUE.Severity -- IBC.SeverityFolderLabelRule.HasSeverity --> ISSUE.Severity -- ACTIONS.SetSeverityAction.HasSeverity --> ISSUE.Severity + class="org.simantics.issues.ui.IssueImageRule"> + + @@ -45,8 +47,7 @@ class="org.simantics.issues.ui.contribution.IssueContextDropAction" /> - - + @@ -55,8 +56,11 @@ class="org.simantics.issues.ui.SeverityChildRule"> - - + + + @@ -74,7 +78,7 @@ - - + + - \ No newline at end of file + diff --git a/bundles/org.simantics.issues.ui/plugin.xml b/bundles/org.simantics.issues.ui/plugin.xml index 88623c5b2..e67d2e12b 100644 --- a/bundles/org.simantics.issues.ui/plugin.xml +++ b/bundles/org.simantics.issues.ui/plugin.xml @@ -156,7 +156,7 @@ id="org.simantics.issues.actions"> diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/DynamicIssueSourceHierarchyRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/DynamicIssueSourceHierarchyRule.java new file mode 100644 index 000000000..0e6120951 --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/DynamicIssueSourceHierarchyRule.java @@ -0,0 +1,34 @@ +package org.simantics.issues.ui; + +import java.util.Collection; +import java.util.Collections; + +import org.simantics.browsing.ui.model.children.ChildRule; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; + +/** + * @author Tuukka Lehtonen + * @since 1.27 + */ +public class DynamicIssueSourceHierarchyRule implements ChildRule { + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(Variable.class); + } + + @Override + public Collection getChildren(ReadGraph graph, Object parent) throws DatabaseException { + Variable v = (Variable) parent; + return v.getChildren(graph); + } + + @Override + public Collection getParents(ReadGraph graph, Object child) throws DatabaseException { + Variable parent = ((Variable)child).getParent(graph); + return parent != null ? Collections.singleton(parent) : Collections.emptyList(); + } + +} diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/DynamicIssueSourceRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/DynamicIssueSourceRule.java new file mode 100644 index 000000000..3a62551eb --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/DynamicIssueSourceRule.java @@ -0,0 +1,33 @@ +package org.simantics.issues.ui; + +import java.util.Collection; +import java.util.Collections; + +import org.simantics.browsing.ui.model.children.ChildRule; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.issues.common.DynamicIssueSources; + +/** + * @author Tuukka Lehtonen + * @since 1.27 + */ +public class DynamicIssueSourceRule implements ChildRule { + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(Resource.class); + } + + @Override + public Collection getChildren(ReadGraph graph, Object parent) throws DatabaseException { + return graph.syncRequest(new DynamicIssueSources((Resource) parent)); + } + + @Override + public Collection getParents(ReadGraph graph, Object child) throws DatabaseException { + return Collections.singleton(child); + } + +} diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java index b19a1f711..10de114c7 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Association for Decentralized Information Management + * Copyright (c) 2007, 2017 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - #6948 *******************************************************************************/ package org.simantics.issues.ui; @@ -31,6 +32,25 @@ public class IssueImageRule implements ImageRule { private final String DESCRIPTION = ColumnKeys.SINGLE; + private final ImageDescriptor tick; + private final ImageDescriptor fatal; + private final ImageDescriptor error; + private final ImageDescriptor warning; + private final ImageDescriptor info; + private final ImageDescriptor note; + private final ImageDescriptor help; + + public IssueImageRule(ReadGraph graph) throws DatabaseException { + SilkResources SILK = SilkResources.getInstance(graph); + tick = graph.adapt(SILK.tick, ImageDescriptor.class); + fatal = graph.adapt(SILK.bomb, ImageDescriptor.class); + error = graph.adapt(SILK.exclamation, ImageDescriptor.class); + warning = graph.adapt(SILK.error, ImageDescriptor.class); + info = graph.adapt(SILK.information, ImageDescriptor.class); + note = graph.adapt(SILK.note, ImageDescriptor.class); + help = graph.adapt(SILK.help, ImageDescriptor.class); + } + @Override public boolean isCompatible(Class contentType) { return contentType.equals(Variable.class); @@ -38,26 +58,32 @@ public class IssueImageRule implements ImageRule { @Override public Map getImage(ReadGraph graph, Object content) throws DatabaseException { + Variable issue = (Variable) content; + String severity = issue.getPossiblePropertyValue(graph, "severity"); + if (severity == null) + return Collections.emptyMap(); + boolean resolved = isResolved(graph, issue); + return Collections.singletonMap(DESCRIPTION, resolved ? tick : toImageDescriptor(severity)); + } - Variable issue = (Variable)content; - - IssueResource ISSUE = IssueResource.getInstance(graph); - SilkResources SILK = SilkResources.getInstance(graph); - String severity = issue.getPropertyValue(graph, "severity"); - - // TODO: now to do this with variables? + public boolean isResolved(ReadGraph graph, Variable issue) throws DatabaseException { Resource issueResource = issue.getPossibleRepresents(graph); - boolean resolved = issueResource != null ? graph.hasStatement(issueResource, ISSUE.Resolved) : false; - if (resolved) - return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.tick, ImageDescriptor.class)); + if (issueResource != null) + return graph.hasStatement(issueResource, IssueResource.getInstance(graph).Resolved); - if("Fatal".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.bomb, ImageDescriptor.class)); - else if("Error".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.exclamation, ImageDescriptor.class)); - else if("Warning".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.error, ImageDescriptor.class)); - else if("Info".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.information, ImageDescriptor.class)); - else if("Note".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.note, ImageDescriptor.class)); - else return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.help, ImageDescriptor.class)); + Boolean resolved = issue.getPossiblePropertyValue(graph, "resolved"); + return Boolean.TRUE.equals(resolved); + } + private ImageDescriptor toImageDescriptor(String severity) { + switch (severity) { + case "Fatal": return fatal; + case "Error": return error; + case "Warning": return warning; + case "Info": return info; + case "Note": return note; + default: return help; + } } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java index 1a58f4d81..1d9b1099c 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java @@ -39,8 +39,6 @@ public class IssueLabelRule implements LabelRule { public Map getLabel(ReadGraph graph, Object content) throws DatabaseException { Variable issue = (Variable)content; - //Layer0 L0 = Layer0.getInstance(graph); - //IssueResource ISSUE = IssueResource.getInstance(graph); String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/ModeledActions.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/ModeledActions.java deleted file mode 100644 index 84118d08a..000000000 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/ModeledActions.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.simantics.issues.ui; - -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - -import org.simantics.issues.ui.ontology.IssueUIResource; - -public class ModeledActions extends org.simantics.modeling.ui.actions.ModeledActions { - - final static public Set browseContexts = Collections.singleton(IssueUIResource.URIs.ActionContext); - - public Collection getBrowseContexts() { - return browseContexts; - } - -} diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java index d2e257211..803324613 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java @@ -31,6 +31,7 @@ import org.simantics.Simantics; import org.simantics.SleepingDatabaseJob; import org.simantics.db.Issue; import org.simantics.db.ReadGraph; +import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.common.request.Queries; @@ -66,7 +67,7 @@ public class RunActiveValidations extends AbstractHandler { final Session session = Simantics.getSession(); // 1. query for which composites to run the validation - final Collection validations = new ArrayList(); + final Collection validations = new ArrayList<>(); final BatchIssueValidationContext context = new BatchIssueValidationContext(); try { @@ -79,12 +80,9 @@ public class RunActiveValidations extends AbstractHandler { Resource model = session.sync(new PossibleActiveModel(Simantics.getProjectResource())); if(model == null) return; - Collection activeSources = session.syncRequest(new SelectedModelBatchIssueSources(model)); - for(Resource source : activeSources) { - BatchIssueSource bis = session.syncRequest(Queries.adapt(source, BatchIssueSource.class, true)); - if(bis != null) - validations.add(bis); - } + toBatchIssueSources(session, + session.syncRequest(new SelectedModelBatchIssueSources(model)), + validations); SubMonitor.convert(monitor, "Preparing resources for validation", 100); context.contexts = Collections.singletonList(model); @@ -111,12 +109,21 @@ public class RunActiveValidations extends AbstractHandler { // Operation cancelled, ignore. return; } - + if(!validations.isEmpty() && !context.contexts.isEmpty()) run(postValidation, validations, context); } + static Collection toBatchIssueSources(RequestProcessor processor, Collection sources, Collection result) throws DatabaseException { + for (Resource source : sources) { + BatchIssueSource bis = processor.syncRequest(Queries.adapt(source, BatchIssueSource.class, true)); + if (bis != null) + result.add(bis); + } + return result; + } + public static void run(Runnable postValidation, final Collection validations, final BatchIssueValidationContext context) { // Run the validations for the selected composites SleepingDatabaseJob dbLock = new SleepingDatabaseJob("Validation"); @@ -139,7 +146,7 @@ public class RunActiveValidations extends AbstractHandler { @Override public Collection perform(ReadGraph graph) throws DatabaseException { IssueResource ISSUE = IssueResource.getInstance(graph); - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (Resource issue : graph.syncRequest(new ManagedIssues(resource))) { Resource list = graph.getSingleObject(issue, ISSUE.Issue_HasContexts); List l = ListUtils.toList(graph, list); diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/UpdateIssuesForOpenDiagrams.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/UpdateIssuesForOpenDiagrams.java index 9b2040c4b..0f7cec48d 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/UpdateIssuesForOpenDiagrams.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/UpdateIssuesForOpenDiagrams.java @@ -34,7 +34,6 @@ import org.simantics.browsing.ui.common.ErrorLogger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; -import org.simantics.db.common.request.Queries; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.ActiveModels; @@ -67,7 +66,7 @@ public class UpdateIssuesForOpenDiagrams extends AbstractHandler { } public static void update(Runnable postValidation) throws DatabaseException, PartInitException { - final List inputs = new ArrayList(); + final List inputs = new ArrayList<>(); IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow wb : windows) { IWorkbenchPage pages[] = wb.getPages(); @@ -82,9 +81,9 @@ public class UpdateIssuesForOpenDiagrams extends AbstractHandler { } } - final Set compositesToValidate = new TreeSet(); - final Collection validations = new ArrayList(); - final Collection activeModels = new ArrayList(); + final Set compositesToValidate = new TreeSet<>(); + final Collection validations = new ArrayList<>(); + final Collection activeModels = new ArrayList<>(); final BatchIssueValidationContext context = new BatchIssueValidationContext(); try { @@ -98,11 +97,9 @@ public class UpdateIssuesForOpenDiagrams extends AbstractHandler { activeModels.addAll(session.syncRequest(new ActiveModels(project))); if(activeModels.size() != 1) return; - Collection activeSources = session.syncRequest(new SelectedModelBatchIssueSources(activeModels.iterator().next())); - for(Resource source : activeSources) { - BatchIssueSource bis = session.syncRequest(Queries.adapt(source, BatchIssueSource.class)); - validations.add(bis); - } + RunActiveValidations.toBatchIssueSources(session, + session.syncRequest(new SelectedModelBatchIssueSources(activeModels.iterator().next())), + validations); session.syncRequest(new ReadRequest() { @Override