Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] adding java code?

This is what we call 'AST rewriting'. There is functionality for this but
it's very new (a prototype) and therefore only internal. Code is located in
org.eclipse.jdt.ui / class ASTRewrite. Latest 2.1 stream
Have a look at corresponding test cases:
Plugin org.eclipse.jdt.ui.tests, package
org.eclipse.jdt.ui.tests.astrewrite (the JUnit PDE plugin is needed to
start these tests).

The idea is that you can mark modifications in an AST and then have a text
change script ('text edits') generated that does not modify the rest of the
code. It also correctly formats the new inserted code. Operations on the
AST include remove, replace, and insert + copy/move of existing nodes.

This discussion should go to jdt-ui-dev@xxxxxxxxxxx

Martin



                                                                                                                                   
                      Jeffrey Palm                                                                                                 
                      <jdp@cs.colorado.e         To:      eclipse-dev@xxxxxxxxxxx                                                  
                      du>                        cc:                                                                               
                      Sent by:                   Subject: [eclipse-dev] adding java code?                                          
                      eclipse-dev-admin@                                                                                           
                      eclipse.org                                                                                                  
                                                                                                                                   
                                                                                                                                   
                      09/17/2002 02:20                                                                                             
                      AM                                                                                                           
                      Please respond to                                                                                            
                      eclipse-dev                                                                                                  
                                                                                                                                   
                                                                                                                                   



If I have a DOM node (org.eclipse.jdt.core.dom...) does anyone have a
suggestion for the best way to replace that node with another.

In particular I want to replace an Expression with a new MethodInvocation.

Thanks for any help!
Jeff
--
Jeffrey Palm --> http://jeffpalm.com

_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/eclipse-dev






Back to the top