@Override public void execute() { if (canExecute()) { for (ICopyable n : list) ((ANode) n).setCut(true); Clipboard.getDefault().setContents(list); } }
public void undo() { for (int i = 0; i < target.size(); i++) { ICloneableModel obj = target.get(i); getRootModel().removeChild((AbstractDBEntityModel) obj); } Clipboard.getDefault().setContents(target); }
@SuppressWarnings("unchecked") public void run() { List<ICloneableModel> model = (List<ICloneableModel>) Clipboard.getDefault().getContents(); if (model == null) { return; } CommandStack stack = (CommandStack) ((VisualDBEditor) getWorkbenchPart()).getAdapter(CommandStack.class); stack.execute(new PasteCommand(model)); }
@Override protected boolean calculateEnabled() { Object obj = Clipboard.getDefault().getContents(); if (obj instanceof CopySnapshot) { CopySnapshot clipBoardCopy = (CopySnapshot) obj; return clipBoardCopy.canPasteToDiagram(getTargetDiagramModel()); } return false; }
@Override public void run() { Object obj = Clipboard.getDefault().getContents(); if (obj instanceof CopySnapshot) { CopySnapshot clipBoardCopy = (CopySnapshot) obj; execute( clipBoardCopy.getPasteCommand(getTargetDiagramModel(), fGraphicalViewer, fMousePosition)); fMousePosition = null; } }
public void execute() { List<ICloneableModel> copied = new ArrayList<ICloneableModel>(); for (int i = 0; i < target.size(); i++) { ICloneableModel obj = target.get(i); AbstractDBEntityModel entity = (AbstractDBEntityModel) obj; entity.setConstraint(getNewRectangle(entity.getConstraint())); getRootModel().addChild((AbstractDBEntityModel) obj); copied.add(obj.clone()); } Clipboard.getDefault().setContents(copied); }
@SuppressWarnings("unchecked") protected boolean calculateEnabled() { Object obj = Clipboard.getDefault().getContents(); if (obj == null) { return false; } if (obj instanceof List) { List<Object> list = (List<Object>) obj; for (int i = 0; i < list.size(); i++) { Object element = list.get(i); if (ICloneableModel.class.isAssignableFrom(element.getClass())) { return true; } } } return true; }
@Override public void run() { List<EditPart> newClips = ViewUtil.getPartsForClipboard(getParts()); Clipboard.getDefault().setContents(newClips); }