[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.jdt] Re: Changing Java source in a builder; which mechanism?
|
"Brad Jarvinen" <Brad.Jarvinen@xxxxxxxxxxxxx> wrote in message
news:fcujsf$6j4$1@xxxxxxxxxxxxxxxxxxxx
> However it seems what I could do would be to have an action to modify the
> source code, and still have a builder exist but change it to validate
> only.
I think that's an excellent idea.
> 1 - Is ASTRewrite okay to use, or should I just modify the AST directly
> without creating TextEdits?
> 2 - The article indicated that TextFileBuffer should be used; is that the
> case for MyAction? Is it required (such as if someone has the source open
> in an editor)? The article seemed to be assuming the AST changes are in
> an editor, not an action.
> 3 - Should I be using a Working Copy instead?
Perhaps Olivier will chime in here.
Left to my own devices, I'd probably pattern it after the "generate getters
and setters" action in the Java editor. The code for that is in
org.eclipse.jdt.ui plug-in, in
org.eclipse.jdt.ui.actions.AddGetterSetterAction and related classes.