JBoss Tools SVN: r31021 - trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-02 19:41:47 -0400 (Mon, 02 May 2011)
New Revision: 31021
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-8798
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-05-02 23:41:17 UTC (rev 31020)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-05-02 23:41:47 UTC (rev 31021)
@@ -65,7 +65,9 @@
assertTrue("File - "+file.getFullPath()+" must be exist",file.exists());
copyFiles(fileNames);
-
+
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+
try{
IMarker[] markers = file.findMarkers(markerType, true, IResource.DEPTH_INFINITE);
13 years, 8 months
JBoss Tools SVN: r31020 - branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-02 19:41:17 -0400 (Mon, 02 May 2011)
New Revision: 31020
Modified:
branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-8798
Modified: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-05-02 23:19:38 UTC (rev 31019)
+++ branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-05-02 23:41:17 UTC (rev 31020)
@@ -52,14 +52,16 @@
private void checkResolution(IProject project, String[] fileNames, String[] results, String markerType, String idName, int id, Class<? extends IMarkerResolution> resolutionClass) throws CoreException {
IFile file = project.getFile(fileNames[0]);
-
+
assertTrue("File - "+file.getFullPath()+" must be exist",file.exists());
-
+
copyFiles(project, fileNames);
-
+
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+
try{
IMarker[] markers = file.findMarkers(markerType, true, IResource.DEPTH_INFINITE);
-
+
for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i];
Integer attribute = ((Integer) marker
13 years, 8 months
JBoss Tools SVN: r31019 - trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-02 19:19:38 -0400 (Mon, 02 May 2011)
New Revision: 31019
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
Log:
Commented System.out.println()
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-05-02 22:52:38 UTC (rev 31018)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-05-02 23:19:38 UTC (rev 31019)
@@ -387,7 +387,7 @@
context.wizard.performFinish();
String text = context.getNewTypeContent();
- System.out.println(text);
+// System.out.println(text);
assertTrue(text.contains("@Decorator"));
assertTrue(text.contains("@Delegate"));
@@ -419,7 +419,7 @@
context.wizard.performFinish();
String text = context.getNewTypeContent();
- System.out.println(text);
+// System.out.println(text);
assertTrue(text.contains("@Named"));
assertTrue(text.contains("\"myNewBean\""));
@@ -451,7 +451,7 @@
context.wizard.performFinish();
String text = context.getNewTypeContent();
- System.out.println(text);
+// System.out.println(text);
assertTrue(text.contains("AnnotationLiteral<" + QUALIFIER_NAME + ">"));
} finally {
@@ -474,7 +474,7 @@
context.wizard.performFinish();
String text = context.getNewTypeContent();
- System.out.println(text);
+// System.out.println(text);
assertTrue(text.contains("AnnotationLiteral<New>"));
assertTrue(text.contains("private final Class<?> value;"));
13 years, 8 months
JBoss Tools SVN: r31018 - 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: scabanovich
Date: 2011-05-02 18:52:38 -0400 (Mon, 02 May 2011)
New Revision: 31018
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
Log:
JBIDE-8832
https://issues.jboss.org/browse/JBIDE-8832
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2011-05-02 22:51:00 UTC (rev 31017)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2011-05-02 22:52:38 UTC (rev 31018)
@@ -142,6 +142,15 @@
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, ITextSourceReference location,
IResource target) {
+ if(location == null) {
+ //
+ } else if(location.getResource() != null && location.getResource().exists()) {
+ if(!location.getResource().equals(target)) {
+ target = location.getResource();
+ }
+ } else {
+ //
+ }
return addError(message, preferenceKey, messageArguments, 0, location
.getLength(), location.getStartPosition(), target);
}
13 years, 8 months
JBoss Tools SVN: r31017 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-02 18:51:00 -0400 (Mon, 02 May 2011)
New Revision: 31017
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java
Log:
JBIDE-8832
https://issues.jboss.org/browse/JBIDE-8832
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java 2011-05-02 22:50:10 UTC (rev 31016)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java 2011-05-02 22:51:00 UTC (rev 31017)
@@ -226,7 +226,7 @@
e = i + s.length();
}
}
- return new TypeDeclaration(p, b, e - b);
+ return new TypeDeclaration(p, a.getResource(), b, e - b);
} catch (JavaModelException e) {
CDISeamSolderCorePlugin.getDefault().logError(e);
}
13 years, 8 months
JBoss Tools SVN: r31016 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl: definition and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-02 18:50:10 -0400 (Mon, 02 May 2011)
New Revision: 31016
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/TypeDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
Log:
JBIDE-8832
https://issues.jboss.org/browse/JBIDE-8832
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-05-02 22:33:32 UTC (rev 31015)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-05-02 22:50:10 UTC (rev 31016)
@@ -305,9 +305,9 @@
if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
p.setSignature(s2);
}
- result.add(new TypeDeclaration((ParametedType)other, offset, length));
+ result.add(new TypeDeclaration((ParametedType)other, typed.getResource(), offset, length));
} else {
- result.add(new TypeDeclaration(p, offset, length));
+ result.add(new TypeDeclaration(p, typed.getResource(), offset, length));
}
}
}
@@ -333,9 +333,9 @@
if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
p.setSignature(s2);
}
- result.add(new TypeDeclaration((ParametedType)other, offset, length));
+ result.add(new TypeDeclaration((ParametedType)other, typed.getResource(), offset, length));
} else {
- result.add(new TypeDeclaration(p, offset, length));
+ result.add(new TypeDeclaration(p, typed.getResource(), offset, length));
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java 2011-05-02 22:33:32 UTC (rev 31015)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java 2011-05-02 22:50:10 UTC (rev 31016)
@@ -72,7 +72,7 @@
}
}
- typeDeclaration = new TypeDeclaration(p, offset, length);
+ typeDeclaration = new TypeDeclaration(p, member.getResource(), offset, length);
}
}
} catch (JavaModelException e) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2011-05-02 22:33:32 UTC (rev 31015)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2011-05-02 22:50:10 UTC (rev 31016)
@@ -191,7 +191,7 @@
String scn = type.getSuperclassName();
if(scn != null && provider.getRange(scn) != null) {
ISourceRange r = provider.getRange(scn);
- superType = new TypeDeclaration(superType, r.getOffset(), r.getLength());
+ superType = new TypeDeclaration(superType, type.getResource(), r.getOffset(), r.getLength());
}
}
@@ -208,7 +208,7 @@
String scn = type.getSuperInterfaceNames()[i];
if(scn != null && provider.getRange(scn) != null) {
ISourceRange r = provider.getRange(scn);
- t = new TypeDeclaration(t, r.getOffset(), r.getLength());
+ t = new TypeDeclaration(t, type.getResource(), r.getOffset(), r.getLength());
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/TypeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/TypeDeclaration.java 2011-05-02 22:33:32 UTC (rev 31015)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/TypeDeclaration.java 2011-05-02 22:50:10 UTC (rev 31016)
@@ -19,13 +19,15 @@
*
*/
public class TypeDeclaration extends ParametedType implements ITypeDeclaration {
+ IResource resource;
int length;
int startPosition;
- public TypeDeclaration(ParametedType type, int startPosition, int length) {
+ public TypeDeclaration(ParametedType type, IResource resource, int startPosition, int length) {
this.setFactory(type.getFactory());
this.type = type.getType();
arrayPrefix = type.arrayPrefix;
+ this.resource = resource;
this.length = length;
this.startPosition = startPosition;
@@ -52,6 +54,6 @@
}
public IResource getResource() {
- return type.getResource();
+ return resource;
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2011-05-02 22:33:32 UTC (rev 31015)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2011-05-02 22:50:10 UTC (rev 31016)
@@ -52,7 +52,7 @@
CDICorePlugin.getDefault().logError(e);
}
if(r != null) {
- parametedType = new TypeDeclaration(parametedType, r.getOffset(), r.getLength());
+ parametedType = new TypeDeclaration(parametedType, type.getResource(), r.getOffset(), r.getLength());
}
}
parametedType.setFactory(this);
@@ -193,7 +193,7 @@
if(sts.length() > 0) {
ParametedType st = getParametedType(contextType, sts);
if(st != null) {
- result = new TypeDeclaration(st, 0, 0);
+ result = new TypeDeclaration(st, context.getResource(), 0, 0);
}
} else if(result != null) {
result.setSignature(t);
13 years, 8 months
JBoss Tools SVN: r31015 - branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-05-02 18:33:32 -0400 (Mon, 02 May 2011)
New Revision: 31015
Modified:
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
Log:
https://issues.jboss.org/browse/JBIDE-8831 (org.jboss.tools.vpe.test suite failes with NPE ?)
removed tests that are using deprecated or closed API to register extension points with templates "on the fly"
Modified: branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
===================================================================
--- branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2011-05-02 21:15:50 UTC (rev 31014)
+++ branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2011-05-02 22:33:32 UTC (rev 31015)
@@ -31,7 +31,8 @@
// $JUnit-BEGIN$
suite.addTestSuite(TemplateLoadingTest.class);
suite.addTestSuite(TemplateSchemeValidateTest.class);
- suite.addTestSuite(TemplatesExpressionParsingTest.class);
+ //TODO: fix it to avoid https://issues.jboss.org/browse/JBIDE-8831 (org.jboss.tools.vpe.test suite failes with NPE ?)
+ //suite.addTestSuite(TemplatesExpressionParsingTest.class);
suite.addTestSuite(VpeTemplateManagerTest.class);
return new VpeTestSetup(suite);
13 years, 8 months
JBoss Tools SVN: r31014 - workspace/snjeza/seam-examples.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-05-02 17:15:50 -0400 (Mon, 02 May 2011)
New Revision: 31014
Modified:
workspace/snjeza/seam-examples/booking22.zip
Log:
JBIDE-8827 Cheatsheet's broken and incomplete for Seam 2.2 booking example
Modified: workspace/snjeza/seam-examples/booking22.zip
===================================================================
(Binary files differ)
13 years, 8 months
JBoss Tools SVN: r31013 - trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-02 15:49:38 -0400 (Mon, 02 May 2011)
New Revision: 31013
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamConfigTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamConfigTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamConfigTest.java 2011-05-02 19:49:17 UTC (rev 31012)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamConfigTest.java 2011-05-02 19:49:38 UTC (rev 31013)
@@ -30,7 +30,7 @@
import org.jboss.tools.cdi.seam.config.core.ConfigDefinitionContext;
import org.jboss.tools.cdi.seam.config.core.definition.SeamBeanDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamBeansDefinition;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
import org.jboss.tools.test.util.ResourcesUtils;
/**
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java 2011-05-02 19:49:17 UTC (rev 31012)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/src/org/jboss/tools/cdi/seam/config/core/test/SeamDefinitionsTest.java 2011-05-02 19:49:38 UTC (rev 31013)
@@ -40,7 +40,7 @@
import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamVirtualFieldDefinition;
-import org.jboss.tools.cdi.seam.config.core.scanner.Location;
+import org.jboss.tools.cdi.seam.config.core.xml.Location;
import org.jboss.tools.cdi.seam.solder.core.CDISeamSolderConstants;
import org.jboss.tools.common.text.ITextSourceReference;
13 years, 8 months
JBoss Tools SVN: r31012 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core: src/org/jboss/tools/cdi/seam/config/core and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-02 15:49:17 -0400 (Mon, 02 May 2011)
New Revision: 31012
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/Location.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXAttribute.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXNode.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXText.java
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXNode.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXText.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/AbstractSeamFieldDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamFieldDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMemberDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamVirtualFieldDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/META-INF/MANIFEST.MF 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/META-INF/MANIFEST.MF 2011-05-02 19:49:17 UTC (rev 31012)
@@ -31,5 +31,6 @@
Export-Package: org.jboss.tools.cdi.seam.config.core,
org.jboss.tools.cdi.seam.config.core.definition,
org.jboss.tools.cdi.seam.config.core.scanner,
+ org.jboss.tools.cdi.seam.config.core.xml,
org.jboss.tools.cdi.seam.config.core.util
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/AbstractSeamFieldDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/AbstractSeamFieldDefinition.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/AbstractSeamFieldDefinition.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -16,9 +16,9 @@
import java.util.Map;
import org.eclipse.jdt.core.IField;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXAttribute;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXText;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXAttribute;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXText;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeanDefinition.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -15,7 +15,7 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -28,7 +28,7 @@
import org.jboss.tools.cdi.internal.core.impl.definition.ParameterDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
import org.jboss.tools.cdi.seam.config.core.ConfigDefinitionContext;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXNode;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXNode;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamFieldDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamFieldDefinition.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamFieldDefinition.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -11,8 +11,8 @@
package org.jboss.tools.cdi.seam.config.core.definition;
import org.eclipse.jdt.core.IField;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXAttribute;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXAttribute;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMemberDefinition.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamMemberDefinition.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -14,9 +14,9 @@
import java.util.Map;
import org.jboss.tools.cdi.core.IJavaAnnotation;
-import org.jboss.tools.cdi.seam.config.core.scanner.Location;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXNode;
+import org.jboss.tools.cdi.seam.config.core.xml.Location;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXNode;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamVirtualFieldDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamVirtualFieldDefinition.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamVirtualFieldDefinition.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -12,8 +12,8 @@
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IType;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXAttribute;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXAttribute;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
/**
*
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.seam.config.core.scanner;
-
-import org.eclipse.core.resources.IFile;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class Location {
- IFile file;
- int start;
- int length;
-
- public Location(int start, int length) {
- this.start = start;
- this.length = length;
- }
-
- public int getStartPosition() {
- return start;
- }
-
- public int getLength() {
- return length;
- }
-
- public IFile getResource() {
- return file;
- }
-
-}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.seam.config.core.scanner;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class SAXAttribute extends SAXText {
- private String name;
- private Location nameLocation;
-
- private SAXElement parent;
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setNameLocation(Location location) {
- nameLocation = location;
- }
-
- public Location getNameLocation() {
- return nameLocation;
- }
-
- public void setValueLocation(Location location) {
- setLocation(location);
- }
-
- public Location getValueLocation() {
- return getLocation();
- }
-
- public void setParent(SAXElement parent) {
- this.parent = parent;
- }
-
- public SAXElement getParent() {
- return parent;
- }
-
-}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXElement.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXElement.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.seam.config.core.scanner;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class SAXElement extends SAXNode {
- protected String uri;
- protected String localName;
- protected String name;
- protected Location nameLocation;
- protected Map<String, SAXAttribute> attributes = new HashMap<String, SAXAttribute>();
- protected SAXText text;
-
- protected SAXElement parent = null;
- protected List<SAXElement> children = new ArrayList<SAXElement>();
-
- public SAXElement() {}
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setNameLocation(Location location) {
- nameLocation = location;
- }
-
- public Location getNameLocation() {
- return nameLocation;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setLocalName(String name) {
- localName = name;
- }
-
- public String getLocalName() {
- return localName;
- }
-
- public void setTextNode(SAXText text) {
- this.text = text;
- }
-
- public SAXText getTextNode() {
- return text;
- }
-
- public void addAttribute(SAXAttribute a) {
- a.setParent(this);
- attributes.put(a.getName(), a);
- }
-
- public boolean hasAttribute(String name) {
- return attributes.containsKey(name);
- }
-
- public SAXAttribute getAttribute(String name) {
- return attributes.get(name);
- }
-
- public Set<String> getAttributeNames() {
- return attributes.keySet();
- }
-
- public void addChildElement(SAXElement child) {
- child.setParent(this);
- children.add(child);
- }
-
- public List<SAXElement> getChildElements() {
- return children;
- }
-
- public void setParent(SAXElement parent) {
- this.parent = parent;
- }
-
- public SAXElement getParent() {
- return parent;
- }
-
-}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXNode.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXNode.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXNode.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.seam.config.core.scanner;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class SAXNode {
- protected Location location = null;
-
- public void setLocation(Location location) {
- this.location = location;
- }
-
- public Location getLocation() {
- return location;
- }
-
-}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -1,198 +0,0 @@
-package org.jboss.tools.cdi.seam.config.core.scanner;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.jboss.tools.common.CommonPlugin;
-import org.jboss.tools.common.xml.SAXValidator;
-import org.jboss.tools.common.xml.XMLEntityResolverImpl;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class SAXParser extends SAXValidator {
-
- XMLReader createParser1(DefaultHandler handler) {
- XMLReader parserInstance = null;
-
- try {
- parserInstance = XMLReaderFactory.createXMLReader(DEFAULT_SAX_PARSER_CLASS_NAME);
- } catch (SAXException e) {
- return null;
- }
-
- setFeature(parserInstance, NAMESPACES_FEATURE_ID, true);
- setFeature(parserInstance, NAMESPACE_PREFIXES_FEATURE_ID, false);
- setFeature(parserInstance, VALIDATION_FEATURE_ID, true);
- setFeature(parserInstance, VALIDATION_SCHEMA_FEATURE_ID, true);
- setFeature(parserInstance, VALIDATION_SCHEMA_CHECKING_FEATURE_ID, false);
- setFeature(parserInstance, VALIDATION_DYNAMIC_FEATURE_ID, false);
- setFeature(parserInstance, FATAL_ERROR_PROCESSING_FEATURE_ID, false);
-
- try {
- parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new XMLEntityResolverImpl());
- } catch (SAXNotRecognizedException e1) {
- CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1); //$NON-NLS-1$
- } catch (SAXNotSupportedException e1) {
- CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1); //$NON-NLS-1$
- }
-
- parserInstance.setContentHandler(handler);
- parserInstance.setErrorHandler(handler);
- return parserInstance;
- }
-
- public SAXElement parse(InputStream input, IDocument document) {
- InputSource s = new InputSource(input);
- ConfigHanlder handler = new ConfigHanlder(document);
- XMLReader reader = createParser1(handler);
- try {
- reader.parse(s);
- } catch (IOException e) {
- CommonPlugin.getDefault().logError(e);
- } catch (SAXException e) {
- CommonPlugin.getDefault().logError(e);
- }
-
- return handler.getRootElement();
- }
-
- class ConfigHanlder extends DefaultHandler {
- SAXElement root = null;
- IDocument document;
- Locator locator;
- List<String> errors = new ArrayList<String>();
- SAXElement current = null;
-
- StringBuffer currentText = new StringBuffer();
- Location currentTextLocation = null;
-
- ConfigHanlder(IDocument document) {
- this.document = document;
- }
-
- public SAXElement getRootElement() {
- return root;
- }
-
- public void setDocumentLocator (Locator locator) {
- this.locator = locator;
- }
-
- private int getCurrentLocation() {
- if (locator != null) {
- int line = locator.getLineNumber() - 1;
- int lineOffset = locator.getColumnNumber() - 1;
- try {
- return document.getLineOffset(line) + lineOffset;
- } catch (BadLocationException e) {
- CommonPlugin.getDefault().logError(e);
- }
- }
- return 0;
- }
-
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- int end = getCurrentLocation(), start = 0;
- if(end > 0) {
- start = document.get().lastIndexOf("<", end);
- }
- SAXElement element = new SAXElement();
- element.setLocalName(localName);
- element.setURI(uri);
- element.setName(qName);
- element.setParent(current);
- if(start >= 0) {
- element.setLocation(new Location(start, end - start));
- int ns = document.get().indexOf(qName, start);
- if(ns >= start) {
- element.setNameLocation(new Location(ns, qName.length()));
- }
- }
- for (int i = 0; i < attributes.getLength(); i++) {
- String n = attributes.getLocalName(i);
- String v = attributes.getValue(i);
- SAXAttribute a = new SAXAttribute();
- a.setName(n);
- a.setValue(v);
- int n_start = document.get().indexOf(n, start);
- if(n_start >= 0) {
- a.setNameLocation(new Location(n_start, n.length()));
- int v_start = document.get().indexOf('"', n_start);
- if(v_start >= 0) {
- a.setValueLocation(new Location(v_start + 1, v.length()));
- }
- }
- //TODO
- element.addAttribute(a);
- }
-
- current = element;
- currentText = new StringBuffer();
- currentTextLocation = null;
- if(root == null) root = element;
- }
-
- public void characters (char ch[], int start, int length) throws SAXException {
- String append = new String(ch, start, length);
- if(append.trim().length() == 0) return;
- int end = getCurrentLocation(), s = 0;
- if (end > 0) {
- s = end - length;
- }
- currentText.append(append);
- currentTextLocation = new Location(s, length);
- }
-
- public void endElement(String uri, String localName, String qName) throws SAXException {
- int end = getCurrentLocation();
- if(end > 0) {
- int start = document.get().lastIndexOf("<", end);
- Location endLocation = new Location(start, end - start);
- //TODO
- }
- if(currentText.length() > 0) {
- SAXText text = new SAXText();
- text.setValue(currentText.toString());
- current.setTextNode(text);
- text.setLocation(currentTextLocation);
- currentText.setLength(0);
- }
-
- if(current.getParent() != null) {
- current.getParent().addChildElement(current);
- }
-
- current = current.getParent();
- }
-
-
- public void error(SAXParseException e) throws SAXException {
- String message = e.getMessage();
- errors.add(message);
- }
-
- public void fatalError(SAXParseException e) throws SAXException {
- String message = e.getMessage();
- errors.add(message);
- }
- }
-
-
-}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXText.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXText.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXText.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.seam.config.core.scanner;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class SAXText extends SAXNode {
- private String value;
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SeamDefinitionBuilder.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -38,6 +38,10 @@
import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamVirtualFieldDefinition;
import org.jboss.tools.cdi.seam.config.core.util.Util;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXAttribute;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXParser;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXText;
/**
*
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-05-02 19:29:25 UTC (rev 31011)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/util/Util.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -26,8 +26,8 @@
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigConstants;
import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
import org.jboss.tools.cdi.seam.config.core.definition.SeamParameterDefinition;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXElement;
-import org.jboss.tools.cdi.seam.config.core.scanner.SAXText;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXText;
/**
*
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/Location.java (from rev 31002, trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/Location.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/Location.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/Location.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.core.xml;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class Location {
+ int start;
+ int length;
+
+ public Location(int start, int length) {
+ this.start = start;
+ this.length = length;
+ }
+
+ public int getStartPosition() {
+ return start;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/Location.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXAttribute.java (from rev 31002, trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXAttribute.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXAttribute.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXAttribute.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.core.xml;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SAXAttribute extends SAXText {
+ private String name;
+ private Location nameLocation;
+
+ private SAXElement parent;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setNameLocation(Location location) {
+ nameLocation = location;
+ }
+
+ public Location getNameLocation() {
+ return nameLocation;
+ }
+
+ public void setValueLocation(Location location) {
+ setLocation(location);
+ }
+
+ public Location getValueLocation() {
+ return getLocation();
+ }
+
+ public void setParent(SAXElement parent) {
+ this.parent = parent;
+ }
+
+ public SAXElement getParent() {
+ return parent;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXAttribute.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java (from rev 31002, trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXElement.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.core.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SAXElement extends SAXNode {
+ protected String uri;
+ protected String localName;
+ protected String name;
+ protected Location nameLocation;
+ protected Map<String, SAXAttribute> attributes = new HashMap<String, SAXAttribute>();
+ protected SAXText text;
+
+ protected SAXElement parent = null;
+ protected List<SAXElement> children = new ArrayList<SAXElement>();
+
+ public SAXElement() {}
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setNameLocation(Location location) {
+ nameLocation = location;
+ }
+
+ public Location getNameLocation() {
+ return nameLocation;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setLocalName(String name) {
+ localName = name;
+ }
+
+ public String getLocalName() {
+ return localName;
+ }
+
+ public void setTextNode(SAXText text) {
+ this.text = text;
+ }
+
+ public SAXText getTextNode() {
+ return text;
+ }
+
+ public void addAttribute(SAXAttribute a) {
+ a.setParent(this);
+ attributes.put(a.getName(), a);
+ }
+
+ public boolean hasAttribute(String name) {
+ return attributes.containsKey(name);
+ }
+
+ public SAXAttribute getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ public Set<String> getAttributeNames() {
+ return attributes.keySet();
+ }
+
+ public void addChildElement(SAXElement child) {
+ child.setParent(this);
+ children.add(child);
+ }
+
+ public List<SAXElement> getChildElements() {
+ return children;
+ }
+
+ public void setParent(SAXElement parent) {
+ this.parent = parent;
+ }
+
+ public SAXElement getParent() {
+ return parent;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXNode.java (from rev 31002, trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXNode.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXNode.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXNode.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.core.xml;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SAXNode {
+ protected Location location = null;
+
+ public void setLocation(Location location) {
+ this.location = location;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXNode.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java (from rev 31002, trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXParser.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -0,0 +1,198 @@
+package org.jboss.tools.cdi.seam.config.core.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.CommonPlugin;
+import org.jboss.tools.common.xml.SAXValidator;
+import org.jboss.tools.common.xml.XMLEntityResolverImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SAXParser extends SAXValidator {
+
+ XMLReader createParser1(DefaultHandler handler) {
+ XMLReader parserInstance = null;
+
+ try {
+ parserInstance = XMLReaderFactory.createXMLReader(DEFAULT_SAX_PARSER_CLASS_NAME);
+ } catch (SAXException e) {
+ return null;
+ }
+
+ setFeature(parserInstance, NAMESPACES_FEATURE_ID, true);
+ setFeature(parserInstance, NAMESPACE_PREFIXES_FEATURE_ID, false);
+ setFeature(parserInstance, VALIDATION_FEATURE_ID, true);
+ setFeature(parserInstance, VALIDATION_SCHEMA_FEATURE_ID, true);
+ setFeature(parserInstance, VALIDATION_SCHEMA_CHECKING_FEATURE_ID, false);
+ setFeature(parserInstance, VALIDATION_DYNAMIC_FEATURE_ID, false);
+ setFeature(parserInstance, FATAL_ERROR_PROCESSING_FEATURE_ID, false);
+
+ try {
+ parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new XMLEntityResolverImpl());
+ } catch (SAXNotRecognizedException e1) {
+ CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1); //$NON-NLS-1$
+ } catch (SAXNotSupportedException e1) {
+ CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1); //$NON-NLS-1$
+ }
+
+ parserInstance.setContentHandler(handler);
+ parserInstance.setErrorHandler(handler);
+ return parserInstance;
+ }
+
+ public SAXElement parse(InputStream input, IDocument document) {
+ InputSource s = new InputSource(input);
+ ConfigHanlder handler = new ConfigHanlder(document);
+ XMLReader reader = createParser1(handler);
+ try {
+ reader.parse(s);
+ } catch (IOException e) {
+ CommonPlugin.getDefault().logError(e);
+ } catch (SAXException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+
+ return handler.getRootElement();
+ }
+
+ class ConfigHanlder extends DefaultHandler {
+ SAXElement root = null;
+ IDocument document;
+ Locator locator;
+ List<String> errors = new ArrayList<String>();
+ SAXElement current = null;
+
+ StringBuffer currentText = new StringBuffer();
+ Location currentTextLocation = null;
+
+ ConfigHanlder(IDocument document) {
+ this.document = document;
+ }
+
+ public SAXElement getRootElement() {
+ return root;
+ }
+
+ public void setDocumentLocator (Locator locator) {
+ this.locator = locator;
+ }
+
+ private int getCurrentLocation() {
+ if (locator != null) {
+ int line = locator.getLineNumber() - 1;
+ int lineOffset = locator.getColumnNumber() - 1;
+ try {
+ return document.getLineOffset(line) + lineOffset;
+ } catch (BadLocationException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ }
+ return 0;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ int end = getCurrentLocation(), start = 0;
+ if(end > 0) {
+ start = document.get().lastIndexOf("<", end);
+ }
+ SAXElement element = new SAXElement();
+ element.setLocalName(localName);
+ element.setURI(uri);
+ element.setName(qName);
+ element.setParent(current);
+ if(start >= 0) {
+ element.setLocation(new Location(start, end - start));
+ int ns = document.get().indexOf(qName, start);
+ if(ns >= start) {
+ element.setNameLocation(new Location(ns, qName.length()));
+ }
+ }
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String n = attributes.getLocalName(i);
+ String v = attributes.getValue(i);
+ SAXAttribute a = new SAXAttribute();
+ a.setName(n);
+ a.setValue(v);
+ int n_start = document.get().indexOf(n, start);
+ if(n_start >= 0) {
+ a.setNameLocation(new Location(n_start, n.length()));
+ int v_start = document.get().indexOf('"', n_start);
+ if(v_start >= 0) {
+ a.setValueLocation(new Location(v_start + 1, v.length()));
+ }
+ }
+ //TODO
+ element.addAttribute(a);
+ }
+
+ current = element;
+ currentText = new StringBuffer();
+ currentTextLocation = null;
+ if(root == null) root = element;
+ }
+
+ public void characters (char ch[], int start, int length) throws SAXException {
+ String append = new String(ch, start, length);
+ if(append.trim().length() == 0) return;
+ int end = getCurrentLocation(), s = 0;
+ if (end > 0) {
+ s = end - length;
+ }
+ currentText.append(append);
+ currentTextLocation = new Location(s, length);
+ }
+
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ int end = getCurrentLocation();
+ if(end > 0) {
+ int start = document.get().lastIndexOf("<", end);
+ Location endLocation = new Location(start, end - start);
+ //TODO
+ }
+ if(currentText.length() > 0) {
+ SAXText text = new SAXText();
+ text.setValue(currentText.toString());
+ current.setTextNode(text);
+ text.setLocation(currentTextLocation);
+ currentText.setLength(0);
+ }
+
+ if(current.getParent() != null) {
+ current.getParent().addChildElement(current);
+ }
+
+ current = current.getParent();
+ }
+
+
+ public void error(SAXParseException e) throws SAXException {
+ String message = e.getMessage();
+ errors.add(message);
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ String message = e.getMessage();
+ errors.add(message);
+ }
+ }
+
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXText.java (from rev 30986, trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/scanner/SAXText.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXText.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXText.java 2011-05-02 19:49:17 UTC (rev 31012)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.core.xml;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SAXText extends SAXNode {
+ private String value;
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXText.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 8 months