Shell shell = new Shell(display, SWT.ON_TOP);
try {
Location instanceLocaction = Platform.getInstanceLocation();
if (instanceLocaction == null) {
// show an error to the user
Platform.endSplash();
return EXIT_OK;
}
if (instanceLocaction.isSet()) {
// everything is fine
} else {
ChooseWorkspaceData launchData = new ChooseWorkspaceData(instanceLocaction.getDefault());
new ChooseWorkspaceDialog(null, launchData, false, true).prompt(true);
String instancePath = launchData.getSelection();
File workspace = new File(instancePath);
if (!workspace.exists()) {
workspace.mkdir();
}
String path = workspace.getAbsolutePath().replace(File.separatorChar, '/');
URL candidateWorkspaceURL = new URL("file", null, path);
instanceLocaction.setURL(candidateWorkspaceURL, true);
launchData.writePersistedData();
}
} finally {
if (shell != null) {
shell.dispose();