use of org.eclipse.gef.commands.CompoundCommand in project tmdmaker by tmdmaker.
the class SubsetCreateDialog method okPressed.
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
editedSubsetType = createEditedSubsetType();
editedExceptNull = panel.isExceptNull();
int partitionSelectionIndex = panel.getSelectedPartitionAttributeIndex();
if (partitionSelectionIndex != -1) {
editedPartitionAttribute = this.attributes.get(partitionSelectionIndex);
}
editedSubsetEntities = panel.getSubsetEntityList();
deletedSubsetEntities = panel.getDeletedSubsetEntityList();
ccommand = new CompoundCommand();
addSubsetAddCommand();
addSubsetTypeChangeCommand();
addSubsetEntityRenameCommand();
addSubsetDeleteCommand();
super.okPressed();
}
use of org.eclipse.gef.commands.CompoundCommand 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);
}
}
use of org.eclipse.gef.commands.CompoundCommand in project tmdmaker by tmdmaker.
the class FileImportAction method getCreateCommands.
private Command getCreateCommands(List<AbstractEntityModel> list, Point p) {
CompoundCommand ccommand = new CompoundCommand();
Diagram diagram = (Diagram) viewer.getContents().getModel();
int i = 0;
for (AbstractEntityModel model : list) {
EntityModelAddCommand c = new EntityModelAddCommand(diagram, p.x + i, p.y + i);
i += 5;
c.setModel(model);
ccommand.add(c);
}
return ccommand.unwrap();
}
use of org.eclipse.gef.commands.CompoundCommand in project jbosstools-base by jbosstools.
the class DefaultAlignmentAction method createAlignmentCommand.
private Command createAlignmentCommand() {
AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
request.setAlignmentRectangle(calculateAlignmentRectangle(request));
request.setAlignment(alignment);
List editparts = getOperationSet(request);
if (editparts.size() < 2)
return null;
CompoundCommand command = new CompoundCommand();
command.setDebugLabel(getText());
for (int i = 0; i < editparts.size(); i++) {
EditPart editpart = (EditPart) editparts.get(i);
command.add(editpart.getCommand(request));
}
return command;
}
use of org.eclipse.gef.commands.CompoundCommand in project archi by archimatetool.
the class SketchDNDEditPolicy method getDropCommand.
@Override
protected Command getDropCommand(DiagramDropRequest request) {
if (!(request.getData() instanceof IStructuredSelection)) {
return null;
}
// XY drop point
Point pt = getDropLocation(request);
// Origin
int origin = pt.x;
int x = pt.x;
int y = pt.y;
// Gather an actual list of elements dragged onto the container, omitting duplicates and anything already on the diagram
Object[] objects = ((IStructuredSelection) request.getData()).toArray();
List<IDiagramModel> list = getDiagramRefsToAdd(objects);
// Compound Command
CompoundCommand result = new CompoundCommand(Messages.SketchDNDEditPolicy_0);
for (IDiagramModel diagramModel : list) {
result.add(new AddDiagramModelReferenceCommand(getTargetContainer(), diagramModel, x, y));
x += 150;
if (x > origin + 400) {
x = origin;
y += 100;
}
}
return result;
}
Aggregations