Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to open an login dialog before the Window is initialized
How to open an login dialog before the Window is initialized [message #459283] Wed, 29 November 2006 22:33 Go to next message
Eclipse UserFriend
Originally posted by: florianwendland.freenet.de

Hello all,
i have a problem concerning the initialization og an dialog before the
window is drawn.

I want to realize a login dialog, where the user can chose his profile.
Then, the profile settings will be load into the PreferenceStore.
My problem is, that there is no shell, which i can pass to the dialog,
before the window was initialized.

Is there another way to work around that problem?

Thx
Florian

------------------------------------------------------------ ----------------
----
Ich verwende die kostenlose Version von SPAMfighter,
die bei mir bis jetzt 3495 Spammails entfernt hat.
F
Re: How to open an login dialog before the Window is initialized [message #459285 is a reply to message #459283] Wed, 29 November 2006 23:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: partyhut.internode.on.net

Hi Florian,

I guess you are extending ApplicationWindow... You can work around it by
create a Display in your main method.

Just do something like this:

public class MyClass extends ApplicationWindow
{
static Display display;

public static void main(String args[])
{
try
{
display = new Display();
}
}

Then you can open your dialog in createContents. Hope that helps.

Cheers,
Henry


Florian Wendland wrote:
> Hello all,
> i have a problem concerning the initialization og an dialog before the
> window is drawn.
>
> I want to realize a login dialog, where the user can chose his profile.
> Then, the profile settings will be load into the PreferenceStore.
> My problem is, that there is no shell, which i can pass to the dialog,
> before the window was initialized.
>
> Is there another way to work around that problem?
>
> Thx
> Florian
>
> ------------------------------------------------------------ ----------------
> ----
> Ich verwende die kostenlose Version von SPAMfighter,
> die bei mir bis jetzt 3495 Spammails entfernt hat.
> Für private Anwender ist SPAMfighter völlig kostenlos!
> Jetzt gratis testen: hier klicken.
>
>
Re: How to open an login dialog before the Window is initialized [message #459369 is a reply to message #459285] Thu, 30 November 2006 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: florianwendland.freenet.de

No,
i'm inside of RCP and there is no main method.
I need a way to crweate a shell before the rcp window is opened.
Thx

------------------------------------------------------------ ----------------
----
Ich verwende die kostenlose Version von SPAMfighter,
die bei mir bis jetzt 3529 Spammails entfernt hat.
F
Re: How to open an login dialog before the Window is initialized [message #459374 is a reply to message #459369] Thu, 30 November 2006 16:29 Go to previous message
Eclipse UserFriend
In your Application class (i.e the one implementing IPlatformRunnable),
there is a run(args) method, so use that one:


public Object run(Object args) throws Exception {
Display display = PlatformUI.createDisplay();
boolean pass = false;
while (!pass) {
Thread.sleep(2000);
Platform.endSplash();
LoginDialog dlg = new LoginDialog(null);

if (Window.OK == dlg.open()) {
String username = dlg.getUsername();
String password = dlg.getPassword();
.....
if (<DO_AUTHENTICATE_HERE>) {
pass = true;
}
} else {
return IPlatformRunnable.EXIT_OK;
}
}


try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new
ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IPlatformRunnable.EXIT_RESTART;
}
return IPlatformRunnable.EXIT_OK;
} finally {
display.dispose();
}
}



Florian Wendland wrote:
> No,
> i'm inside of RCP and there is no main method.
> I need a way to crweate a shell before the rcp window is opened.
> Thx
>
> ------------------------------------------------------------ ----------------
> ----
> Ich verwende die kostenlose Version von SPAMfighter,
> die bei mir bis jetzt 3529 Spammails entfernt hat.
> Für private Anwender ist SPAMfighter völlig kostenlos!
> Jetzt gratis testen: hier klicken.
>
>
Previous Topic:Marker in node XML
Next Topic:Using a Java Agent (e.g. Spring/Toplink) with an Eclipse RCP app?
Goto Forum:
  


Current Time: Mon Mar 17 15:11:20 EDT 2025

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

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

Back to the top