Author: scabanovich
Date: 2007-10-16 11:36:32 -0400 (Tue, 16 Oct 2007)
New Revision: 4244
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
JBIDE-982
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-10-16
15:17:41 UTC (rev 4243)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-10-16
15:36:32 UTC (rev 4244)
@@ -34,6 +34,7 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
@@ -144,6 +145,8 @@
if(cannotBeModified) {
setEnablement(seamEnablement, false);
setEnablement(runtime, false);
+ } else if(hasDependents(project)) {
+ setEnablement(seamEnablement, false);
}
return composite;
@@ -159,6 +162,27 @@
}
return false;
}
+
+ private boolean hasDependents(IProject p) {
+ ISeamProject sp = SeamCorePlugin.getSeamProject(p, false);
+ if(sp == null) return false;
+ IEclipsePreferences ep = SeamPreferences.getProjectPreferences(sp);
+ if(ep == null) return false;
+ String ear = ep.get("seam.ear.project", null);
+ if(projectExists(ear)) return true;
+ String ejb = ep.get("seam.ejb.project", null);
+ if(projectExists(ejb)) return true;
+ String test = ep.get("seam.test.project", null);
+ if(projectExists(test)) return true;
+ return false;
+ }
+
+ private boolean projectExists(String name) {
+ if(name == null) return false;
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if(p != null && p.exists() && p.isAccessible()) return true;
+ return false;
+ }
@Override
public boolean performOk() {
Show replies by date