Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Replacement for ActionHandler
Replacement for ActionHandler [message #990997] Sun, 16 December 2012 16:42 Go to next message
Mikael Petterson is currently offline Mikael PettersonFriend
Messages: 153
Registered: July 2009
Senior Member
Hi,

refreshAction.setActionDefinitionId(REFRESH_ACTION_ID);
//Deprecated
//getViewSite().getKeyBindingService().registerAction(action);
//Using below:
IHandlerService service = (IHandlerService)getViewSite().getService(IHandlerService.class);
service.activateHandler(refreshAction.getActionDefinitionId(),new ActionHandler(refreshAction));

But I got that the ActionHandler is deprecated but I cannot find what to use instead.

Any ideas or examples?

br,

//mike
Re: Replacement for ActionHandler [message #991108 is a reply to message #990997] Mon, 17 December 2012 11:41 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 2012-12-16 17:42, Mikael Petterson wrote:
> Hi,
>
> refreshAction.setActionDefinitionId(REFRESH_ACTION_ID);
> //Deprecated
> //getViewSite().getKeyBindingService().registerAction(action);
> //Using below:
> IHandlerService service =
> (IHandlerService)getViewSite().getService(IHandlerService.class);
>
> service.activateHandler(refreshAction.getActionDefinitionId(),new
> ActionHandler(refreshAction));
>
> But I got that the ActionHandler is deprecated but I cannot find what to
> use instead.
>
> Any ideas or examples?

Note there exists two variants of ActionHandler:

org.eclipse.jface.commands.ActionHandler

and

org.eclipse.ui.commands.ActionHandler

Only the latter is deprecated.

- Daniel
Re: Replacement for ActionHandler [message #991295 is a reply to message #991108] Tue, 18 December 2012 12:05 Go to previous message
Mikael Petterson is currently offline Mikael PettersonFriend
Messages: 153
Registered: July 2009
Senior Member
Hi,

I tried using jface in my View:

private static final String REFRESH_ACTION_ID ="net.sourceforge.eclipseccase.views.configspecview.refreshAction";

IHandlerService service = (IHandlerService)getViewSite().getService(IHandlerService.class);
		
		refreshAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("net.sourceforge.eclipseccase.ui", "icons/full/refresh.gif"));
		refreshAction.setToolTipText("Refresh");
		//TODO: 3571949 Shortcut for Save/Clear/Refresh actions in configspec editor 
		refreshAction.setActionDefinitionId(REFRESH_ACTION_ID);		
		service.activateHandler(refreshAction.getActionDefinitionId(), new ActionHandler(refreshAction));



I have the following in my plugin.xml

	<extension point="org.eclipse.ui.commands"
       id="net.sourceforge.eclipseccase.views.configspecview.refreshAction"
       name="RefreshCsAction">
 	</extension>

	<key platform="gtk" commandId="net.sourceforge.eclipseccase.views.configspecview.refreshAction"
			 schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
			sequence="Alt+C K">
		</key>



When I have my view active and press ALT+C a tooltip pops up but but it does not show

ALT+C K. And even if I press ALT+C K nothing happens.


Any ideas what I am missing here?

br,

//mike
Previous Topic:eclipse debug hot code replacement fails
Next Topic:Handling of isDirty() method in formbased editor.
Goto Forum:
  


Current Time: Fri Dec 19 10:54:07 GMT 2014

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

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