use of org.tmdmaker.ui.editor.gef3.commands.VirtualSupersetEditCommand in project tmdmaker by tmdmaker.
the class VirtualSupersetTypeEditPart method getCommand.
/**
* {@inheritDoc}
*
* @see org.eclipse.gef.editparts.AbstractEditPart#getCommand(org.eclipse.gef.Request)
*/
@Override
public Command getCommand(Request request) {
if (!REQ_OPEN.equals(request.getType()))
return super.getCommand(request);
VirtualSupersetType type = getModel();
VirtualSuperset superset = type.getSuperset();
Diagram diagram = superset.getDiagram();
List<AbstractEntityModel> list = type.getSubsetList();
VirtualSupersetCreateDialog dialog = new VirtualSupersetCreateDialog(getViewer().getControl().getShell(), diagram, superset, list);
if (dialog.open() != Dialog.OK)
return null;
return new VirtualSupersetEditCommand(superset, dialog.getEditedValue(), dialog.getSelection(), dialog.getEditedAggregator().isApplyAttribute());
}
use of org.tmdmaker.ui.editor.gef3.commands.VirtualSupersetEditCommand 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