Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » What happens to the class HandlerUtil
What happens to the class HandlerUtil [message #878636] Tue, 29 May 2012 16:21 Go to next message
Eclipse UserFriend
The usage of HandlerUtil is very popular in 3.x command handlers.

What happens to all these handlers if I am migrating an RCP application to E4? Methods like
HandlerUtil.getActiveWorkbenchWindow(event)
will not work unless the application runs in "legacy mode".

Is it correct, that HandlerUtil or at least some parts of it (which parts?) should be considered @deprecated for clean E4 development?
Re: What happens to the class HandlerUtil [message #878652 is a reply to message #878636] Tue, 29 May 2012 16:48 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You don't need that anymore in your handlers @Execute method you'd write
something like this:

@Execute
public void run(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
}

Tom

Am 29.05.12 18:21, schrieb Jordan Dukadinov:
> The usage of HandlerUtil is very popular in 3.x command handlers.
>
> What happens to all these handlers if I am migrating an RCP application
> to E4? Methods like HandlerUtil.getActiveWorkbenchWindow(event) will not
> work unless the application runs in "legacy mode".
>
> Is it correct, that HandlerUtil or at least some parts of it (which
> parts?) should be considered @deprecated for clean E4 development?
Re: What happens to the class HandlerUtil [message #878654 is a reply to message #878652] Tue, 29 May 2012 16:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ups that's the shell so you'd probably use the active part and findout
the MWindow it is in.

Maybe a similar helper might make sense for e4 Handlers but it would
operate on the IEclipseContext.

Tom

Am 29.05.12 18:48, schrieb Tom Schindl:
> You don't need that anymore in your handlers @Execute method you'd write
> something like this:
>
> @Execute
> public void run(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
> }
>
> Tom
>
> Am 29.05.12 18:21, schrieb Jordan Dukadinov:
>> The usage of HandlerUtil is very popular in 3.x command handlers.
>>
>> What happens to all these handlers if I am migrating an RCP application
>> to E4? Methods like HandlerUtil.getActiveWorkbenchWindow(event) will not
>> work unless the application runs in "legacy mode".
>>
>> Is it correct, that HandlerUtil or at least some parts of it (which
>> parts?) should be considered @deprecated for clean E4 development?
>
Re: What happens to the class HandlerUtil [message #878933 is a reply to message #878654] Wed, 30 May 2012 08:27 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your quick reply Tom.
So can we make the statement that HandlerUtil should not be used at all with E4?
Re: What happens to the class HandlerUtil [message #878941 is a reply to message #878933] Wed, 30 May 2012 08:40 Go to previous messageGo to next message
Christian Campo is currently offline Christian CampoFriend
Messages: 597
Registered: July 2009
Senior Member
Does that mean some of the methods should get the attribute @deprecated ?
Re: What happens to the class HandlerUtil [message #878997 is a reply to message #878941] Wed, 30 May 2012 10:32 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
Christian Campo wrote on Wed, 30 May 2012 04:40
Does that mean some of the methods should get the attribute @deprecated ?


No, at least not right now. The E3.x bridging/compatibility layer won't be going away.

Brian.
Re: What happens to the class HandlerUtil [message #878999 is a reply to message #878933] Wed, 30 May 2012 10:33 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Well it can't be used at all any more in a pure e4 environment because
there's no execution event passed to your handler but only the
IEclipseContext. One could talk about whether an HandlerUtil which
operates on the IEclipseContext makes sense to get added though e.g. to
ui.services (though this bundle is widget agnostic so things like Shell
can't be referenced from there!).

Tom

Am 30.05.12 10:27, schrieb Jordan Dukadinov:
> Thanks for your quick reply Tom.
> So can we make the statement that HandlerUtil should not be used at all
> with E4?
Re: What happens to the class HandlerUtil [message #879001 is a reply to message #878941] Wed, 30 May 2012 10:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Christian,

Not sure what you mean. HandlerUtil is part of org.eclipse.ui.workbench
so it implies that one runs in compat mode and there the HandlerUtil is
fully functional and so no deprecation is needed at all.

If I got Jordan's question correct he asked about pure e4 and there he's
unable to use HanderUtil because e4 handlers are DI enhanced POJOs

Tom

Am 30.05.12 10:40, schrieb Christian Campo:
> Does that mean some of the methods should get the attribute @deprecated ?
Re: What happens to the class HandlerUtil [message #879003 is a reply to message #878933] Wed, 30 May 2012 10:42 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
Jordan Dukadinov wrote on Wed, 30 May 2012 04:27
Thanks for your quick reply Tom.
So can we make the statement that HandlerUtil should not be used at all with E4?


A pure E4 app shouldn't (cannot) use anything in org.clipse.ui.*: although the E3.x bridging/compatibility layer is built on top of the E4.x layer, it makes some assumptions about the structure of the underlying E4 application model. For Eclipse 4.3 we'll be looking to see how allow E4 code to coexist with E3.x, to allow for hybrid apps, so to speak.

It would definitely be useful, however, to know of the classes and utilities you use miss from org.eclipse.ui.*. Feel free to add your candidates (and use cases too) to:

Strategy for porting useful org.eclipse.ui.* bits for Eclipse4 RCP apps
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350251

Brian.
Previous Topic:Change 'locale' attribute in TranslationService at Runtime
Next Topic:Update label of handled tool item
Goto Forum:
  


Current Time: Thu Apr 25 00:04:16 GMT 2024

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

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

Back to the top