Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to exit RCP during start up?
How to exit RCP during start up? [message #332671] Tue, 04 November 2008 15:19 Go to next message
Joel Rosi-Schwartz is currently offline Joel Rosi-SchwartzFriend
Messages: 624
Registered: July 2009
Location: London. England
Senior Member
Hi,

In an RCP application I am building I have to check for the existence of a
resource and if it does not exist display a dialog to the user to select one
from the file system. If the user fails to select a valid resource, i.e.
they press Cancel, then I want to exit the application. In this case the
workbench should never be instantiated.

Any suggestions on how to implement this use case?

Thanks,
Joel
--
Joel Rosi-Schwartz
Etish Limited [http://www.etish.org]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^...^
/ o,o \ The proud parents of Useme & ORMF
|) ::: (| Open Requirements Management Framework
====w=w==== [http://www.eclipse.org/ormf/]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Re: How to exit RCP during start up? [message #332672 is a reply to message #332671] Tue, 04 November 2008 15:29 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
You could try to hack the code up in your IApplication implementation's
start(IApplicationContext) method before it calls
PlatformUI.createDisplay() maybe?
Re: How to exit RCP during start up? [message #332678 is a reply to message #332672] Tue, 04 November 2008 17:44 Go to previous messageGo to next message
Joel Rosi-Schwartz is currently offline Joel Rosi-SchwartzFriend
Messages: 624
Registered: July 2009
Location: London. England
Senior Member
Thanks for the reply.

Back in the old days (I think 3.2 if my memory servers) one could call
return IPlatformRunnable.EXIT_OK from the run() method. This is no longer
true of the start() method. Calling System.exit() is possible but brutish.

I also have a further issue. My architecture is split up with an app, core
and ui bundles. I would really not like to pollute the app bundle with UI
stuff if I can help it. Once I pull this File dialog into the app bundle, I
also have to pull up my preferences. This means that all of my dialogs that
access preferences also (and I have not many but a few) these have be pulled
up to access the plug-ins preference store. This is getting too sloppy for
my taste.

The only solution I have come up with so far is to put the resource check in
the Activator.start() method of my ui bundle. This also seems brutish,
but...

Anyone have a idea for a cleaner solution?

Thanks,
Joel


On 04/11/2008 15:29, in article geppn5$kqp$1@build.eclipse.org, "Remy Chi
Jian Suen" <remy.suen@gmail.com> wrote:

> You could try to hack the code up in your IApplication implementation's
> start(IApplicationContext) method before it calls
> PlatformUI.createDisplay() maybe?
Re: How to exit RCP during start up? [message #332679 is a reply to message #332678] Tue, 04 November 2008 18:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 11/4/2008 12:44 PM, Joel Rosi-Schwartz wrote:
> I also have a further issue. My architecture is split up with an app, core
> and ui bundles. I would really not like to pollute the app bundle with UI
> stuff if I can help it. Once I pull this File dialog into the app bundle, I
> also have to pull up my preferences. This means that all of my dialogs that
> access preferences also (and I have not many but a few) these have be pulled
> up to access the plug-ins preference store. This is getting too sloppy for
> my taste.
>
> The only solution I have come up with so far is to put the resource check in
> the Activator.start() method of my ui bundle. This also seems brutish,
> but...
>
> Anyone have a idea for a cleaner solution?

You could define your own extension point in the app bundle and have it
delegate to some interface (defined by that extension point) to do the
real work. Something like ResourceSelectionHandler. Then your UI plugin
implements that extension point and provides and implementation of the
interface.

You could also do it with a fragment that is hosted by the app plugin;
the fragment can have UI dependencies but keep them out of the plugin
itself.

Hope this helps,
Eric
Re: How to exit RCP during start up? [message #332680 is a reply to message #332679] Tue, 04 November 2008 18:16 Go to previous messageGo to next message
Joel Rosi-Schwartz is currently offline Joel Rosi-SchwartzFriend
Messages: 624
Registered: July 2009
Location: London. England
Senior Member
On 04/11/2008 18:03, in article geq2q5$pav$1@build.eclipse.org, "Eric Rizzo"
<eclipse-news@rizzoweb.com> wrote:

> On 11/4/2008 12:44 PM, Joel Rosi-Schwartz wrote:
>> I also have a further issue. My architecture is split up with an app, core
>> and ui bundles. I would really not like to pollute the app bundle with UI
>> stuff if I can help it. Once I pull this File dialog into the app bundle, I
>> also have to pull up my preferences. This means that all of my dialogs that
>> access preferences also (and I have not many but a few) these have be pulled
>> up to access the plug-ins preference store. This is getting too sloppy for
>> my taste.
>>
>> The only solution I have come up with so far is to put the resource check in
>> the Activator.start() method of my ui bundle. This also seems brutish,
>> but...
>>
>> Anyone have a idea for a cleaner solution?
>
> You could define your own extension point in the app bundle and have it
> delegate to some interface (defined by that extension point) to do the
> real work. Something like ResourceSelectionHandler. Then your UI plugin
> implements that extension point and provides and implementation of the
> interface.
>
> You could also do it with a fragment that is hosted by the app plugin;
> the fragment can have UI dependencies but keep them out of the plugin
> itself.
>
> Hope this helps,
> Eric

The first is a very interesting idea, I will give it whirl. The second, i.e.
using a fragment, doesn't actually solve my issues.

Thanks,
Joel
Re: How to exit RCP during start up? [message #332681 is a reply to message #332680] Tue, 04 November 2008 19:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

Does
PlatformUI.getWorkbench().close();

do what you want?

Joel Rosi-Schwartz wrote:
> On 04/11/2008 18:03, in article geq2q5$pav$1@build.eclipse.org, "Eric Rizzo"
> <eclipse-news@rizzoweb.com> wrote:
>
>> On 11/4/2008 12:44 PM, Joel Rosi-Schwartz wrote:
>>> I also have a further issue. My architecture is split up with an app, core
>>> and ui bundles. I would really not like to pollute the app bundle with UI
>>> stuff if I can help it. Once I pull this File dialog into the app bundle, I
>>> also have to pull up my preferences. This means that all of my dialogs that
>>> access preferences also (and I have not many but a few) these have be pulled
>>> up to access the plug-ins preference store. This is getting too sloppy for
>>> my taste.
>>>
>>> The only solution I have come up with so far is to put the resource check in
>>> the Activator.start() method of my ui bundle. This also seems brutish,
>>> but...
>>>
>>> Anyone have a idea for a cleaner solution?
>> You could define your own extension point in the app bundle and have it
>> delegate to some interface (defined by that extension point) to do the
>> real work. Something like ResourceSelectionHandler. Then your UI plugin
>> implements that extension point and provides and implementation of the
>> interface.
>>
>> You could also do it with a fragment that is hosted by the app plugin;
>> the fragment can have UI dependencies but keep them out of the plugin
>> itself.
>>
>> Hope this helps,
>> Eric
>
> The first is a very interesting idea, I will give it whirl. The second, i.e.
> using a fragment, doesn't actually solve my issues.
>
> Thanks,
> Joel
>


--
Derek
Re: How to exit RCP during start up? [message #332698 is a reply to message #332681] Wed, 05 November 2008 15:24 Go to previous message
Joel Rosi-Schwartz is currently offline Joel Rosi-SchwartzFriend
Messages: 624
Registered: July 2009
Location: London. England
Senior Member
Thanks Derek, that is exactly what I was looking for.

Cheers,
Joel

On 04/11/2008 19:18, in article geq770$a4h$1@build.eclipse.org, "Derek"
<subs@_nospam_consertum.com> wrote:

> Does
> PlatformUI.getWorkbench().close();
>
> do what you want?
>
> Joel Rosi-Schwartz wrote:
>> On 04/11/2008 18:03, in article geq2q5$pav$1@build.eclipse.org, "Eric Rizzo"
>> <eclipse-news@rizzoweb.com> wrote:
>>
>>> On 11/4/2008 12:44 PM, Joel Rosi-Schwartz wrote:
>>>> I also have a further issue. My architecture is split up with an app, core
>>>> and ui bundles. I would really not like to pollute the app bundle with UI
>>>> stuff if I can help it. Once I pull this File dialog into the app bundle, I
>>>> also have to pull up my preferences. This means that all of my dialogs that
>>>> access preferences also (and I have not many but a few) these have be
>>>> pulled
>>>> up to access the plug-ins preference store. This is getting too sloppy for
>>>> my taste.
>>>>
>>>> The only solution I have come up with so far is to put the resource check
>>>> in
>>>> the Activator.start() method of my ui bundle. This also seems brutish,
>>>> but...
>>>>
>>>> Anyone have a idea for a cleaner solution?
>>> You could define your own extension point in the app bundle and have it
>>> delegate to some interface (defined by that extension point) to do the
>>> real work. Something like ResourceSelectionHandler. Then your UI plugin
>>> implements that extension point and provides and implementation of the
>>> interface.
>>>
>>> You could also do it with a fragment that is hosted by the app plugin;
>>> the fragment can have UI dependencies but keep them out of the plugin
>>> itself.
>>>
>>> Hope this helps,
>>> Eric
>>
>> The first is a very interesting idea, I will give it whirl. The second, i.e.
>> using a fragment, doesn't actually solve my issues.
>>
>> Thanks,
>> Joel
>>
>

--
Joel Rosi-Schwartz
Etish Limited [http://www.etish.org]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^...^
/ o,o \ The proud parents of Useme & ORMF
|) ::: (| Open Requirements Management Framework
====w=w==== [http://www.eclipse.org/ormf/]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previous Topic:rcp application and file association
Next Topic:Synchronize view not showing files in conflict mode after update
Goto Forum:
  


Current Time: Sat Nov 09 01:44:01 GMT 2024

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

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

Back to the top