Here is what I found.
I'm adding a doc into book garage (pharo for the entreprise)

How to create Nautilus-Plugins

Here we will give some brief explanations on how to create your own plugin. By the way there are only two requirements
to create a Nautilus-Plugin:

• the class should inherit from AbstractNautilusPlugin
• it should implement #registerTo: aModel

Announcement subscription

The method registerTo: is used by the plugin to register itself to aModel announcements.


Pharo by Example

MyPlugin>>registerTo: aModel

    aModel announcer
    on: NautilusKeyPressed send: #keyPressed: to: self


In this example, the instance of MyPlugin subscribe themselves to NautilusKeyPressed, and
tell aModel’s announcer to send: keyPressed to the instance.

Pharo by Example

So each time a key will be pressed in a Nautilus window the methodkeyPressed: will be called.

Pharo by Example

Display

If you want your plugin to add a graphical widget to Nautilus you should override the display method. This method should return the Morphic element you want Nautilus to display. By default the method returns nil to
notify Nautilus not to display anything.

Pharo by Example

MyPlugin>>display

    morph := LabelMorph new contents: '';
enabled: false; vResizing: #shrinkWrap; hResizing: #spaceFill; yourself.

^ morph


Pharo by Example

You can also redefine the following methods on the class side:

• #defaultPosition : defines the default position of the morph (pos- sible values are {#top, #middle, #bottom, #none}). The default value is #none.

• #possiblePositions:answersacollectionofthepossiblepositions the widget could adopt.

And finally you could redefine the name method to change the name displayed in the Nautilus Plugin Manager.


Pharo by Example

Reply via email to