Author: scabanovich
Date: 2011-08-24 15:29:21 -0400 (Wed, 24 Aug 2011)
New Revision: 34241
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
Log:
JBIDE-9582
https://issues.jboss.org/browse/JBIDE-9582
Fixed recognizing of ESB project
Modified: trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF 2011-08-24
19:18:17 UTC (rev 34240)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF 2011-08-24
19:29:21 UTC (rev 34241)
@@ -10,10 +10,11 @@
org.jboss.tools.esb.validator.ui
Require-Bundle: org.jboss.tools.common.ui,
org.jboss.tools.esb.core,
- org.eclipse.ui,
+ org.eclipse.ui;bundle-version="3.7.0",
org.jboss.tools.esb.project.core,
- org.eclipse.wst.validation,
- org.eclipse.jdt.ui,
- org.jboss.tools.common.validation
+ org.eclipse.wst.validation;bundle-version="1.2.300",
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.jboss.tools.common.validation,
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200"
Bundle-Version: 1.5.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java 2011-08-24
19:18:17 UTC (rev 34240)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java 2011-08-24
19:29:21 UTC (rev 34241)
@@ -16,6 +16,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.jboss.tools.common.model.XModelObject;
@@ -82,6 +85,10 @@
}
public boolean shouldValidate(IProject project) {
+ if(!project.isAccessible()) {
+ return false;
+ }
+
String esbContentFolder = null;
try {
@@ -92,8 +99,14 @@
if(esbContentFolder != null) return isEnabled(project);
+
try {
- return project != null && project.isAccessible() &&
project.hasNature(ESBProjectConstant.ESB_PROJECT_NATURE) && isEnabled(project);
+ IFacetedProject fp = ProjectFacetsManager.create(project);
+ IProjectFacet f =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
+ if(fp != null && f != null && fp.getInstalledVersion(f) != null) {
+ return true;
+ }
+ return project.hasNature(ESBProjectConstant.ESB_PROJECT_NATURE) &&
isEnabled(project);
} catch (CoreException e) {
ESBValidatorPlugin.log(e);
}
@@ -155,24 +168,26 @@
//ignore
}
- if(esbContentFolder != null) {
- IFolder esbContent = project.getFolder(new Path(esbContentFolder +
"/META-INF")); //$NON-NLS-1$
- if(esbContent != null && esbContent.exists()) {
- IResource[] rs = null;
- try {
- rs = esbContent.members();
- } catch (CoreException e) {
- ESBValidatorPlugin.log(e);
- }
- for (IResource r: rs) {
- if(r instanceof IFile) {
- IFile file = (IFile)r;
- String name = file.getName();
- if(!name.endsWith(XML_EXT)) continue;
- XModelObject o = EclipseResourceUtil.createObjectForResource(file);
- if(o != null &&
o.getModelEntity().getName().startsWith(ESBConstants.ENT_ESB_FILE)) {
- validateESBConfigFile(o, file);
- }
+ if(esbContentFolder == null) {
+ esbContentFolder = ESBProjectConstant.DEFAULT_ESB_CONFIG_RESOURCE_FOLDER;
+ }
+
+ IFolder esbContent = project.getFolder(new Path(esbContentFolder +
"/META-INF")); //$NON-NLS-1$
+ if(esbContent != null && esbContent.exists()) {
+ IResource[] rs = null;
+ try {
+ rs = esbContent.members();
+ } catch (CoreException e) {
+ ESBValidatorPlugin.log(e);
+ }
+ for (IResource r: rs) {
+ if(r instanceof IFile) {
+ IFile file = (IFile)r;
+ String name = file.getName();
+ if(!name.endsWith(XML_EXT)) continue;
+ XModelObject o = EclipseResourceUtil.createObjectForResource(file);
+ if(o != null &&
o.getModelEntity().getName().startsWith(ESBConstants.ENT_ESB_FILE)) {
+ validateESBConfigFile(o, file);
}
}
}