]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/Experiments.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / modelBrowser / model / Experiments.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.common.ResourceArray;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.layer0.Layer0;
23 import org.simantics.modeling.ui.Activator;
24 import org.simantics.simulation.ontology.SimulationResource;
25
26 @Deprecated
27 public class Experiments extends Node {
28
29     public Experiments(Resource resource) {
30         super(resource);
31     }
32
33     @Override
34     public Resource getResource() {
35         return resource;
36     }
37
38     @Override
39     public String getLabel(ReadGraph g) {
40         return "Experiments";
41     }
42
43     @Override
44     public Collection<?> getChildren(ReadGraph g) throws DatabaseException {
45         Layer0 b = Layer0.getInstance(g);
46         SimulationResource SIMU = SimulationResource.getInstance(g);
47         Collection<INode> ret = new ArrayList<INode>();
48         for (Resource r : g.getObjects(resource, b.ConsistsOf)) {
49             if (g.isInstanceOf(r, SIMU.Experiment)) {
50                 INode node = g.adapt(r, INode.class);
51                 if (node instanceof IPathNode)
52                     ((IPathNode) node).setPath(new ResourceArray(resource));
53                 ret.add(node);
54             }
55         }
56         return ret;
57     }
58
59     @Override
60     public ImageDescriptor getImage(ReadGraph g) {
61         return Activator.EXPERIMENTS_ICON;
62     }
63
64     @SuppressWarnings("rawtypes")
65     @Override
66     public Object getAdapter(Class adapter) {
67         // deny adaptability, prevent showing of properties this way.
68         return null;
69     }
70
71 }