1 11 12 package org.eclipse.pde.internal.ui.editor.text; 13 14 import org.eclipse.jface.text.IRegion; 15 import org.eclipse.jface.text.ITextViewer; 16 import org.eclipse.jface.text.Region; 17 import org.eclipse.jface.text.information.IInformationProvider; 18 import org.eclipse.jface.text.information.IInformationProviderExtension; 19 import org.eclipse.pde.internal.ui.editor.PDESourcePage; 20 21 25 public class PDESourceInfoProvider implements IInformationProvider, 26 IInformationProviderExtension { 27 28 private PDESourcePage fSourcePage; 29 30 33 public PDESourceInfoProvider(PDESourcePage sourcePage) { 34 fSourcePage = sourcePage; 35 } 36 37 40 public String getInformation(ITextViewer textViewer, IRegion subject) { 41 return getInformation2(textViewer, subject).toString(); 43 } 44 45 48 public IRegion getSubject(ITextViewer textViewer, int offset) { 49 if ((textViewer == null) || 51 (fSourcePage == null)) { 52 return null; 53 } 54 IRegion region = PDEWordFinder.findWord(textViewer.getDocument(), offset); 56 if (region == null) { 58 return new Region(offset, 0); 59 } 60 return region; 61 } 62 63 66 public Object getInformation2(ITextViewer textViewer, IRegion subject) { 67 if ((textViewer == null) || 69 (fSourcePage == null)) { 70 return null; 71 } 72 Object selection = fSourcePage.getSelection(); 74 if (selection == null) { 77 selection = new Object (); 78 } 79 return selection; 80 } 84 85 } 86 | Popular Tags |