Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[e4-dev] ECommandParserService & PerspectiveSwitcher First Look

I have a base implementation of a pure-e4 perspective switcher available at:
http://github.com/jd-carroll/e4-perspective-switcher

There are still plenty of items on the "needs work list," like labels, context menu, etc.  To create the implementation I ran into many more issues than I first imagined.  (Like all of the dialog window dependencies on org.eclipse.ui)  All of the necessary support dialog windows and utilities have been ported over to eclipse4.  The repo is complete with a demo application.

Even though it is not complete, I wanted to share it with everyone for two reasons:
- First, feedback early and often is never a bad thing
- Second, the ECommandParserService

Yep, an ECommandParserService.  One of the issues I ran into is being able to create commands/handlers/menu's/etc. agnostic of the application.  Sure, I can hear it already, that's what processor's are for.  True, but that is a lot of code, redundant code at that, to have to write.  So I created a "service" that will accept annotated class's and is able to build the command/handler/toolbar/... from the annotations.  One of the many benefits I see in this is that now your handler class with @Execute is also your handler definition for the model (@Handler).

The ECommandParserService as it stands is an ugly piece of brute force work.  It was my attempt at becoming more familiar with the model, and thus I have a much clearer idea on how to implement an ECommandParserService (name up for discussion).  So if there is interest, please let me know and I will create a prettier version.  I also thought it valuable in the continued effort of porting all of the old actions/commands into Eclipse4 (from anywhere).

To start getting an idea for the power behind a service like this, take a look at some of these examples:
bundleclass://org.eclipse.e4.ui.workbench.commands.swt/ : 
...ide.bindings.SampleBindingContext
...ide.bindings.SampleBindingTable
...ide.bindings.ShowPerspectiveBinding
...ide.commands.ShowPerspectiveCommand
...ide.handlers.ShowPerspectiveHandler

and of course the most important
...workbench.commands.util.ECommandParserService

I will work on creating more examples this week and upload them, so keep a watchful eye.  But I want to finish the perspective switcher first as I know people are waiting on that.

As I said, let me know if there is interest.

Thanks,

JD

ps- For the perspective switcher, I am going to create an abstract perspective switcher service and a concrete swt implementation thus removing the dependency on swt.  Sound reasonable?

Back to the top