Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 36476

Summary: Create AST for String and add it to existed AST
Product: [Eclipse Project] JDT Reporter: Konstantin Scheglov <Konstantin.Scheglov>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Konstantin Scheglov CLA 2003-04-14 22:51:56 EDT
I need way for parsing part of Java code in String and add it then in existing AST. I.e. something like this is needed:
AST.parseExpression(String)
AST.parseMethodDeclaration(String)
  May be also other information, like position in current AST, where I am going to add new AST subtree.


Here is small description of problem:
  I want to edit Java file in multipage editor, one page is standard java
editor and second is my page. For my page I need AST of source, so I parse
source on open and then use it. However now I need change source, but I
still need AST, and I show AST in tree view, so I don't want parse source
again and recreate view. Parsing takes long time and after recreate
position in tree view lost. So, I want change source and then manually
update (replace, insert or delete) part of AST. Is there better way?
  Currently I create all needed AST structures manually, using AST.newXXX.
But this is fairly complex work, and I would like to simplify it. For
example, is it possible to parse only one line of code in context of
current position in AST. But I can not find way to do this.
Comment 1 Philipe Mulet CLA 2003-04-22 05:29:45 EDT
Good suggestion for improvement.
Comment 2 David Audel CLA 2004-01-22 09:41:43 EST
Time permitting

Later
Comment 3 Eclipse Webmaster CLA 2009-08-30 02:39:53 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.