]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/State.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / modelBrowser / model / State.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.Collection;
15 import java.util.Collections;
16
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;
28
29 @Deprecated
30 public class State extends Node implements IModifiable, IDeletable {
31
32     public State(Resource resource) {
33         super(resource);
34     }
35
36     @Override
37     public Collection<?> getChildren(ReadGraph g) {
38         return Collections.emptyList();
39     }
40
41     @Override
42     public ImageDescriptor getImage(ReadGraph g) {
43         return Activator.STATE_ICON;
44     }
45
46     @Override
47     public Modifier getModifier(final Session session, String columnId) {
48         return new LabelModifier(session, resource);
49     }
50
51     @Override
52     public void handleDelete(WriteGraph graph) throws DatabaseException {
53         // Must remove:
54         //   1. the state itself
55         //   2. all references to it state as an initial state from experiments
56
57         // Handles both 1. and 2.
58         super.handleDelete(graph);
59     }
60
61 }