Author: snjeza
Date: 2010-08-31 18:43:27 -0400 (Tue, 31 Aug 2010)
New Revision: 24587
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
Log:
https://jira.jboss.org/browse/JBDS-1302 Servers added during installation are not readded
to a deleted workspace
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
===================================================================
---
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2010-08-31
22:40:47 UTC (rev 24586)
+++
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2010-08-31
22:43:27 UTC (rev 24587)
@@ -210,19 +210,32 @@
}
private void saveWorkspacePreferences() {
+ Activator.getDefault().getPreferenceStore().setValue(Activator.FIRST_START, false);
String workspaces = getWorkspaces();
String newWorkspaces = "";
+ boolean addWorkspace = true;
if (workspaces == null || workspaces.trim().length() == 0) {
newWorkspaces = getWorkspace();
} else {
- newWorkspaces = workspaces + "," + getWorkspace();
+ StringTokenizer tokenizer = new StringTokenizer(workspaces, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String workspace = tokenizer.nextToken();
+ if (workspace.equals(getWorkspace())) {
+ addWorkspace = false;
+ }
+ }
+ if (addWorkspace) {
+ newWorkspaces = workspaces + "," + getWorkspace();
+ }
}
- IEclipsePreferences prefs = getPreferences();
- prefs.put(Activator.WORKSPACES, newWorkspaces);
- try {
- prefs.flush();
- } catch (BackingStoreException e) {
- Activator.log(e);
+ if (addWorkspace) {
+ IEclipsePreferences prefs = getPreferences();
+ prefs.put(Activator.WORKSPACES, newWorkspaces);
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ Activator.log(e);
+ }
}
}
@@ -230,6 +243,11 @@
* @return
*/
private boolean willBeInitialized() {
+ boolean firstStart =
Activator.getDefault().getPreferenceStore().getBoolean(Activator.FIRST_START);
+ if (firstStart) {
+ return true;
+ }
+
String workspaces = getWorkspaces();
if (workspaces == null || workspaces.trim().length() == 0) {
return true;