private void selectObjects(ISelection savedSelections){
  List<Object> selectedElements=new ArrayList<Object>();
  if (savedSelections != null && savedSelections instanceof IStructuredSelection) {
    IStructuredSelection structuredSelection=((IStructuredSelection)savedSelections);
    for (    Object selection : structuredSelection.toList()) {
      if (selection instanceof TreeElement<?,?>) {
        TreeElement<?,?> element=(TreeElement<?,?>)selection;
        if (element.getData() instanceof IModelChangeSupport) {
          IModelChangeSupport modelObject=(IModelChangeSupport)element.getData();
          TreeElement<?,?> newTreeElement=findTreeElementForModelObject(modelObject);
          if (newTreeElement != null) {
            selectedElements.add(newTreeElement);
          }
        }
      }
    }
  }
  if (!selectedElements.isEmpty()) {
    fTreeViewer.setSelection(new StructuredSelection(selectedElements),true);
  }
}

private void selectObjects ( ISelection savedSelections ) { List < Object > selectedElements = new ArrayList < Object > ( ) ; if ( savedSelections != null && savedSelections instanceof IStructuredSelection ) { IStructuredSelection structuredSelection = ( ( IStructuredSelection ) savedSelections ) ; for ( Object selection : structuredSelection . toList ( ) ) { if ( selection instanceof TreeElement < ? , ? > ) { TreeElement < ? , ? > element = ( TreeElement < ? , ? > ) selection ; if ( element . getData ( ) instanceof IModelChangeSupport ) { IModelChangeSupport modelObject = ( IModelChangeSupport ) element . getData ( ) ; TreeElement < ? , ? > newTreeElement = findTreeElementForModelObject ( modelObject ) ; if ( newTreeElement != null ) { selectedElements . add ( newTreeElement ) ; } } } } } if ( ! selectedElements . isEmpty ( ) ) { fTreeViewer . setSelection ( new StructuredSelection ( selectedElements ) , true ) ; } }
this method will re - select the nodes that were selected before the change in the outline structure . this method should be called by any method that changes the structure of the outline tree .
