Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.viewers
Class TreePathViewerSorter


java.lang.Object
  extended by 

org.eclipse.jface.viewers.ViewerComparator
      extended by 

org.eclipse.jface.viewers.ViewerSorter
          extended by 
org.eclipse.jface.viewers.TreePathViewerSorter
Direct Known Subclasses:
CommonViewerSorter

public class TreePathViewerSorter
extends ViewerSorter

A viewer sorter that is provided extra context in the form of the path of the parent element of the elements being sorted.

Since:
3.2

Field Summary
 
Fields inherited from class org.eclipse.jface.viewers. ViewerSorter
collator
 
Constructor Summary
TreePathViewerSorter ()
           
 
Method Summary
 int category ( TreePath parentPath, Object element)
          Provide a category for the given element that will have the given parent path when it is added to the viewer.
 int compare ( Viewer viewer, TreePath parentPath, Object e1, Object e2)
          Compare the given elements that will have the given parent path when they are added to the viewer.
 boolean isSorterProperty ( TreePath parentPath, Object element, String property)
          Returns whether this viewer sorter would be affected by a change to the given property of the given element.
 void sort ( Viewer viewer, TreePath parentPath, Object[] elements)
          Sorts the given elements in-place, modifying the given array.
 
Methods inherited from class org.eclipse.jface.viewers. ViewerSorter
getCollator
 
Methods inherited from class org.eclipse.jface.viewers. ViewerComparator
category, compare, getComparator, isSorterProperty, sort
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreePathViewerSorter

public TreePathViewerSorter()
Method Detail

category

public int category(
TreePath parentPath,
                    
Object element)
Provide a category for the given element that will have the given parent path when it is added to the viewer. The provided path is relative to the viewer input. The parent path will be null when the elements are root elements.

By default, the this method calls ViewerComparator.category(Object). Subclasses may override.

Parameters:
parentPath - the parent path for the element
element - the element
Returns:
the category of the element

compare

public int compare(
Viewer viewer,
                   
TreePath parentPath,
                   
Object e1,
                   
Object e2)
Compare the given elements that will have the given parent path when they are added to the viewer. The provided path is relative to the viewer input. The parent path will be null when the elements are root elements.

By default, the this method calls ViewerComparator.sort(Viewer, Object[]). Subclasses may override.

Parameters:
viewer - the viewer
parentPath - the parent path for the two elements
e1 - the first element
e2 - the second element
Returns:
a negative number if the first element is less than the second element; the value 0 if the first element is equal to the second element; and a positive

isSorterProperty

public boolean isSorterProperty(
TreePath parentPath,
                                
Object element,
                                
String property)
Returns whether this viewer sorter would be affected by a change to the given property of the given element. The provided path is relative to the viewer input. The parent path will be null when the elements are root elements.

The default implementation of this method calls ViewerComparator.isSorterProperty(Object, String). Subclasses may reimplement.

Parameters:
parentPath - the parent path of the element
element - the element
property - the property
Returns:
true if the sorting would be affected, and false if it would be unaffected

sort

public void sort(
Viewer viewer,
                 
TreePath parentPath,
                 
Object[] elements)
Sorts the given elements in-place, modifying the given array. The provided path is relative to the viewer input. The parent path will be null when the elements are root elements.

The default implementation of this method uses the java.util.Arrays#sort algorithm on the given array, calling compare(Viewer, TreePath, Object, Object) to compare elements.

Subclasses may reimplement this method to provide a more optimized implementation.

Parameters:
viewer - the viewer
parentPath - the parent path of the given elements
elements - the elements to sort

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire