1 11 package org.eclipse.ant.internal.ui.editor; 12 13 import org.eclipse.ant.internal.ui.editor.text.XMLTextHover; 14 import org.eclipse.jface.text.IRegion; 15 import org.eclipse.jface.text.ITextViewer; 16 import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector; 17 import org.eclipse.jface.text.hyperlink.IHyperlink; 18 19 public class AntElementHyperlinkDetector extends AbstractHyperlinkDetector { 20 21 private AntEditor fEditor; 22 23 public AntElementHyperlinkDetector() { 24 } 25 26 29 public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { 30 if (region == null) { 31 return null; 32 } 33 fEditor = (AntEditor) getAdapter(AntEditor.class); 34 region= XMLTextHover.getRegion(textViewer, region.getOffset()); 35 Object linkTarget= fEditor.findTarget(region); 36 if (linkTarget == null) { 37 return null; 38 } 39 return new IHyperlink[] {new AntElementHyperlink(fEditor, region, linkTarget)}; 40 } 41 } 42 | Popular Tags |