1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in 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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.modeling.ui.modelBrowser.model;
\r
14 import java.util.ArrayList;
\r
15 import java.util.Collection;
\r
17 import org.eclipse.jface.resource.ImageDescriptor;
\r
18 import org.simantics.charts.ontology.ChartResource;
\r
19 import org.simantics.db.ReadGraph;
\r
20 import org.simantics.db.Resource;
\r
21 import org.simantics.db.exception.DatabaseException;
\r
22 import org.simantics.layer0.Layer0;
\r
23 import org.simantics.modeling.ui.Activator;
\r
26 public class Charts extends Node {
\r
28 public Charts(Resource resource) {
\r
32 public Resource getResource() {
\r
37 public String getLabel(ReadGraph g)
\r
43 public Collection<?> getChildren(ReadGraph g) throws DatabaseException {
\r
44 Layer0 b = Layer0.getInstance(g);
\r
45 ChartResource wr = ChartResource.getInstance(g);
\r
46 Collection<INode> ret = new ArrayList<INode>();
\r
47 for (Resource r : g.getObjects(resource, b.ConsistsOf)) {
\r
48 if (g.isInstanceOf(r, wr.Chart)) {
\r
49 ret.add(g.adapt(r, INode.class));
\r
56 public ImageDescriptor getImage(ReadGraph g) {
\r
57 return Activator.CHARTGROUP_ICON;
\r
60 @SuppressWarnings("rawtypes")
\r
62 public Object getAdapter(Class adapter) {
\r
63 // deny adaptability, prevent showing of properties this way.
\r