Search in sources :

Example 1 with GoIntoStateEvent

use of org.eclipse.che.ide.ui.smartTree.event.GoIntoStateEvent in project che by eclipse.

the class DefaultGoInto method reset.

/** {@inheritDoc} */
public void reset() {
    //reset selection
    tree.getSelectionModel().deselectAll();
    Element rootContainer = tree.getContainer(null);
    rootContainer.setInnerHTML("");
    //restore root nodes
    for (Node rootNode : rootNodes) {
        NodeDescriptor descriptor = tree.getNodeDescriptor(rootNode);
        rootContainer.appendChild(descriptor.getRootContainer());
    }
    //then re-add our go into node
    Node parent = node.getParent();
    if (parent != null) {
        tree.getNodeStorage().add(parent, node);
    }
    tree.scrollIntoView(node);
    tree.getSelectionModel().select(node, false);
    tree.update();
    active = false;
    fireEvent(new GoIntoStateEvent(DEACTIVATED, node));
}
Also used : Element(com.google.gwt.dom.client.Element) Node(org.eclipse.che.ide.api.data.tree.Node) GoIntoStateEvent(org.eclipse.che.ide.ui.smartTree.event.GoIntoStateEvent)

Example 2 with GoIntoStateEvent

use of org.eclipse.che.ide.ui.smartTree.event.GoIntoStateEvent in project che by eclipse.

the class DefaultGoInto method activate.

/** {@inheritDoc} */
public boolean activate(Node node) {
    if (!node.supportGoInto()) {
        return false;
    }
    //save node
    this.node = node;
    //save root nodes
    rootNodes = tree.getRootNodes();
    //reset selection
    tree.getSelectionModel().deselectAll();
    Element rootContainer = tree.getContainer(null);
    rootContainer.setInnerHTML("");
    rootContainer.appendChild(tree.getNodeDescriptor(node).getRootContainer());
    //if go into node is collapsed - then we need to expand it
    if (!tree.getNodeDescriptor(node).isExpanded()) {
        tree.setExpanded(node, true);
    }
    //then select go into node
    tree.getSelectionModel().select(node, false);
    tree.update();
    fireEvent(new GoIntoStateEvent(ACTIVATED, node));
    return active = true;
}
Also used : Element(com.google.gwt.dom.client.Element) GoIntoStateEvent(org.eclipse.che.ide.ui.smartTree.event.GoIntoStateEvent)

Aggregations

Element (com.google.gwt.dom.client.Element)2 GoIntoStateEvent (org.eclipse.che.ide.ui.smartTree.event.GoIntoStateEvent)2 Node (org.eclipse.che.ide.api.data.tree.Node)1