Index: NbEditorToolBar.java =================================================================== RCS file: /cvs/editor/src/org/netbeans/modules/editor/NbEditorToolBar.java,v retrieving revision 1.18.2.1 diff -u -r1.18.2.1 NbEditorToolBar.java --- NbEditorToolBar.java 18 Jan 2006 19:09:29 -0000 1.18.2.1 +++ NbEditorToolBar.java 28 Mar 2006 16:33:17 -0000 @@ -594,23 +594,25 @@ private Lookup createActionContext() { JTextComponent c = getComponent(); - DataObject dobj = (c != null) ? NbEditorUtilities.getDataObject(c.getDocument()) : null; - - if (dobj != null){ - Node node = dobj.getNodeDelegate(); - return Lookups.singleton(node); - } - Lookup lookup = null; for (java.awt.Component comp = c; comp != null; comp = comp.getParent()) { if (comp instanceof Lookup.Provider) { - lookup = ((Lookup.Provider)comp).getLookup (); + Lookup lookup = ((Lookup.Provider)comp).getLookup (); if (lookup != null) { - break; + return lookup; } } } - return lookup; + + DataObject dobj = (c != null) ? NbEditorUtilities.getDataObject(c.getDocument()) : null; + if (dobj != null){ + Node node = dobj.getNodeDelegate(); + // XXX this could probably be just node.getLookup(), since + // the node contains itself in its lookup + return Lookups.singleton(node); + } + + return null; } private void processButton(AbstractButton button) {