diff --git a/collects/profj/tool.ss b/collects/profj/tool.ss index 535e13e28d..218915ffdc 100644 --- a/collects/profj/tool.ss +++ b/collects/profj/tool.ss @@ -892,7 +892,10 @@ (let ([c-box (new java-comment-box%)] [text (get-edit-target-object)]) (send text insert c-box) - (send text set-caret-owner c-box 'global))))) + (send text set-caret-owner c-box 'global)))) + (demand-callback + (lambda (mi) + (send mi enable ((get-edit-target-object) . is-a? . text%))))) (register-capability-menu-item 'profj:special:java-comment-box (get-special-menu)) )) diff --git a/collects/profjWizard/tool.ss b/collects/profjWizard/tool.ss index 08d5bdd1a1..c5cf9cb849 100644 --- a/collects/profjWizard/tool.ss +++ b/collects/profjWizard/tool.ss @@ -87,7 +87,13 @@ ;; ... the diagram (send editor insert (format "/*~n~a~n*/~n~n" (draw (car class-as-info))))) (send editor insert class-as-text)))) - (new menu-item% (label descr) (parent (get-special-menu)) (callback A))) + (define (enable mi) + (send mi enable ((get-edit-target-object) . is-a? . text%))) + (new menu-item% + (label descr) + (parent (get-special-menu)) + (callback A) + (demand-callback enable))) (make-menu-item% INSERT-JAVA-CLASS get-class-info make-class class-draw) (register-capability-menu-item 'profjWizard:special:java-class (get-special-menu))