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