Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreePath


        refreshSelectedPath();
    }

    private void refreshSelectedPath() {
        if (selectedPath != null) {
            TreePath treePath = contentProvider.findPath(selectedPath);
            if (treePath != null) {
                viewer.setSelection(new TreeSelection(treePath), true);
            }
            else {
                viewer.setSelection(TreeSelection.EMPTY);
View Full Code Here


        if (viewer.getSelection().isEmpty()) {
            result = null;
        }
        else {
            TreeSelection selection = (TreeSelection) viewer.getSelection();
            TreePath treePath = selection.getPaths()[0];
            result = new String[treePath.getSegmentCount()];
            for (int i = 0; i < result.length; i++) {
                result[i] = treePath.getSegment(i).toString();
            }
        }
        return result;
    }
View Full Code Here

        public TreePath findPath(final String[] path) {
            if ( (path == null) || (path.length == 0)) {
                return null;
            }

            TreePath result = TreePath.EMPTY;
            ZipTreeNode current = entryMap.get(path[0]);
            if (current == null) {
                return null;
            }
            result = result.createChildPath(current);

            segments: for (int i = 1; i < path.length; i++) {
                Collection<ZipTreeNode> children = current.getChildren();
                for (ZipTreeNode child: children) {
                    if (path[i].equals(child.toString())) {
                        current = child;
                        result = result.createChildPath(child);
                        continue segments;
                    }
                }
                return null;
            }
View Full Code Here

        public TreePath findPath(String[] path) {
            if (path == null || path.length == 0)
                return null;

            TreePath result = TreePath.EMPTY;
            ZipTreeNode current = entryMap.get(path[0]);
            if (current == null)
                return null;
            result = result.createChildPath(current);

            segments: for (int i = 1; i < path.length; i++) {
                Collection<ZipTreeNode> children = current.getChildren();
                for (ZipTreeNode child : children) {
                    if (path[i].equals(child.toString())) {
                        current = child;
                        result = result.createChildPath(child);
                        continue segments;
                    }
                }
                return null;
            }
View Full Code Here

        refreshSelectedPath();
    }

    private void refreshSelectedPath() {
        if (selectedPath != null) {
            TreePath treePath = contentProvider.findPath(selectedPath);
            if (treePath != null)
                viewer.setSelection(new TreeSelection(treePath), true);
            else
                viewer.setSelection(TreeSelection.EMPTY);
        }
View Full Code Here

        String[] result;
        if (viewer.getSelection().isEmpty())
            result = null;
        else {
            TreeSelection selection = (TreeSelection) viewer.getSelection();
            TreePath treePath = selection.getPaths()[0];
            result = new String[treePath.getSegmentCount()];
            for (int i = 0; i < result.length; i++)
                result[i] = treePath.getSegment(i).toString();
        }
        return result;
    }
View Full Code Here

            return null;
        }
        final IDebugTarget target = (IDebugTarget) process.getAdapter(IDebugTarget.class);
        ISelection selection = null;
        if (target == null) {
            selection = new TreeSelection(new TreePath(new Object[] {
                    DebugPlugin.getDefault().getLaunchManager(), process.getLaunch(),
                    process }));
        } else {
            selection = new TreeSelection(new TreePath(new Object[] {
                    DebugPlugin.getDefault().getLaunchManager(), target.getLaunch(),
                    target }));
        }
        return new ShowInContext(null, selection);
    }
View Full Code Here

              it = it.getParentItem();
            }

            Collections.reverse(ls);
            Display.getCurrent().asyncExec(
                new ExpandRunnable(new TreePath(ls.toArray())));
          }
        }

      });
      viewer.getTree().addListener(SWT.MeasureItem, new Listener() {
View Full Code Here

      ITreeContentProvider ts = (ITreeContentProvider) viewer
          .getContentProvider();
      Object[] children = ts.getChildren(item.getLastSegment());

      if (children != null && children.length == 1) {
        TreePath ps = item.createChildPath(children[0]);
        viewer.expandToLevel(ps, 2);
        Display.getCurrent().asyncExec(new ExpandRunnable(ps));
      }
    }
View Full Code Here

    assertThat(filter.isElementVisible(v, path.getLastSegment()), is(FALSE));
  }

  @Test
  public void shouldShowTheElementIfTheLabelOfTheElementMatchesTheFilterText() {
    TreePath path = new TreePath(new Object[]{"parent", "child"});

    ITreePathContentProvider contentProvider = mock(ITreePathContentProvider.class);
    given(contentProvider.getChildren(path.getParentPath()))
        .willReturn(new Object[]{path.getLastSegment()});
    given(contentProvider.getParents(path.getLastSegment()))
        .willReturn(new TreePath[]{path.getParentPath()});

    TreeViewer v = mock(TreeViewer.class);
    given(v.getContentProvider()).willReturn(contentProvider);

    filter.setPattern("child");
    assertThat(filter.isElementVisible(v, path.getLastSegment()), is(TRUE));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.TreePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.