]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/ui/DiagramModelHints.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / ui / DiagramModelHints.java
diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/ui/DiagramModelHints.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/ui/DiagramModelHints.java
new file mode 100644 (file)
index 0000000..07cd719
--- /dev/null
@@ -0,0 +1,104 @@
+/*******************************************************************************\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.ui;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.UndoContext;\r
+import org.simantics.db.common.ResourceArray;\r
+import org.simantics.diagram.adapter.ConnectionVisualsLoader;\r
+import org.simantics.diagram.adapter.ElementFactory;\r
+import org.simantics.diagram.adapter.IDiagramLoader;\r
+import org.simantics.diagram.synchronization.graph.ElementLoader;\r
+import org.simantics.diagram.synchronization.graph.ElementWriter;\r
+import org.simantics.g2d.canvas.ICanvasContext;\r
+import org.simantics.g2d.diagram.IDiagram;\r
+import org.simantics.simulation.experiment.IExperiment;\r
+import org.simantics.structural2.modelingRules.IModelingRules;\r
+import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
+import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
+\r
+/**\r
+ * \r
+ * @Author Toni Kalajainen\r
+ */\r
+public class DiagramModelHints {\r
+\r
+    public static final Key KEY_DIAGRAM_RESOURCE = new KeyOf(Resource.class, "DIAGRAM_RESOURCE");\r
+\r
+    public static final Key KEY_DIAGRAM_MODEL_URI = new KeyOf(String.class, "DIAGRAM_MODEL_URI");\r
+\r
+    public static final Key KEY_DIAGRAM_RUNTIME_RESOURCE = new KeyOf(Resource.class, "DIAGRAM_RUNTIME_RESOURCE");\r
+\r
+    public static final Key KEY_DIAGRAM_RESOURCE_ARRAY = new KeyOf(ResourceArray.class, "DIAGRAM_RESOURCE_ARRAY");\r
+\r
+    /**\r
+     * A hint for defining and extra pass for loading/initializing an element\r
+     * after the current pass. It is possible to request for infinitely many\r
+     * passes by always setting a new ElementLoader hint into the loaded element\r
+     * during loading. The loading process will loop until none of the loaded\r
+     * elements have a loader hint. An {@link ElementFactory} or\r
+     * {@link ElementLoader} is only allowed to set this hint on the element it\r
+     * is loading, not on any other element.\r
+     */\r
+    public static final Key KEY_ELEMENT_LOADER = new KeyOf(ElementLoader.class, "ELEMENT_LOADER");\r
+\r
+    /**\r
+     * Allows customizable external control over how the an IElement gets\r
+     * written into backing storage (graph) when it is added to a diagram.\r
+     * \r
+     * This hint will be removed after it has been used by the synchronizer.\r
+     */\r
+    public static final Key KEY_ELEMENT_WRITER = new KeyOf(ElementWriter.class, "ELEMENT_WRITER");\r
+\r
+    /**\r
+     * TODO: what is this for?\r
+     */\r
+    public static final Key KEY_ACTIVE_EXPERIMENT = new KeyOf(IExperiment.class, "ACTIVE_EXPERIMENT");\r
+\r
+    /**\r
+     * Operating UI requires this for some unknown reason.\r
+     * TODO: find out what this is\r
+     */\r
+    public static final Key KEY_SESSION_ID = new KeyOf(String.class, "SESSION_ID");\r
+\r
+    /**\r
+     * Externally definable rules for topological modeling, i.e. how nodes and\r
+     * edges and their connectivity is bounded.\r
+     */\r
+    public static final Key KEY_MODELING_RULES = new KeyOf(IModelingRules.class, "MODELING_RULES");\r
+\r
+    /**\r
+     * For customizing how connection segments are loaded for a diagram. Give\r
+     * this hint as an initial hint to {@link IDiagramLoader} to use your own\r
+     * version in diagram loading.\r
+     */\r
+    public static final Key KEY_CONNECTION_VISUALS_LOADER = new KeyOf(ConnectionVisualsLoader.class, "CONNECTION_VISUALS_LOADER");\r
+\r
+    /**\r
+     * For storing an {@link UndoContext} in {@link IDiagram} or\r
+     * {@link ICanvasContext}.\r
+     * \r
+     * @deprecated to be removed down, do not use anymore\r
+     */\r
+    public static final Key KEY_UNDO_CONTEXT = new KeyOf(UndoContext.class, "UNDO_CONTEXT");\r
+\r
+    /**\r
+     * An informational hint that functions only as a trigger for listeners to\r
+     * tell that the diagram contents have changed and that the changes have\r
+     * been noticed and updated into the runtime diagram model ({@link IDiagram}\r
+     * ). The hint is given the value {@link Boolean#TRUE} every time the update\r
+     * happens, i.e. the value is of no importance, only the trigger aspect is.\r
+     */\r
+    public static final Key KEY_DIAGRAM_CONTENTS_UPDATED = new KeyOf(Boolean.class, "DIAGRAM_CONTENTS_UPDATED");\r
+\r
+\r
+}\r