• R/O
  • HTTP
  • SSH
  • HTTPS

tmdmaker: Commit

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


Commit MetaInfo

Revision3b3f960bd41fe9f91e39d3f4ea8e333f613ebb66 (tree)
Time2018-09-05 08:29:57
Authornakag <nakag@user...>
Commiternakag

Log Message

Modify multivalue and build logic.

Change Summary

Incremental Difference

--- a/bundles/tmdmaker.core/META-INF/MANIFEST.MF
+++ b/bundles/tmdmaker.core/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Export-Package: jp.sourceforge.tmdmaker.core,
99 jp.sourceforge.tmdmaker.model,
1010 jp.sourceforge.tmdmaker.model.constraint,
1111 jp.sourceforge.tmdmaker.model.generate.attributelist,
12+ jp.sourceforge.tmdmaker.model.multivalue,
1213 jp.sourceforge.tmdmaker.model.other,
1314 jp.sourceforge.tmdmaker.model.parts,
1415 jp.sourceforge.tmdmaker.model.relationship,
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/AbstractEntityModel.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/AbstractEntityModel.java
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
2525 import org.slf4j.LoggerFactory;
2626
2727 import jp.sourceforge.tmdmaker.model.constraint.Constraint;
28+import jp.sourceforge.tmdmaker.model.multivalue.MultivalueAnd;
2829 import jp.sourceforge.tmdmaker.model.subset.Subsets;
2930
3031 /**
@@ -594,4 +595,7 @@ public abstract class AbstractEntityModel extends ConnectableElement {
594595 return new Subsets(this);
595596 }
596597
598+ public MultivalueAnd multivalueAnd() {
599+ return new MultivalueAnd(this);
600+ }
597601 }
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/ConnectableElement.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/ConnectableElement.java
@@ -74,4 +74,13 @@ public abstract class ConnectableElement extends ModelElement {
7474 targetConnections.remove(connx);
7575 firePropertyChange(P_TARGET_CONNECTION, connx, null);
7676 }
77+
78+ /**
79+ * リレーションシップがあるか?
80+ *
81+ * @return 他のモデルとのリレーションシップがある場合はtrueを返す.
82+ */
83+ public boolean hasRelationship() {
84+ return this.sourceConnections.size() != 0 || this.targetConnections.size() != 0;
85+ }
7786 }
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Header2DetailRelationship.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Header2DetailRelationship.java
@@ -15,7 +15,7 @@
1515 */
1616 package jp.sourceforge.tmdmaker.model;
1717
18-import jp.sourceforge.tmdmaker.model.rule.MultivalueRule;
18+import jp.sourceforge.tmdmaker.model.rule.ImplementRule;
1919
2020 /**
2121 * 多値のANDのヘッダとディテールとのリレーションシップ
@@ -49,11 +49,11 @@ public class Header2DetailRelationship extends TransfarReuseKeysToTargetRelation
4949 */
5050 public Header2DetailRelationship(AbstractEntityModel header) {
5151 setSource(header);
52- detail = MultivalueRule.createDetail(header);
52+ detail = createDetail(header);
5353 setTarget(detail);
5454 setTargetCardinality(Cardinality.MANY);
5555
56- superset = MultivalueRule.createMultivalueAndSuperset(header);
56+ superset = createMultivalueAndSuperset(header);
5757 superset.setDetail(detail);
5858
5959 aggregator = new MultivalueAndAggregator();
@@ -64,7 +64,64 @@ public class Header2DetailRelationship extends TransfarReuseKeysToTargetRelation
6464
6565 detail2aggregator = new RelatedRelationship(detail, aggregator);
6666 oldHeaderName = header.getName();
67- newHeaderName = MultivalueRule.createHeaderName(header);
67+ newHeaderName = createHeaderName(header);
68+ }
69+
70+ /**
71+ * 多値のANDのSupersetを作成する。
72+ *
73+ * @param header
74+ * 派生元のモデル
75+ * @return 多値のANDのSuperset
76+ */
77+ private MultivalueAndSuperset createMultivalueAndSuperset(AbstractEntityModel header) {
78+ MultivalueAndSuperset superset = new MultivalueAndSuperset();
79+ superset.setEntityType(header.getEntityType());
80+ superset.setName(header.getName());
81+ superset.addReusedIdentifier(header);
82+
83+ return superset;
84+ }
85+
86+ /**
87+ * 多値のANDのDetailを作成する。
88+ *
89+ * @param header
90+ * 派生元のモデル
91+ * @return 多値のANDのDetail
92+ */
93+ private Detail createDetail(AbstractEntityModel header) {
94+ Detail detail = new Detail();
95+ detail.setName(header.getName() + "DTL");
96+ detail.setEntityType(header.getEntityType());
97+ detail.setOriginalReusedIdentifier(header.createReusedIdentifier());
98+ detail.getDetailIdentifier().copyFrom(createDetailIdentifier(header.getName()));
99+ ImplementRule.setModelDefaultValue(detail);
100+ return detail;
101+ }
102+
103+ /**
104+ * Detailの個体指定子を作成する
105+ *
106+ * @param headerName
107+ * 派生元のモデル名
108+ * @return Detailの個体指定子
109+ */
110+ private Identifier createDetailIdentifier(String headerName) {
111+ Identifier id = new Identifier(headerName + "明細番号");
112+ ImplementRule.setIdentifierDefaultValue(id);
113+
114+ return id;
115+ }
116+
117+ /**
118+ * 多値のANDのHeaderの名称を作成する。
119+ *
120+ * @param model
121+ * @return
122+ */
123+ private String createHeaderName(AbstractEntityModel model) {
124+ return model.getName() + "HDR";
68125 }
69126
70127 /**
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/SubsetEntity.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/SubsetEntity.java
@@ -181,4 +181,15 @@ public class SubsetEntity extends AbstractEntityModel {
181181 public void accept(IVisitor visitor) {
182182 visitor.visit(this);
183183 }
184+
185+ /**
186+ *
187+ * {@inheritDoc}
188+ *
189+ * @see jp.sourceforge.tmdmaker.model.ConnectableElement#hasRelationship()
190+ */
191+ @Override
192+ public boolean hasRelationship() {
193+ return getModelSourceConnections().size() != 0 || getModelTargetConnections().size() > 1;
194+ }
184195 }
--- /dev/null
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/multivalue/MultivalueAnd.java
@@ -0,0 +1,65 @@
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.multivalue;
17+
18+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
19+import jp.sourceforge.tmdmaker.model.Detail;
20+import jp.sourceforge.tmdmaker.model.Header2DetailRelationship;
21+import jp.sourceforge.tmdmaker.model.MultivalueAndAggregator;
22+import jp.sourceforge.tmdmaker.model.MultivalueAndSuperset;
23+
24+/**
25+ * 多値のANDの集約クラス
26+ *
27+ * @author nakag
28+ *
29+ */
30+public class MultivalueAnd {
31+ private AbstractEntityModel model;
32+
33+ public MultivalueAnd(AbstractEntityModel model) {
34+ this.model = model;
35+ }
36+
37+ public Detail detail() {
38+ Header2DetailRelationship relationship = this.model.getHeader2DetailRelationship();
39+ if (relationship != null) {
40+ return relationship.getDetail();
41+ }
42+ return null;
43+ }
44+
45+ public MultivalueAndAggregator aggregator() {
46+ Header2DetailRelationship relationship = this.model.getHeader2DetailRelationship();
47+ if (relationship != null) {
48+ return relationship.getAggregator();
49+ }
50+ return null;
51+ }
52+
53+ public MultivalueAndSuperset superset() {
54+ Header2DetailRelationship relationship = this.model.getHeader2DetailRelationship();
55+ if (relationship != null) {
56+ return relationship.getMultivalueAndSuperset();
57+ }
58+ return null;
59+
60+ }
61+
62+ public MultivalueAndBuilder builder() {
63+ return new MultivalueAndBuilder(this.model);
64+ }
65+}
--- /dev/null
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/multivalue/MultivalueAndBuilder.java
@@ -0,0 +1,90 @@
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.multivalue;
17+
18+import java.util.ArrayList;
19+import java.util.List;
20+
21+import jp.sourceforge.tmdmaker.model.AbstractConnectionModel;
22+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
23+import jp.sourceforge.tmdmaker.model.AbstractRelationship;
24+import jp.sourceforge.tmdmaker.model.Cardinality;
25+import jp.sourceforge.tmdmaker.model.Header2DetailRelationship;
26+import jp.sourceforge.tmdmaker.model.relationship.Relationship;
27+
28+/**
29+ * 多値のANDを生成するクラス.
30+ *
31+ * @author nakag
32+ *
33+ */
34+public class MultivalueAndBuilder {
35+ private AbstractEntityModel header;
36+ private Header2DetailRelationship relationship;
37+ private List<AbstractRelationship> removedRelationshipList = new ArrayList<AbstractRelationship>();
38+ private List<AbstractRelationship> reconnectedRelationshipList = new ArrayList<AbstractRelationship>();
39+
40+ /**
41+ * コンストラクタは公開しない.
42+ *
43+ * @param header
44+ */
45+ protected MultivalueAndBuilder(AbstractEntityModel header) {
46+ this.header = header;
47+ this.relationship = new Header2DetailRelationship(header);
48+ }
49+
50+ public void build() {
51+ this.relationship.connect();
52+ if (header.isEvent()) {
53+ for (AbstractConnectionModel con : header.getModelTargetConnections()) {
54+ if (con instanceof AbstractRelationship) {
55+ AbstractRelationship relation = (AbstractRelationship) con;
56+ if (relation.isMultiValue()) {
57+ this.removedRelationshipList.add(relation);
58+ AbstractEntityModel source = relation.getSource();
59+ AbstractRelationship reconnectedRelationship = Relationship.of(source,
60+ this.relationship.getDetail());
61+ reconnectedRelationship.setTargetCardinality(Cardinality.MANY);
62+ this.reconnectedRelationshipList.add(reconnectedRelationship);
63+ }
64+ }
65+ }
66+ if (!this.removedRelationshipList.isEmpty()) {
67+ for (AbstractRelationship removed : this.removedRelationshipList) {
68+ removed.disconnect();
69+ }
70+ for (AbstractRelationship reconnected : this.reconnectedRelationshipList) {
71+ reconnected.connect();
72+ }
73+ }
74+
75+ }
76+
77+ }
78+
79+ public void rollback() {
80+ this.relationship.disconnect();
81+ if (!this.removedRelationshipList.isEmpty()) {
82+ for (AbstractRelationship removed : this.removedRelationshipList) {
83+ removed.connect();
84+ }
85+ for (AbstractRelationship reconnected : this.reconnectedRelationshipList) {
86+ reconnected.disconnect();
87+ }
88+ }
89+ }
90+}
--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/rule/MultivalueRule.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/rule/MultivalueRule.java
@@ -18,9 +18,6 @@ package jp.sourceforge.tmdmaker.model.rule;
1818 import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
1919 import jp.sourceforge.tmdmaker.model.Attribute;
2020 import jp.sourceforge.tmdmaker.model.DataTypeDeclaration;
21-import jp.sourceforge.tmdmaker.model.Detail;
22-import jp.sourceforge.tmdmaker.model.Identifier;
23-import jp.sourceforge.tmdmaker.model.MultivalueAndSuperset;
2421 import jp.sourceforge.tmdmaker.model.MultivalueOrEntity;
2522 import jp.sourceforge.tmdmaker.model.StandardSQLDataType;
2623
@@ -67,60 +64,6 @@ public class MultivalueRule {
6764 return attribute;
6865 }
6966
70- /**
71- * 多値のANDのDetailを作成する。
72- *
73- * @param header
74- * 派生元のモデル
75- * @return 多値のANDのDetail
76- */
77- public static Detail createDetail(AbstractEntityModel header) {
78- Detail detail = new Detail();
79- detail.setName(header.getName() + "DTL");
80- detail.setEntityType(header.getEntityType());
81- detail.setOriginalReusedIdentifier(header.createReusedIdentifier());
82- detail.getDetailIdentifier().copyFrom(createDetailIdentifier(header.getName()));
83- ImplementRule.setModelDefaultValue(detail);
84- return detail;
85- }
8667
87- /**
88- * Detailの個体指定子を作成する
89- *
90- * @param headerName
91- * 派生元のモデル名
92- * @return Detailの個体指定子
93- */
94- private static Identifier createDetailIdentifier(String headerName) {
95- Identifier id = new Identifier(headerName + "明細番号");
96- ImplementRule.setIdentifierDefaultValue(id);
9768
98- return id;
99- }
100-
101- /**
102- * 多値のANDのSupersetを作成する。
103- *
104- * @param header
105- * 派生元のモデル
106- * @return 多値のANDのSuperset
107- */
108- public static MultivalueAndSuperset createMultivalueAndSuperset(AbstractEntityModel header) {
109- MultivalueAndSuperset superset = new MultivalueAndSuperset();
110- superset.setEntityType(header.getEntityType());
111- superset.setName(header.getName());
112- superset.addReusedIdentifier(header);
113-
114- return superset;
115- }
116-
117- /**
118- * 多値のANDのHeaderの名称を作成する。
119- *
120- * @param model
121- * @return
122- */
123- public static String createHeaderName(AbstractEntityModel model) {
124- return model.getName() + "HDR";
125- }
12669 }
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/actions/MultivalueAndCreateAction.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/actions/MultivalueAndCreateAction.java
@@ -15,23 +15,11 @@
1515 */
1616 package jp.sourceforge.tmdmaker.ui.actions;
1717
18-import org.eclipse.gef.commands.CompoundCommand;
1918 import org.eclipse.ui.IWorkbenchPart;
2019
2120 import jp.sourceforge.tmdmaker.Messages;
22-import jp.sourceforge.tmdmaker.model.AbstractConnectionModel;
2321 import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
24-import jp.sourceforge.tmdmaker.model.AbstractRelationship;
25-import jp.sourceforge.tmdmaker.model.Cardinality;
26-import jp.sourceforge.tmdmaker.model.Detail;
27-import jp.sourceforge.tmdmaker.model.Header2DetailRelationship;
28-import jp.sourceforge.tmdmaker.model.MultivalueAndAggregator;
29-import jp.sourceforge.tmdmaker.model.MultivalueAndSuperset;
30-import jp.sourceforge.tmdmaker.model.relationship.Relationship;
31-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ConnectionCreateCommand;
32-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ConnectionDeleteCommand;
33-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.ConstraintAdjusterCommand;
34-import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.RelationshipConnectionCommand;
22+import jp.sourceforge.tmdmaker.ui.editor.gef3.commands.MultivalueAndCreateCommand;
3523 import jp.sourceforge.tmdmaker.ui.editor.gef3.editparts.node.AbstractModelEditPart;
3624
3725 /**
@@ -82,36 +70,7 @@ public class MultivalueAndCreateAction extends AbstractEntitySelectionAction {
8270 @Override
8371 public void run() {
8472 AbstractEntityModel model = getModel();
85- Header2DetailRelationship relationship = new Header2DetailRelationship(model);
86- Detail detail = relationship.getDetail();
87- MultivalueAndAggregator aggregator = relationship.getAggregator();
88- MultivalueAndSuperset superset = relationship.getMultivalueAndSuperset();
89-
90- CompoundCommand ccommand = new CompoundCommand();
91- ccommand.add(new RelationshipConnectionCommand(relationship));
92- ccommand.add(new ConstraintAdjusterCommand(model, detail, 100, 0));
93- ccommand.add(new ConstraintAdjusterCommand(model, superset, 64, -80));
94- ccommand.add(new ConstraintAdjusterCommand(model, aggregator, 75, -30));
95-
96- // 多値のリレーションをHeaderから削除してDetailと再接続
97- if (model.isEvent()) {
98- for (AbstractConnectionModel con : model.getModelTargetConnections()) {
99- if (con instanceof AbstractRelationship) {
100- AbstractRelationship relation = (AbstractRelationship) con;
101- if (relation.isMultiValue()) {
102- AbstractEntityModel source = relation.getSource();
103- ConnectionDeleteCommand command2 = new ConnectionDeleteCommand(relation);
104- ccommand.add(command2);
105- AbstractRelationship newRelation = Relationship.of(source, detail);
106-
107- newRelation.setTargetCardinality(Cardinality.MANY);
108- ConnectionCreateCommand command3 = new ConnectionCreateCommand(newRelation,
109- source, detail);
110- ccommand.add(command3);
111- }
112- }
113- }
114- }
115- execute(ccommand.unwrap());
73+ execute(new MultivalueAndCreateCommand(model));
11674 }
75+
11776 }
--- /dev/null
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/draw2d/adjuster/MultivalueAndAdjuster.java
@@ -0,0 +1,50 @@
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.AbstractEntityModel;
19+import jp.sourceforge.tmdmaker.model.multivalue.MultivalueAnd;
20+import jp.sourceforge.tmdmaker.ui.editor.draw2d.ConstraintAdjuster;
21+import jp.sourceforge.tmdmaker.ui.editor.draw2d.ConstraintConverter;
22+
23+/**
24+ * 多値のANDの位置調整.
25+ *
26+ * @author nakag
27+ *
28+ */
29+public class MultivalueAndAdjuster implements ConstraintAdjuster {
30+ private AbstractEntityModel header;
31+
32+ public MultivalueAndAdjuster(AbstractEntityModel header) {
33+ this.header = header;
34+ }
35+
36+ /**
37+ *
38+ * {@inheritDoc}
39+ *
40+ * @see jp.sourceforge.tmdmaker.ui.editor.draw2d.ConstraintAdjuster#adjust()
41+ */
42+ @Override
43+ public void adjust() {
44+ MultivalueAnd and = this.header.multivalueAnd();
45+ ConstraintConverter.setTranslatedConstraint(and.detail(), this.header, 100, 0);
46+ ConstraintConverter.setTranslatedConstraint(and.superset(), this.header, 64, -80);
47+ ConstraintConverter.setTranslatedConstraint(and.aggregator(), this.header, 75, -30);
48+ }
49+
50+}
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/draw2d/figure/node/MultivalueAndSupersetFigure.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/draw2d/figure/node/MultivalueAndSupersetFigure.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.
@@ -16,6 +16,7 @@
1616 package jp.sourceforge.tmdmaker.ui.editor.draw2d.figure.node;
1717
1818 import java.util.Arrays;
19+import java.util.Collections;
1920 import java.util.List;
2021
2122 import jp.sourceforge.tmdmaker.model.EntityType;
@@ -51,7 +52,7 @@ public class MultivalueAndSupersetFigure extends AbstractModelFigure<MultivalueA
5152 */
5253 @Override
5354 protected boolean isNotImplement(MultivalueAndSuperset model) {
54- return false;
55+ return model.isNotImplement();
5556 }
5657
5758 /**
@@ -64,4 +65,11 @@ public class MultivalueAndSupersetFigure extends AbstractModelFigure<MultivalueA
6465 protected String getTypeLabel(MultivalueAndSuperset model) {
6566 return EntityType.MA.getLabel();
6667 }
68+
69+ @Override
70+ protected List<String> setupRelationshipList(MultivalueAndSuperset model) {
71+ return Collections.emptyList();
72+ }
73+
74+
6775 }
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/draw2d/figure/node/SubsetEntityFigure.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/draw2d/figure/node/SubsetEntityFigure.java
@@ -41,7 +41,7 @@ public class SubsetEntityFigure extends AbstractModelFigure<SubsetEntity> {
4141 */
4242 @Override
4343 protected List<String> setupIdentifierList(SubsetEntity model) {
44- if (model.isSameSubset() && model.getAttributes().size() == 0) {
44+ if (model.isSameSubset() && model.getAttributes().size() == 0 && !model.hasRelationship()) {
4545 return Collections.emptyList();
4646 }
4747 if (model.isSupersetAnEntity()) {
@@ -60,7 +60,7 @@ public class SubsetEntityFigure extends AbstractModelFigure<SubsetEntity> {
6060 @Override
6161 protected List<String> setupRelationshipList(SubsetEntity model) {
6262 List<String> relationships = new ArrayList<String>();
63- if (model.isSameSubset() && model.getAttributes().size() == 0) {
63+ if (model.isSameSubset() && model.getAttributes().size() == 0 && !model.hasRelationship()) {
6464 // do nothing
6565 } else {
6666 if (!model.isSupersetAnEntity()) {
--- /dev/null
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/editor/gef3/commands/MultivalueAndCreateCommand.java
@@ -0,0 +1,72 @@
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 org.eclipse.gef.commands.Command;
19+
20+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
21+import jp.sourceforge.tmdmaker.model.multivalue.MultivalueAndBuilder;
22+import jp.sourceforge.tmdmaker.ui.editor.draw2d.adjuster.MultivalueAndAdjuster;
23+
24+/**
25+ * 多値のAND作成Command.
26+ *
27+ * @author nakag
28+ *
29+ */
30+public class MultivalueAndCreateCommand extends Command {
31+ private AbstractEntityModel model;
32+ private MultivalueAndBuilder builder;
33+
34+ public MultivalueAndCreateCommand(AbstractEntityModel model) {
35+ this.model = model;
36+ }
37+
38+ /**
39+ *
40+ * {@inheritDoc}
41+ *
42+ * @see org.eclipse.gef.commands.Command#execute()
43+ */
44+ @Override
45+ public void execute() {
46+ this.builder = this.model.multivalueAnd().builder();
47+ this.builder.build();
48+ new MultivalueAndAdjuster(this.model).adjust();
49+ }
50+
51+ /**
52+ *
53+ * {@inheritDoc}
54+ *
55+ * @see org.eclipse.gef.commands.Command#undo()
56+ */
57+ @Override
58+ public void undo() {
59+ this.builder.rollback();
60+ }
61+
62+ /**
63+ *
64+ * {@inheritDoc}
65+ *
66+ * @see org.eclipse.gef.commands.Command#redo()
67+ */
68+ @Override
69+ public void redo() {
70+ this.builder.build();
71+ }
72+}
Show on old repository browser