use of org.tmdmaker.ui.editor.gef3.commands.VirtualSupersetCreateCommand in project tmdmaker by tmdmaker.
the class VirtualSupersetCreateAction method run.
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
// アクション呼び出し時のマウスカーソル位置を取得。位置の微調整必要かも
Point pos = getControlCursorLocation();
List<AbstractEntityModel> selectedModels = getSelectedModelList();
Diagram diagram = getDiagram();
VirtualSuperset original = null;
VirtualSupersetType aggregator = null;
if (!selectedModels.isEmpty()) {
original = getVirtualSuperset();
if (original != null) {
selectedModels.remove(original);
}
}
VirtualSupersetCreateDialog dialog = new VirtualSupersetCreateDialog(getControl().getShell(), diagram, original, selectedModels);
if (dialog.open() == Dialog.OK) {
CompoundCommand ccommand = null;
VirtualSuperset edited = dialog.getEditedValue();
aggregator = dialog.getEditedAggregator();
List<AbstractEntityModel> selection = dialog.getSelection();
// みなしスーパーセット作成
if (original == null) {
if (selection.isEmpty()) {
return;
}
ccommand = new CompoundCommand();
ccommand.add(new VirtualSupersetCreateCommand(edited, selection, pos.x, pos.y));
ccommand.add(new VirtualSupersetTypeChangeCommand(edited, aggregator.isApplyAttribute()));
} else {
ccommand = new VirtualSupersetEditCommand(original, edited, selection, aggregator.isApplyAttribute());
}
execute(ccommand);
}
}
Aggregations