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));
}
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;
}
Aggregations