Hi Don,

On 5/19/06, Don Taylor <nospamformeSVP@gmail.com> wrote:

When I run your code outside the action listener then it works, but when
it is inside the action listeners run() then it does not display anything.

Well, the problem is that you need to run it from an UI-thread. The code below shows a helper to do it:

if cmd == 'onCreateActions':
    from org.eclipse.jface.action import Action
    from org.python.pydev.core.docutils import PySelection
    from org.eclipse.ui.texteditor import IEditorStatusLine
    from org.eclipse.swt.widgets import Display
    from java.lang import Runnable
#------------------------------------------------ HELPER TO RUN THINGS IN THE UI

    class RunInUi(Runnable):
        '''Helper class that implements a Runnable (just so that we
        can pass it to the Java side). It simply calls some callable.
        def __init__(self, c):
            self.callable = c
        def run(self):
            self.callable ()
    def runInUi(callable):
        @param callable: the callable that will be run in the UI
#------------------------------------------------ END HELPER TO RUN THINGS IN THE UI
    class ExampleCommand3(Action):
        def run(self):
            def callable():
                statusLine = editor.getAdapter(IEditorStatusLine)
                if statusLine is not None:
                    statusLine.setMessage(True, "foo", None)
    editor.addOfflineActionListener ("e", ExampleCommand3(), 'Example on how to bind script action', False)