diff -r 6552f6e77b1d editor.lib/src/org/netbeans/editor/Annotations.java --- a/editor.lib/src/org/netbeans/editor/Annotations.java Tue Mar 18 16:40:56 2008 +0100 +++ b/editor.lib/src/org/netbeans/editor/Annotations.java Thu Mar 20 19:40:58 2008 +0100 @@ -61,9 +61,12 @@ import javax.swing.JMenuItem; import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import org.netbeans.editor.ext.ExtKit; +import org.openide.util.ContextAwareAction; +import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.openide.util.actions.Presenter; +import org.openide.util.lookup.Lookups; /** Annotations class act as data model containing all annotations attached * to one document. Class uses instances of private class LineAnnotations for @@ -642,6 +645,14 @@ public class Annotations implements Docu } } + private Action getAction(AnnotationDesc anno, Action action) { + if (action instanceof ContextAwareAction && anno instanceof Lookup.Provider) { + Lookup lookup = ((Lookup.Provider) anno).getLookup(); + action = ((ContextAwareAction) action).createContextAwareInstance(lookup); + } + return action; + } + /** Creates menu item for the given action. It must handle the BaseActions, which * have localized name stored not in Action.NAME property. */ private JMenuItem createMenuItem(Action action, BaseKit kit) { @@ -684,7 +695,7 @@ public class Annotations implements Docu if (actions != null) { subMenu = new JMenu(anno.getAnnotationTypeInstance().getDescription()); for (int j=0; j 0) { orderedSubMenus.add(subMenu); @@ -703,7 +714,7 @@ public class Annotations implements Docu if (actions != null) { subMenu = new JMenu(pasiveAnnos[i].getAnnotationTypeInstance().getDescription()); for (int j=0; j= 0; i--) { - Class cls = inners[i]; - if (cls.getName().endsWith("AnnotationDescDelegate")) { - delegate = cls.getDeclaredField("delegate"); - delegate.setAccessible(true); - } - } for (Iterator it = lineAnnotations.getAnnotations(); it.hasNext();) { AnnotationDesc annoDesc = (AnnotationDesc)it.next(); - Annotation anno = (Annotation)delegate.get(annoDesc); + Annotation anno = ((Lookup.Provider) annoDesc).getLookup().lookup(Annotation.class); annotations.add(anno); }