Author: scabanovich
Date: 2009-12-17 10:52:05 -0500 (Thu, 17 Dec 2009)
New Revision: 19424
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Added opportunity to recognize entity by file name even if xml doctype/schema is missing.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java 2009-12-17
15:50:22 UTC (rev 19423)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java 2009-12-17
15:52:05 UTC (rev 19424)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.cdi.xml.beans.model;
-import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.EntityRecognizerExtension;
-public class CDIBeansEntityRecognizer implements EntityRecognizer, CDIBeansConstants {
+public class CDIBeansEntityRecognizer implements EntityRecognizerExtension,
CDIBeansConstants {
public CDIBeansEntityRecognizer() {}
@@ -23,7 +23,19 @@
}
return null;
}
-
+
+ public String getEntityName(String fileName, String ext, String body) {
+ if(body == null) return null;
+ String result = getEntityName(ext, body);
+ if(result != null) {
+ return result;
+ }
+ if("beans.xml".equals(fileName) &&
body.indexOf("<beans") >= 0) {
+ return ENT_CDI_BEANS;
+ }
+ return null;
+ }
+
private boolean isComponentsSchema(String body) {
int i = body.indexOf("<beans"); //$NON-NLS-1$
if(i < 0) return false;
@@ -32,5 +44,5 @@
String s = body.substring(i, j);
return s.indexOf("\"" + BEANS_NAMESPACE + "\"") >
0; //$NON-NLS-1$
}
-
+
}