Search in sources :

Example 11 with ResourceNode

use of org.eclipse.che.ide.resources.tree.ResourceNode in project che by eclipse.

the class SelectPathViewImpl method acceptButtonClicked.

private void acceptButtonClicked() {
    List<Node> nodes = tree.getSelectionModel().getSelectedNodes();
    if (nodes.isEmpty()) {
        return;
    }
    Node selectedNode = nodes.get(0);
    if (selectedNode instanceof ResourceNode) {
        delegate.setSelectedPath(((ResourceNode) selectedNode).getData().getLocation().toString());
    }
    hide();
}
Also used : Node(org.eclipse.che.ide.api.data.tree.Node) ResourceNode(org.eclipse.che.ide.resources.tree.ResourceNode) ResourceNode(org.eclipse.che.ide.resources.tree.ResourceNode)

Example 12 with ResourceNode

use of org.eclipse.che.ide.resources.tree.ResourceNode in project che by eclipse.

the class LibraryNodeProvider method intercept.

@Override
public Promise<List<Node>> intercept(Node parent, List<Node> children) {
    if (parent instanceof ResourceNode) {
        final Resource resource = ((ResourceNode) parent).getData();
        if (resource.getResourceType() != PROJECT) {
            return promises.resolve(children);
        }
        final Project project = (Project) resource;
        if (isJavaProject(project) && isDisplayLibraries(project)) {
            final List<Node> intercepted = newArrayList(children);
            intercepted.add(nodeFactory.newLibrariesNode(project.getLocation(), settingsProvider.getSettings()));
            return promises.resolve(intercepted);
        }
    }
    return promises.resolve(children);
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) JavaUtil.isJavaProject(org.eclipse.che.ide.ext.java.client.util.JavaUtil.isJavaProject) Node(org.eclipse.che.ide.api.data.tree.Node) ResourceNode(org.eclipse.che.ide.resources.tree.ResourceNode) Resource(org.eclipse.che.ide.api.resources.Resource) ResourceNode(org.eclipse.che.ide.resources.tree.ResourceNode)

Aggregations

Node (org.eclipse.che.ide.api.data.tree.Node)12 ResourceNode (org.eclipse.che.ide.resources.tree.ResourceNode)12 Resource (org.eclipse.che.ide.api.resources.Resource)4 Project (org.eclipse.che.ide.api.resources.Project)3 ArrayList (java.util.ArrayList)2 ResourceDelta (org.eclipse.che.ide.api.resources.ResourceDelta)2 Path (org.eclipse.che.ide.resource.Path)2 Tree (org.eclipse.che.ide.ui.smartTree.Tree)2 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 JsonArray (elemental.json.JsonArray)1 JsonObject (elemental.json.JsonObject)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 NodeSettings (org.eclipse.che.ide.api.data.tree.settings.NodeSettings)1 Container (org.eclipse.che.ide.api.resources.Container)1 JavaUtil.isJavaProject (org.eclipse.che.ide.ext.java.client.util.JavaUtil.isJavaProject)1 SyntheticNode (org.eclipse.che.ide.project.node.SyntheticNode)1 PostLoadEvent (org.eclipse.che.ide.ui.smartTree.event.PostLoadEvent)1 PostLoadHandler (org.eclipse.che.ide.ui.smartTree.event.PostLoadEvent.PostLoadHandler)1 Test (org.junit.Test)1