JBoss Tools SVN: r31706 - in trunk: seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-31 19:57:29 -0400 (Tue, 31 May 2011)
New Revision: 31706
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
Log:
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2011-05-31 23:27:46 UTC (rev 31705)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2011-05-31 23:57:29 UTC (rev 31706)
@@ -62,6 +62,7 @@
import org.jboss.tools.common.zip.UnzipOperation;
import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.internal.KbBuilder;
import org.osgi.framework.Bundle;
/**
@@ -79,9 +80,7 @@
*/
public static void enableCDI(IProject project, boolean genearteBeansXml, IProgressMonitor monitor) {
try {
- if (!project.hasNature(IKbProject.NATURE_ID)) {
- EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
- }
+ WebModelPlugin.addNatureToProjectWithValidationSupport(project, KbBuilder.BUILDER_ID, IKbProject.NATURE_ID);
WebModelPlugin.addNatureToProjectWithValidationSupport(project, CDICoreBuilder.BUILDER_ID, CDICoreNature.NATURE_ID);
if(genearteBeansXml) {
File beansXml = getBeansXml(project);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java 2011-05-31 23:27:46 UTC (rev 31705)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java 2011-05-31 23:57:29 UTC (rev 31706)
@@ -39,6 +39,7 @@
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.internal.KbBuilder;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.internal.core.AbstractContextVariable;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
@@ -53,11 +54,7 @@
return;
}
try {
-// EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
- if(!project.hasNature(IKbProject.NATURE_ID)) {
- EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
- }
-// EclipseResourceUtil.addBuilderToProject(project, ValidationPlugin.VALIDATION_BUILDER_ID);
+ WebModelPlugin.addNatureToProjectWithValidationSupport(project, KbBuilder.BUILDER_ID, IKbProject.NATURE_ID);
WebModelPlugin.addNatureToProjectWithValidationSupport(project, SeamCoreBuilder.BUILDER_ID, ISeamProject.NATURE_ID);
} catch (CoreException e) {
SeamCorePlugin.getPluginLog().logError(e);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2011-05-31 23:27:46 UTC (rev 31705)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2011-05-31 23:57:29 UTC (rev 31706)
@@ -866,7 +866,8 @@
if(projectType != ProjectType.EAR) {
ClasspathHelper.addClasspathEntries(project, fv);
createSeamProjectPreferenes(project, model);
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+// EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ SeamUtil.enableSeamSupport(project);
}
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
13 years, 6 months
JBoss Tools SVN: r31705 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-31 19:27:46 -0400 (Tue, 31 May 2011)
New Revision: 31705
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java
Log:
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java 2011-05-31 23:15:07 UTC (rev 31704)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java 2011-05-31 23:27:46 UTC (rev 31705)
@@ -11,6 +11,7 @@
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolution2;
import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
public class BuilderOrderResolutionGenerator implements IMarkerResolutionGenerator2 {
@@ -51,7 +52,7 @@
ICommand[] bs = d.getBuildSpec();
ICommand v = null;
for (int i = 0; i < bs.length; i++) {
- if(ValidatorManager.WTP_VALIDATOR_ID.equals(bs[i].getBuilderName())) {
+ if(ValidationPlugin.VALIDATION_BUILDER_ID.equals(bs[i].getBuilderName())) {
v = bs[i];
}
if(v != null) {
13 years, 6 months
JBoss Tools SVN: r31704 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-31 19:15:07 -0400 (Tue, 31 May 2011)
New Revision: 31704
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
Log:
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-05-31 22:48:47 UTC (rev 31703)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-05-31 23:15:07 UTC (rev 31704)
@@ -27,6 +27,7 @@
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
@@ -110,7 +111,6 @@
}
}
- static String WTP_VALIDATOR_ID = "org.eclipse.wst.validation.validationbuilder"; //$NON-NLS-1$
static String ORDER_PROBLEM_MARKER_TYPE = "org.jboss.tools.jst.web.kb.builderOrderProblem"; //$NON-NLS-1$
private static String ATTR_VALIDATOR = "validator"; //$NON-NLS-1$
@@ -160,7 +160,7 @@
boolean validationFound = false;
for (ICommand c: cs) {
String name = c.getBuilderName();
- if(WTP_VALIDATOR_ID.equals(name)) {
+ if(ValidationPlugin.VALIDATION_BUILDER_ID.equals(name)) {
validationFound = true;
} else if(builderId.equals(name)) {
return !validationFound;
13 years, 6 months
JBoss Tools SVN: r31703 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: internal/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-31 18:48:47 -0400 (Tue, 31 May 2011)
New Revision: 31703
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties 2011-05-31 22:45:34 UTC (rev 31702)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties 2011-05-31 22:48:47 UTC (rev 31703)
@@ -1,4 +1,4 @@
-WRONG_BUILDER_ORDER=Wrong order of builders in project {0}: Validation Builder should follow builder {1}. Validation is aborted.
+WRONG_BUILDER_ORDER=Project {0} cannot be validated: Validation Builder should follow {1}.
VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL=Linked resource path must not be null\!
VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL=Variable name must not be null\!
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-05-31 22:45:34 UTC (rev 31702)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-05-31 22:48:47 UTC (rev 31703)
@@ -21,7 +21,9 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.core.ValidationException;
@@ -112,45 +114,25 @@
static String ORDER_PROBLEM_MARKER_TYPE = "org.jboss.tools.jst.web.kb.builderOrderProblem"; //$NON-NLS-1$
private static String ATTR_VALIDATOR = "validator"; //$NON-NLS-1$
- public static boolean isCorrectOrder(IProject project, String builderId) {
- try {
- ICommand[] cs = project.getDescription().getBuildSpec();
- boolean validationFound = false;
- for (ICommand c: cs) {
- String name = c.getBuilderName();
- if(WTP_VALIDATOR_ID.equals(name)) {
- validationFound = true;
- }
- if(builderId.equals(name)) {
- return !validationFound;
- }
- }
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- return true;
- }
-
- public static IMarker findBuilderOrderMarker(IProject project, String validator) {
- IMarker result = null;
- try {
- IMarker[] ms = project.findMarkers(ORDER_PROBLEM_MARKER_TYPE, false, IResource.DEPTH_ZERO);
- for (IMarker m: ms) {
- if(validator.equals(m.getAttribute(ATTR_VALIDATOR, null))) {
- result = m;
- }
- }
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- return result;
- }
-
- public static boolean validateBuilderOrder(IProject project, String builderId, String validator, SeverityPreferences preferences) throws CoreException {
- String severityPreferenceValue = preferences.getBuilderOrderPreference(project);
- int severity = getSeverity(severityPreferenceValue);
+ /**
+ * Helper method to be called by IValidator implementations.
+ * It implements common logic:
+ * 1. Checks if builderId follows Validation Builder.
+ * 2. Checks severity preference associated with this builder.
+ * 3. Creates, updates or deletes error/warning marker on project
+ * taking into account builders order and severity preference.
+ *
+ * @param project
+ * @param builderId
+ * @param validatorId
+ * @param preferences
+ * @return
+ * @throws CoreException
+ */
+ public static boolean validateBuilderOrder(IProject project, String builderId, String validatorId, SeverityPreferences preferences) throws CoreException {
+ int severity = getSeverity(preferences.getBuilderOrderPreference(project));
boolean isCorrect = isCorrectOrder(project, builderId);
- IMarker marker = findBuilderOrderMarker(project, validator);
+ IMarker marker = findBuilderOrderMarker(project, validatorId);
if(isCorrect || severity <= IMarker.SEVERITY_INFO) {
if(marker != null) {
ResourcesPlugin.getWorkspace().deleteMarkers(new IMarker[]{marker});
@@ -162,9 +144,9 @@
}
} else {
marker = project.createMarker(ORDER_PROBLEM_MARKER_TYPE);
- marker.setAttribute(ATTR_VALIDATOR, validator);
+ marker.setAttribute(ATTR_VALIDATOR, validatorId);
marker.setAttribute(IMarker.SEVERITY, severity);
- String message = NLS.bind(KbMessages.WRONG_BUILDER_ORDER, project.getName(), builderId);
+ String message = NLS.bind(KbMessages.WRONG_BUILDER_ORDER, project.getName(), findBuilderName(builderId));
marker.setAttribute(IMarker.MESSAGE, message);
//Temporary to debug
WebKbPlugin.getDefault().logError(message);
@@ -173,10 +155,40 @@
return isCorrect || severity <= IMarker.SEVERITY_INFO;
}
- public static int getSeverity(String severityPreferenceValue) {
+ private static boolean isCorrectOrder(IProject project, String builderId) throws CoreException {
+ ICommand[] cs = project.getDescription().getBuildSpec();
+ boolean validationFound = false;
+ for (ICommand c: cs) {
+ String name = c.getBuilderName();
+ if(WTP_VALIDATOR_ID.equals(name)) {
+ validationFound = true;
+ } else if(builderId.equals(name)) {
+ return !validationFound;
+ }
+ }
+ return true;
+ }
+
+ private static IMarker findBuilderOrderMarker(IProject project, String validator) throws CoreException {
+ IMarker result = null;
+ IMarker[] ms = project.findMarkers(ORDER_PROBLEM_MARKER_TYPE, false, IResource.DEPTH_ZERO);
+ for (IMarker m: ms) {
+ if(validator.equals(m.getAttribute(ATTR_VALIDATOR, null))) {
+ result = m;
+ }
+ }
+ return result;
+ }
+
+ private static String findBuilderName(String builderId) {
+ IExtension ext = Platform.getExtensionRegistry().getExtension(builderId);
+ return (ext != null && ext.getLabel() != null) ? ext.getLabel() : builderId;
+ }
+
+ private static int getSeverity(String severityPreferenceValue) {
return (SeverityPreferences.IGNORE.equals(severityPreferenceValue))
? IMarker.SEVERITY_INFO
- : SeverityPreferences.WARNING.equals(severityPreferenceValue)
+ : (SeverityPreferences.WARNING.equals(severityPreferenceValue))
? IMarker.SEVERITY_WARNING
: IMarker.SEVERITY_ERROR;
}
13 years, 6 months
JBoss Tools SVN: r31701 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-31 17:58:57 -0400 (Tue, 31 May 2011)
New Revision: 31701
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2011-05-31 21:57:37 UTC (rev 31700)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2011-05-31 21:58:57 UTC (rev 31701)
@@ -29,6 +29,7 @@
public void initializeDefaultPreferences() {
IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(CDICorePlugin.PLUGIN_ID);
defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ defaultPreferences.put(SeverityPreferences.WRONG_BUILDER_ORDER_PREFERENCE_NAME, CDIPreferences.ERROR);
for (String name : CDIPreferences.SEVERITY_OPTION_NAMES) {
defaultPreferences.put(name, SeverityPreferences.ERROR);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2011-05-31 21:57:37 UTC (rev 31700)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java 2011-05-31 21:58:57 UTC (rev 31701)
@@ -305,4 +305,5 @@
public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
}
+
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-05-31 21:57:37 UTC (rev 31700)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-05-31 21:58:57 UTC (rev 31701)
@@ -171,13 +171,21 @@
*/
public boolean shouldValidate(IProject project) {
try {
- return project != null && project.isAccessible() && project.hasNature(CDICoreNature.NATURE_ID) && isEnabled(project);
+ return project != null
+ && project.isAccessible()
+ && project.hasNature(CDICoreNature.NATURE_ID)
+ && validateBuilderOrder(project)
+ && isEnabled(project);
} catch (CoreException e) {
CDICorePlugin.getDefault().logError(e);
}
return false;
}
+ private boolean validateBuilderOrder(IProject project) throws CoreException {
+ return ValidatorManager.validateBuilderOrder(project, getBuilderId(), getId(), CDIPreferences.getInstance());
+ }
+
/*
* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter)
13 years, 6 months
JBoss Tools SVN: r31700 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb: src/org/jboss/tools/jst/web/kb/internal/validation and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-31 17:57:37 -0400 (Tue, 31 May 2011)
New Revision: 31700
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
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/internal/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties 2011-05-31 21:53:27 UTC (rev 31699)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties 2011-05-31 21:57:37 UTC (rev 31700)
@@ -4,4 +4,5 @@
# END NON-TRANSLATABLE
KBProblemName=EL Knowledge Base Problem
-KBBuilderProblemName=Knowledge Base Builder Problem
\ No newline at end of file
+KBBuilderProblemName=Knowledge Base Builder Problem
+BuilderOrderProblemName=Builders Order Problem
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-05-31 21:53:27 UTC (rev 31699)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-05-31 21:57:37 UTC (rev 31700)
@@ -135,6 +135,15 @@
</persistent>
</extension>
+ <extension id="builderOrderProblem" name="%BuilderOrderProblemName" point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.core.resources.problemmarker">
+ </super>
+ <persistent value="true">
+ </persistent>
+ <attribute name="validator">
+ </attribute>
+ </extension>
+
<extension id="kbproblemmarker" name="%KBProblemName" point="org.eclipse.core.resources.markers">
<super type="org.eclipse.wst.validation.problemmarker">
</super>
@@ -149,6 +158,12 @@
</markerResolutionGenerator>
</extension>
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.jboss.tools.jst.web.kb.builderOrderProblem"
+ class="org.jboss.tools.jst.web.kb.internal.validation.BuilderOrderResolutionGenerator"/>
+ </extension>
+
<extension
point="org.eclipse.wst.validation.validator"
id="cd"
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java 2011-05-31 21:57:37 UTC (rev 31700)
@@ -0,0 +1,78 @@
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+
+public class BuilderOrderResolutionGenerator implements IMarkerResolutionGenerator2 {
+
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ try {
+ if(ValidatorManager.ORDER_PROBLEM_MARKER_TYPE.equals(marker.getType())) {
+ return new IMarkerResolution[]{new BuilderOrderResolution()};
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return new IMarkerResolution[0];
+ }
+
+ public boolean hasResolutions(IMarker marker) {
+ try {
+ return ValidatorManager.ORDER_PROBLEM_MARKER_TYPE.equals(marker.getType());
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+
+}
+
+class BuilderOrderResolution implements IMarkerResolution2 {
+
+ public String getLabel() {
+ return "Change Order of Builders."; //$NON-NLS-1$
+ }
+
+ public void run(IMarker marker) {
+ IProject project = marker.getResource().getProject();
+
+ try {
+ IProjectDescription d = project.getDescription();
+ ICommand[] bs = d.getBuildSpec();
+ ICommand v = null;
+ for (int i = 0; i < bs.length; i++) {
+ if(ValidatorManager.WTP_VALIDATOR_ID.equals(bs[i].getBuilderName())) {
+ v = bs[i];
+ }
+ if(v != null) {
+ bs[i] = (i + 1 < bs.length) ? bs[i + 1] : v;
+ }
+ }
+ d.setBuildSpec(bs);
+ project.setDescription(d, IProject.FORCE, new NullProgressMonitor());
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/BuilderOrderResolutionGenerator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-05-31 21:53:27 UTC (rev 31699)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-05-31 21:57:37 UTC (rev 31700)
@@ -535,13 +535,22 @@
* @see org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
*/
public boolean shouldValidate(IProject project) {
- if(isEnabled(project)) {
- for (IELValidationDelegate delegate : DELEGATES) {
- if(delegate.shouldValidate(project)) {
- return true;
+ try {
+ if(validateBuilderOrder(project) && isEnabled(project)) {
+ for (IELValidationDelegate delegate : DELEGATES) {
+ if(delegate.shouldValidate(project)) {
+ return true;
+ }
}
}
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
}
return false;
}
-}
\ No newline at end of file
+
+ private boolean validateBuilderOrder(IProject project) throws CoreException {
+ return ValidatorManager.validateBuilderOrder(project, getBuilderId(), getId(), ELSeverityPreferences.getInstance());
+ }
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-05-31 21:53:27 UTC (rev 31699)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-05-31 21:57:37 UTC (rev 31700)
@@ -16,8 +16,10 @@
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
@@ -26,6 +28,7 @@
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.jst.web.kb.KbMessages;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
@@ -76,12 +79,6 @@
if(validatingProjects.contains(rootProject)) {
return OK_STATUS;
}
- if(!checkBuilderOrder(validationHelper, rootProject)) {
- //TODO activate this return after duly testing
- // it would be too dangerous to abort validation now
- // while some test project have wrong builder order.
-// return OK_STATUS;
- }
validatingProjects.add(rootProject);
}
}
@@ -111,40 +108,79 @@
}
}
- private static String WTP_VALIDATOR_ID = "org.eclipse.wst.validation.validationbuilder"; //$NON-NLS-1$
+ static String WTP_VALIDATOR_ID = "org.eclipse.wst.validation.validationbuilder"; //$NON-NLS-1$
+ static String ORDER_PROBLEM_MARKER_TYPE = "org.jboss.tools.jst.web.kb.builderOrderProblem"; //$NON-NLS-1$
+ private static String ATTR_VALIDATOR = "validator"; //$NON-NLS-1$
- private boolean checkBuilderOrder(ContextValidationHelper validationHelper, IProject project) {
- IValidationContextManager validationContextManager = validationHelper.getValidationContextManager();
- List<IValidator> validators = validationContextManager.getValidators();
- Set<String> requiredBuilders = new HashSet<String>();
- for (IValidator v: validators) {
- String builderId = v.getBuilderId();
- if(builderId != null) {
- requiredBuilders.add(builderId);
- }
- }
+ public static boolean isCorrectOrder(IProject project, String builderId) {
try {
- boolean validationFound = false;
- ICommand[] cs = project.getDescription().getBuildSpec();
+ ICommand[] cs = project.getDescription().getBuildSpec();
+ boolean validationFound = false;
for (ICommand c: cs) {
String name = c.getBuilderName();
if(WTP_VALIDATOR_ID.equals(name)) {
validationFound = true;
}
- if(requiredBuilders.contains(name) && validationFound) {
- String message = NLS.bind(KbMessages.WRONG_BUILDER_ORDER, project.getName(), name);
- WebKbPlugin.getDefault().logError(message);
- return false;
+ if(builderId.equals(name)) {
+ return !validationFound;
}
- }
-
+ }
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(e);
}
-
return true;
}
+ public static IMarker findBuilderOrderMarker(IProject project, String validator) {
+ IMarker result = null;
+ try {
+ IMarker[] ms = project.findMarkers(ORDER_PROBLEM_MARKER_TYPE, false, IResource.DEPTH_ZERO);
+ for (IMarker m: ms) {
+ if(validator.equals(m.getAttribute(ATTR_VALIDATOR, null))) {
+ result = m;
+ }
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return result;
+ }
+
+ public static boolean validateBuilderOrder(IProject project, String builderId, String validator, SeverityPreferences preferences) throws CoreException {
+ String severityPreferenceValue = preferences.getBuilderOrderPreference(project);
+ int severity = getSeverity(severityPreferenceValue);
+ boolean isCorrect = isCorrectOrder(project, builderId);
+ IMarker marker = findBuilderOrderMarker(project, validator);
+ if(isCorrect || severity <= IMarker.SEVERITY_INFO) {
+ if(marker != null) {
+ ResourcesPlugin.getWorkspace().deleteMarkers(new IMarker[]{marker});
+ }
+ } else {
+ if(marker != null) {
+ if(marker.getAttribute(IMarker.SEVERITY, -1) != severity) {
+ marker.setAttribute(IMarker.SEVERITY, severity);
+ }
+ } else {
+ marker = project.createMarker(ORDER_PROBLEM_MARKER_TYPE);
+ marker.setAttribute(ATTR_VALIDATOR, validator);
+ marker.setAttribute(IMarker.SEVERITY, severity);
+ String message = NLS.bind(KbMessages.WRONG_BUILDER_ORDER, project.getName(), builderId);
+ marker.setAttribute(IMarker.MESSAGE, message);
+ //Temporary to debug
+ WebKbPlugin.getDefault().logError(message);
+ }
+ }
+ return isCorrect || severity <= IMarker.SEVERITY_INFO;
+ }
+
+ public static int getSeverity(String severityPreferenceValue) {
+ return (SeverityPreferences.IGNORE.equals(severityPreferenceValue))
+ ? IMarker.SEVERITY_INFO
+ : SeverityPreferences.WARNING.equals(severityPreferenceValue)
+ ? IMarker.SEVERITY_WARNING
+ : IMarker.SEVERITY_ERROR;
+ }
+
private IStatus validate(Set<IFile> changedFiles, ContextValidationHelper validationHelper, IReporter reporter) throws ValidationException {
IValidationContextManager validationContextManager = validationHelper.getValidationContextManager();
List<IValidator> validators = validationContextManager.getValidators();
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java 2011-05-31 21:53:27 UTC (rev 31699)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java 2011-05-31 21:57:37 UTC (rev 31700)
@@ -29,6 +29,7 @@
IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(WebKbPlugin.PLUGIN_ID);
defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ defaultPreferences.put(SeverityPreferences.WRONG_BUILDER_ORDER_PREFERENCE_NAME, ELSeverityPreferences.ERROR);
for (String name : ELSeverityPreferences.SEVERITY_OPTION_NAMES) {
defaultPreferences.put(name, ELSeverityPreferences.ERROR);
}
13 years, 6 months
JBoss Tools SVN: r31699 - trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-31 17:53:27 -0400 (Tue, 31 May 2011)
New Revision: 31699
Modified:
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/.project
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/.project
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/.project 2011-05-31 21:52:13 UTC (rev 31698)
+++ trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/.project 2011-05-31 21:53:27 UTC (rev 31699)
@@ -21,17 +21,17 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
+ <name>org.jboss.tools.common.verification.verifybuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.common.verification.verifybuilder</name>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
13 years, 6 months
JBoss Tools SVN: r31698 - trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-31 17:52:13 -0400 (Tue, 31 May 2011)
New Revision: 31698
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/.project
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/.project 2011-05-31 21:45:38 UTC (rev 31697)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/.project 2011-05-31 21:52:13 UTC (rev 31698)
@@ -21,12 +21,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
13 years, 6 months
JBoss Tools SVN: r31697 - in trunk/jsf/tests/org.jboss.tools.jsf.test/projects: JsfJbide7975 and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-31 17:45:38 -0400 (Tue, 31 May 2011)
New Revision: 31697
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/.project
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JsfJbide7975/.project
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/i18nTestProject/.project
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/.project 2011-05-31 21:44:19 UTC (rev 31696)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/.project 2011-05-31 21:45:38 UTC (rev 31697)
@@ -21,12 +21,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JsfJbide7975/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JsfJbide7975/.project 2011-05-31 21:44:19 UTC (rev 31696)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JsfJbide7975/.project 2011-05-31 21:45:38 UTC (rev 31697)
@@ -21,12 +21,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/projects/i18nTestProject/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/projects/i18nTestProject/.project 2011-05-31 21:44:19 UTC (rev 31696)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/projects/i18nTestProject/.project 2011-05-31 21:45:38 UTC (rev 31697)
@@ -21,12 +21,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
13 years, 6 months