Author: scabanovich
Date: 2007-09-11 09:31:02 -0400 (Tue, 11 Sep 2007)
New Revision: 3555
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
JBIDE-825 Added listener to runtime preference to update default runtime.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-09-11
12:53:17 UTC (rev 3554)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-09-11
13:31:02 UTC (rev 3555)
@@ -32,6 +32,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.jboss.tools.common.xml.XMLUtilities;
@@ -51,6 +52,7 @@
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
+import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -68,6 +70,8 @@
ClassPath classPath = new ClassPath(this);
+ boolean useDefaultRuntime = false;
+
SeamRuntime runtime = null;
Set<IPath> sourcePaths = new HashSet<IPath>();
@@ -134,12 +138,20 @@
*
*/
public SeamRuntime getRuntime() {
+ if(useDefaultRuntime) {
+ SeamRuntimeManager.getInstance().getDefaultRuntime();
+ }
return runtime;
}
public void setRuntime(SeamRuntime runtime) {
if(this.runtime == runtime) return;
- this.runtime = runtime;
+ useDefaultRuntime = runtime == SeamRuntimeManager.getInstance().getDefaultRuntime();
+ if(useDefaultRuntime) {
+ this.runtime = null;
+ } else {
+ this.runtime = runtime;
+ }
storeRuntime();
}
@@ -213,9 +225,19 @@
if(runtimeName != null) {
runtime = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName);
} else {
- runtime = SeamRuntimeManager.getInstance().getDefaultRuntime();
+ useDefaultRuntime = true;
+ runtime = null;
storeRuntime();
}
+ SeamCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new
Preferences.IPropertyChangeListener() {
+ public void propertyChange(Preferences.PropertyChangeEvent event) {
+ if(SeamFacetPreference.RUNTIME_LIST.equals(event.getProperty()) && runtime !=
null && runtime.isDefault()) {
+ runtime = null;
+ useDefaultRuntime = true;
+ storeRuntime();
+ }
+ }
+ });
}
/**
Show replies by date