import org.simantics.db.procedure.AsyncListener;\r
import org.simantics.db.request.Read;\r
import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.AdaptionUtils;\r
import org.simantics.utils.datastructures.Callback;\r
\r
@Override\r
public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
- final Resource r = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
- if(r == null) {\r
+ final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
+ if(resource == null) {\r
updateCallback.run("Selection properties");\r
return;\r
}\r
@Override\r
public String perform(ReadGraph graph) throws DatabaseException {\r
Layer0 l0 = Layer0.getInstance(graph);\r
+ ModelingResources mr = ModelingResources.getInstance(graph);\r
+ Resource r = resource;\r
+ if(graph.hasStatement(r, mr.ElementToComponent)) {\r
+ r = graph.getSingleObject(r, mr.ElementToComponent);\r
+ }\r
String label = graph.getPossibleRelatedValue(r, l0.HasLabel);\r
if(label != null)\r
return label;\r