Author: akazakov
Date: 2010-08-03 15:54:23 -0400 (Tue, 03 Aug 2010)
New Revision: 23886
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
https://jira.jboss.org/browse/JBIDE-6507 Enable/disable checkbox has been added to
CDI/EL/Seam validation preference pages.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.jsf.JSFModelPlugin;
/**
@@ -27,6 +28,7 @@
public void initializeDefaultPreferences() {
IEclipsePreferences defaultPreferences = ((IScopeContext) new
DefaultScope()).getNode(JSFModelPlugin.PLUGIN_ID);
+ defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
for (String name : JSFSeverityPreferences.SEVERITY_OPTION_NAMES) {
defaultPreferences.put(name, JSFSeverityPreferences.ERROR);
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -77,6 +77,10 @@
return SEVERITY_OPTION_NAMES;
}
+ public static boolean isValidationEnabled(IProject project) {
+ return INSTANCE.isEnabled(project);
+ }
+
public static boolean shouldValidateEL(IProject project) {
return !(SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project,
UNKNOWN_EL_VARIABLE_NAME)) &&
SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project,
UNKNOWN_EL_VARIABLE_PROPERTY_NAME)) &&
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -88,8 +88,12 @@
public ELValidator() {
}
- private boolean isEnabled(IProject project) {
- return JSFSeverityPreferences.shouldValidateEL(project);
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
+ */
+ public boolean isEnabled(IProject project) {
+ return JSFSeverityPreferences.isValidationEnabled(project) &&
JSFSeverityPreferences.shouldValidateEL(project);
}
/*
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2010-08-03 19:25:10 UTC (rev
23885)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2010-08-03 19:54:23 UTC (rev
23886)
@@ -140,6 +140,7 @@
id="cd"
name="JBoss KB Project Validator">
<validator>
+ <runStrategy project="true"/>
<projectNature id="org.eclipse.jdt.core.javanature" />
<filter
objectClass="org.eclipse.core.resources.IFile"
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -60,4 +60,11 @@
* @return true if this validator should validate given project.
*/
boolean shouldValidate(IProject project);
+
+ /**
+ * Returns "true" if this validator is enabled in the preferences store.
+ * @param project
+ * @return
+ */
+ boolean isEnabled(IProject project);
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -170,4 +170,8 @@
public static boolean shouldValidateSettings(IProject project) {
return !SeamPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project,
INVALID_PROJECT_SETTINGS));
}
+
+ public static boolean isValidationEnabled(IProject project) {
+ return INSTANCE.isEnabled(project);
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
@@ -28,6 +29,7 @@
public void initializeDefaultPreferences() {
IEclipsePreferences defaultPreferences = ((IScopeContext) new
DefaultScope()).getNode(SeamCorePlugin.PLUGIN_ID);
+ defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
for (String name : SeamPreferences.SEVERITY_OPTION_NAMES) {
defaultPreferences.put(name, SeamPreferences.ERROR);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-08-03
19:25:10 UTC (rev 23885)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-08-03
19:54:23 UTC (rev 23886)
@@ -136,12 +136,20 @@
/*
* (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
+ */
+ public boolean isEnabled(IProject project) {
+ return SeamPreferences.isValidationEnabled(project);
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
*/
public boolean shouldValidate(IProject project) {
try {
- // TODO check preferences
- return project!=null && project.isAccessible() &&
project.hasNature(ISeamProject.NATURE_ID);
+ // TODO check preferences for root web project only
+ return project!=null && project.isAccessible() &&
project.hasNature(ISeamProject.NATURE_ID) && isPreferencesEnabled(project);
} catch (CoreException e) {
SeamCorePlugin.getDefault().logError(e);
}
@@ -165,7 +173,7 @@
}
private boolean isPreferencesEnabled(IProject project) {
- return SeamPreferences.shouldValidateCore(project);
+ return isEnabled(project) && SeamPreferences.shouldValidateCore(project);
}
/*