List of usage examples for org.eclipse.jface.viewers TreePath EMPTY
TreePath EMPTY
To view the source code for org.eclipse.jface.viewers TreePath EMPTY.
Click Source Link
From source file:BMVirtualFindAction.java
License:Open Source License
protected VirtualTreeModelViewer initVirtualViewer(TreeModelViewer clientViewer, VirtualViewerListener listener) { Object input = clientViewer.getInput(); ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE); clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND); listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta); VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(clientViewer.getDisplay(), SWT.NONE, makeVirtualPresentationContext(clientViewer.getPresentationContext())); fVirtualViewer.addViewerUpdateListener(listener); fVirtualViewer.addLabelUpdateListener(listener); fVirtualViewer.setInput(input);//from ww w. j ava 2s . co m if (fVirtualViewer.canToggleColumns()) { fVirtualViewer.setShowColumns(clientViewer.isShowColumns()); } fVirtualViewer.updateViewer(stateDelta); return fVirtualViewer; }
From source file:BMVirtualFindAction.java
License:Open Source License
protected void setSelectionToClient(VirtualTreeModelViewer virtualViewer, ILabelProvider labelProvider, VirtualItem findItem) {/*from w w w . j a v a 2s . co m*/ virtualViewer.getTree().setSelection(new VirtualItem[] { findItem }); ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE); virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT); fClientViewer.updateViewer(stateDelta); ISelection selection = fClientViewer.getSelection(); if (!selection.isEmpty() && selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement().equals(findItem.getData())) { } else { DebugUIPlugin.errorDialog(fClientViewer.getControl().getShell(), "Error", "Could not select item:" + labelProvider.getText(findItem), new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Element no longer in viewer.")); } }
From source file:BMVirtualFindAction.java
License:Open Source License
public void update() { setEnabled(fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0); }
From source file:com.openMap1.mapper.views.ClassModelView.java
/** * @param qualifiedClassName the package name and class name of the class whose mapping has been selected */// w ww. j a v a2s . c o m public void showMappedClass(String qualifiedClassName, String subset) { // RMIM case; find the named LabelledEClass and expand to it if ((isRMIMRoot(ecoreRoot)) && (subset != null)) { TreePath startPath = TreePath.EMPTY.createChildPath(topLabelledEClass); if (parameterClassName() != null) startPath = extendToParameterClass(startPath, parameterClassName()); TreePath namedPath = findLabelledPath(qualifiedClassName, subset, startPath); if (namedPath != null) { viewer.setSelection(new TreeSelection(namedPath), true); // make it visible } else { System.out.println("Null tree path"); } } // non-RMIM case; find the named EClass and expand to it if (!(isRMIMRoot(ecoreRoot))) { EClass namedClass = ModelUtil.getNamedClass(ecoreRoot, qualifiedClassName); if (namedClass != null) { viewer.expandToLevel(namedClass, 0); viewer.setSelection(new StructuredSelection(namedClass)); } } }
From source file:com.openMap1.mapper.views.ClassModelView.java
/** * /*w ww . j a va 2 s . c om*/ * @param path * @return the treePath of LabelledEClasses got by following a string path, * or null if it cannot be followed */ private TreePath getLabelledTreePath(String path) { TreePath result = null; if (path != null) { StringTokenizer steps = new StringTokenizer(path, "/"); String topName = steps.nextToken(); // check the first step, which should be the name of the top class if (topName.equals(topLabelledEClass.eClass().getName())) { result = TreePath.EMPTY.createChildPath(topLabelledEClass); LabelledEClass currentClass = topLabelledEClass; while ((steps.hasMoreTokens()) && (currentClass != null)) { String step = steps.nextToken(); currentClass = currentClass.getNamedAssocChild(step); if (currentClass != null) result = result.createChildPath(currentClass); else result = null; } } } return result; }
From source file:com.palantir.typescript.text.OutlinePage.java
License:Apache License
private List<TreePath> mapTreePaths(List<NavigationBarItem> lexicalStructure) { ImmutableList.Builder<TreePath> treePaths = ImmutableList.builder(); for (TreePath treePath : this.getTreeViewer().getExpandedTreePaths()) { TreePath newTreePath = TreePath.EMPTY; for (int i = 0; i < treePath.getSegmentCount(); i++) { NavigationBarItem segment = (NavigationBarItem) treePath.getSegment(i); NavigationBarItem newSegment = mapSegment(lexicalStructure, segment); if (newSegment != null) { newTreePath = newTreePath.createChildPath(newSegment); }/*ww w. j a v a 2s . co m*/ } treePaths.add(newTreePath); } return treePaths.build(); }
From source file:de.walware.ecommons.workbench.search.ui.TextSearchResultTreeContentProvider.java
License:Open Source License
protected void addElement(final TreeViewer viewer, final E element, final int idx) { viewer.insert(TreePath.EMPTY, element, idx); }
From source file:de.walware.ecommons.workbench.search.ui.TextSearchResultTreeContentProvider.java
License:Open Source License
protected void removeElement(final TreeViewer viewer, final E element, final int idx) { viewer.remove(TreePath.EMPTY, idx); }
From source file:de.walware.statet.r.internal.ui.search.RElementSearchResultTreeContentProvider.java
License:Open Source License
protected void doAdd(final TreeViewer viewer, final Object element) { final Object parent = getParent(element); SortedListSet<Object> children = this.levelChildren.get(parent); if (children == null) { if (parent != null) { doAdd(viewer, parent);// w w w.j a v a 2 s.c o m } children = new SortedArraySet<Object>(NO_ELEMENTS, new LevelComparator()); this.levelChildren.put(parent, children); } final int idx; if ((idx = children.addE(element)) >= 0) { if (viewer != null) { viewer.insert((parent != null) ? parent : TreePath.EMPTY, element, idx); } } }
From source file:net.sourceforge.tagsea.core.ui.tags.TagsView.java
License:Open Source License
/** * @param tag/*from w ww.ja va2s . co m*/ * @return */ private TreePath createTreePath(ITag tag) { String[] segments = tag.getName().split("\\."); boolean flat = !TagSEAPlugin.getDefault().getPreferenceStore() .getBoolean(ITagSEAPreferences.TAGS_VIEW_TREE); TagTreeItem parent = null; String parentName = ""; TreePath path = TreePath.EMPTY; for (String segment : segments) { TagTreeItem item = new TagTreeItem(parentName + segment, parent, flat); parentName = item.getName() + "."; path = path.createChildPath(item); parent = item; } return path; }