use of com.archimatetool.editor.views.tree.commands.NewElementCommand in project archi by archimatetool.
the class TreeModelViewActionFactory method createNewElementAction.
private IAction createNewElementAction(final IFolder folder, final EClass eClass) {
IAction action = new Action(ArchiLabelProvider.INSTANCE.getDefaultName(eClass)) {
@Override
public void run() {
// Create a new Archimate Element, set its name
IArchimateElement element = (IArchimateElement) IArchimateFactory.eINSTANCE.create(eClass);
element.setName(getText());
// Execute Command
Command cmd = new NewElementCommand(folder, element);
CommandStack commandStack = (CommandStack) folder.getAdapter(CommandStack.class);
commandStack.execute(cmd);
}
};
action.setImageDescriptor(ArchiLabelProvider.INSTANCE.getImageDescriptor(eClass));
return action;
}
Aggregations