]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NodeContextValueBean.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / NodeContextValueBean.java
diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NodeContextValueBean.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NodeContextValueBean.java
new file mode 100644 (file)
index 0000000..cc0bb47
--- /dev/null
@@ -0,0 +1,50 @@
+/*******************************************************************************\r
+ * Copyright (c) 2012 Association for Decentralized Information Management in\r
+ * 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.browsing.ui.swt;\r
+\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import org.simantics.browsing.ui.model.nodetypes.EntityNodeType;\r
+import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType;\r
+import org.simantics.databoard.util.Bean;\r
+import org.simantics.db.Resource;\r
+\r
+public class NodeContextValueBean extends Bean {\r
+\r
+       public String name;\r
+       public Resource resource;\r
+       public List<Resource> resources;\r
+       public String className = "";\r
+       \r
+       public NodeContextValueBean(EntityNodeType ent) {\r
+               name = EntityNodeType.class.getName();\r
+               resource = ent.entityTypes.get(0);\r
+               resources = ent.entityTypes;\r
+       }\r
+\r
+       public NodeContextValueBean(SpecialNodeType ent) {\r
+               assert(ent.resource != null);\r
+               name = SpecialNodeType.class.getName();\r
+               resource = ent.resource;\r
+               resources = Collections.singletonList(ent.resource);\r
+               className = ent.getContentType().getName();\r
+       }\r
+\r
+       public NodeContextValueBean(Resource resource) {\r
+               assert(resource != null);\r
+               name = Resource.class.getName();\r
+               this.resource = resource;\r
+               this.resources = Collections.singletonList(resource);\r
+       }\r
+       \r
+}\r