Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332386

Summary: Allow generic/DI type instantiation
Product: [Technology] XWT Reporter: Erdal Karaca <erdal.karaca.de>
Component: CoreAssignee: Project Inbox <e4.xwt-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Erdal Karaca CLA 2010-12-12 02:50:04 EST
Currently, XWT will instantiate all types internally.
It is obvious that instantiating (or being able to instantiate) types through the DI will add extra benefits.

XWT could provide a switch to do this or do this automatically when a 'type factory' is provided in the options, e.g.:

options.put("XWT.TypeFactory", eclipseContextTypeFactory);
XWT.loadWithOptions(options);

eclipseContextTypeFactory must provide a mechanism to instantiate a class on its own. For example, this could use the ContextFactory of e4 to instantiate the type...
Comment 1 Erdal Karaca CLA 2010-12-12 03:17:16 EST
It should also be possible to inject the named bindings, e.g.:

<Composite x:Class="com.example.MyHandler">
   <Button x:Name="myButton" SelectionEvent="handleButton" />
</Composite>

class MyHandler {
  @Inject
  @Named("myButton")
  Button myButton;
  
  void handleButton() {
  ...
  }
}