package org.simantics.district.network.ui; import java.util.Collections; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.district.network.ontology.DistrictNetworkResource; public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling.ui.diagramEditor.OpenDiagramFromConfigurationAdapter { @Override public boolean canHandle(ReadGraph g, Resource r) throws DatabaseException { Resource diagram = getDiagram(g, r, Collections.emptySet()); if (diagram == null) return false; DistrictNetworkResource DN = DistrictNetworkResource.getInstance(g); return g.isInstanceOf(diagram, DN.Diagram) && !isLocked(g, diagram); } @Override protected String getEditorId() { return DistrictDiagramEditor.ID; } }