]> gerrit.simantics Code Review - simantics/platform.git/blob - modelBrowser/model/Composite.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / modelBrowser / model / Composite.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.core.runtime.IAdaptable;
18 import org.eclipse.jface.dialogs.MessageDialog;
19 import org.eclipse.jface.resource.ImageDescriptor;
20 import org.eclipse.jface.viewers.ISelection;
21 import org.eclipse.jface.viewers.IStructuredSelection;
22 import org.eclipse.ui.PlatformUI;
23 import org.simantics.db.ReadGraph;
24 import org.simantics.db.Resource;
25 import org.simantics.db.Session;
26 import org.simantics.db.WriteGraph;
27 import org.simantics.db.common.request.WriteRequest;
28 import org.simantics.db.common.utils.NameUtils;
29 import org.simantics.db.exception.DatabaseException;
30 import org.simantics.layer0.Layer0;
31 import org.simantics.layer0.utils.direct.GraphUtils;
32 import org.simantics.modeling.ModelingUtils;
33 import org.simantics.modeling.ui.Activator;
34
35 @Deprecated
36 public class Composite extends Node {
37         
38         public Composite(ReadGraph g, Resource resource) {
39                 super(resource);
40         }
41
42         @Override
43         public Collection<?> getChildren(ReadGraph g) throws DatabaseException {
44                 Collection<INode> ret = new ArrayList<INode>();
45         Layer0 b = Layer0.getInstance(g);
46                 for(Resource r : g.getObjects(resource, b.ConsistsOf))
47                         ret.add(g.adapt(r, INode.class));
48                 return ret;
49         }
50
51         @Override
52         public ImageDescriptor getImage(ReadGraph g) {
53                 return Activator.COMPOSITE_ICON;
54         }
55                 
56 }