]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/DefaultParameters.java
Editing of texts inside SVG elements
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / impl / DefaultParameters.java
diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/DefaultParameters.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/DefaultParameters.java
new file mode 100644 (file)
index 0000000..1b7b453
--- /dev/null
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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:
+ *     Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.element.handler.impl;
+
+import java.util.Map;
+
+import org.simantics.g2d.element.ElementHints;
+import org.simantics.g2d.element.IElement;
+import org.simantics.g2d.element.handler.Parameters;
+
+/**
+ * @author Antti Villberg
+ * @since 1.31.0
+ */
+public class DefaultParameters implements Parameters {
+
+       private static final long serialVersionUID = -9138310692519364097L;
+
+       public static final DefaultParameters INSTANCE = new DefaultParameters();
+
+       @Override
+       public Map<String, Object> getParameters(IElement e) {
+               return e.getHint(ElementHints.KEY_PARAMETERS);
+       }
+
+       @Override
+       public void setParameters(IElement e, Map<String, Object> p) {
+               if (p != null) {
+                       e.setHint(ElementHints.KEY_PARAMETERS, p);
+               } else {
+                       e.removeHint(ElementHints.KEY_PARAMETERS);
+               }
+       }
+
+}