"Create Snippet From Selection" context-menu entry

Milian Wolff mail at milianw.de
Fri Feb 12 11:54:50 UTC 2010

On Friday, 12. February 2010 08:12:38 Andreas Pakulat wrote:
> On 12.02.10 01:41:22, Milian Wolff wrote:
> > On Thursday 11 February 2010 23:46:23 David Nolden wrote:
> > > Hi! I have a problem with this context-menu entry in the editor. The
> > > problem is that it shows up _always_, and it shows up in a very bad
> > > place, without any separation from the code-navigation features.
> >
> > If you tell me how I could separate it from the code-navigation entries,
> > I'll happily do so. And regarding the "shows up always": I can change it
> > to only show once a selection is actually available, but that imo
> > decreases the discoverability of that feature immensely. What do others
> > think?
> This part I kind of agree with David and actually you do too. We've had
> very long discussions about the context menu in the treeview only
> containing actions which make sense based on the current context. The
> same applies here. If you want to improve discoverability of this
> feature, then add a permanent action to the main menu (in
> Editor->Snippets for example), that is greyed out without a selection in
> the editor.

Yes, after sleeping about it I came to the same conclusion.

> > > Yes in same cases it's greyed out, but anyway I think this anyway is
> > > not something you will be doing all the time. Such "random plugin"
> > > entries should only show up if there is a real indication that the user
> > > is actually using that plugin, for example it should definitely not
> > > show up if I don't even have the snippet tool view added to my
> > > mainwindow.
> >
> > Well, the question here is: Is a plugin supposed to be "working" or
> > "activated" without it's view? In the snippets case it is not imo - just
> > like you say, but what about other plugins? And this also imposes a bit
> > of additional cruft on my side (i.e. track how many views are available
> > and only show if the number of views is higher than 0.
> >
> > But actually snippets are "working" without a snippets view. You just
> > can't edit them.
> FACK. Having plugins track how many views are open to check wether they
> should add view-unrelated actions is simply wrong. If a plugin is loaded
> all its functionality should be available.

OK, what I'll do is:

- only add context menu when selection is available
- somehow separate the action from the navigation actions (dunno if that 
really works with the current API).
- add permanent action to menu
Milian Wolff
mail at milianw.de

More information about the KDevelop-devel mailing list