]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/SVGElementRule.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / typicals / rules / SVGElementRule.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012 Association for Decentralized Information Management in\r
3  * 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.modeling.typicals.rules;\r
13 \r
14 import org.simantics.db.Resource;\r
15 import org.simantics.db.WriteGraph;\r
16 import org.simantics.db.exception.DatabaseException;\r
17 import org.simantics.diagram.stubs.G2DResource;\r
18 import org.simantics.modeling.typicals.ITypicalSynchronizationRule;\r
19 import org.simantics.modeling.typicals.TypicalInfo;\r
20 \r
21 /**\r
22  * Synchronizes:\r
23  * * SVG document\r
24  * \r
25  * @author Tuukka Lehtonen\r
26  */\r
27 public enum SVGElementRule implements ITypicalSynchronizationRule {\r
28 \r
29     INSTANCE;\r
30 \r
31     public static SVGElementRule getInstance() {\r
32         return INSTANCE;\r
33     }\r
34 \r
35     @Override\r
36     public boolean synchronize(WriteGraph graph, Resource template, Resource instance, TypicalInfo info) throws DatabaseException {\r
37         G2DResource G2D = G2DResource.getInstance(graph);\r
38         boolean changed = Properties.synchronizePrimitivePropertyValue(graph, template, instance, G2D.HasSVGDocument);\r
39         if(changed) info.messageLog.add("\t\t\tSVG document");\r
40         return changed;\r
41     }\r
42 \r
43 }\r