1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.profile.view;
14 import java.util.ArrayList;
15 import java.util.Collection;
16 import java.util.Collections;
18 import org.simantics.browsing.ui.model.children.ChildRule;
19 import org.simantics.db.ReadGraph;
20 import org.simantics.db.Resource;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.diagram.stubs.DiagramResource;
24 public class RuntimeDirectProfileEntries implements ChildRule {
27 public boolean isCompatible(Class<?> contentType) {
28 return contentType.equals(Resource.class);
32 public Collection<?> getChildren(ReadGraph graph, Object parent)
33 throws DatabaseException {
35 Resource runtimeDiagram = (Resource)parent;
36 DiagramResource dr = DiagramResource.getInstance(graph);
37 Resource runtimeProfile = graph.getPossibleObject(runtimeDiagram, dr.RuntimeDiagram_HasRuntimeProfile);
38 if(runtimeProfile == null) return Collections.emptyList();
39 return graph.syncRequest(new DirectProfileEntries(new ResourcePair(runtimeProfile, runtimeProfile)));
44 public Collection<?> getParents(ReadGraph graph, Object child)
45 throws DatabaseException {
46 return new ArrayList<Resource>();