1 11 package org.eclipse.jface.text.hyperlink; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.IAdaptable; 15 16 17 27 public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, IHyperlinkDetectorExtension { 28 29 32 private IAdaptable fContext; 33 34 42 public final void setContext(IAdaptable context) throws IllegalStateException , IllegalArgumentException { 43 Assert.isLegal(context != null); 44 if (fContext != null) 45 throw new IllegalStateException (); 46 fContext= context; 47 } 48 49 52 public void dispose() { 53 fContext= null; 54 } 55 56 65 protected final Object getAdapter(Class adapterClass) { 66 Assert.isLegal(adapterClass != null); 67 if (fContext != null) 68 return fContext.getAdapter(adapterClass); 69 return null; 70 } 71 72 } 73 | Popular Tags |