RSE
Release 1.0

org.eclipse.rse.ui
Class SystemSortableSelection

java.lang.Object
  extended byorg.eclipse.rse.ui.SystemSortableSelection
All Implemented Interfaces:
Comparable

public class SystemSortableSelection
extends Object
implements Comparable

The TreeViewer widget does not seem to guarantee that multiple-selections are returned sorted in order of appearance in the tree. Some action require they be, such as MoveUp and MoveDown. This class captures the information for each selected item and permits sorting via position, using the Arrays helper class in java.util.


Constructor Summary
SystemSortableSelection(Object selectedObject)
          Constructor for SystemSortableSelection
 
Method Summary
 int compareTo(Object other)
           
 boolean equals(Object other)
           
 int getPosition()
          Get the poisition of the selected object within its parent list
 Object getSelectedObject()
          Get the selected object
static Object[] getSortedObjects(SystemSortableSelection[] sortedArray, Object[] outputArray)
          IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, AND CALLED SORTARRAY, THIS CONVERTS INTO A SORTED ARRAY THAT JUST HAS THE ORIGINAL OBJECTS IN IT FROM THE SELECTION LIST.
static SystemSortableSelection[] makeSortableArray(IStructuredSelection selection)
          Convert structured selection into an array of these objects.
 void setPosition(int position)
          Set the position of the selected object within its parent list
static void sortArray(SystemSortableSelection[] sortableArray)
          IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, THIS WILL SORT THAT ARRAY BY THE POSITION
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemSortableSelection

public SystemSortableSelection(Object selectedObject)
Constructor for SystemSortableSelection

Method Detail

getSelectedObject

public Object getSelectedObject()
Get the selected object


setPosition

public void setPosition(int position)
Set the position of the selected object within its parent list


getPosition

public int getPosition()
Get the poisition of the selected object within its parent list


compareTo

public int compareTo(Object other)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(Object)

equals

public boolean equals(Object other)

makeSortableArray

public static SystemSortableSelection[] makeSortableArray(IStructuredSelection selection)
Convert structured selection into an array of these objects. YOU MUST CALL SET POSITION AFTER FOR EACH ITEM, BEFORE YOU CAN SORT THIS ARRAY!


sortArray

public static void sortArray(SystemSortableSelection[] sortableArray)
IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, THIS WILL SORT THAT ARRAY BY THE POSITION


getSortedObjects

public static Object[] getSortedObjects(SystemSortableSelection[] sortedArray,
                                        Object[] outputArray)
IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, AND CALLED SORTARRAY, THIS CONVERTS INTO A SORTED ARRAY THAT JUST HAS THE ORIGINAL OBJECTS IN IT FROM THE SELECTION LIST.


RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.