Bug 356511 - Make pojo programming model accessible from org.eclipse.ui extension points
Summary: Make pojo programming model accessible from org.eclipse.ui extension points
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 enhancement with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 278631 406307 (view as bug list)
Depends on: 420584
Blocks:
  Show dependency tree
 
Reported: 2011-09-01 14:59 EDT by Ralf Ebert CLA
Modified: 2017-03-16 13:19 EDT (History)
18 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Ebert CLA 2011-09-01 14:59:37 EDT
Build Identifier: 

With the extension point programing model being very popular in the IDE and RCP world and the pojo/dependency injection model in e4 being very modern, I wondered if these two concepts could be brought together. 

I did a quick prototype to check if this is possible for views. I added this to ViewRegistry#postConstruct:

String className = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
if (className.startsWith("platform:")) {
    descriptor.setContributionURI(className);
} else {
    descriptor.setContributionURI(CompatibilityPart.COMPATIBILITY_VIEW_URI);
}

Instead of only:

descriptor.setContributionURI(CompatibilityPart.COMPATIBILITY_VIEW_URI);

This makes the new e4 features like service tracking using @Inject accessible for programmers using the extension points. 

Of course, the class name starting with "platform:" is not a good distinctive criteria for deciding if the value should be treated as legacy or e4, something better would have to be found. But I wanted to validate my suggestion first and ask for your opinion about the general approach.

A more general approach would also need to included editors, command handlers, etc.


Reproducible: Always
Comment 1 Lars Vogel CLA 2011-09-02 04:54:31 EDT
Maybe the compatibility layout would make plugable to support such a approach?
Comment 2 Lars Vogel CLA 2013-08-04 17:48:20 EDT
Eric Moffatt did a related change in Bug 378298, here is his comment:
----------
Committed

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=ac4572d1c89b229bf6354cf199cd49372b7e7ebe

This adds a new extension 'e4view' to the org.eclipse.ui.views extension point and changes the ViewRegistry code to recognize that the 'class' should be used as the contributionURI in the model (rather than CompatibilityView).

This is the first step but there is still work to do so I won't close this one yet...
-------
Comment 3 Lars Vogel CLA 2013-08-04 17:50:06 EDT
*** Bug 406307 has been marked as a duplicate of this bug. ***
Comment 4 Lars Vogel CLA 2013-08-04 17:50:46 EDT
*** Bug 278631 has been marked as a duplicate of this bug. ***
Comment 5 Eric Moffatt CLA 2013-08-07 10:53:37 EDT
Moving to 4.4 M2 to keep it on the radar...
Comment 6 Wim Jongman CLA 2013-08-07 13:21:04 EDT
(In reply to comment #5)
> Moving to 4.4 M2 to keep it on the radar...

Cool. Can we discuss the next steps? Selection service integration?
Comment 7 Markus Keller CLA 2013-08-12 09:15:45 EDT
(In reply to comment #2)
I've pushed some follow-up fixes to views.exsd: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=c5d952117cac0829e46998e12ce417c6fdd38fc8
Comment 8 Wim Jongman CLA 2013-09-08 15:39:11 EDT
Hi,

The cross referencing inside the manifest editor does not work for the e4view extension point. 

Would it not be easier to use the existing "view" extension and just check if the view implements IViewPart. If it does not then it defaults to an e4view. 

This will make sure that the cross referencing works. Since the "view" extension is referenced from various places it would require changes in these places to also reference this e4view extension.
Comment 9 Eric Moffatt CLA 2013-09-13 13:57:26 EDT
Moving into M3 to allow for more extension changes. I'll try to remember bookkeeping this time (i.e. updating the copyright...), thanks Markus.
Comment 10 Eric Moffatt CLA 2013-10-07 15:00:58 EDT
In an ideal world we would be able to do as Wim suggests but unfortunately there doesn't seem to be a way to have the extension point editors provide a 'flavor' of a given extension (where we'd just re-use the existing 'view' and have a checkbox or something to determine whether or not it's legacy / e4).

I think the problem is that .exsd doesn't have conditionals so trying to express that 'if it's a legacy part it must subclass IViewPart otherwise not' isn't possible.
Comment 11 Wim Jongman CLA 2013-10-08 02:46:11 EDT
(In reply to Eric Moffatt from comment #10)
> In an ideal world we would be able to do as Wim suggests but unfortunately
> there doesn't seem to be a way to have the extension point editors provide a
> 'flavor' of a given extension (where we'd just re-use the existing 'view'
> and have a checkbox or something to determine whether or not it's legacy /
> e4).
> 
> I think the problem is that .exsd doesn't have conditionals so trying to
> express that 'if it's a legacy part it must subclass IViewPart otherwise
> not' isn't possible.

You mean to allow the class selection dialog to select other classes then IViewPart implementations?
Comment 12 Daniel Rolka CLA 2013-10-16 12:21:31 EDT
Have you tried the 'e4view' views of the 'org.eclipse.ui.views' extension point introduced in M1 for Luna:

http://download.eclipse.org/eclipse/downloads/drops4/S-4.4M1-201308072000/news/Contribute E4 Views into the IDE

Daniel
Comment 13 Lars Vogel CLA 2013-10-16 12:30:34 EDT
Daniel, original this bug would also cover POJOs for handlers and editors. With your title change this gets lost. Can you change it back or shall we open new bugs for handlers and editors?
Comment 14 Daniel Rolka CLA 2013-10-16 12:35:36 EDT
(In reply to Daniel Rolka from comment #12)
> Have you tried the 'e4view' views of the 'org.eclipse.ui.views' extension
> point introduced in M1 for Luna:
> 
> http://download.eclipse.org/eclipse/downloads/drops4/S-4.4M1-201308072000/
> news/Contribute E4 Views into the IDE
> 
> Daniel

We try to define some component owner during bug triage process (currently is my bug triage turn) so let me add missing components (feel free and update it if needed)

By the way, I haven't noticed the entire discussion below however it was good to boost the Luna's M1 achievements :)

Daniel
Comment 15 Lars Vogel CLA 2013-10-29 02:45:51 EDT
I created a separate bug for POJOs and handlers. Bug 420584.
Comment 16 Eric Moffatt CLA 2013-12-10 15:37:44 EST
M4 is done...
Comment 17 Wim Jongman CLA 2014-01-20 02:56:45 EST
Another thing that does not work is the appearance of the view in the "Quick Search". It does appear in the "Show View" dialog.
Comment 18 Lars Vogel CLA 2015-01-22 13:59:32 EST
I mark this bug as fixed, since Eclipse 4.4. we have the e4view and you can use the POJO programming model for e4 handlers in the IDE already.
Comment 19 Michael Relby CLA 2015-01-23 03:35:17 EST
(In reply to Lars Vogel from comment #18)
> I mark this bug as fixed, since Eclipse 4.4. we have the e4view and you can
> use the POJO programming model for e4 handlers in the IDE already.

How about editors?
Comment 20 Rolf Theunissen CLA 2017-03-16 13:19:13 EDT
Any update on the registration of POJO for editors?