Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to intercept main window creation?
How to intercept main window creation? [message #1828105] Mon, 01 June 2020 20:11
Teymuraz Khazaradze is currently offline Teymuraz KhazaradzeFriend
Messages: 4
Registered: September 2010
Junior Member
I need to to do some job just after main window is created but parts are not created yet. How can I intercept this moment in application initialization process?

For example I have the only one part MyPart and some service MyService:
class MyPart {
  void init( Composite aParent, MyService aService ) {
    // here is part content creation

class MyService {
  private final Shell mainWindowShell;
  public MyService( Shell aMainWindowShell ) {
    mainWindowShell = aMainWindowShell;
  public void maximizeMainWindow() {
    mainWindowShell.setMaximized( true );

When part is created by MyPart.init(Composite,MyService) an instance of the MyService must exist. However call to MyServce constructor requires access to the main windows Shell.

I have MyService and other creation code like this:
class InTheMiddleOfNowhere {
  public void initMyServices( IEclipseContext aMainWindowContext ) {
    // init MyService
    MyService s = new MyService( aMainWindowContext.get( Shell.class );
    aMainWindowContext.set( MyService.class, s );
    // other services

This service creation code mus be called after main window shell is created but before any part constructor is called. The question is how and which code have to call initMyServices(IEclipseContext) ? Maybe there is some event, or any interceptor or something else?

[Updated on: Mon, 01 June 2020 20:16]

Report message to a moderator

Previous Topic:What API indicate that Eclipse startup is finished
Next Topic:Plugin with Tycho and 2020-03 but I want it to work on JRE 8
Goto Forum:

Current Time: Mon Feb 06 20:02:12 GMT 2023

Powered by FUDForum. Page generated in 0.05044 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top