Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 462 Details for
Bug 11125
DOM/AST: API request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Because we needed this API for our implementation, we made the necessary changes ourselves. They may or may not be interesting to implementors of this feature.
changes.txt (text/plain), 2.83 KB, created by
Luc Bourlier
on 2002-03-11 15:35:29 EST
(
hide
)
Description:
Because we needed this API for our implementation, we made the necessary changes ourselves. They may or may not be interesting to implementors of this feature.
Filename:
MIME Type:
Creator:
Luc Bourlier
Created:
2002-03-11 15:35:29 EST
Size:
2.83 KB
patch
obsolete
>AST: > public static CompilationUnit parseCompilationUnit(char[] source, String unitName, IJavaProject javaProject, boolean resolveBindings) { > > CompilationUnitDeclaration compilationUnitDeclaration = null; > > if (resolveBindings) { > // If resolveBindings is true, we need to record the mod count > // once newAST has been constructed. If the mod count goes above > // this level, someone is modifying the AST and all bets are off > // regarding resolved bindings. All existing binding info should be > // discarded, and the various public resolveBinding methods should > // thereafter return null. > try { > compilationUnitDeclaration = CompilationUnitResolver.resolve( > source, unitName, javaProject, > new AbstractSyntaxTreeVisitorAdapter()); > if (compilationUnitDeclaration != null && source != null) { > ASTConverter converter = new ASTConverter(true); > AST ast = new AST(); > ast.setBindingResolver(new DefaultBindingResolver(compilationUnitDeclaration.scope)); > converter.setAST(ast); > CompilationUnit cu = converter.convert(compilationUnitDeclaration, source); > // line end table should be extracted from scanner > cu.setLineEndTable(compilationUnitDeclaration.compilationResult.lineSeparatorPositions); > > // line end table should be extracted from scanner > //cu.setLineEndTable(parser.scanner.lineEnds); > return cu; > } else { > return null; > } > } catch(JavaModelException e) { > } > } else { > return parseCompilationUnit(source); > } > return null; > } > > >CompilationUnitResolver: > protected static INameEnvironment getNameEnvironment(IJavaProject javaProject) > throws JavaModelException { > return (SearchableEnvironment) ((JavaProject)javaProject).getSearchableNameEnvironment(); > } > > public static CompilationUnitDeclaration resolve( > char[] source, String unitName, IJavaProject javaProject, > IAbstractSyntaxTreeVisitor visitor) > throws JavaModelException { > > CompilationUnitResolver compilationUnitVisitor = > new CompilationUnitResolver( > getNameEnvironment(javaProject), > getHandlingPolicy(), > JavaCore.getOptions(), > getRequestor(), > getProblemFactory(visitor)); > > CompilationUnitDeclaration unit = null; > try { > String encoding = (String) JavaCore.getOptions().get(CompilerOptions.OPTION_Encoding); > if ("".equals(encoding)) encoding = null; //$NON-NLS-1$ > > unit = > compilationUnitVisitor.resolve( > new BasicCompilationUnit( > source, > unitName, > encoding)); > return unit; > } finally { > if (unit != null) { > unit.cleanUp(); > } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11125
: 462