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;
23 import org.simantics.scenegraph.profile.ProfileUtils;
25 public class ProfileEntryChildren implements ChildRule {
28 public boolean isCompatible(Class<?> contentType) {
29 return contentType.equals(ProfileTuple.class);
33 public Collection<?> getChildren(ReadGraph graph, Object parent)
34 throws DatabaseException {
35 ProfileTuple entry = (ProfileTuple) parent;
36 ArrayList<ProfileTuple> entries = new ArrayList<>();
37 DiagramResource DIA = DiagramResource.getInstance(graph);
38 Resource children = graph.getPossibleObject(entry.getEntry(), DIA.HasEntries);
39 if (children != null) {
40 for (Resource entry2 : ProfileUtils.getProfileChildrenFromEntries(graph, children))
41 entries.add(new ProfileTuple(entry.getBaseProfile(), entry2, entry.getRuntimeDiagram()));
44 return Collections.emptyList();
48 public Collection<?> getParents(ReadGraph graph, Object child)
49 throws DatabaseException {
50 return Collections.emptyList();