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.Collection;
15 import java.util.Collections;
17 import org.eclipse.jface.resource.ImageDescriptor;
18 import org.simantics.browsing.ui.common.node.IDeletable;
19 import org.simantics.browsing.ui.common.node.IModifiable;
20 import org.simantics.browsing.ui.content.Labeler.Modifier;
21 import org.simantics.browsing.ui.graph.impl.LabelModifier;
22 import org.simantics.db.ReadGraph;
23 import org.simantics.db.Resource;
24 import org.simantics.db.Session;
25 import org.simantics.db.WriteGraph;
26 import org.simantics.db.exception.DatabaseException;
27 import org.simantics.modeling.ui.Activator;
30 public class State extends Node implements IModifiable, IDeletable {
32 public State(Resource resource) {
37 public Collection<?> getChildren(ReadGraph g) {
38 return Collections.emptyList();
42 public ImageDescriptor getImage(ReadGraph g) {
43 return Activator.STATE_ICON;
47 public Modifier getModifier(final Session session, String columnId) {
48 return new LabelModifier(session, resource);
52 public void handleDelete(WriteGraph graph) throws DatabaseException {
54 // 1. the state itself
55 // 2. all references to it state as an initial state from experiments
57 // Handles both 1. and 2.
58 super.handleDelete(graph);