]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ISymbolItem.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / symbollibrary / ISymbolItem.java
diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ISymbolItem.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ISymbolItem.java
new file mode 100644 (file)
index 0000000..da8546b
--- /dev/null
@@ -0,0 +1,66 @@
+/*******************************************************************************\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.symbollibrary;\r
+\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.simantics.db.procedure.Listener;\r
+import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.handler.StaticSymbol;\r
+import org.simantics.utils.datastructures.cache.ProvisionException;\r
+import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
+import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
+import org.simantics.utils.datastructures.hints.IHintObservable;\r
+\r
+/**\r
+ * Represents a single symbol group element.\r
+ * \r
+ * <p>\r
+ * Implementations must override equals/hashCode.\r
+ * </p>\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ */\r
+public interface ISymbolItem extends IAdaptable {\r
+\r
+    /**\r
+     * @return get the symbol group which this symbol item is a part of\r
+     */\r
+    ISymbolGroup getGroup();\r
+\r
+    /**\r
+     * @return the name of this symbol item to be shown to the user\r
+     */\r
+    String getName();\r
+\r
+    /**\r
+     * @return a more verbose description of the item, for tooltips etc.\r
+     */\r
+    String getDescription();\r
+\r
+    /**\r
+     * @param hints external hints for element class loading or\r
+     *        <code>null</code> if no hints need to be provided\r
+     * @return an {@link ElementClass} that must contain at least a\r
+     *         {@link StaticSymbol} handler\r
+     * @throws ProvisionException if the {@link ElementClass} cannot be\r
+     *         retrieved for some reason\r
+     */\r
+    ElementClass getElementClass(IHintObservable hints) throws ProvisionException;\r
+\r
+    /**\r
+     * Pass a database listener in {@link #getElementClass(IHintObservable)}\r
+     * hint observable argument using this key to start listening to the changes\r
+     * in the element class result.\r
+     */\r
+    public static final Key KEY_ELEMENT_CLASS_LISTENER = new KeyOf(Listener.class, "ELEMENT_CLASS_LISTENER");\r
+\r
+}\r