Search in sources :

Example 1 with NewFolderCommand

use of com.archimatetool.editor.views.tree.commands.NewFolderCommand in project archi by archimatetool.

the class NewFolderAction method run.

@Override
public void run() {
    Object selected = getSelection().getFirstElement();
    if (selected instanceof IFolder) {
        IFolder parent = (IFolder) selected;
        // Create a new Folder, set its name
        IFolder folder = IArchimateFactory.eINSTANCE.createFolder();
        folder.setName(Messages.NewFolderAction_1);
        folder.setType(FolderType.USER);
        // Execute Command
        Command cmd = new NewFolderCommand(parent, folder);
        CommandStack commandStack = (CommandStack) parent.getAdapter(CommandStack.class);
        commandStack.execute(cmd);
    }
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) NewFolderCommand(com.archimatetool.editor.views.tree.commands.NewFolderCommand) Command(org.eclipse.gef.commands.Command) NewFolderCommand(com.archimatetool.editor.views.tree.commands.NewFolderCommand) IFolder(com.archimatetool.model.IFolder)

Aggregations

NewFolderCommand (com.archimatetool.editor.views.tree.commands.NewFolderCommand)1 IFolder (com.archimatetool.model.IFolder)1 Command (org.eclipse.gef.commands.Command)1 CommandStack (org.eclipse.gef.commands.CommandStack)1