From d82eefb550b11c6b1b346a8d858d590ac80dea84 Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 29 Jul 2015 09:07:08 +0200 Subject: [PATCH] Source menu items now get deactivated if the sourceview in the tab does not support the various sourceview methods. --- juci/notebook.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/juci/notebook.cc b/juci/notebook.cc index e2c70b5..9286bc8 100644 --- a/juci/notebook.cc +++ b/juci/notebook.cc @@ -33,6 +33,17 @@ Notebook::Controller::Controller() : }; CurrentSourceView()->search_highlight(last_search, case_sensitive_search, regex_search); } + + if(CurrentPage()!=-1) { + if(auto menu_item=dynamic_cast(Singleton::menu()->ui_manager->get_widget("/MenuBar/SourceMenu/SourceGotoDeclaration"))) + menu_item->set_sensitive((bool)CurrentSourceView()->get_declaration_location); + + if(auto menu_item=dynamic_cast(Singleton::menu()->ui_manager->get_widget("/MenuBar/SourceMenu/SourceGotoMethod"))) + menu_item->set_sensitive((bool)CurrentSourceView()->goto_method); + + if(auto menu_item=dynamic_cast(Singleton::menu()->ui_manager->get_widget("/MenuBar/SourceMenu/SourceRename"))) + menu_item->set_sensitive((bool)CurrentSourceView()->rename_similar_tokens); + } }); INFO("Notebook Controller Success"); } // Constructor