Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » e4 compat layer and programmatic Action contributions.
e4 compat layer and programmatic Action contributions. [message #1106568] Wed, 11 September 2013 05:06 Go to next message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 857
Registered: July 2009
Senior Member
Hi,

I am migrating an RCP to build against Kepler. I include the
org.eclipse.rcp feature, which I understand includes the e4 compat.
layer. The RCP works, plugin.xml like perspectives and views come-up
nicely. However, I have some code in an ActionBarAdvisor which calls
fillActionBars() where I register

.....
register(ActionFactory.INTRO.create(window));

The IntroAction's constructor calls this:

IntroDescriptor introDescriptor = ((Workbench) workbenchWindow
.getWorkbench()).getIntroDescriptor();


which returns null and leads to an NPE subsequently.
Now, I presume this is all very old style and I guess not supported by
the e4 compat. layer. I am just seeking confirmation for this.

Also, I would like to hear about the alternatives for migrating the
actions[1] or better make these Actions work with a Kepler RCP .

Thank You,
Christophe


[1] See my makeActions(...) method for all the registered actions:



prefAction = ActionFactory.PREFERENCES.create(window);
aboutAction = ActionFactory.ABOUT.create(window);
helpAction = ActionFactory.HELP_CONTENTS.create(window);
saveAction = ActionFactory.SAVE.create(window);

perspectivesMenu = ContributionItemFactory.PERSPECTIVES_SHORTLIST
.create(window);

viewsMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(window);

getAction(ActionFactory.SAVE.getId());

register(prefAction);
register(aboutAction);
register(helpAction);
register(ActionFactory.INTRO.create(window));
register(ActionFactory.EDIT_ACTION_SETS.create(window));
register(ActionFactory.NEW.create(window));
register(ActionFactory.SAVE.create(window));
register(ActionFactory.SAVE_AS.create(window));
register(ActionFactory.SAVE_ALL.create(window));
register(ActionFactory.UNDO.create(window));
register(ActionFactory.REDO.create(window));
register(ActionFactory.CUT.create(window));
register(ActionFactory.COPY.create(window));
register(ActionFactory.PASTE.create(window));
register(ActionFactory.DELETE.create(window));
register(ActionFactory.SELECT_ALL.create(window));
// register(ActionFactory.PRINT.create(window));
register(ActionFactory.IMPORT.create(window));
register(ActionFactory.EXPORT.create(window));
register(ActionFactory.CLOSE.create(window));
register(ActionFactory.CLOSE_ALL.create(window));

register(ActionFactory.QUIT.create(window));
[Solved]Re: e4 compat layer and programmatic Action contributions. [message #1107473 is a reply to message #1106568] Thu, 12 September 2013 08:58 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 857
Registered: July 2009
Senior Member
The NPE was for the ActionFactory.INTRO action only.
All other actions are working. Should I file a bug on this?


// On 11-09-13 11:06, Christophe Bouhier wrote:
> Hi,
>
> I am migrating an RCP to build against Kepler. I include the
> org.eclipse.rcp feature, which I understand includes the e4 compat.
> layer. The RCP works, plugin.xml like perspectives and views come-up
> nicely. However, I have some code in an ActionBarAdvisor which calls
> fillActionBars() where I register
>
> ....
> register(ActionFactory.INTRO.create(window));
>
> The IntroAction's constructor calls this:
>
> IntroDescriptor introDescriptor = ((Workbench) workbenchWindow
> .getWorkbench()).getIntroDescriptor();
>
>
> which returns null and leads to an NPE subsequently.
> Now, I presume this is all very old style and I guess not supported by
> the e4 compat. layer. I am just seeking confirmation for this.
>
> Also, I would like to hear about the alternatives for migrating the
> actions[1] or better make these Actions work with a Kepler RCP .
>
> Thank You,
> Christophe
>
>
> [1] See my makeActions(...) method for all the registered actions:
>
>
>
> prefAction = ActionFactory.PREFERENCES.create(window);
> aboutAction = ActionFactory.ABOUT.create(window);
> helpAction = ActionFactory.HELP_CONTENTS.create(window);
> saveAction = ActionFactory.SAVE.create(window);
>
> perspectivesMenu = ContributionItemFactory.PERSPECTIVES_SHORTLIST
> .create(window);
>
> viewsMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
>
> getAction(ActionFactory.SAVE.getId());
>
> register(prefAction);
> register(aboutAction);
> register(helpAction);
> register(ActionFactory.INTRO.create(window));
> register(ActionFactory.EDIT_ACTION_SETS.create(window));
> register(ActionFactory.NEW.create(window));
> register(ActionFactory.SAVE.create(window));
> register(ActionFactory.SAVE_AS.create(window));
> register(ActionFactory.SAVE_ALL.create(window));
> register(ActionFactory.UNDO.create(window));
> register(ActionFactory.REDO.create(window));
> register(ActionFactory.CUT.create(window));
> register(ActionFactory.COPY.create(window));
> register(ActionFactory.PASTE.create(window));
> register(ActionFactory.DELETE.create(window));
> register(ActionFactory.SELECT_ALL.create(window));
> // register(ActionFactory.PRINT.create(window));
> register(ActionFactory.IMPORT.create(window));
> register(ActionFactory.EXPORT.create(window));
> register(ActionFactory.CLOSE.create(window));
> register(ActionFactory.CLOSE_ALL.create(window));
>
> register(ActionFactory.QUIT.create(window));
>
>
Re: [Solved]Re: e4 compat layer and programmatic Action contributions. [message #1115933 is a reply to message #1107473] Tue, 24 September 2013 15:48 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 105
Registered: July 2009
Senior Member
Christophe, thanks for the input. For me the deciding factor of whether to open a defect is whether this code would work in 3.8 (my guess is 'yes'...Wink and if it does then please open a defect stating that this is a regression...
Re: [Solved]Re: e4 compat layer and programmatic Action contributions. [message #1117251 is a reply to message #1115933] Thu, 26 September 2013 04:40 Go to previous message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 857
Registered: July 2009
Senior Member
On 24-09-13 21:48, Eric Moffatt wrote:
> Christophe, thanks for the input. For me the deciding factor of whether
> to open a defect is whether this code would work in 3.8 (my guess is
> 'yes'...;) and if it does then please open a defect stating that this is
> a regression...
>
Well, I went from 3.7 to 4.3 (Yep, quiet a hop), so I don't know about
3.8. For 3.7 it did work, but that was pre-e4.
Previous Topic:[Solved] Eclipse e4 - No bundle loaded after exporting to exe
Next Topic:RCP starts in IDE, but not when exported.
Goto Forum:
  


Current Time: Wed Apr 16 12:10:29 EDT 2014

Powered by FUDForum. Page generated in 0.01603 seconds