]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NodeContextValueBean.java
Merge remote-tracking branch 'origin/svn' commit 'ccc1271c9d6657fb9dcf4cf3cb115fa0c8c...
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / NodeContextValueBean.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.browsing.ui.swt;\r
13 \r
14 import java.util.Collections;\r
15 import java.util.List;\r
16 \r
17 import org.simantics.browsing.ui.model.nodetypes.EntityNodeType;\r
18 import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType;\r
19 import org.simantics.databoard.util.Bean;\r
20 import org.simantics.db.Resource;\r
21 \r
22 public class NodeContextValueBean extends Bean {\r
23 \r
24         public String name;\r
25         public Resource resource;\r
26         public List<Resource> resources;\r
27         public String className = "";\r
28         \r
29         public NodeContextValueBean(EntityNodeType ent) {\r
30                 name = EntityNodeType.class.getName();\r
31                 resource = ent.entityTypes.get(0);\r
32                 resources = ent.entityTypes;\r
33         }\r
34 \r
35         public NodeContextValueBean(SpecialNodeType ent) {\r
36                 assert(ent.resource != null);\r
37                 name = SpecialNodeType.class.getName();\r
38                 resource = ent.resource;\r
39                 resources = Collections.singletonList(ent.resource);\r
40                 className = ent.getContentType().getName();\r
41         }\r
42 \r
43         public NodeContextValueBean(Resource resource) {\r
44                 assert(resource != null);\r
45                 name = Resource.class.getName();\r
46                 this.resource = resource;\r
47                 this.resources = Collections.singletonList(resource);\r
48         }\r
49         \r
50 }\r