4545import org .eclipse .jface .text .IFindReplaceTarget ;
4646import org .eclipse .jface .text .IFindReplaceTargetExtension5 ;
4747import org .eclipse .jface .util .OpenStrategy ;
48+ import org .eclipse .jface .viewers .ColumnLabelProvider ;
4849import org .eclipse .jface .viewers .ColumnPixelData ;
4950import org .eclipse .jface .viewers .EditingSupport ;
5051import org .eclipse .jface .viewers .IContentProvider ;
5556import org .eclipse .jface .viewers .ITreeSelection ;
5657import org .eclipse .jface .viewers .StructuredSelection ;
5758import org .eclipse .jface .viewers .TableLayout ;
59+ import org .eclipse .jface .viewers .TreePath ;
60+ import org .eclipse .jface .viewers .TreeSelection ;
5861import org .eclipse .jface .viewers .TreeViewer ;
5962import org .eclipse .jface .viewers .TreeViewerColumn ;
6063import org .eclipse .jface .window .Window ;
137140 * specification of the view. If this list is left out the problems
138141 * markerContentProvider will be used.
139142 *
143+ * @param <auto>
144+ *
140145 * @since 3.4
141146 *
142147 */
143- public class ExtendedMarkersView extends ViewPart implements IFindReplaceTarget , IFindReplaceTargetExtension5 {
148+ public class ExtendedMarkersView < auto > extends ViewPart implements IFindReplaceTarget , IFindReplaceTargetExtension5 {
144149
145150 /**
146151 * The Markers View Update Job Family
@@ -1796,7 +1801,6 @@ public void updateLayout() {
17961801 public void endInlineSession () {
17971802 findComposite .dispose ();
17981803 findComposite = null ;
1799- ;
18001804 }
18011805
18021806 @ Override
@@ -1808,34 +1812,39 @@ public boolean canPerformFind() {
18081812 @ Override
18091813 public int findAndSelect (int widgetOffset , String findString , boolean searchForward , boolean caseSensitive ,
18101814 boolean wholeWord ) {
1811- IMarker [] markers = getAllMarkers ();
1812- int foundIndex = 0 ;
1813-
1814- widgetOffset = 0 ;
18151815
1816- try {
1817- for (int searchIndex = widgetOffset ; searchIndex < markers .length ; searchIndex ++) {
1818- String markerMessage = (String ) markers [searchIndex ].getAttribute ("message" ); //$NON-NLS-1$
1819- if (markerMessage .contains (findString )) {
1820- foundIndex = searchIndex ;
1821- break ;
1816+ var tree = viewer .getTree ();
1817+ var items = tree .getItems ();
1818+ ArrayList <TreePath > selection = new ArrayList <>();
1819+ for (var item : items ) {
1820+ // TODO: has children?
1821+ for (var child : ((MarkerViewerContentProvider ) viewer .getContentProvider ()).getElements (item )) {
1822+ MarkerSupportItem [] markerCategoryChildren = ((MarkerCategory ) child ).getChildren ();
1823+ for (var markerSupportItem : markerCategoryChildren ) {
1824+ String markerMessage = markerSupportItem .getMarker ().getAttribute (IMarker .MESSAGE ,
1825+ MarkerSupportInternalUtilities .UNKNOWN_ATRRIBTE_VALUE_STRING );
1826+ if (markerMessage .contains (findString )) {
1827+ ArrayList <Object > selectionPath = new ArrayList <>();
1828+ selectionPath .add (item );
1829+ selectionPath .add (markerSupportItem );
1830+ selection .add (new TreePath (selectionPath .toArray ()));
1831+ }
18221832 }
1833+ var text = ((ColumnLabelProvider ) viewer .getLabelProvider (1 )).getText (child );
1834+ System .out .println (text );
18231835 }
1824- } catch (Exception e ) {
1825-
18261836 }
18271837
1828- viewer .setSelection (new StructuredSelection (new Object [] { markers [foundIndex ] }), true );
1829-
1838+ viewer .setSelection (new TreeSelection (selection .toArray (new TreePath [0 ])));
18301839
1831- return foundIndex ;
1840+ // very messy! TODO revisit how inline findreplace works
1841+ return 0 ;
18321842 }
18331843
18341844 @ Override
18351845 public Point getSelection () {
1836- IStructuredSelection selection = (IStructuredSelection ) viewer .getSelection ();
18371846
1838- return new Point (selection . getFirstElement (). hashCode () , 0 );
1847+ return new Point (0 , 0 );
18391848 }
18401849
18411850 @ Override
0 commit comments