Search in sources :

Example 6 with TreeSelectionRequest

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

the class NewElementCommand method redo.

@Override
public void redo() {
    fFolder.getElements().add(fElement);
    // Select
    UIRequestManager.INSTANCE.fireRequest(new TreeSelectionRequest(this, new StructuredSelection(fElement), true));
}
Also used : TreeSelectionRequest(com.archimatetool.editor.views.tree.TreeSelectionRequest) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 7 with TreeSelectionRequest

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

the class NewFolderCommand method undo.

@Override
public void undo() {
    fParent.getFolders().remove(fFolder);
    // Select the parent node if no node is selected (this happens when the node is deleted)
    TreeSelectionRequest request = new TreeSelectionRequest(this, new StructuredSelection(fParent), true) {

        @Override
        public boolean shouldSelect(Viewer viewer) {
            return viewer.getSelection().isEmpty();
        }
    };
    UIRequestManager.INSTANCE.fireRequest(request);
}
Also used : TreeSelectionRequest(com.archimatetool.editor.views.tree.TreeSelectionRequest) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Viewer(org.eclipse.jface.viewers.Viewer)

Aggregations

TreeSelectionRequest (com.archimatetool.editor.views.tree.TreeSelectionRequest)7 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)7 Viewer (org.eclipse.jface.viewers.Viewer)3 NonNotifyingCompoundCommand (com.archimatetool.editor.model.commands.NonNotifyingCompoundCommand)1 CommandStack (org.eclipse.gef.commands.CommandStack)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1