]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/Images.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / modelBrowser / model / Images.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.modeling.ui.modelBrowser.model;
13
14 import java.util.ArrayList;
15 import java.util.Collection;
16
17 import org.eclipse.jface.resource.ImageDescriptor;
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.Resource;
20 import org.simantics.db.exception.DatabaseException;
21 import org.simantics.diagram.stubs.ImageResource;
22 import org.simantics.layer0.Layer0;
23 import org.simantics.modeling.ui.Activator;
24
25 /**
26  * 
27  * @author J-P Laine
28  *
29  * @Deprecated Use org.simantics.image instead
30  */
31 @Deprecated
32 public class Images extends Node {
33
34     public Images(Resource resource) {
35         super(resource);
36     }
37
38     @Override
39     public Resource getResource() {
40         return resource;
41     }
42
43     @Override
44     public String getLabel(ReadGraph g) {
45         return "Images";
46     }
47
48     @Override
49     public Collection<?> getChildren(ReadGraph g) throws DatabaseException {
50         Layer0 b = Layer0.getInstance(g);
51         ImageResource img = ImageResource.getInstance(g);
52         Collection<INode> ret = new ArrayList<INode>();
53
54         for (Resource r : g.getObjects(resource, b.ConsistsOf)) {
55             if (g.isInstanceOf(r, img.Image)) {
56                 ret.add(g.adapt(r, INode.class));
57             }
58         }
59         return ret;
60     }
61
62     @Override
63     public ImageDescriptor getImage(ReadGraph g) {
64         return Activator.IMAGES_ICON;
65     }
66
67     @SuppressWarnings("unchecked")
68     @Override
69     public Object getAdapter(Class adapter) {
70         // deny adaptability, prevent showing of properties this way.
71         return null;
72     }
73
74 }