How to open an login dialog before the Window is initialized [message #459283] |
Wed, 29 November 2006 22:33  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #459374 is a reply to message #459369] |
Thu, 30 November 2006 16:29  |
Eclipse User |
|
|
|
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.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02523 seconds