/**
* @see ISourceElementRequestor
*/
- //public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) {
- // JavaElementInfo parentInfo = (JavaElementInfo) fInfoStack.peek();
- // JavaElement parentHandle= (JavaElement)fHandleStack.peek();
- // if (!(parentHandle.getElementType() == IJavaElement.COMPILATION_UNIT)) {
- // Assert.isTrue(false); // Should not happen
- // }
- //
- // ICompilationUnit parentCU= (ICompilationUnit)parentHandle;
- // //create the import container and its info
- // IImportContainer importContainer= parentCU.getImportContainer();
- // if (fImportContainerInfo == null) {
- // fImportContainerInfo= new JavaElementInfo();
- // fImportContainerInfo.setIsStructureKnown(true);
- // parentInfo.addChild(importContainer);
- // fNewElements.put(importContainer, fImportContainerInfo);
- // }
- //
- // // tack on the '.*' if it is onDemand
- // String importName;
- // if (onDemand) {
- // importName= new String(name) + ".*"; //$NON-NLS-1$
- // } else {
- // importName= new String(name);
- // }
- //
- // ImportDeclaration handle = new ImportDeclaration(importContainer, importName);
- // resolveDuplicates(handle);
- //
- // SourceRefElementInfo info = new SourceRefElementInfo();
- // info.setSourceRangeStart(declarationStart);
- // info.setSourceRangeEnd(declarationEnd);
- //
- // fImportContainerInfo.addChild(handle);
- // fNewElements.put(handle, info);
- //}
+ public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) {
+ JavaElementInfo parentInfo = (JavaElementInfo) fInfoStack.peek();
+ JavaElement parentHandle= (JavaElement)fHandleStack.peek();
+ if (!(parentHandle.getElementType() == IJavaElement.COMPILATION_UNIT)) {
+ Assert.isTrue(false); // Should not happen
+ }
+
+ ICompilationUnit parentCU= (ICompilationUnit)parentHandle;
+ //create the import container and its info
+ ImportContainer importContainer= parentCU.getImportContainer();
+ if (fImportContainerInfo == null) {
+ fImportContainerInfo= new JavaElementInfo();
+ fImportContainerInfo.setIsStructureKnown(true);
+ parentInfo.addChild(importContainer);
+ fNewElements.put(importContainer, fImportContainerInfo);
+ }
+
+ // tack on the '.*' if it is onDemand
+ String importName;
+ if (onDemand) {
+ importName= new String(name) + ".*"; //$NON-NLS-1$
+ } else {
+ importName= new String(name);
+ }
+
+ ImportDeclaration handle = new ImportDeclaration(importContainer, importName);
+// ImportDeclaration handle = new ImportDeclaration(null, importName);
+// resolveDuplicates(handle);
+
+ SourceRefElementInfo info = new SourceRefElementInfo();
+ info.setSourceRangeStart(declarationStart);
+ info.setSourceRangeEnd(declarationEnd);
+
+ fImportContainerInfo.addChild(handle);
+ fNewElements.put(handle, info);
+ }
/*
* Table of line separator position. This table is passed once at the end
* of the parse action, so as to allow computation of normalized ranges.