]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/requests/SetFlagExternal.java
Find SCL references in SCLModuleEditor with Ctrl+Shift+G
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / requests / SetFlagExternal.java
1 package org.simantics.modeling.requests;
2
3 import java.util.Collection;
4
5 import org.simantics.db.Resource;
6 import org.simantics.db.WriteGraph;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.diagram.stubs.DiagramResource;
9
10 /**
11  * @author Tuukka Lehtonen
12  */
13 public class SetFlagExternal {
14
15     Collection<Resource> flags;
16     boolean              external;
17
18     public SetFlagExternal(Collection<Resource> flags, boolean external) {
19         this.flags = flags;
20         this.external = external;
21     }
22
23     public void perform(WriteGraph graph) throws DatabaseException {
24         DiagramResource DIA = DiagramResource.getInstance(graph);
25         for (Resource flag : flags) {
26             if (external)
27                 graph.claim(flag, DIA.ExternalFlag, DIA.ExternalFlag, flag);
28             else
29                 graph.deny(flag, DIA.ExternalFlag);
30         }
31     }
32
33 }