0

My requirement is to highlight all occurrences of keywords when user double clicks on a word in eclipse rcp sql editor.

Problem is that already existing feature for syntax highlighting is gone when I override doubleclicked() method by extending DefaultTextDoubleClickStrategy and implementing ITextDoubleClickStrategy.

for (int i = 0; i < wrappers.size(); i++) {
            presentation.addStyleRange(new StyleRange(wrappers.get(i)
                    .getStart(), wrappers.get(i).getEnd()
                    - wrappers.get(i).getStart(), attr.getForeground(), attr
                    .getBackground()));
            text.changeTextPresentation(presentation, true);


    }

text.changeTextPresentation is overlapping with syntax coloring behavior. It is conflicting and overriding Presentation reconciler functionality which damages and repairs sql editor changes.

How to prevent my double click strategy from overlapping with syntax coloring behavior? Can we do syntax coloring along with highlighting occurrences?

Any help is greatly appreciated.

2
  • Could be a problem in the SourceViewerConfiguration (or derived class) used to specify the double click strategy.
    – greg-449
    Sep 13, 2013 at 10:38
  • Thanks. I am using textviewer.changetextpresentation(presentation, true) to set styleRange to selected region. This is overriding default eclipse sql editor syntax coloring. How to restore syntax coloring behavior along with retaining highlighted behavior?
    – rohitha
    Sep 17, 2013 at 10:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy