1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package pl.edu.agh.cast.command;
19
20 import java.util.Collection;
21
22 import org.eclipse.gef.commands.Command;
23
24 import pl.edu.agh.cast.data.model.property.IPropertyContainer;
25 import pl.edu.agh.cast.data.model.property.MetaProperty;
26
27
28
29
30
31
32 public class RemoveMetaPropertiesCommand extends Command {
33
34 private IPropertyContainer container;
35
36 private Collection<MetaProperty> metaProperties;
37
38
39
40
41
42
43
44 public RemoveMetaPropertiesCommand(IPropertyContainer container, Collection<MetaProperty> metaProperties) {
45 if (container == null || metaProperties == null || metaProperties.isEmpty()) {
46 throw new IllegalArgumentException();
47 }
48 this.container = container;
49 this.metaProperties = metaProperties;
50 }
51
52
53
54
55
56
57 @Override
58 public boolean canUndo() {
59 return false;
60 }
61
62
63
64
65
66
67 @Override
68 public void execute() {
69 for (MetaProperty metaProperty : metaProperties) {
70 container.getMetaPropertyManager().removeMetaProperty(metaProperty.getName());
71 }
72 }
73
74 }