Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to shutdown the application
How to shutdown the application [message #459231] Wed, 29 November 2006 07:55 Go to next message
Eclipse UserFriend
Originally posted by: lifenewbd.yahoo.com

Hi,

I have an authentication dialog that is called and shown from start()
method of plugin class. Now if authentication fails, I want to shutdown
the application. Now as I am not supposed to call stop method, and again
in start method it is not guarantedd that workbench is created and
executed, so I also can't call PluginUI.getWorkbench().close(), so how can
I shutdown the application please?
Re: How to shutdown the application [message #459270 is a reply to message #459231] Wed, 29 November 2006 14:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: agomez.develance.com

Instead of trying to shutdown the app, you could show your Authentication
dialog before creating the workbench, and depending on the dialog?s return
code proceed to create the workbench or not. The final result would be the
same.

In your Application class, you could implement the run() method as follows:

public Object run(Object args) throws Exception {

final Display display = PlatformUI.createDisplay();

try {

LoginDialog login = new LoginDialog(display.getActiveShell());

login.open();

if (login.getReturnCode() == Window.OK) {

int returnCode = PlatformUI.createAndRunWorkbench(display, new
ApplicationWorkbenchAdvisor());

if (returnCode == PlatformUI.RETURN_RESTART) {

return IPlatformRunnable.EXIT_RESTART;

}

return IPlatformRunnable.EXIT_OK;

}

return IPlatformRunnable.EXIT_OK;

} finally {

display.dispose();

}

}


Hope this helps you.
Adrian

"Lifenewbd" <lifenewbd@yahoo.com> escribi
Re: How to shutdown the application [message #459291 is a reply to message #459270] Thu, 30 November 2006 03:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lifenewbd.yahoo.com

Hello,

Thanks for the suggestion. I know this, but I don't have any application
class. I am developing plugins. The plugin whose start() method possesses
the code of authentication dialog, is the main plugin (set as bundle
activator). And I actually load the original eclipse workbench as my
application's workbench.
Re: How to shutdown the application [message #459300 is a reply to message #459291] Thu, 30 November 2006 04:14 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

You could throw an exception. The doc for start method says:
"If this method throws an exception, it is taken as an indication that
plug-in initialization has failed; as a result, the plug-in will not be
activated; moreover, the plug-in will be marked as disabled and
ineligible for activation for the duration."

--
Patrick
Re: How to shutdown the application [message #459301 is a reply to message #459300] Thu, 30 November 2006 04:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lifenewbd.yahoo.com

Hi,

Thanks for this good suggestion. Actually currently I do so. But I want
that the application will exit if authentication fails, the workbench will
not be created. So any other solution please?
Re: How to shutdown the application [message #459304 is a reply to message #459301] Thu, 30 November 2006 05:27 Go to previous message
Eclipse UserFriend
The plugin you are developing is for an RCP or are you planning on
distributing this into a normal Eclipse installation?
If the latter I would refrain from stopping the Workbench since this
really is bad style and I would personally hate your plugin when it
stops my workbench.
With the approach suggested from the last reply I would say make all
your plugins that should not start depend on the plugin that throws the
Exception during startup so that if this plugin is not available none of
the plugins will be. Then simply route all your authentication through
this plugin.

Regards
Stefan

Lifenewbd wrote:
> Hi,
>
> Thanks for this good suggestion. Actually currently I do so. But I want
> that the application will exit if authentication fails, the workbench
> will not be created. So any other solution please?
>
Previous Topic:Switch between perspectives
Next Topic:How to prevent System.exit(*)?
Goto Forum:
  


Current Time: Wed Sep 24 06:07:38 EDT 2025

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

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

Back to the top