Index: src/org/eclipse/cdt/internal/ui/cview/CView.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt-releng/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java,v retrieving revision 1.61.2.2 diff -u -r1.61.2.2 CView.java --- src/org/eclipse/cdt/internal/ui/cview/CView.java 28 Aug 2006 18:59:45 -0000 1.61.2.2 +++ src/org/eclipse/cdt/internal/ui/cview/CView.java 3 Nov 2006 19:53:16 -0000 @@ -203,7 +203,7 @@ * @see ISetSelectionTarget#selectReveal() */ public void selectReveal(ISelection selection) { - IStructuredSelection ssel = SelectionConverter.convertSelectionToCElements(selection); + IStructuredSelection ssel = SelectionConverter.convertSelectionToCElements(selection, true); if (!ssel.isEmpty()) { getViewer().setSelection(ssel, true); } Index: src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt-releng/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java,v retrieving revision 1.5 diff -u -r1.5 SelectionConverter.java --- src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java 23 Jun 2006 17:52:13 -0000 1.5 +++ src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java 3 Nov 2006 19:53:16 -0000 @@ -39,7 +39,25 @@ protected static final ICElement[] EMPTY_RESULT= new ICElement[0]; + /** + * Converts objects of a structured selection to c elements if possible. + * This is a convenience method, fully equivalent to + * convertSelectionToCElements(s, false). + * @param s The structured selection + * @return + */ public static IStructuredSelection convertSelectionToCElements(ISelection s) { + return convertSelectionToCElements(s, false); + } + + /** + * Converts objects of a structured selection to c elements if possible. + * @param s The structured selection + * @param keepNonCElements Whether to keep objects in selection if they cannot be converted + * @return The converted selection + */ + public static IStructuredSelection convertSelectionToCElements(ISelection s, + boolean keepNonCElements) { List converted = new ArrayList(); if (s instanceof StructuredSelection) { Object[] elements = ((StructuredSelection) s).toArray(); @@ -52,7 +70,11 @@ if (c != null) { converted.add(c); } + else if (keepNonCElements) + converted.add(e); } + else if (keepNonCElements) + converted.add(e); } } return new StructuredSelection(converted.toArray());