]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/ui/DiagramModelHints.java
Logger fixes after merge commit:fdbe8762
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / ui / DiagramModelHints.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.diagram.ui;\r
13 \r
14 import org.simantics.db.Resource;\r
15 import org.simantics.db.UndoContext;\r
16 import org.simantics.db.common.ResourceArray;\r
17 import org.simantics.diagram.adapter.ConnectionVisualsLoader;\r
18 import org.simantics.diagram.adapter.ElementFactory;\r
19 import org.simantics.diagram.adapter.IDiagramLoader;\r
20 import org.simantics.diagram.synchronization.graph.ElementLoader;\r
21 import org.simantics.diagram.synchronization.graph.ElementWriter;\r
22 import org.simantics.g2d.canvas.ICanvasContext;\r
23 import org.simantics.g2d.diagram.IDiagram;\r
24 import org.simantics.simulation.experiment.IExperiment;\r
25 import org.simantics.structural2.modelingRules.IModelingRules;\r
26 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
27 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
28 \r
29 /**\r
30  * \r
31  * @Author Toni Kalajainen\r
32  */\r
33 public class DiagramModelHints {\r
34 \r
35     public static final Key KEY_DIAGRAM_RESOURCE = new KeyOf(Resource.class, "DIAGRAM_RESOURCE");\r
36 \r
37     public static final Key KEY_DIAGRAM_MODEL_URI = new KeyOf(String.class, "DIAGRAM_MODEL_URI");\r
38 \r
39     public static final Key KEY_DIAGRAM_RUNTIME_RESOURCE = new KeyOf(Resource.class, "DIAGRAM_RUNTIME_RESOURCE");\r
40 \r
41     public static final Key KEY_DIAGRAM_RESOURCE_ARRAY = new KeyOf(ResourceArray.class, "DIAGRAM_RESOURCE_ARRAY");\r
42 \r
43     /**\r
44      * A hint for defining and extra pass for loading/initializing an element\r
45      * after the current pass. It is possible to request for infinitely many\r
46      * passes by always setting a new ElementLoader hint into the loaded element\r
47      * during loading. The loading process will loop until none of the loaded\r
48      * elements have a loader hint. An {@link ElementFactory} or\r
49      * {@link ElementLoader} is only allowed to set this hint on the element it\r
50      * is loading, not on any other element.\r
51      */\r
52     public static final Key KEY_ELEMENT_LOADER = new KeyOf(ElementLoader.class, "ELEMENT_LOADER");\r
53 \r
54     /**\r
55      * Allows customizable external control over how the an IElement gets\r
56      * written into backing storage (graph) when it is added to a diagram.\r
57      * \r
58      * This hint will be removed after it has been used by the synchronizer.\r
59      */\r
60     public static final Key KEY_ELEMENT_WRITER = new KeyOf(ElementWriter.class, "ELEMENT_WRITER");\r
61 \r
62     /**\r
63      * TODO: what is this for?\r
64      */\r
65     public static final Key KEY_ACTIVE_EXPERIMENT = new KeyOf(IExperiment.class, "ACTIVE_EXPERIMENT");\r
66 \r
67     /**\r
68      * Operating UI requires this for some unknown reason.\r
69      * TODO: find out what this is\r
70      */\r
71     public static final Key KEY_SESSION_ID = new KeyOf(String.class, "SESSION_ID");\r
72 \r
73     /**\r
74      * Externally definable rules for topological modeling, i.e. how nodes and\r
75      * edges and their connectivity is bounded.\r
76      */\r
77     public static final Key KEY_MODELING_RULES = new KeyOf(IModelingRules.class, "MODELING_RULES");\r
78 \r
79     /**\r
80      * For customizing how connection segments are loaded for a diagram. Give\r
81      * this hint as an initial hint to {@link IDiagramLoader} to use your own\r
82      * version in diagram loading.\r
83      */\r
84     public static final Key KEY_CONNECTION_VISUALS_LOADER = new KeyOf(ConnectionVisualsLoader.class, "CONNECTION_VISUALS_LOADER");\r
85 \r
86     /**\r
87      * For storing an {@link UndoContext} in {@link IDiagram} or\r
88      * {@link ICanvasContext}.\r
89      * \r
90      * @deprecated to be removed down, do not use anymore\r
91      */\r
92     public static final Key KEY_UNDO_CONTEXT = new KeyOf(UndoContext.class, "UNDO_CONTEXT");\r
93 \r
94     /**\r
95      * An informational hint that functions only as a trigger for listeners to\r
96      * tell that the diagram contents have changed and that the changes have\r
97      * been noticed and updated into the runtime diagram model ({@link IDiagram}\r
98      * ). The hint is given the value {@link Boolean#TRUE} every time the update\r
99      * happens, i.e. the value is of no importance, only the trigger aspect is.\r
100      */\r
101     public static final Key KEY_DIAGRAM_CONTENTS_UPDATED = new KeyOf(Boolean.class, "DIAGRAM_CONTENTS_UPDATED");\r
102 \r
103 \r
104 }\r