X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FNodeContextValueBean.java;fp=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FNodeContextValueBean.java;h=cc0bb47accd1ba70c1199782bc7aa38ce8ba2b5e;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git 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 index 000000000..cc0bb47ac --- /dev/null +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NodeContextValueBean.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2012 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.browsing.ui.swt; + +import java.util.Collections; +import java.util.List; + +import org.simantics.browsing.ui.model.nodetypes.EntityNodeType; +import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType; +import org.simantics.databoard.util.Bean; +import org.simantics.db.Resource; + +public class NodeContextValueBean extends Bean { + + public String name; + public Resource resource; + public List resources; + public String className = ""; + + public NodeContextValueBean(EntityNodeType ent) { + name = EntityNodeType.class.getName(); + resource = ent.entityTypes.get(0); + resources = ent.entityTypes; + } + + public NodeContextValueBean(SpecialNodeType ent) { + assert(ent.resource != null); + name = SpecialNodeType.class.getName(); + resource = ent.resource; + resources = Collections.singletonList(ent.resource); + className = ent.getContentType().getName(); + } + + public NodeContextValueBean(Resource resource) { + assert(resource != null); + name = Resource.class.getName(); + this.resource = resource; + this.resources = Collections.singletonList(resource); + } + +}