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.ui.navigator
Class CommonViewerSorter


java.lang.Object
  extended by 

org.eclipse.jface.viewers.ViewerComparator
      extended by 

org.eclipse.jface.viewers.ViewerSorter
          extended by 

org.eclipse.jface.viewers.TreePathViewerSorter
              extended by 
org.eclipse.ui.navigator.CommonViewerSorter

public final class CommonViewerSorter
extends TreePathViewerSorter

Provides an implementation of TreeViewerSorter that uses the given parent to determine the correct sort order based on the defined org.eclipse.ui.navigator.navigatorContent/navigatorContent/commonSorter elements available in the set of visible content extensions.

The CommonViewerSorter must be assigned a INavigatorContentService to drive its sorting algorithm. Without a valid content service, the sorter will return the default ordering.

A CommonViewerSorter may not be attached to more than one CommonViewer.

Since:
3.2

Field Summary
 
Fields inherited from class org.eclipse.jface.viewers. ViewerSorter
collator
 
Constructor Summary
CommonViewerSorter ()
           
 
Method Summary
 int category ( Object element)
          Returns the category of the given element.
 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 ( Object element, String property)
          Returns whether this viewer sorter would be affected by a change to the given property of the given element.
 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 setContentService ( INavigatorContentService aContentService)
          Create a sorter service attached to the given content service.
 
Methods inherited from class org.eclipse.jface.viewers. TreePathViewerSorter
category, sort
 
Methods inherited from class org.eclipse.jface.viewers. ViewerSorter
getCollator
 
Methods inherited from class org.eclipse.jface.viewers. ViewerComparator
compare, getComparator, sort
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonViewerSorter

public CommonViewerSorter()
Method Detail

setContentService

public void setContentService(
INavigatorContentService aContentService)
Create a sorter service attached to the given content service.

Parameters:
aContentService - The content service used by the viewer that will use this sorter service.
Since:
3.3

category

public int category(
Object element)
Description copied from class: ViewerComparator
Returns the category of the given element. The category is a number used to allocate elements to bins; the bins are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort criterion.

The default implementation of this framework method returns 0. Subclasses may reimplement this method to provide non-trivial categorization.

Overrides:
category in class ViewerComparator
Parameters:
element - the element
Returns:
the category

compare

public int compare(
Viewer viewer,
                   
TreePath parentPath,
                   
Object e1,
                   
Object e2)
Description copied from class: TreePathViewerSorter
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.

Overrides:
compare in class TreePathViewerSorter
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(
Object element,
                                
String property)
Description copied from class: ViewerComparator
Returns whether this viewer sorter would be affected by a change to the given property of the given element.

The default implementation of this method returns false. Subclasses may reimplement.

Overrides:
isSorterProperty in class ViewerComparator
Parameters:
element - the element
property - the property
Returns:
true if the sorting would be affected, and false if it would be unaffected

isSorterProperty

public boolean isSorterProperty(
TreePath parentPath,
                                
Object element,
                                
String property)
Description copied from class: TreePathViewerSorter
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.

Overrides:
isSorterProperty in class TreePathViewerSorter
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

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