-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.diagram.query;\r
-\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.ResourceArray;\r
-import org.simantics.db.common.request.ResourceRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.diagram.adapter.IDiagramLoader;\r
-import org.simantics.g2d.diagram.IDiagram;\r
-import org.simantics.utils.datastructures.hints.IHintObservable;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class DiagramLoadQuery extends ResourceRead<IDiagram> {\r
-\r
- Resource model;\r
- Resource runtime;\r
- IProgressMonitor monitor;\r
- ResourceArray structuralPath;\r
- IDiagramLoader loader;\r
- IHintObservable initialHints;\r
-\r
- public DiagramLoadQuery(IProgressMonitor monitor, Resource model, Resource resource, Resource runtime, ResourceArray structuralPath, IDiagramLoader loader, IHintObservable initialHints) {\r
- super(resource);\r
-\r
-// if (runtime == null)\r
-// throw new IllegalArgumentException("null runtime diagram resource");\r
-\r
- this.model = model;\r
- this.runtime = runtime;\r
- this.monitor = monitor;\r
- this.structuralPath = structuralPath != null ? structuralPath : ResourceArray.EMPTY;\r
- this.loader = loader;\r
- this.initialHints = initialHints;\r
- }\r
-\r
- @Override\r
- public IDiagram perform(ReadGraph graph) throws DatabaseException {\r
- return loader.loadDiagram(monitor, graph, graph.getPossibleURI(model), resource, runtime, structuralPath, initialHints);\r
- }\r
-\r
- @Override\r
- public boolean equals(Object other) {\r
- // Make sure that we always receive a new result\r
- return this == other;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- return super.hashCode() + 31 * getClass().hashCode();\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.diagram.query;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.ResourceArray;
+import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.diagram.adapter.IDiagramLoader;
+import org.simantics.g2d.diagram.IDiagram;
+import org.simantics.utils.datastructures.hints.IHintObservable;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class DiagramLoadQuery extends ResourceRead<IDiagram> {
+
+ Resource model;
+ Resource runtime;
+ IProgressMonitor monitor;
+ ResourceArray structuralPath;
+ IDiagramLoader loader;
+ IHintObservable initialHints;
+
+ public DiagramLoadQuery(IProgressMonitor monitor, Resource model, Resource resource, Resource runtime, ResourceArray structuralPath, IDiagramLoader loader, IHintObservable initialHints) {
+ super(resource);
+
+// if (runtime == null)
+// throw new IllegalArgumentException("null runtime diagram resource");
+
+ this.model = model;
+ this.runtime = runtime;
+ this.monitor = monitor;
+ this.structuralPath = structuralPath != null ? structuralPath : ResourceArray.EMPTY;
+ this.loader = loader;
+ this.initialHints = initialHints;
+ }
+
+ @Override
+ public IDiagram perform(ReadGraph graph) throws DatabaseException {
+ return loader.loadDiagram(monitor, graph, graph.getPossibleURI(model), resource, runtime, structuralPath, initialHints);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ // Make sure that we always receive a new result
+ return this == other;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode() + 31 * getClass().hashCode();
+ }
+
+}