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.db.ReadGraph;
\r
19 import org.simantics.db.Resource;
\r
20 import org.simantics.db.exception.DatabaseException;
\r
21 import org.simantics.diagram.stubs.ImageResource;
\r
22 import org.simantics.layer0.Layer0;
\r
23 import org.simantics.modeling.ui.Activator;
\r
29 * @Deprecated Use org.simantics.image instead
\r
32 public class Images extends Node {
\r
34 public Images(Resource resource) {
\r
39 public Resource getResource() {
\r
44 public String getLabel(ReadGraph g) {
\r
49 public Collection<?> getChildren(ReadGraph g) throws DatabaseException {
\r
50 Layer0 b = Layer0.getInstance(g);
\r
51 ImageResource img = ImageResource.getInstance(g);
\r
52 Collection<INode> ret = new ArrayList<INode>();
\r
54 for (Resource r : g.getObjects(resource, b.ConsistsOf)) {
\r
55 if (g.isInstanceOf(r, img.Image)) {
\r
56 ret.add(g.adapt(r, INode.class));
\r
63 public ImageDescriptor getImage(ReadGraph g) {
\r
64 return Activator.IMAGES_ICON;
\r
67 @SuppressWarnings("unchecked")
\r
69 public Object getAdapter(Class adapter) {
\r
70 // deny adaptability, prevent showing of properties this way.
\r