Community
Participate
Working Groups
Add a hyperlink detector that resolve macros, have just add to the JFace URLHyperlinkDetector a method that resolve macro before returning the IHyperlink to the workbench. 2007-04-10 Alphonse Van Assche <alcapcom@gmail.com> * src/org/eclipse/linuxtools/rpm/ui/editor/URLHyperlinkWithMacroDetector.java: New new class to resolve macro in URL. (detectHyperlinks): New method. (URLHyperlinkWithMacroDetector): Likewise. (resolveDefinesInURL): Likewise. * src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java: (getHyperlinkDetectors): use URLHyperlinkWithMacroDetector.
Created attachment 63351 [details] URLHyperlinkWithMacroDetector
Created attachment 63753 [details] new URLHyperlinkWithMacroDetector - extend rather than re-implement Could we do something like this instead? Rather than copying and slightly modifying the JFace class, could we extend it like this? I'm not sure if this makes sense ... public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { IHyperlink[] returned = super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks); if (returned.length > 0) { IHyperlink hyperlink = returned[0]; if (hyperlink instanceof URLHyperlink) { URLHyperlink urlHyperlink = (URLHyperlink) hyperlink; String newURLString = resolveDefinesInURL(urlHyperlink.getURLString()); return new IHyperlink[] {new URLHyperlink(urlHyperlink.getHyperlinkRegion(), newURLString)}; } } return returned; }
Absolutely that make sense more sense, thanks!
Thanks for the patch. Committed as revision 610. I've started on a test for this functionality. If you have time, please take a look at the recently-committed: org.eclipse.linuxtools.rpm.ui.editor.tests.HyperlinkWithMacroTests.java
Comment on attachment 63351 [details] URLHyperlinkWithMacroDetector Setting iplog flag.