import java.io.IOException;\r
import java.util.ArrayList;\r
import java.util.Collection;\r
+import java.util.Collections;\r
import java.util.HashMap;\r
+import java.util.Map;\r
+import java.util.Set;\r
\r
import org.eclipse.core.commands.AbstractHandler;\r
import org.eclipse.core.commands.ExecutionEvent;\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.core.runtime.SubMonitor;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.FileDialog;\r
import org.eclipse.swt.widgets.MessageBox;\r
import org.eclipse.swt.widgets.Shell;\r
import org.eclipse.ui.handlers.HandlerUtil;\r
+import org.simantics.Simantics;\r
import org.simantics.databoard.binding.Binding;\r
import org.simantics.databoard.container.DataContainer;\r
import org.simantics.databoard.container.DataContainers;\r
import org.simantics.databoard.container.DataFormatException;\r
import org.simantics.databoard.container.FormatHandler;\r
+import org.simantics.db.Issue;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
+import org.simantics.db.Session;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler;\r
import org.simantics.db.layer0.adapter.impl.DefaultPasteImportAdvisor;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
+import org.simantics.db.request.Read;\r
import org.simantics.graph.representation.TransferableGraph1;\r
+import org.simantics.issues.common.AllBatchIssueSources;\r
+import org.simantics.issues.common.BatchIssueSource;\r
import org.simantics.issues.ontology.IssueResource;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
\r
});\r
\r
+ \r
+ Collection<Resource> confs = SimanticsUI.getSession().syncRequest(new Read<Collection<Resource>>() {\r
+\r
+ @Override\r
+ public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
+ return findAllConfigurations(graph, ModelRoot);\r
+ }\r
+\r
+ });\r
+\r
\r
+ // Batch validate all issue sources after import\r
try {\r
- BatchValidations.runAll(null, ModelRoot);\r
+ for(Resource conf : confs) {\r
+ /*\r
+ * This section is copied from BatchValidations.runAll. runAll did\r
+ * not find module types to validate.\r
+ */\r
+// BatchValidations.runAll(null, mod);\r
+\r
+ final Session session = Simantics.getSession();\r
+ final Collection<BatchIssueSource> validations = session.sync( new AllBatchIssueSources(ModelRoot) );\r
+ SubMonitor progress = SubMonitor.convert(null, "Validate Model", 100);\r
+ Collection<Resource> contexts = Collections.singletonList(conf);\r
+ for(BatchIssueSource bis : validations) {\r
+ Map<Resource, Set<Issue>> is = BatchValidations.validate(progress.newChild(90, SubMonitor.SUPPRESS_NONE), bis, contexts);\r
+ BatchValidations.store(progress.newChild(10, SubMonitor.SUPPRESS_NONE), bis.getResource(), is);\r
+ }\r
+ }\r
} catch(Throwable t) {\r
t.printStackTrace();\r
} \r