Review Request: Only show language context menu extensions if the menu is invoked in a context relevant to that language

Sven Brauch svenbrauch at gmx.de
Sun Apr 15 19:47:02 UTC 2012



> On April 15, 2012, 12:56 p.m., David Nolden wrote:
> > Hmm, somehow it feels like the code is in the wrong place, especially because it's fiddling with the duchain, which feels wrong in the plugin controller.
> > 
> > In principle, the language plugins themselves should be responsible for deciding, as there may also be cross-language actions.
> > 
> > As a compromise, one could add this code to a virtual member function of ILanguageSupport (for example "bool needContextMenu(Context*)"), so that this code would be the default, but it could be overridden.

Okay, Milian said that too and I agree, this should probably be done in the language plugins. So C++ checks whether the current document is a C++ document and only adds its context menu if it is. The API you suggested sounds good, I will suggest a patch for it soon.


- Sven


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104212/#review12468
-----------------------------------------------------------


On March 11, 2012, 2:27 p.m., Sven Brauch wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104212/
> -----------------------------------------------------------
> 
> (Updated March 11, 2012, 2:27 p.m.)
> 
> 
> Review request for KDevelop and Milian Wolff.
> 
> 
> Description
> -------
> 
> I tried to implement proper rename support for python, and during that task I noticed this behaviour: any loaded language plugin will add its context menu extensions to any context menu. The c++ plugin adds its rename dialog to php and python files. This patch fixes that behaviour by retrieving the URL of the file the action was invoked on, and then checks that the plugin -- if it is a language plugin -- fits that language.
> 
> 
> Diffs
> -----
> 
>   shell/plugincontroller.cpp 23408a6 
> 
> Diff: http://git.reviewboard.kde.org/r/104212/diff/
> 
> 
> Testing
> -------
> 
> The "rename" action no longer shows up in python, but seems to work as before in c++.
> 
> 
> Thanks,
> 
> Sven Brauch
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120415/304c53d7/attachment.html>


More information about the KDevelop-devel mailing list