Where to populate Version Control entry
Andreas Pakulat
apaku at gmx.de
Sun Aug 17 18:02:56 UTC 2008
On 17.08.08 13:07:51, Manuel Breugelmans wrote:
> On Saturday 16 August 2008 22:13:20 Andreas Pakulat wrote:
> > Hi,
> >
> > I wanted to move the code that populates the "Version Control" context
> > menu from the individual vcs plugins into a more central place.
> > Unfortunately I couldn't quite figure out the apropriate place for it.
> >
> > My problem is mostly that in shell/ there's only plugin controller who
> > can contribute to the context menus, but I don't want the VCS-code
> > there.
> >
> > So I'm looking for ideas how to do this in a clean way, ideally
> > something inside the vcs library would do this, but that would need
> > either the vcs lib linking to shell or a public signal in the
> > interfaces. I don't really like either of the options, but has anybody
> > got a better idea?
>
> Personally I would still populate in each plugin and instead delegate it to a
> common VcsContextGroup class, activated in the plugin's contextMenuExtension
> member.
>
> like so:
> void populate(KDevelop::ContextMenuExtension& menu, KDevelop::Context*
> context);
>
> As the prime actor here is a context action it makes a strong candidate for a
> class as well. Actually I'm already doing something like this for the code
> generation context actions.
>
> cfr:
> kdevelop/languages/cpp/languagesupport.cpp:126
> kdevelop/languages/cpp/veritas/stubcontextaction.h
> kdevelop/languages/cpp/veritas/uutcontextaction.h
I've looked through your code and I think what your idea is. The problem
is that this class would still populate the group multiple times as
multiple vcs plugins might say they can handle a given context item. Or
think about the case of selecting multiple projects with different
vcs systems in each. I think really the only sane way is filling this
menu in 1 place and then using the VCS api for each context item
(file/projectitem/whatever).
Andreas
--
Beware the one behind you.
More information about the KDevelop-devel
mailing list