Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Problem using StartupMonitor to show a login dialog
Problem using StartupMonitor to show a login dialog [message #798212] Tue, 14 February 2012 06:39 Go to previous message
Markus Stier is currently offline Markus Stier
Messages: 11
Registered: July 2009
Junior Member
Hi!

I'm currently developing an application which requires a user login as very first action. I've registered a StartupMonitor which implements applicationRunning() as shown below.

    public void applicationRunning()
    {
        LoginDialog loginDlg = ContextInjectionFactory.make(LoginDialog.class, m_context);

        loginDlg.create();

        loginDlg.setBlockOnOpen(true);
        loginDlg.open();
    }


The LoginDialog consists of a name field, a password field and a login button.
This works nearly as expected. The LoginDialog pops up and the user is able to login. If the authentication was successful I fire an Login_Successful_Event which is handled by a @ProcessAdditions Method. The event handler uses EPartService.showPart() to initialize the UI.

The problem: If the LoginDialog is not the active window and you press the login button (assuming name and password are already filled) an exception is thrown in getActiveWindowService().

//org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl

private EPartService getActiveWindowService() {
   IEclipseContext activeWindowContext = application.getContext().getActiveChild();
   if (activeWindowContext == null) {
      throw new IllegalStateException("Application does not have an active window"); //$NON-NLS-1$
    }
(...omitted...)


It seems that the active window is not set at this point of the application life cycle.

Is this behavior 'by design'? Should I use another way to implement my login requirement? How?

Or is this a bug? The JavaDoc of applicationRunning() states that the application is completely initialized...



best regards
Markus
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:ModelService.find cannot find part stacks
Next Topic:Problems creating a Part Toolbar
Goto Forum:
  


Current Time: Fri May 24 09:08:56 EDT 2013

Powered by FUDForum. Page generated in 0.01616 seconds