-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.ui.modelBrowser.model;\r
-\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.simantics.browsing.ui.content.Labeler.Modifier;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.modeling.ui.Activator;\r
-\r
-@Deprecated\r
-public class ConnectionUp implements INode {\r
-\r
- Resource sourceRelation;\r
- Resource target;\r
- Resource targetRelation;\r
- Resource connection;\r
-\r
- public ConnectionUp(Resource connection,\r
- Resource sourceRelation, Resource target, Resource targetRelation) {\r
- this.connection = connection;\r
- this.sourceRelation = sourceRelation;\r
- this.target = target;\r
- this.targetRelation = targetRelation;\r
- }\r
-\r
- @Override\r
- public Collection<?> getChildren(ReadGraph g) {\r
- return Collections.EMPTY_LIST;\r
- }\r
-\r
- @Override\r
- public ImageDescriptor getImage(ReadGraph g) {\r
- return Activator.ARROW_RIGHT_ICON;\r
- }\r
-\r
- @Override\r
- public String getLabel(ReadGraph g) throws DatabaseException {\r
- Layer0 b = Layer0.getInstance(g);\r
- String targetName = g.getPossibleRelatedValue(target, b.HasName);\r
- if(targetName == null)\r
- targetName = "";\r
-\r
- String relationName = g.getPossibleRelatedValue(targetRelation, b.HasName);\r
- if(relationName == null)\r
- relationName = "";\r
-\r
- return targetName + "." + relationName;\r
- }\r
-\r
- @Override\r
- public int getCategory(ReadGraph graph) {\r
- return 0;\r
- }\r
-\r
- @Override\r
- public void handleDrop(Session session, ISelection selection) {\r
- }\r
-\r
- @Override\r
- public void handleDelete(WriteGraph graph) throws DatabaseException {\r
- }\r
-\r
- @Override\r
- public boolean hasChildren(ReadGraph g) {\r
- return false;\r
- }\r
-\r
- @Override\r
- public Object getAdapter(Class adapter) {\r
- if(adapter.isAssignableFrom(Resource.class))\r
- return connection;\r
- return null;\r
- }\r
-\r
- @Override\r
- public Modifier getModifier(Session session, String columnId) {\r
- return null;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.ui.modelBrowser.model;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.simantics.browsing.ui.content.Labeler.Modifier;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.Session;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.layer0.Layer0;
+import org.simantics.modeling.ui.Activator;
+
+@Deprecated
+public class ConnectionUp implements INode {
+
+ Resource sourceRelation;
+ Resource target;
+ Resource targetRelation;
+ Resource connection;
+
+ public ConnectionUp(Resource connection,
+ Resource sourceRelation, Resource target, Resource targetRelation) {
+ this.connection = connection;
+ this.sourceRelation = sourceRelation;
+ this.target = target;
+ this.targetRelation = targetRelation;
+ }
+
+ @Override
+ public Collection<?> getChildren(ReadGraph g) {
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public ImageDescriptor getImage(ReadGraph g) {
+ return Activator.ARROW_RIGHT_ICON;
+ }
+
+ @Override
+ public String getLabel(ReadGraph g) throws DatabaseException {
+ Layer0 b = Layer0.getInstance(g);
+ String targetName = g.getPossibleRelatedValue(target, b.HasName);
+ if(targetName == null)
+ targetName = "";
+
+ String relationName = g.getPossibleRelatedValue(targetRelation, b.HasName);
+ if(relationName == null)
+ relationName = "";
+
+ return targetName + "." + relationName;
+ }
+
+ @Override
+ public int getCategory(ReadGraph graph) {
+ return 0;
+ }
+
+ @Override
+ public void handleDrop(Session session, ISelection selection) {
+ }
+
+ @Override
+ public void handleDelete(WriteGraph graph) throws DatabaseException {
+ }
+
+ @Override
+ public boolean hasChildren(ReadGraph g) {
+ return false;
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ if(adapter.isAssignableFrom(Resource.class))
+ return connection;
+ return null;
+ }
+
+ @Override
+ public Modifier getModifier(Session session, String columnId) {
+ return null;
+ }
+
+}