Re: [Pydev-code] Can we add an action to the context menu of the PyDev editor?
Brought to you by:
fabioz
|
From: Fabio Z. <fa...@gm...> - 2007-11-27 05:58:10
|
It should be possible... The error you seem to be having is that
you're using a version of pydev and another of pydev extension (so,
pydev extensions seems to be trying to access something that's not
available in pydev).
Cheers,
Fabio
On Nov 26, 2007 9:49 PM, Florian Shkurti <flo...@gm...> wrote:
> Hi everyone,
>
> I have a plug-in that extends org.eclipse.ui.popupMenus
> in order to add an action to the context menu of the PyDev
> editor. Here's the relevant portion of my plugin.xml file:
>
> <viewerContribution
> id="org.eclipse.olm.editor_extensions.python_add_comment"
> targetID="#PythonEditorContext">
> <action
> class="org.eclipse.olm.pinkhippo.editor_extensions.AddCommentDelegate"
> icon="icons/sample.gif"
> id="org.eclipse.olm.editor_extensions.editor_actions.add_comment"
> label="Add Comment"
> menubarPath="additions"/>
> </viewerContribution>
>
> Unfortunately, the code that handles this action and implements
> IEditorActionDelegate has to access the editor, in the following way:
>
> ...
> public void run(IAction action) {
>
> if( editor.getEditorInput() != null &&
> editor.getEditorInput() instanceof IFileEditorInput &&
> editor instanceof AbstractTextEditor){
> ...
>
> I say 'unfortunately', because PyDev seems to be complaining
> about illegal access of some internal module. Here's the error message:
>
> Error received...
> tried to access field
> org.python.pydev.ui.pythonpathconf.InterpreterInfo.modulesManager from
> class com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver
> tried to access field
> org.python.pydev.ui.pythonpathconf.InterpreterInfo.modulesManager from
> class com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver
> java.lang.IllegalAccessError: tried to access field
> org.python.pydev.ui.pythonpathconf.InterpreterInfo.modulesManager from
> class com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver
> at com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver.notifyDefaultPythonpathRestored(InterpreterObserver.java:58)
> at com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver$1.run(InterpreterObserver.java:96)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
>
>
> Moreover, since this error occurs the action that I tried to insert in the
> context menu of the PyDev editor never appears there. The same code
> runs perfectly for the context menu of the Java editor (i.e.
> #CompilationUnitEditorContext
> as the targetID).
>
>
> Can anyone tell me what I am doing wrong here?
> Is it possible to extend the context menu of the PyDev editor?
>
>
>
> Thanks,
> Florian
>
> PS: I am running Eclipse 3.2 on Linux, Ubuntu 7.04
> and PyDev 1.3.8.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> pydev-code mailing list
> pyd...@li...
> https://lists.sourceforge.net/lists/listinfo/pydev-code
>
|