use of com.archimatetool.editor.views.tree.commands.MoveObjectCommand in project archi by archimatetool.
the class TreeModelViewerDragDropHandler method moveTreeObjects.
/**
* Move Tree Objects
*/
void moveTreeObjects(IFolder newParent, Object[] objects) {
final CompoundCommand compoundCommand = new NonNotifyingCompoundCommand() {
@Override
public String getLabel() {
return getCommands().size() > 1 ? Messages.TreeModelViewerDragDropHandler_0 : super.getLabel();
}
};
for (Object object : objects) {
if (object instanceof IFolder) {
// This first - folders go in folders
if (!newParent.getFolders().contains(object)) {
compoundCommand.add(new MoveFolderCommand(newParent, (IFolder) object));
}
} else if (object instanceof IArchimateModelObject) {
if (!newParent.getElements().contains(object)) {
compoundCommand.add(new MoveObjectCommand(newParent, (IArchimateModelObject) object));
}
}
}
CommandStack stack = (CommandStack) newParent.getAdapter(CommandStack.class);
stack.execute(compoundCommand);
}
Aggregations