Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to show Workspace Launcher on Startup ??
How to show Workspace Launcher on Startup ?? [message #397479] Tue, 30 November 2004 09:39 Go to next message
Eclipse UserFriend
Hi,

I am developing a RCP Product/Application. It is running fine, but i got a
little problem.
On Startup workspace directory is always created in directory application
is started from.
For multi user support i would like to have the Workspace chooser dialog
from standart eclipse, so i can create active workspace whereever i want.

Is there any way, or better what do i have to do to user Workspace
prompter.

thx
Dennis
Re: How to show Workspace Launcher on Startup ?? [message #397687 is a reply to message #397479] Tue, 30 November 2004 21:09 Go to previous messageGo to next message
Eclipse UserFriend
It's not too hard to add this to your application. The catch is that the
classes that provide the prompting in the IDE are internal. I suggest
that you copy the interesting function into your own prompter.

Have a look at IDEApplication, and notice that before the workbench
advisor is created, the workspace is configured. Use this same pattern
and use Platform.getInstanceDataLocation() to get/set the workspace
location.

Cheers,
Jean-Michel

Dennis wrote:
> Hi,
>
> I am developing a RCP Product/Application. It is running fine, but i got
> a little problem.
> On Startup workspace directory is always created in directory
> application is started from.
> For multi user support i would like to have the Workspace chooser dialog
> from standart eclipse, so i can create active workspace whereever i want.
>
> Is there any way, or better what do i have to do to user Workspace
> prompter.
>
> thx
> Dennis
>
Re: How to show Workspace Launcher on Startup ?? [message #397703 is a reply to message #397687] Wed, 01 December 2004 07:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I already tried sth like that. Right after creating Display before
workbench is created in my IPlatformRunnable class i tried to set instance
Directory.
All i got was an exception. Perhaps anyone else tried this ?

my run methode :
Display display = PlatformUI.createDisplay();
Location instanceLoc = Platform.getInstanceLocation();
instanceLoc.release();
URL url = promptForInstanceLoc(display);
if (url == null) {
return IPlatformRunnable.EXIT_OK;
}
instanceLoc.setURL(url, true);
try {
int code = PlatformUI.createAndRunWorkbench(display,
new BXTPWorkbenchAdvisor());
// exit the application with an appropriate return code
return code == PlatformUI.RETURN_RESTART ? EXIT_RESTART :
EXIT_OK;
} finally {
if (display != null) {
display.dispose();
}
}

private URL promptForInstanceLoc(Display display) {
Shell shell = new Shell(display);
DirectoryDialog dialog = new DirectoryDialog(shell);
dialog.setText("Select Workspace Directory");
dialog.setMessage("Select the workspace directory to use.");
String dir = dialog.open();
shell.dispose();
try {
return dir == null ? null : new File(dir).toURL();
} catch (MalformedURLException e) {
return null;
}
}

and the exception :
!ENTRY org.eclipse.osgi Nov 30, 2004 17:05:11.432
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Cannot change the location once it is set.
at
org.eclipse.core.runtime.adaptor.BasicLocation.setURL(BasicL ocation.java:116)
at
com.bredexsw.bxtp.client.gui.plugin.BXTPLauncher.run(BXTPLau ncher.java:53)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:335)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)

Jean-Michel Lemieux wrote:

> It's not too hard to add this to your application. The catch is that the
> classes that provide the prompting in the IDE are internal. I suggest
> that you copy the interesting function into your own prompter.

> Have a look at IDEApplication, and notice that before the workbench
> advisor is created, the workspace is configured. Use this same pattern
> and use Platform.getInstanceDataLocation() to get/set the workspace
> location.

> Cheers,
> Jean-Michel

> Dennis wrote:
>> Hi,
>>
>> I am developing a RCP Product/Application. It is running fine, but i got
>> a little problem.
>> On Startup workspace directory is always created in directory
>> application is started from.
>> For multi user support i would like to have the Workspace chooser dialog
>> from standart eclipse, so i can create active workspace whereever i want.
>>
>> Is there any way, or better what do i have to do to user Workspace
>> prompter.
>>
>> thx
>> Dennis
>>
Re: How to show Workspace Launcher on Startup ?? [message #398211 is a reply to message #397703] Sun, 05 December 2004 21:19 Go to previous message
Eclipse UserFriend
This is because when you started your application you specified a value
for the workspace (this is in one of the tab of the "eclipse application
launchers"). To avoid the problem replace the value by "@noDefault".

PaScaL

Dennis wrote:
> Hi,
>
> I already tried sth like that. Right after creating Display before
> workbench is created in my IPlatformRunnable class i tried to set
> instance Directory.
> All i got was an exception. Perhaps anyone else tried this ?
>
> my run methode :
> Display display = PlatformUI.createDisplay();
> Location instanceLoc = Platform.getInstanceLocation();
> instanceLoc.release();
> URL url = promptForInstanceLoc(display);
> if (url == null) {
> return IPlatformRunnable.EXIT_OK;
> }
> instanceLoc.setURL(url, true);
> try {
> int code = PlatformUI.createAndRunWorkbench(display,
> new BXTPWorkbenchAdvisor());
> // exit the application with an appropriate return code
> return code == PlatformUI.RETURN_RESTART ? EXIT_RESTART :
> EXIT_OK;
> } finally {
> if (display != null) {
> display.dispose();
> }
> }
>
> private URL promptForInstanceLoc(Display display) {
> Shell shell = new Shell(display);
> DirectoryDialog dialog = new DirectoryDialog(shell);
> dialog.setText("Select Workspace Directory");
> dialog.setMessage("Select the workspace directory to use.");
> String dir = dialog.open();
> shell.dispose();
> try {
> return dir == null ? null : new File(dir).toURL();
> } catch (MalformedURLException e) {
> return null;
> }
> }
>
> and the exception :
> !ENTRY org.eclipse.osgi Nov 30, 2004 17:05:11.432
> !MESSAGE Application error
> !STACK 1
> java.lang.IllegalStateException: Cannot change the location once it is set.
> at
> org.eclipse.core.runtime.adaptor.BasicLocation.setURL(BasicL ocation.java:116)
>
> at
> com.bredexsw.bxtp.client.gui.plugin.BXTPLauncher.run(BXTPLau ncher.java:53)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:335)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
> at org.eclipse.core.launcher.Main.run(Main.java:704)
> at org.eclipse.core.launcher.Main.main(Main.java:688)
>
> Jean-Michel Lemieux wrote:
>
>> It's not too hard to add this to your application. The catch is that
>> the classes that provide the prompting in the IDE are internal. I
>> suggest that you copy the interesting function into your own prompter.
>
>
>> Have a look at IDEApplication, and notice that before the workbench
>> advisor is created, the workspace is configured. Use this same pattern
>> and use Platform.getInstanceDataLocation() to get/set the workspace
>> location.
>
>
>> Cheers,
>> Jean-Michel
>
>
>> Dennis wrote:
>>
>>> Hi,
>>>
>>> I am developing a RCP Product/Application. It is running fine, but i
>>> got a little problem.
>>> On Startup workspace directory is always created in directory
>>> application is started from.
>>> For multi user support i would like to have the Workspace chooser
>>> dialog from standart eclipse, so i can create active workspace
>>> whereever i want.
>>>
>>> Is there any way, or better what do i have to do to user Workspace
>>> prompter.
>>>
>>> thx
>>> Dennis
>>>
>
>
Previous Topic:Job API: Progress Monitor doesn't work propably
Next Topic:RCP Coolbar Dropdown menu
Goto Forum:
  


Current Time: Tue Jul 08 05:32:10 EDT 2025

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

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

Back to the top