Author: akazakov
Date: 2011-03-29 21:15:09 -0400 (Tue, 29 Mar 2011)
New Revision: 30137
Modified:
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
https://issues.jboss.org/browse/JBIDE-8626
Modified:
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
---
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2011-03-30
01:11:01 UTC (rev 30136)
+++
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2011-03-30
01:15:09 UTC (rev 30137)
@@ -66,6 +66,7 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamUtil;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -172,6 +173,31 @@
return removed;
}
+ public void performApply() {
+ for (SeamRuntime rt : getAddedSeamRuntimes()) {
+ SeamRuntimeManager.getInstance().addRuntime(rt);
+ }
+ getAddedSeamRuntimes().clear();
+ for (SeamRuntime rt : getRemoved()) {
+ SeamRuntimeManager.getInstance().removeRuntime(rt);
+ }
+ getRemoved().clear();
+ Map<SeamRuntime, SeamRuntime> changed = getChangedSeamRuntimes();
+ for (SeamRuntime c : changed.keySet()) {
+ SeamRuntime o = changed.get(c);
+ o.setHomeDir(c.getHomeDir());
+ o.setVersion(c.getVersion());
+ String oldName = o.getName();
+ String newName = c.getName();
+ if (!oldName.equals(newName)) {
+ SeamRuntimeManager.getInstance().changeRuntimeName(oldName, newName);
+ }
+ }
+ getChangedSeamRuntimes().clear();
+
+ SeamRuntimeManager.getInstance().save();
+ }
+
/**
* TBD
*
@@ -806,7 +832,7 @@
}
if (added.contains(source) || changed.containsKey(source)) {
source.setName(rt.getName());
- source.setHomeDir(rt.getName());
+ source.setHomeDir(rt.getHomeDir());
source.setVersion(rt.getVersion());
} else {
changed.put(rt, source);
@@ -1031,6 +1057,7 @@
dialog.open();
tableView.refresh();
setDefaultRuntimes();
+ performApply();
}
public void run(String name, String version) {
@@ -1046,6 +1073,7 @@
dialog.open();
tableView.refresh();
setDefaultRuntimes();
+ performApply();
}
}
@@ -1096,6 +1124,7 @@
tableView.setSelection(new StructuredSelection(c));
}
}
+ performApply();
}
private SeamRuntime findChangedRuntime(SeamRuntime source) {
@@ -1140,6 +1169,7 @@
}
tableView.refresh();
setDefaultRuntimes();
+ performApply();
}
private void removeRuntime(SeamRuntime r) {