]> gerrit.simantics Code Review - simantics/district.git/blob
1c49acbcbc9a505772018badb9c2860f3cd8a4d8
[simantics/district.git] /
1 package org.simantics.district.network.ui;\r
2 \r
3 import java.util.Collections;\r
4 \r
5 import org.simantics.db.ReadGraph;\r
6 import org.simantics.db.Resource;\r
7 import org.simantics.db.exception.DatabaseException;\r
8 import org.simantics.district.network.ontology.DistrictNetworkResource;\r
9 \r
10 public class OpenDiagramFromConfigurationAdapter\r
11         extends org.simantics.modeling.ui.diagramEditor.OpenDiagramFromConfigurationAdapter {\r
12 \r
13     @Override\r
14     public boolean canHandle(ReadGraph g, Resource r) throws DatabaseException {\r
15         Resource diagram = getDiagram(g, r, Collections.emptySet());\r
16         if (diagram == null)\r
17             return false;\r
18         DistrictNetworkResource DN = DistrictNetworkResource.getInstance(g);\r
19         return g.isInstanceOf(diagram, DN.Diagram) && !isLocked(g, diagram);\r
20     }\r
21 \r
22     @Override\r
23     protected String getEditorId() {\r
24         return DistrictDiagramEditor.ID;\r
25     }\r
26 }\r