import java.util.Collection;
import java.util.List;
-import org.simantics.browsing.ui.BuiltinKeys;
import org.simantics.browsing.ui.NodeContext;
import org.simantics.browsing.ui.common.NodeContextBuilder;
import org.simantics.browsing.ui.model.actions.ActionBrowseContext;
+import org.simantics.browsing.ui.model.nodetypes.EntityNodeType;
+import org.simantics.browsing.ui.model.nodetypes.NodeType;
import org.simantics.db.ReadGraph;
import org.simantics.db.RequestProcessor;
import org.simantics.db.Resource;
}
public static NodeContext getNodeContextForResource(Resource resource) {
- return NodeContextBuilder.buildWithData(BuiltinKeys.INPUT, resource);
+ return NodeContextBuilder.buildWithInput(resource);
+ }
+
+ public static NodeContext getNodeContextWithTypeForResource(ReadGraph graph, Resource resource) {
+ try {
+ return NodeContextBuilder.buildWithData(
+ NodeType.KEY_SEQUENCE,
+ new Object[] { resource, EntityNodeType.getNodeTypeFor(graph, resource) });
+ } catch (DatabaseException e) {
+ return NodeContextBuilder.buildWithInput(resource);
+ }
}
public static class URIsToBrowseContext extends UnaryRead<List<String>, BrowseContext> {
importJava "org.simantics.browsing.ui.model.browsecontexts.BrowseContexts" where
toBrowseContextG :: Vector String -> <ReadGraph> BrowseContext
getNodeContextForResource :: Resource -> <Proc> NodeContext
+ getNodeContextWithTypeForResource :: Resource -> <Proc, ReadGraph> NodeContext
"""
Creates a new BrowseContext for the given Collection of Resources.