I explicitly decided against using ExecutableExtension when I designed the e4-bridge but what you duplicated here is exactly what the e4 bridge does already since some time with DIViewPart and DIEditorPart.
Tom Am 24.08.12 03:40, schrieb Joseph D Carroll Jr: > After a brief conversation with Paul on IRC, I hacked together a > solution for grabbing the WorkbenchContext in a 3.x application. (See > attached) > > It is clearly a hack, would be better to use a lifecycle hook. But this > allowed me to create an injector for all of my 3.x editors and views. > Obviously there are things that cannot be injected even though it would > be possible (like the composite), but I am able to inject things like > properties. While I haven't tested it, I have a feeling that it *could* > be possible to inject methods like @Focus. > (It also gives me all the goodies like Logger and NLS injected!) > > I am building an application that uses a diagram editor from GMF, thus I > have to use 3.x editors. But with a little more finessing, I think this > would be a good option for 3.x & 4.x interoperability in the compat > layer. I am just getting started on this application so maybe something > like this already exists and I just missed it. But I thought I would > share... > > (The source files are attached) > - I created an abstract class "InjectableExecutableExtensionFactory" > that defines the base functionality > - From this I extend to a "BlockDiagramPartFactory" that is capable of > supplying the specific contexts for injection and anything else > - Then whether old or new classes, just annotate them with @Creatable > and any @Inject's > - Lastly, when I create my view/editor extension point, invoke the > extension factory. The factory is capable of providing context for > specific classes or passing them through with no added context. > > <plugin> > <extension > point="org.eclipse.ui.editors"> > <editor > > class="braintrader.blockdiagram.ui.parts.BlockDiagramPartFactory:braintrader.blockdiagram.ui.blockdiagrameditor" > default="false" > id="braintrader.blockdiagram.ui.blockdiagrameditor" > name="Block Diagram Editor"> > </editor> > </extension> > <extension > point="org.eclipse.ui.views"> > <view > > class="braintrader.blockdiagram.ui.parts.BlockDiagramPartFactory:braintrader.blockdiagram.ui.view.blocklibrary" > id="braintrader.blockdiagram.ui.view.blocklibrary" > name="Block Library" > restorable="true"> > </view> > </extension> > </plugin> > > Whether or not this is actually useful / beneficial, I don't know. But > this is going to be my approach for now, presuming I don't run into any > major road blocks. > > > Take care, > > JD > > > _______________________________________________ > e4-dev mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/e4-dev > -- B e s t S o l u t i o n . a t EDV Systemhaus GmbH ------------------------------------------------------------------------ tom schindl geschäftsführer/CEO ------------------------------------------------------------------------ eduard-bodem-gasse 5-7/1 A-6020 innsbruck fax ++43 512 935833 http://www.BestSolution.at phone ++43 512 935834 _______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
