• R/O
  • HTTP
  • SSH
  • HTTPS

tmdmaker: Commit

TMD-Maker(T字形ER図作成ツール)のEclipse Plugin,RCP,Webサイト用


Commit MetaInfo

Revision6c3c9152b270ddd92f1cd4ac76449a1347500cef (tree)
Time2018-09-18 08:17:33
Authornakag <nakag@user...>
Commiternakag

Log Message

Refactoring virtual superset build.

Change Summary

Incremental Difference

--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Diagram.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Diagram.java
@@ -168,23 +168,6 @@ public class Diagram extends ModelElement {
168168 visitor.visit(this);
169169 }
170170
171- /**
172- * みなしスーパーセット作成
173- *
174- * @param virtualSupersetName
175- * みなしスーパーセット名
176- * @param virtualSubsets
177- * みなしサブセット
178- * @return 作成したみなしスーパーセット
179- */
180- public VirtualSuperset createVirtualSuperset(String virtualSupersetName,
181- List<AbstractEntityModel> virtualSubsets) {
182- VirtualSupersetType2VirtualSupersetRelationship r = new VirtualSupersetType2VirtualSupersetRelationship(virtualSupersetName, virtualSubsets);
183- VirtualSuperset superset = r.getSuperset();
184- r.connect();
185- return superset;
186- }
187-
188171 public List<AbstractEntityModel> findEntityModelExcludeFor(List<AbstractEntityModel> excludes) {
189172 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
190173 for (ModelElement m : getChildren()) {
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/VirtualSuperset.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/VirtualSuperset.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2017 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -18,6 +18,10 @@ package jp.sourceforge.tmdmaker.model;
1818 import java.util.ArrayList;
1919 import java.util.List;
2020
21+import jp.sourceforge.tmdmaker.model.parts.ModelName;
22+import jp.sourceforge.tmdmaker.model.rule.ImplementRule;
23+import jp.sourceforge.tmdmaker.model.virtual.VirtualSubsets;
24+
2125 /**
2226 * みなしスーパーセット.
2327 *
@@ -28,13 +32,35 @@ import java.util.List;
2832 public class VirtualSuperset extends AbstractEntityModel {
2933
3034 /**
35+ * コンストラクタは公開しない.
36+ */
37+ protected VirtualSuperset() {
38+ }
39+
40+ /**
41+ * みなしスーパーセットを作成する。
42+ *
43+ * @param name
44+ * みなしスーパーセット名
45+ * @return みなしスーパーセット
46+ */
47+ public static VirtualSuperset of(ModelName name) {
48+ VirtualSuperset superset = new VirtualSuperset();
49+ superset.setName(name.getValue());
50+ superset.setNotImplement(true);
51+ ImplementRule.setModelDefaultValue(superset);
52+
53+ return superset;
54+ }
55+
56+ /**
3157 *
3258 * {@inheritDoc}
3359 *
3460 * @see jp.sourceforge.tmdmaker.model.AbstractEntityModel#createReusedIdentifier()
3561 */
3662 @Override
37- public ReusedIdentifier createReusedIdentifier() {
63+ protected ReusedIdentifier createReusedIdentifier() {
3864 return null;
3965 }
4066
@@ -94,7 +120,7 @@ public class VirtualSuperset extends AbstractEntityModel {
94120 public VirtualSupersetType getVirtualSupersetType() {
95121 VirtualSupersetType2VirtualSupersetRelationship r = getCreationRelationship();
96122 if (r != null) {
97- return r.getType();
123+ return r.getVirtualSupersetType();
98124 }
99125 return null;
100126 }
@@ -169,4 +195,8 @@ public class VirtualSuperset extends AbstractEntityModel {
169195 }
170196 return null;
171197 }
198+
199+ public VirtualSubsets virtualSubsets() {
200+ return new VirtualSubsets(this);
201+ }
172202 }
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/VirtualSupersetType2VirtualSupersetRelationship.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/VirtualSupersetType2VirtualSupersetRelationship.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2017 TMD-Maker Project <http://tmdmaker.osdn.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ package jp.sourceforge.tmdmaker.model;
1818 import java.util.ArrayList;
1919 import java.util.List;
2020
21-import jp.sourceforge.tmdmaker.model.rule.VirtualEntityRule;
21+import jp.sourceforge.tmdmaker.model.parts.ModelName;
2222
2323 /**
2424 * みなしスーパーセットとサブセット間のリレーションシップ.
@@ -29,13 +29,35 @@ import jp.sourceforge.tmdmaker.model.rule.VirtualEntityRule;
2929 @SuppressWarnings("serial")
3030 public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractConnectionModel {
3131 /** みなしスーパーセット */
32+ @SuppressWarnings("unused")
33+ @Deprecated
3234 private VirtualSuperset superset;
3335 /** みなしスーパーセットタイプ */
36+ @SuppressWarnings("unused")
37+ @Deprecated
3438 private VirtualSupersetType type;
3539 /** みなしスーパーセットタイプとみなしサブセットとのリレーションシップ */
3640 private List<Entity2VirtualSupersetTypeRelationship> subset2typeRelationshipList;
3741
42+ /**
43+ * Patch040SerializerHandler用
44+ */
45+ @Deprecated
3846 public VirtualSupersetType2VirtualSupersetRelationship() {
47+
48+ }
49+
50+ public VirtualSupersetType2VirtualSupersetRelationship(VirtualSuperset superset) {
51+ setSource(new VirtualSupersetType());
52+ setTarget(superset);
53+ }
54+
55+ public VirtualSupersetType2VirtualSupersetRelationship(VirtualSuperset superset,
56+ List<AbstractEntityModel> subsets) {
57+ setSource(new VirtualSupersetType());
58+ setTarget(superset);
59+ setSubsetList(subsets);
60+
3961 }
4062
4163 /**
@@ -49,11 +71,15 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
4971 public VirtualSupersetType2VirtualSupersetRelationship(String virtualSupersetName,
5072 List<AbstractEntityModel> subsets) {
5173 setSource(new VirtualSupersetType());
52- setTarget(VirtualEntityRule.createVirtualSuperset(virtualSupersetName));
74+ setTarget(VirtualSuperset.of(new ModelName(virtualSupersetName)));
75+ setSubsetList(subsets);
76+ }
77+
78+ public void setSubsetList(List<AbstractEntityModel> subsets) {
5379 this.subset2typeRelationshipList = new ArrayList<Entity2VirtualSupersetTypeRelationship>();
5480 for (AbstractEntityModel s : subsets) {
5581 Entity2VirtualSupersetTypeRelationship r = new Entity2VirtualSupersetTypeRelationship(s,
56- type);
82+ getVirtualSupersetType());
5783 subset2typeRelationshipList.add(r);
5884 }
5985 }
@@ -69,8 +95,10 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
6995 super.connect();
7096 connectSubsetList();
7197 Diagram diagram = getDiagram();
72- diagram.addChild(superset);
73- diagram.addChild(type);
98+ if (diagram != null) {
99+ diagram.addChild(getVirtualSuperset());
100+ diagram.addChild(getVirtualSupersetType());
101+ }
74102 }
75103
76104 private Diagram getDiagram() {
@@ -92,8 +120,10 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
92120 @Override
93121 public void disconnect() {
94122 Diagram diagram = getDiagram();
95- diagram.removeChild(type);
96- diagram.removeChild(superset);
123+ if (diagram != null) {
124+ diagram.removeChild(getVirtualSupersetType());
125+ diagram.removeChild(getVirtualSuperset());
126+ }
97127 disconnectSubsetList();
98128 super.disconnect();
99129 }
@@ -136,7 +166,7 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
136166 public String getTargetName() {
137167 StringBuilder builder = new StringBuilder();
138168 boolean first = true;
139- VirtualSupersetType type = (VirtualSupersetType) getSource();
169+ VirtualSupersetType type = getVirtualSupersetType();
140170 for (AbstractEntityModel m : type.getSubsetList()) {
141171 if (first) {
142172 first = false;
@@ -159,14 +189,6 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
159189 visitor.visit(this);
160190 }
161191
162- public VirtualSuperset getSuperset() {
163- return superset;
164- }
165-
166- public VirtualSupersetType getType() {
167- return type;
168- }
169-
170192 private List<AbstractEntityModel> getSubsetList() {
171193 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
172194 for (Entity2VirtualSupersetTypeRelationship r : this.subset2typeRelationshipList) {
@@ -178,12 +200,15 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
178200 public void reconnect(List<AbstractEntityModel> subsets) {
179201 List<AbstractEntityModel> currentSubsetList = getSubsetList();
180202 List<Entity2VirtualSupersetTypeRelationship> newSubsetList = new ArrayList<Entity2VirtualSupersetTypeRelationship>();
203+
181204 for (AbstractEntityModel s : subsets) {
182- int index = currentSubsetList.indexOf(s);
183- if (index > 0) {
205+
206+ if (currentSubsetList.contains(s)) {
207+ int index = currentSubsetList.indexOf(s);
184208 newSubsetList.add(subset2typeRelationshipList.get(index));
185209 } else {
186- newSubsetList.add(new Entity2VirtualSupersetTypeRelationship(s, type));
210+ newSubsetList.add(
211+ new Entity2VirtualSupersetTypeRelationship(s, getVirtualSupersetType()));
187212 }
188213 }
189214 disconnectSubsetList();
@@ -203,13 +228,19 @@ public class VirtualSupersetType2VirtualSupersetRelationship extends AbstractCon
203228 @Override
204229 public void setSource(ConnectableElement source) {
205230 super.setSource(source);
206- this.type = (VirtualSupersetType) source;
231+ }
232+
233+ public VirtualSuperset getVirtualSuperset() {
234+ return (VirtualSuperset) getTarget();
235+ }
236+
237+ public VirtualSupersetType getVirtualSupersetType() {
238+ return (VirtualSupersetType) getSource();
207239 }
208240
209241 @Override
210242 public void setTarget(ConnectableElement target) {
211243 super.setTarget(target);
212- this.superset = (VirtualSuperset) target;
213244 }
214245
215246 }
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/subset/SubsetBuilder.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/subset/SubsetBuilder.java
@@ -41,8 +41,8 @@ public class SubsetBuilder {
4141 private boolean exceptNullChanged = false;
4242 private boolean exceptNull = false;
4343 private List<ModelName> addSubsetNameList = new ArrayList<ModelName>();
44- private List<SubsetType2SubsetRelationship> addedSubsetRelationship = new ArrayList<SubsetType2SubsetRelationship>();
45- private List<SubsetType2SubsetRelationship> deletedSubsetRelationship = new ArrayList<SubsetType2SubsetRelationship>();
44+ private List<SubsetType2SubsetRelationship> addedSubsetRelationshipList = new ArrayList<SubsetType2SubsetRelationship>();
45+ private List<SubsetType2SubsetRelationship> deletedSubsetRelationshipList = new ArrayList<SubsetType2SubsetRelationship>();
4646 private Entity2SubsetTypeRelationship entity2SubsetTypeRelationship;
4747
4848 /**
@@ -84,21 +84,21 @@ public class SubsetBuilder {
8484
8585 private void buildSubsetEntities(SubsetType subsetType) {
8686 if (!this.addSubsetNameList.isEmpty()) {
87- if (this.addedSubsetRelationship.isEmpty()) {
87+ if (this.addedSubsetRelationshipList.isEmpty()) {
8888 for (ModelName name : this.addSubsetNameList) {
8989 SubsetType2SubsetRelationship relationship = new SubsetType2SubsetRelationship(
9090 subsetType, name);
91- this.addedSubsetRelationship.add(relationship);
91+ this.addedSubsetRelationshipList.add(relationship);
9292 }
9393 }
94- for (SubsetType2SubsetRelationship r : this.addedSubsetRelationship) {
94+ for (SubsetType2SubsetRelationship r : this.addedSubsetRelationshipList) {
9595 r.connect();
9696 }
9797 }
9898 }
9999
100100 private void removeSubsetEntities() {
101- for (SubsetType2SubsetRelationship r : this.deletedSubsetRelationship) {
101+ for (SubsetType2SubsetRelationship r : this.deletedSubsetRelationshipList) {
102102 r.disconnect();
103103 }
104104 }
@@ -187,7 +187,7 @@ public class SubsetBuilder {
187187 * @return
188188 */
189189 public SubsetBuilder remove(SubsetEntity removeSubset) {
190- this.deletedSubsetRelationship.add(removeSubset.getSubsetTypeRelationship());
190+ this.deletedSubsetRelationshipList.add(removeSubset.getSubsetTypeRelationship());
191191 return this;
192192 }
193193
@@ -198,14 +198,14 @@ public class SubsetBuilder {
198198 */
199199 public List<SubsetEntity> getAddedSubsetList() {
200200 List<SubsetEntity> addedSubsetList = new ArrayList<SubsetEntity>();
201- for (SubsetType2SubsetRelationship r : this.addedSubsetRelationship) {
201+ for (SubsetType2SubsetRelationship r : this.addedSubsetRelationshipList) {
202202 addedSubsetList.add(r.getSubsetEntity());
203203 }
204204 return addedSubsetList;
205205 }
206206
207207 public void rollbackAdd() {
208- for (SubsetType2SubsetRelationship r : this.addedSubsetRelationship) {
208+ for (SubsetType2SubsetRelationship r : this.addedSubsetRelationshipList) {
209209 r.disconnect();
210210 }
211211 if (!this.entity2SubsetTypeRelationship.getSubsetType().hasSubsetEntity()) {
@@ -217,7 +217,7 @@ public class SubsetBuilder {
217217 if (!this.entity2SubsetTypeRelationship.isConnected()) {
218218 this.entity2SubsetTypeRelationship.connect();
219219 }
220- for (SubsetType2SubsetRelationship r : this.deletedSubsetRelationship) {
220+ for (SubsetType2SubsetRelationship r : this.deletedSubsetRelationshipList) {
221221 r.connect();
222222 }
223223 }
--- /dev/null
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/virtual/VirtualSubsetBuilder.java
@@ -0,0 +1,78 @@
1+/*
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package jp.sourceforge.tmdmaker.model.virtual;
17+
18+import java.util.List;
19+
20+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
21+import jp.sourceforge.tmdmaker.model.Entity2VirtualSupersetTypeRelationship;
22+import jp.sourceforge.tmdmaker.model.VirtualSuperset;
23+import jp.sourceforge.tmdmaker.model.VirtualSupersetType2VirtualSupersetRelationship;
24+
25+/**
26+ * みなしサブセットを生成するクラス.
27+ *
28+ * @author nakag
29+ *
30+ */
31+public class VirtualSubsetBuilder {
32+ private VirtualSuperset parent;
33+ private VirtualSupersetType2VirtualSupersetRelationship relationship;
34+ private List<AbstractEntityModel> addSubsetList;
35+ private boolean creation = true;
36+ private List<Entity2VirtualSupersetTypeRelationship> oldSubsetRelationshipList;
37+
38+ public VirtualSubsetBuilder(VirtualSuperset parent) {
39+ this.parent = parent;
40+ this.relationship = this.parent.getCreationRelationship();
41+ this.creation = this.relationship == null;
42+ if (!this.creation) {
43+ this.oldSubsetRelationshipList = this.relationship.getSubset2typeRelationshipList();
44+ }
45+ }
46+
47+ public VirtualSubsetBuilder subsetList(List<AbstractEntityModel> addSubsetList) {
48+ this.addSubsetList = addSubsetList;
49+ return this;
50+ }
51+
52+ public void build() {
53+ if (this.creation) {
54+ if (addSubsetList != null && !addSubsetList.isEmpty()) {
55+ if (this.relationship == null) {
56+ this.relationship = new VirtualSupersetType2VirtualSupersetRelationship(this.parent, this.addSubsetList);
57+ }
58+ this.relationship.connect();
59+ }
60+ return;
61+ }
62+
63+ if (addSubsetList != null && !addSubsetList.isEmpty()) {
64+ this.relationship.reconnect(addSubsetList);
65+ } else {
66+ this.relationship.disconnect();
67+ }
68+ }
69+
70+ public void rollback() {
71+ if (this.creation) {
72+ this.relationship.disconnect();
73+ } else {
74+ this.relationship.setSubset2typeRelationshipList(this.oldSubsetRelationshipList);
75+ this.relationship.connect();
76+ }
77+ }
78+}
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/rule/VirtualEntityRule.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/virtual/VirtualSubsets.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2017 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -13,29 +13,26 @@
1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16-package jp.sourceforge.tmdmaker.model.rule;
16+package jp.sourceforge.tmdmaker.model.virtual;
1717
1818 import jp.sourceforge.tmdmaker.model.VirtualSuperset;
1919
2020 /**
21- * みなし概念に関するルールをまとめたクラス
21+ * みなしサブセットの集約クラス.
2222 *
23- * @author nakaG
23+ * みなしサブセット操作の起点になる.
2424 *
25+ * @author nakag
26+ *
2527 */
26-public class VirtualEntityRule {
27- /**
28- * みなしスーパーセットを作成する。
29- *
30- * @param name
31- * みなしスーパーセット名
32- * @return みなしスーパーセット
33- */
34- public static VirtualSuperset createVirtualSuperset(String name) {
35- VirtualSuperset superset = new VirtualSuperset();
36- superset.setName(name);
37- ImplementRule.setModelDefaultValue(superset);
28+public class VirtualSubsets {
29+ private VirtualSuperset parent;
3830
39- return superset;
31+ public VirtualSubsets(VirtualSuperset parent) {
32+ this.parent = parent;
33+ }
34+
35+ public VirtualSubsetBuilder builder() {
36+ return new VirtualSubsetBuilder(this.parent);
4037 }
4138 }
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/actions/VirtualSupersetCreateAction.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/actions/VirtualSupersetCreateAction.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2017 TMD-Maker Project <http://tmdmaker.osdn.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -29,13 +29,9 @@ import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
2929 import jp.sourceforge.tmdmaker.model.Diagram;
3030 import jp.sourceforge.tmdmaker.model.VirtualSuperset;
3131 import jp.sourceforge.tmdmaker.model.VirtualSupersetType;
32-import jp.sourceforge.tmdmaker.model.VirtualSupersetType2VirtualSupersetRelationship;
3332 import jp.sourceforge.tmdmaker.ui.dialogs.VirtualSupersetCreateDialog;
34-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ConnectionDeleteCommand;
35-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ConstraintChangeCommand;
36-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ModelEditCommand;
37-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.RelationshipConnectionCommand;
38-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSubsetReplaceCommand;
33+import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSupersetCreateCommand;
34+import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSupersetEditCommand;
3935 import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSupersetTypeChangeCommand;
4036 import jp.sourceforge.tmdmaker.ui.editor.gef3.editparts.DiagramEditPart;
4137 import jp.sourceforge.tmdmaker.ui.editor.gef3.editparts.node.AbstractEntityModelEditPart;
@@ -82,46 +78,29 @@ public class VirtualSupersetCreateAction extends AbstractMultipleSelectionAction
8278
8379 if (original != null) {
8480 selectedModels.remove(original);
85- aggregator = original.getVirtualSupersetType();
8681 }
8782 }
8883
8984 VirtualSupersetCreateDialog dialog = new VirtualSupersetCreateDialog(
9085 getControl().getShell(), diagram, original, selectedModels);
9186 if (dialog.open() == Dialog.OK) {
92- CompoundCommand ccommand = new CompoundCommand();
87+ CompoundCommand ccommand = null;
9388 VirtualSuperset edited = dialog.getEditedValue();
9489 aggregator = dialog.getEditedAggregator();
90+ List<AbstractEntityModel> selection = dialog.getSelection();
91+
9592 // みなしスーパーセット作成
9693 if (original == null) {
97- List<AbstractEntityModel> selection = dialog.getSelection();
98- if (selection.size() == 0) {
94+ if (selection.isEmpty()) {
9995 return;
10096 }
101- VirtualSupersetType2VirtualSupersetRelationship r = new VirtualSupersetType2VirtualSupersetRelationship(
102- edited.getName(), selection);
103- VirtualSuperset virtualSuperset = r.getSuperset();
104- VirtualSupersetType type = r.getType();
105- ccommand.add(new RelationshipConnectionCommand(r));
106- ccommand.add(
107- new VirtualSupersetTypeChangeCommand(type, aggregator.isApplyAttribute()));
108- ccommand.add(new ConstraintChangeCommand(virtualSuperset, pos.x, pos.y));
109- ccommand.add(new ConstraintChangeCommand(type, pos.x, pos.y + 50));
97+ ccommand = new CompoundCommand();
98+ ccommand.add(new VirtualSupersetCreateCommand(edited, selection, pos.x, pos.y));
99+ ccommand.add(new VirtualSupersetTypeChangeCommand(edited,
100+ aggregator.isApplyAttribute()));
110101 } else {
111- List<AbstractEntityModel> selectedList = dialog.getSelection();
112- if (selectedList.size() == 0) {
113- ccommand.add(new ConnectionDeleteCommand(original.getCreationRelationship()));
114- } else {
115- // みなしスーパーセット編集
116- ccommand.add(new ModelEditCommand(original, edited));
117-
118- // 接点編集
119- ccommand.add(
120- new VirtualSupersetTypeChangeCommand(original.getVirtualSupersetType(),
121- dialog.getEditedAggregator().isApplyAttribute()));
122- // 接点との接続
123- ccommand.add(new VirtualSubsetReplaceCommand(original, dialog.getSelection()));
124- }
102+ ccommand = new VirtualSupersetEditCommand(original, edited, selection,
103+ aggregator.isApplyAttribute());
125104 }
126105 execute(ccommand);
127106 }
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/dialogs/VirtualSupersetCreateDialog.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/dialogs/VirtualSupersetCreateDialog.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2016 TMD-Maker Project <http://tmdmaker.osdn.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -20,15 +20,6 @@ import java.util.LinkedHashSet;
2020 import java.util.List;
2121 import java.util.Set;
2222
23-import jp.sourceforge.tmdmaker.Messages;
24-import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
25-import jp.sourceforge.tmdmaker.model.Diagram;
26-import jp.sourceforge.tmdmaker.model.VirtualSuperset;
27-import jp.sourceforge.tmdmaker.model.VirtualSupersetType;
28-import jp.sourceforge.tmdmaker.model.rule.VirtualEntityRule;
29-import jp.sourceforge.tmdmaker.ui.dialogs.components.ModelSelectPanel;
30-import jp.sourceforge.tmdmaker.ui.dialogs.components.VirtualSupersetSettingPanel;
31-
3223 import org.eclipse.jface.dialogs.Dialog;
3324 import org.eclipse.jface.dialogs.IDialogConstants;
3425 import org.eclipse.swt.SWT;
@@ -42,6 +33,15 @@ import org.eclipse.swt.widgets.Control;
4233 import org.eclipse.swt.widgets.Shell;
4334 import org.eclipse.swt.widgets.Text;
4435
36+import jp.sourceforge.tmdmaker.Messages;
37+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
38+import jp.sourceforge.tmdmaker.model.Diagram;
39+import jp.sourceforge.tmdmaker.model.VirtualSuperset;
40+import jp.sourceforge.tmdmaker.model.VirtualSupersetType;
41+import jp.sourceforge.tmdmaker.model.parts.ModelName;
42+import jp.sourceforge.tmdmaker.ui.dialogs.components.ModelSelectPanel;
43+import jp.sourceforge.tmdmaker.ui.dialogs.components.VirtualSupersetSettingPanel;
44+
4545 /**
4646 * みなしスーパーセット作成ダイアログ.
4747 *
@@ -139,7 +139,7 @@ public class VirtualSupersetCreateDialog extends Dialog {
139139 */
140140 @Override
141141 protected void okPressed() {
142- editedValue = VirtualEntityRule.createVirtualSuperset(panel1.getVirtualSupersetName());
142+ editedValue = VirtualSuperset.of(new ModelName(panel1.getVirtualSupersetName()));
143143 // editedValue.setName(panel1.getVirtualSupersetName());
144144 editedAggregator = new VirtualSupersetType();
145145 editedAggregator.setApplyAttribute(panel1.isApplyAttributeSelected());
--- /dev/null
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/draw2d/adjuster/VirtualSupersetAdjuster.java
@@ -0,0 +1,55 @@
1+/*
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package jp.sourceforge.tmdmaker.ui.editor.draw2d.adjuster;
17+
18+import jp.sourceforge.tmdmaker.model.VirtualSuperset;
19+import jp.sourceforge.tmdmaker.model.VirtualSupersetType;
20+import jp.sourceforge.tmdmaker.ui.editor.draw2d.ConstraintAdjuster;
21+import jp.sourceforge.tmdmaker.ui.editor.draw2d.ConstraintConverter;
22+
23+/**
24+ * みなしスーパーセットの位置調整.
25+ *
26+ * @author nakag
27+ *
28+ */
29+public class VirtualSupersetAdjuster implements ConstraintAdjuster {
30+
31+ private VirtualSuperset superset;
32+ private VirtualSupersetType type;
33+ private int x;
34+ private int y;
35+
36+ public VirtualSupersetAdjuster(VirtualSuperset superset, int x, int y) {
37+ super();
38+ this.superset = superset;
39+ this.type = superset.getVirtualSupersetType();
40+ this.x = x;
41+ this.y = y;
42+ }
43+
44+ /**
45+ *
46+ * {@inheritDoc}
47+ *
48+ * @see jp.sourceforge.tmdmaker.ui.editor.draw2d.ConstraintAdjuster#adjust()
49+ */
50+ @Override
51+ public void adjust() {
52+ ConstraintConverter.setConstraint(superset, x, y);
53+ ConstraintConverter.setConstraint(type, x, y + 50);
54+ }
55+}
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/commands/VirtualSubsetReplaceCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
1-/*
2- * Copyright 2009-2017 TMD-Maker Project <http://tmdmaker.osdn.jp/>
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
16-package jp.sourceforge.tmdmaker.ui.editor.gef3.commands;
17-
18-import java.util.List;
19-
20-import org.eclipse.gef.commands.Command;
21-
22-import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
23-import jp.sourceforge.tmdmaker.model.Entity2VirtualSupersetTypeRelationship;
24-import jp.sourceforge.tmdmaker.model.VirtualSuperset;
25-import jp.sourceforge.tmdmaker.model.VirtualSupersetType2VirtualSupersetRelationship;
26-
27-/**
28- * みなしスーパセットに接続しているサブセットを置き換えるCommand.
29- *
30- * @author nakag
31- *
32- */
33-public class VirtualSubsetReplaceCommand extends Command {
34- private VirtualSupersetType2VirtualSupersetRelationship relationship;
35- private List<Entity2VirtualSupersetTypeRelationship> oldSubset2typeRelationshipList;
36- private List<AbstractEntityModel> newSubsetList;
37-
38- public VirtualSubsetReplaceCommand(VirtualSuperset superset,
39- List<AbstractEntityModel> newSubsetList) {
40- this.relationship = superset.getCreationRelationship();
41- this.newSubsetList = newSubsetList;
42- this.oldSubset2typeRelationshipList = relationship.getSubset2typeRelationshipList();
43- }
44-
45- @Override
46- public void execute() {
47- relationship.reconnect(newSubsetList);
48- }
49-
50- @Override
51- public void undo() {
52- relationship.disconnect();
53- relationship.setSubset2typeRelationshipList(oldSubset2typeRelationshipList);
54- relationship.connect();
55- }
56-
57-}
--- /dev/null
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/commands/VirtualSupersetCreateCommand.java
@@ -0,0 +1,107 @@
1+/*
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package jp.sourceforge.tmdmaker.ui.editor.gef3.commands;
17+
18+import java.util.List;
19+
20+import org.eclipse.gef.commands.Command;
21+
22+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
23+import jp.sourceforge.tmdmaker.model.VirtualSuperset;
24+import jp.sourceforge.tmdmaker.model.virtual.VirtualSubsetBuilder;
25+import jp.sourceforge.tmdmaker.ui.editor.draw2d.adjuster.VirtualSupersetAdjuster;
26+
27+/**
28+ * みなしスーパーセット作成Command.
29+ *
30+ * @author nakag
31+ *
32+ */
33+public class VirtualSupersetCreateCommand extends Command {
34+ private VirtualSuperset superset;
35+ private VirtualSubsetBuilder builder;
36+ private int x;
37+ private int y;
38+
39+ /**
40+ * みなしスーパーセット、サブセットの新規作成用
41+ *
42+ * @param superset
43+ * @param subsets
44+ * @param x
45+ * @param y
46+ */
47+ public VirtualSupersetCreateCommand(VirtualSuperset superset, List<AbstractEntityModel> subsets,
48+ int x, int y) {
49+ this.superset = superset;
50+ this.builder = this.superset.virtualSubsets().builder();
51+ this.builder.subsetList(subsets);
52+ this.x = x;
53+ this.y = y;
54+ }
55+
56+ /**
57+ * みなしスーパーセット、サブセットの編集用
58+ *
59+ * @param superset
60+ * @param subsets
61+ */
62+ public VirtualSupersetCreateCommand(VirtualSuperset superset,
63+ List<AbstractEntityModel> subsets) {
64+ this(superset, subsets, 0, 0);
65+ }
66+
67+ /**
68+ *
69+ * {@inheritDoc}
70+ *
71+ * @see org.eclipse.gef.commands.Command#execute()
72+ */
73+ @Override
74+ public void execute() {
75+ this.builder.build();
76+ if (needPositionAdjust()) {
77+ new VirtualSupersetAdjuster(superset, x, y).adjust();
78+ }
79+ }
80+
81+ private boolean needPositionAdjust() {
82+ return !(this.x == 0 && this.y == 0);
83+ }
84+
85+ /**
86+ *
87+ * {@inheritDoc}
88+ *
89+ * @see org.eclipse.gef.commands.Command#undo()
90+ */
91+ @Override
92+ public void undo() {
93+ this.builder.rollback();
94+ }
95+
96+ /**
97+ *
98+ * {@inheritDoc}
99+ *
100+ * @see org.eclipse.gef.commands.Command#redo()
101+ */
102+ @Override
103+ public void redo() {
104+ this.builder.build();
105+ }
106+
107+}
--- /dev/null
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/commands/VirtualSupersetEditCommand.java
@@ -0,0 +1,49 @@
1+/*
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package jp.sourceforge.tmdmaker.ui.editor.gef3.commands;
17+
18+import java.util.List;
19+
20+import org.eclipse.gef.commands.CompoundCommand;
21+
22+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
23+import jp.sourceforge.tmdmaker.model.VirtualSuperset;
24+
25+
26+/**
27+ * みなしスーパーセット編集Command.
28+ *
29+ * @author nakag
30+ *
31+ */
32+public class VirtualSupersetEditCommand extends CompoundCommand {
33+
34+ public VirtualSupersetEditCommand(VirtualSuperset original, VirtualSuperset edited,
35+ List<AbstractEntityModel> selection, boolean applyAttribute) {
36+ if (selection.isEmpty()) {
37+ add(new ConnectionDeleteCommand(original.getCreationRelationship()));
38+ } else {
39+ // みなしスーパーセット編集
40+ add(new ModelEditCommand(original, edited));
41+
42+ // 接点との接続
43+ add(new VirtualSupersetCreateCommand(original, selection));
44+
45+ // 接点編集
46+ add(new VirtualSupersetTypeChangeCommand(original, applyAttribute));
47+ }
48+ }
49+}
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/commands/VirtualSupersetTypeChangeCommand.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/commands/VirtualSupersetTypeChangeCommand.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2015 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -15,17 +15,17 @@
1515 */
1616 package jp.sourceforge.tmdmaker.ui.editor.gef3.commands;
1717
18-import jp.sourceforge.tmdmaker.model.VirtualSupersetType;
19-
2018 import org.eclipse.gef.commands.Command;
2119
20+import jp.sourceforge.tmdmaker.model.VirtualSuperset;
21+
2222 /**
2323 * みなしスーパーセット種類変更Command.
2424 *
2525 * @author nakag
2626 */
2727 public class VirtualSupersetTypeChangeCommand extends Command {
28- private VirtualSupersetType model;
28+ private VirtualSuperset model;
2929 private boolean oldApplyAttribute;
3030 private boolean newApplyAttribute;
3131
@@ -37,10 +37,9 @@ public class VirtualSupersetTypeChangeCommand extends Command {
3737 * @param newApplyAttribute
3838 * アトリビュートに適用.
3939 */
40- public VirtualSupersetTypeChangeCommand(VirtualSupersetType model, boolean newApplyAttribute) {
40+ public VirtualSupersetTypeChangeCommand(VirtualSuperset model, boolean newApplyAttribute) {
4141 this.model = model;
4242 this.newApplyAttribute = newApplyAttribute;
43- this.oldApplyAttribute = model.isApplyAttribute();
4443 }
4544
4645 /**
@@ -50,7 +49,8 @@ public class VirtualSupersetTypeChangeCommand extends Command {
5049 */
5150 @Override
5251 public void execute() {
53- this.model.setApplyAttribute(newApplyAttribute);
52+ this.oldApplyAttribute = this.model.getVirtualSupersetType().isApplyAttribute();
53+ this.model.getVirtualSupersetType().setApplyAttribute(newApplyAttribute);
5454 }
5555
5656 /**
@@ -60,6 +60,11 @@ public class VirtualSupersetTypeChangeCommand extends Command {
6060 */
6161 @Override
6262 public void undo() {
63- this.model.setApplyAttribute(oldApplyAttribute);
63+ this.model.getVirtualSupersetType().setApplyAttribute(oldApplyAttribute);
64+ }
65+
66+ @Override
67+ public void redo() {
68+ this.model.getVirtualSupersetType().setApplyAttribute(newApplyAttribute);
6469 }
6570 }
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/editparts/node/VirtualSupersetTypeEditPart.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/editparts/node/VirtualSupersetTypeEditPart.java
@@ -1,5 +1,5 @@
11 /*
2- * Copyright 2009-2017 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.jp/>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import java.util.List;
2121 import org.eclipse.draw2d.IFigure;
2222 import org.eclipse.gef.Request;
2323 import org.eclipse.gef.commands.Command;
24-import org.eclipse.gef.commands.CompoundCommand;
2524 import org.eclipse.jface.dialogs.Dialog;
2625
2726 import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
@@ -30,10 +29,7 @@ import jp.sourceforge.tmdmaker.model.VirtualSuperset;
3029 import jp.sourceforge.tmdmaker.model.VirtualSupersetType;
3130 import jp.sourceforge.tmdmaker.ui.dialogs.VirtualSupersetCreateDialog;
3231 import jp.sourceforge.tmdmaker.ui.editor.draw2d.figure.node.SubsetTypeFigure;
33-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ConnectionDeleteCommand;
34-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ModelEditCommand;
35-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSubsetReplaceCommand;
36-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSupersetTypeChangeCommand;
32+import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.VirtualSupersetEditCommand;
3733
3834 /**
3935 * みなしスーパーセット種類(同一(=)/相違マーク(×))のコントローラ.
@@ -87,24 +83,8 @@ public class VirtualSupersetTypeEditPart extends AbstractSubsetTypeEditPart<Virt
8783 if (dialog.open() != Dialog.OK)
8884 return null;
8985
90- CompoundCommand ccommand = new CompoundCommand();
91- List<AbstractEntityModel> selectedList = dialog.getSelection();
92- if (selectedList.size() == 0) {
93- ccommand.add(new ConnectionDeleteCommand(superset.getCreationRelationship()));
94- } else {
95- VirtualSuperset edited = dialog.getEditedValue();
96- // みなしスーパーセット編集
97- ccommand.add(new ModelEditCommand(superset, edited));
98-
99- // 接点編集
100- ccommand.add(new VirtualSupersetTypeChangeCommand(superset.getVirtualSupersetType(),
101- dialog.getEditedAggregator().isApplyAttribute()));
102-
103- // 接点との接続
104- ccommand.add(new VirtualSubsetReplaceCommand(superset, dialog.getSelection()));
105- }
106-
107- return ccommand;
86+ return new VirtualSupersetEditCommand(superset, dialog.getEditedValue(),
87+ dialog.getSelection(), dialog.getEditedAggregator().isApplyAttribute());
10888 }
10989
11090 /**
--- a/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/DiagramTest.java
+++ b/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/DiagramTest.java
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
1919
2020 import java.util.ArrayList;
2121 import java.util.List;
22-
22+import jp.sourceforge.tmdmaker.model.parts.ModelName;
2323 import org.junit.Test;
2424
2525 /**
@@ -40,7 +40,8 @@ public class DiagramTest {
4040 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
4141 list.add(e1);
4242 list.add(e2);
43- VirtualSuperset vsp = diagram.createVirtualSuperset("スーパーセット", list);
43+ VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
44+ vsp.virtualSubsets().builder().subsetList(list).build();
4445 VirtualSupersetType2VirtualSupersetRelationship t2v = (VirtualSupersetType2VirtualSupersetRelationship) vsp.getModelTargetConnections().get(0);
4546 VirtualSupersetType type = vsp.getVirtualSupersetType();
4647 Entity2VirtualSupersetTypeRelationship m2t1 = (Entity2VirtualSupersetTypeRelationship) type
@@ -74,7 +75,8 @@ public class DiagramTest {
7475 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
7576 list.add(e1);
7677 list.add(e2);
77- VirtualSuperset vsp = diagram.createVirtualSuperset("スーパーセット", list);
78+ VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
79+ vsp.virtualSubsets().builder().subsetList(list).build();
7880 assertEquals(3, diagram.findEntityModel().size());
7981
8082 VirtualSupersetType type = vsp.getVirtualSupersetType();
--- a/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/RelatedRelationshipTest.java
+++ b/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/RelatedRelationshipTest.java
@@ -19,8 +19,8 @@ import static org.junit.Assert.assertEquals;
1919
2020 import org.junit.Test;
2121
22+import jp.sourceforge.tmdmaker.model.parts.ModelName;
2223 import jp.sourceforge.tmdmaker.model.relationship.Relationship;
23-import jp.sourceforge.tmdmaker.model.rule.VirtualEntityRule;
2424
2525 /**
2626 * RelatedRelationshipのテスト
@@ -42,7 +42,7 @@ public class RelatedRelationshipTest {
4242 Entity e2 = Entity.ofEvent(new Identifier("テスト2番号")).withDefaultAttribute();
4343 diagram.addChild(e2);
4444
45- VirtualSuperset vsp = VirtualEntityRule.createVirtualSuperset("スーパーセット");
45+ VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
4646 VirtualSupersetType type = new VirtualSupersetType();
4747 diagram.addChild(vsp);
4848 diagram.addChild(type);
--- a/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/VirtualSupersetTest.java
+++ b/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/VirtualSupersetTest.java
@@ -23,6 +23,8 @@ import java.util.List;
2323
2424 import org.junit.Test;
2525
26+import jp.sourceforge.tmdmaker.model.parts.ModelName;
27+
2628 /**
2729 * VirtualSupersetのテストクラス
2830 *
@@ -46,7 +48,8 @@ public class VirtualSupersetTest {
4648 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
4749 list.add(e1);
4850 list.add(e2);
49- VirtualSuperset vsp = diagram.createVirtualSuperset("スーパーセット", list);
51+ VirtualSuperset vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
52+ vsp.virtualSubsets().builder().subsetList(list).build();
5053 VirtualSupersetType type1 = vsp.getVirtualSupersetType();
5154
5255 assertEquals(true, vsp.isDeletable());
@@ -78,11 +81,13 @@ public class VirtualSupersetTest {
7881 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
7982 list.add(e1);
8083 list.add(e2);
81- VirtualSuperset vsp1 = diagram.createVirtualSuperset("スーパーセット1", list);
84+ VirtualSuperset vsp1 = VirtualSuperset.of(new ModelName("スーパーセット1"));
85+ vsp1.virtualSubsets().builder().subsetList(list).build();
8286 list = new ArrayList<AbstractEntityModel>();
8387 list.add(e3);
8488 list.add(vsp1);
85- VirtualSuperset vsp2 = diagram.createVirtualSuperset("スーパーセット2", list);
89+ VirtualSuperset vsp2 = VirtualSuperset.of(new ModelName("スーパーセット2"));
90+ vsp2.virtualSubsets().builder().subsetList(list).build();
8691
8792 assertEquals(true, vsp2.isDeletable());
8893 assertEquals(false, vsp1.isDeletable());
--- a/tests/tmdmaker.test/src/jp/sourceforge/tmdmaker/editpart/TMDEditPartFactoryTest.java
+++ b/tests/tmdmaker.test/src/jp/sourceforge/tmdmaker/editpart/TMDEditPartFactoryTest.java
@@ -111,7 +111,8 @@ public class TMDEditPartFactoryTest {
111111 List<AbstractEntityModel> list = new ArrayList<AbstractEntityModel>();
112112 list.add(e1);
113113 list.add(e2);
114- vsp = diagram.createVirtualSuperset("スーパーセット", list);
114+ vsp = VirtualSuperset.of(new ModelName("スーパーセット"));
115+ vsp.virtualSubsets().builder().subsetList(list).build();
115116 vtype = vsp.getVirtualSupersetType();
116117 }
117118
@@ -187,7 +188,7 @@ public class TMDEditPartFactoryTest {
187188 editPart = factory.createEditPart(null, o);
188189 assertThat(editPart, instanceOf(VirtualEntityEditPart.class));
189190
190- o = new VirtualSuperset();
191+ o = VirtualSuperset.of(new ModelName("スーパーセット"));
191192 editPart = factory.createEditPart(null, o);
192193 assertThat(editPart, instanceOf(VirtualSupersetEditPart.class));
193194
Show on old repository browser