How to exit RCP during start up? [message #332671] |
Tue, 04 November 2008 15:19 |
|
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 #332678 is a reply to message #332672] |
Tue, 04 November 2008 17:44 |
|
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 |
Eclipse User |
|
|
|
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 |
|
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 |
Eclipse User |
|
|
|
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 |
|
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/]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
Powered by
FUDForum. Page generated in 0.03866 seconds