Author: dgolovin
Date: 2010-04-26 14:09:12 -0400 (Mon, 26 Apr 2010)
New Revision: 21699
Modified:
branches/jbosstools-3.1.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.java
branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5902 Validation not running on CDI project before
I enable JSF support
patch applied to the branch
Modified:
branches/jbosstools-3.1.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
---
branches/jbosstools-3.1.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-04-26
17:59:43 UTC (rev 21698)
+++
branches/jbosstools-3.1.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-04-26
18:09:12 UTC (rev 21699)
@@ -20,6 +20,7 @@
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.web.kb.IKbProject;
@@ -28,6 +29,7 @@
* @author Alexey Kazakov
*/
public class CDIUtil {
+
/**
* Adds CDI and KB builders to the project.
*
@@ -40,6 +42,7 @@
EclipseResourceUtil.addNatureToProject(project,
IKbProject.NATURE_ID);
}
+ EclipseResourceUtil.addBuilderToProject(project,
ValidationPlugin.VALIDATION_BUILDER_ID);
} catch (CoreException e) {
CDICorePlugin.getDefault().logError(e);
}
Modified:
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.java
===================================================================
---
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.java 2010-04-26
17:59:43 UTC (rev 21698)
+++
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.java 2010-04-26
18:09:12 UTC (rev 21699)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@@ -108,6 +109,23 @@
proj.setDescription(description, null);
}
+ public static void addBuilderToProject(IProject project, String builderId) throws
CoreException {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] existing = desc.getBuildSpec();
+ for (ICommand command : existing) {
+ if(builderId.equals(command.getBuilderName())) {
+ return;
+ }
+ }
+ ICommand[] cmds = new ICommand[existing.length + 1];
+ ICommand newcmd = project.getDescription().newCommand();
+ newcmd.setBuilderName(builderId);
+ cmds[0] = newcmd;
+ System.arraycopy(existing, 0, cmds, 1, existing.length );
+ desc.setBuildSpec(cmds);
+ project.setDescription(desc, null);
+ }
+
public static void removeNatureFromProject(IProject project, String natureId) throws
CoreException {
IProject proj = project.getProject();
IProjectDescription description = proj.getDescription();
Modified:
branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
---
branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2010-04-26
17:59:43 UTC (rev 21698)
+++
branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2010-04-26
18:09:12 UTC (rev 21699)
@@ -53,6 +53,7 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.ui.IValidator;
import org.jboss.tools.common.ui.preferences.SettingsPage;
@@ -965,6 +966,7 @@
if(!project.hasNature(IKbProject.NATURE_ID)) {
EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
}
+ EclipseResourceUtil.addBuilderToProject(project,
ValidationPlugin.VALIDATION_BUILDER_ID);
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}