1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.modeling.ui.modelBrowser.model;
14 import java.util.ArrayList;
15 import java.util.Collection;
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.request.ObjectsWithType;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.layer0.Layer0;
23 import org.simantics.modeling.ui.Activator;
24 import org.simantics.operation.Layer0X;
27 public class RelationViews extends Node {
29 public RelationViews(Resource resource) {
34 public String getLabel(ReadGraph g) {
35 return "Relation views";
39 public Collection<?> getChildren(ReadGraph g) throws DatabaseException {
40 Layer0 l0 = Layer0.getInstance(g);
41 Layer0X L0X = Layer0X.getInstance(g);
42 Collection<Resource> ret = new ArrayList<Resource>();
43 for (Resource r : g.syncRequest(new ObjectsWithType(resource, l0.ConsistsOf, L0X.RelationView))) {
50 public ImageDescriptor getImage(ReadGraph g) {
51 return Activator.SPREADSHEETS_ICON;
55 public Object getAdapter(Class adapter) {
56 // deny adaptability, prevent showing of properties this way.