Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Eclipse Kepler Dependency Injection in 3.x & Views(how to use DI & Views from an 3.x Plugin in E4)
Eclipse Kepler Dependency Injection in 3.x & Views [message #1075314] Mon, 29 July 2013 04:11 Go to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
I have a working plugin in Eclipse 3.7 with Views and a Perspective.
Now I try to move this to Eclipse Kepler 4.3 therefore i follow the Tutorial from Jonas Helming
All my Views are based on a TemplateView in another Plugin. This TemplateView was transformed to an e4 style POJO View.
My Plugin extends this TemplateView and adds the wrapper class (as described in the Tutorial).

Iff i run my application in e3 style (means TemplateView is extending ViewPart) everything is fine and the Perspective gets added. But when i change it to the e4 style (means TemplateView is extending POJO and i use the Wrapper in my plugin.xml) eclipse does no longer dispay the Perspective and its Views.

my e3 View is not really interesting, as its mostly using my custom api (which would only confuse here & it is working correctly - as it starts as e3)

and this is the e4 Wrapper class:

import org.eclipse.e4.tools.compat.parts.DIViewPart;
import lumo.views.contact.e3.E3DetailView;

public class E4DetailView extends DIViewPart<E3DetailView> {
    public E4DetailView() {
        super(E3DetailView.class);
    }
}


what kind of app does my Application have to be? e3 (plugin.xml) or e4 (Application.e4xmi)?
do i try to solve this the wrong way?
Re: Eclipse Kepler Dependency Injection in 3.x &amp; Views [message #1075390 is a reply to message #1075314] Mon, 29 July 2013 06:52 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas Helming
Messages: 363
Registered: July 2009
Senior Member
Hi,
to make that clear: you should not have to migrate anything, when
switching to 4.x, as the compatibility layer provides the same API as
3.x does. The described "soft migration" allows you to use concepts such
as DI, but that is not mandatory in Eclipse 4.
If you use the warpper classes, you can programm your views in a way you
would do in a native e4 application, therefore you can benefit from DI.
From your description, I cannot really identify any mistake, everything
sound good to me. What confuses me is that the perspective is not shown
anymore, actually nothing should change there. Could it be that the
bundle defining the perspective is not in the run configuration anymore?
Regards
Jonas


Am 29.07.2013 10:11, schrieb Ludwig Moser:
> I have a working plugin in Eclipse 3.7 with Views and a Perspective.
> Now I try to move this to Eclipse Kepler 4.3 therefore i follow the
> http://eclipsesource.com/blogs/tutorials/eclipse-4-e4-tutorial-soft-migration-from-3-x-to-eclipse-4-e4/
>
> All my Views are based on a TemplateView in another Plugin. This
> TemplateView was transformed to an e4 style POJO View.
> My Plugin extends this TemplateView and adds the wrapper class (as
> described in the Tutorial).
>
> Iff i run my application in e3 style (means TemplateView is extending
> ViewPart) everything is fine and the Perspective gets added. But when i
> change it to the e4 style (means TemplateView is extending POJO and i
> use the Wrapper in my plugin.xml) eclipse does no longer dispay the
> Perspective and its Views.
>
> my e3 View is not really interesting, as its mostly using my custom api
> (which would only confuse here & it is working correctly - as it starts
> as e3)
>
> and this is the e4 Wrapper class:
>
> import org.eclipse.e4.tools.compat.parts.DIViewPart;
> import lumo.views.contact.e3.E3DetailView;
>
> public class E4DetailView extends DIViewPart<E3DetailView> {
> public E4DetailView() {
> super(E3DetailView.class);
> }
> }
>
> what kind of app does my Application have to be? e3 (plugin.xml) or e4
> (Application.e4xmi)?
> do i try to solve this the wrong way?
Re: Eclipse Kepler Dependency Injection in 3.x &amp; Views [message #1075403 is a reply to message #1075390] Mon, 29 July 2013 07:11 Go to previous message
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
EDIT:
i got the solution!
i have now an e3 Application (plugin.xml) in an e4 Workbench.

my plugins are defined as all e3 plugins are.
my views are POJO's and get wrapped.
important:
i've had my old e3 style, means a

+Constructor
+void createPartControl(Composite parent);
where the createPartControl was Annotated with @PostConstruct (means exection after DI is done!, this was my mistake!)

what i did to solve was.
modify the constructer to use Composite parent and add the correct Annotation:

 (pseudocode)
@Inject
Constructor(Composite parent) {
   createPartControl(parent);
}


this was all, i had wrong!

thanks for your help jonas (great tutorial page - helps a lot)

[Updated on: Tue, 30 July 2013 07:20]

Report message to a moderator

Previous Topic:accessing resources from other plugin in Application.e4xmi
Next Topic:Setting elements as transient
Goto Forum:
  


Current Time: Sat Apr 19 23:23:25 EDT 2014

Powered by FUDForum. Page generated in 0.01498 seconds