Domanda

I have a tool that works on Pharo packages (RPackages).

To make it accessible i want to add a menu entry to the Nautilus package context menu, so one can open my tool on selected packages from within Nautilus. Is this possible?

È stato utile?

Soluzione

To add entries to the Nautilus context menus you can use one of the menu pragmas that are defined in the AbstractNautilusUI menu pragmas protocol.

Just define a class side method with one of the pragmas on any class you desire. For example:

MyClass class >> myMenuEntry: aBuilder
   <nautilusGlobalPackageMenu>
   | target packages |

   target := aBuilder model.

   (packages := target selectedPackages) ifNil: [ ^ target ].

   (aBuilder item: #'Show my selection')
        action: [ self inform: packages ]

In the case of the Nautilus package menu you obtain the selection via

aBuilder model selectedPackages

Use the Finder’s pragma search option to look at examples.

(Thanks to Benjamin Van Ryseghem)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top