Adding a command to multiple views [message #336555] |
Mon, 22 June 2009 14:20  |
Eclipse User |
|
|
|
I have "Refresh" Handler that can be used for any Part that implements an
interface called RefreshablePart:
<handler class="test.RefreshPartHandler"
commandId="org.eclipse.ui.file.refresh">
<activeWhen>
<with variable="activePart">
<instanceof value="test.RefreshablePart"/>
</with>
</activeWhen>
</handler>
Here is how a refresh icon is added to a view:
<menuContribution locationURI="toolbar:testView">
<command commandId="org.eclipse.ui.file.refresh"
icon="icons/refresh.gif" style="push">
</command>
</menuContribution>
This works fine -- except that the Refresh icon appears disabled unless
the view is in focus, even though it still is clickable and works as
expected (clicking the icon makes the view receive focus).
One workaround is to specify the same icon as a disabledIcon. This is not
a perfect solution as there are still some subtle differences (mouse
over), and of course this causes issues if I actually wanted to disable
the command under certain circumstances.
But perhaps there is a better way to approach this?
|
|
|
|
Powered by
FUDForum. Page generated in 0.02864 seconds