Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Test for file extension in the active editor via expression definition in plugin.xml
Test for file extension in the active editor via expression definition in plugin.xml [message #552943] Sat, 14 August 2010 19:37 Go to next message
Eclipse UserFriend
I am trying to make the display of a toolbar button conditional upon the
type (extension) of the input file in the currently active editor. For
this I set the following expression:


<definition
id="com.kelman.basemap.ui.selectedGeometrySingleFile">
<and>
<reference

definitionId="com.kelman.database.kismet.ui.view.activeEditor ">
</reference>
<with
variable="activeEditor">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.name"
value="*.gdb">
</test>
</adapt>
</with>
</and>
</definition>

hoping to get the active editor adapt to the IResource and then test the
file name for the desired extension ("gdb").

But the getAdapter() method of the editor is never called. I guess, I am
using the wrong setup. What variable should I use to make the framework
use the editor as the target for adapter?

Thanks for any guidance.

Alex Molochnikov
Kelman Technologies Inc.
Re: Test for file extension in the active editor via expression definition in plugin.xml [message #553146 is a reply to message #552943] Mon, 16 August 2010 10:44 Go to previous messageGo to next message
Eclipse UserFriend
You need activeEditorInput to get the active editor input.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Re: Test for file extension in the active editor via expression definition in plugin.xml [message #553191 is a reply to message #553146] Mon, 16 August 2010 11:21 Go to previous message
Eclipse UserFriend
Paul Webster wrote:
> You need activeEditorInput to get the active editor input.
>
> PW
>
>
Thanks you. It worked:

<definition
id="com.kelman.basemap.ui.selectedGeometrySingleFile">
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.extension"
value="gdb">
</test>
</adapt>
</with>
</definition>
Previous Topic:Is there a way to override an existing adapterfactory / avoid it from adapting
Next Topic:Re: Key bindings not working in Eclipse
Goto Forum:
  


Current Time: Sat Jul 05 13:19:46 EDT 2025

Powered by FUDForum. Page generated in 0.03226 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top