Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsProblem using activeEditorInput with Commands
https://www.eclipse.org/forums/index.php/mv/msg/159837/504977/#msg_504977
I'm migrating an application to eclipse 3.6 and converting the Actions to Commands. I'm setting up visiblewhen and enabledWhen conditions in the plugin.xml. I want some commands enabled with specific activeEditorInput, and have figured out this variable is actually the IEditorPart toString() value. I've tried to set up the xml code for a test definition like
This doesn't work. In my command execute(), I've done System.out.println() to get HandlerUtil.getVariables(event, ISources.ACTIVE_EDITOR_INPUT_NAME) and cut-and-pasted the result into the value field of the xml code expression. Even doing that, it doesn't work. If it were java code, it would be easy to step through and troubleshoot, but I'm stuck on how to troubleshoot this xml. Any thoughts would be much appreciated.]]>Michael Schmidt2009-12-23T23:18:56-00:00Re: Problem using activeEditorInput with Commands
https://www.eclipse.org/forums/index.php/mv/msg/159837/505001/#msg_505001
> Hi, Michael
>
> Your definition use variable activeEditorInput, its seems that this
> variable is not supported out of the box. See supported variables
> http://wiki.eclipse.org/Command_Core_Expressions
activeEditorInput is supported by the Platform. Look at ISources class
(http://bit.ly/7QEEsz) for the supported variables
- Prakash
Platform UI Team, IBM
Blog <http://blog.eclipse-tips.com>
Twitter <http://www.twitter.com/Eclipse_Tips>]]>Prakash G.R.2009-12-24T05:22:02-00:00Re: Problem using activeEditorInput with Commands
https://www.eclipse.org/forums/index.php/mv/msg/159837/504990/#msg_504990
Your definition use variable activeEditorInput, its seems that this variable is not supported out of the box. See supported variables
With best regards, Michael]]>Michael Golovanov2009-12-24T06:54:19-00:00Re: Problem using activeEditorInput with Commands
https://www.eclipse.org/forums/index.php/mv/msg/159837/505004/#msg_505004
]]>Michael Golovanov2009-12-24T10:30:50-00:00Re: Problem using activeEditorInput with Commands
https://www.eclipse.org/forums/index.php/mv/msg/159837/505028/#msg_505028
From the tracings, the activePart and activeEditor values are from the editor's toString() method. I confirmed this with a dummy command using the following code in the execute method.
This results in the following console output
1 activeEditorId us.mschmidt.akinoowin.dbeditors.DbEditor
2 activeEditorInput By Lead Author
3 activeEditor Table Editor By Lead Author
4 activePartId us.mschmidt.akinoowin.dbeditors.DbEditor
5 activePart Table Editor By Lead Author
I then create a visibleWhen <with> <equals> condition and cut-and-paste the values from the console into the xml (to avoid typos). The command is visible with conditions 1 and 4 but not 2, 3, or 5. So, apparently it evaluates correctly for the class references but not for the toString() values. Any thoughts?]]>Michael Schmidt2009-12-24T18:06:38-00:00Re: Problem using activeEditorInput with Commands
https://www.eclipse.org/forums/index.php/mv/msg/159837/505937/#msg_505937
>
> I then create a visibleWhen <with> <equals> condition and cut-and-paste
> the values from the console into the xml (to avoid typos). The command
> is visible with conditions 1 and 4 but not 2, 3, or 5. So, apparently
> it evaluates correctly for the class references but not for the
> toString() values. Any thoughts?
In ISources, _NAME means that the constant value (i.e.
activeEditorInput) is the name that can be used in "with" core expressions.
ACTIVE_EDITOR_NAME returns an IEditorPart. ACTIVE_PART_NAME returns an
IWorkbenchPart. ACTIVE_EDITOR_INPUT_NAME returns an IEditorInput.