|
Re: What will AST ultimately support? [message #155474 is a reply to message #155456] |
Wed, 21 April 2004 23:33 |
Eclipse User |
|
|
|
Originally posted by: akiezun.to.reply.remove.whats.unneeded.mit.edu
Guillaume Pothier wrote:
> Hi,
> Will(does) AST handle code formatting, taking into account the user's
> coding style preferences?
> Will current refactorings (like generate getters and setters) be ported
> to use AST instead of plain string concatenation?
> Guillaume
>
fyi,
'generate getters and setters' is not implemented as a refactoring
https://bugs.eclipse.org/bugs/show_bug.cgi?id=37820
yes, use ASTRewrite and your prefs should be respected. if not, enter a
bug report.
a.
|
|
|
|
|
Re: What will AST ultimately support? [message #155640 is a reply to message #155591] |
Thu, 22 April 2004 20:47 |
Guillaume Pothier Messages: 107 Registered: July 2009 |
Senior Member |
|
|
Ok, that's good news. Can you point me to an example of AST code
manipulation? I am currently struggling to find an IDocument instance to
apply the changes generated by ASTRewriter... But maybe there is another
way?
Thanks
Guillaume
Charles-Philip Bentley wrote:
> I have been doing some custom refactorings myself in my plug-in and i
> work exclusively with ASTs. It is so much easier IMO.
>
> However there is an issue. You can't "Edit-->Undo" a whole refactoring
> with AST. You only Undo AST modifications. So if you do 10 AST
> modifications for a refactoring, you will have to do "Edit-->Undo" 10
> times to completely undo the refactoring/structure modification.
>
> Charles
>
> Guillaume Pothier wrote:
>
>> Yeah, I should have said code manipulation instead of refactorings.
>> Thanks for the pointer to ASTRewrite.
>> So, is the new AST designed to handle all code manipulation? Or will
>> there sill be a need for plain-text code assembly?
>> g
>>
>>
>> Adam Kiezun wrote:
>>
>>> Guillaume Pothier wrote:
>>>
>>>> Hi,
>>>> Will(does) AST handle code formatting, taking into account the
>>>> user's coding style preferences?
>>>> Will current refactorings (like generate getters and setters) be
>>>> ported to use AST instead of plain string concatenation?
>>>> Guillaume
>>>>
>>>
>>> fyi,
>>> 'generate getters and setters' is not implemented as a refactoring
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=37820
>>>
>>> yes, use ASTRewrite and your prefs should be respected. if not, enter
>>> a bug report.
>>>
>>> a.
>>>
>
|
|
|
Re: What will AST ultimately support? [message #155720 is a reply to message #155640] |
Fri, 23 April 2004 10:08 |
Charles-Philip Bentley Messages: 60 Registered: July 2009 |
Member |
|
|
Hi Gui
I have been told to do that
import org.eclipse.jface.text.Document;
....
IDocument idoc= new Document(icu.getSource());
where icu is an ICompilationUnit.
--------------
Otherwise you can get an IDocument from the active EditorPart
AbstractTextEditor ate = (AbstractTextEditor) _part;
FileEditorInput fe = (FileEditorInput) _part.getEditorInput();
IDocument idoc = ate.getDocumentProvider().getDocument(fe);
But that only works for me when inside the Java Editor (ie _part is not
null)
Guillaume Pothier wrote:
> Ok, that's good news. Can you point me to an example of AST code
> manipulation? I am currently struggling to find an IDocument instance to
> apply the changes generated by ASTRewriter... But maybe there is another
> way?
> Thanks
> Guillaume
>
> Charles-Philip Bentley wrote:
>
>> I have been doing some custom refactorings myself in my plug-in and i
>> work exclusively with ASTs. It is so much easier IMO.
>>
>> However there is an issue. You can't "Edit-->Undo" a whole refactoring
>> with AST. You only Undo AST modifications. So if you do 10 AST
>> modifications for a refactoring, you will have to do "Edit-->Undo" 10
>> times to completely undo the refactoring/structure modification.
>>
>> Charles
>>
>> Guillaume Pothier wrote:
>>
>>> Yeah, I should have said code manipulation instead of refactorings.
>>> Thanks for the pointer to ASTRewrite.
>>> So, is the new AST designed to handle all code manipulation? Or will
>>> there sill be a need for plain-text code assembly?
>>> g
>>>
>>>
>>> Adam Kiezun wrote:
>>>
>>>> Guillaume Pothier wrote:
>>>>
>>>>> Hi,
>>>>> Will(does) AST handle code formatting, taking into account the
>>>>> user's coding style preferences?
>>>>> Will current refactorings (like generate getters and setters) be
>>>>> ported to use AST instead of plain string concatenation?
>>>>> Guillaume
>>>>>
>>>>
>>>> fyi,
>>>> 'generate getters and setters' is not implemented as a refactoring
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=37820
>>>>
>>>> yes, use ASTRewrite and your prefs should be respected. if not,
>>>> enter a bug report.
>>>>
>>>> a.
>>>>
>>
|
|
|
Re: What will AST ultimately support? [message #155728 is a reply to message #155720] |
Fri, 23 April 2004 09:49 |
Guillaume Pothier Messages: 107 Registered: July 2009 |
Senior Member |
|
|
Hehe thanks!
Charles-Philip Bentley wrote:
> Hi Gui
>
> I have been told to do that
>
> import org.eclipse.jface.text.Document;
> ...
> IDocument idoc= new Document(icu.getSource());
>
> where icu is an ICompilationUnit.
>
> --------------
>
> Otherwise you can get an IDocument from the active EditorPart
>
> AbstractTextEditor ate = (AbstractTextEditor) _part;
> FileEditorInput fe = (FileEditorInput) _part.getEditorInput();
> IDocument idoc = ate.getDocumentProvider().getDocument(fe);
>
> But that only works for me when inside the Java Editor (ie _part is not
> null)
>
> Guillaume Pothier wrote:
>
>> Ok, that's good news. Can you point me to an example of AST code
>> manipulation? I am currently struggling to find an IDocument instance
>> to apply the changes generated by ASTRewriter... But maybe there is
>> another way?
>> Thanks
>> Guillaume
>>
>> Charles-Philip Bentley wrote:
>>
>>> I have been doing some custom refactorings myself in my plug-in and i
>>> work exclusively with ASTs. It is so much easier IMO.
>>>
>>> However there is an issue. You can't "Edit-->Undo" a whole
>>> refactoring with AST. You only Undo AST modifications. So if you do
>>> 10 AST modifications for a refactoring, you will have to do
>>> "Edit-->Undo" 10 times to completely undo the refactoring/structure
>>> modification.
>>>
>>> Charles
>>>
>>> Guillaume Pothier wrote:
>>>
>>>> Yeah, I should have said code manipulation instead of refactorings.
>>>> Thanks for the pointer to ASTRewrite.
>>>> So, is the new AST designed to handle all code manipulation? Or will
>>>> there sill be a need for plain-text code assembly?
>>>> g
>>>>
>>>>
>>>> Adam Kiezun wrote:
>>>>
>>>>> Guillaume Pothier wrote:
>>>>>
>>>>>> Hi,
>>>>>> Will(does) AST handle code formatting, taking into account the
>>>>>> user's coding style preferences?
>>>>>> Will current refactorings (like generate getters and setters) be
>>>>>> ported to use AST instead of plain string concatenation?
>>>>>> Guillaume
>>>>>>
>>>>>
>>>>> fyi,
>>>>> 'generate getters and setters' is not implemented as a refactoring
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=37820
>>>>>
>>>>> yes, use ASTRewrite and your prefs should be respected. if not,
>>>>> enter a bug report.
>>>>>
>>>>> a.
>>>>>
>>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04561 seconds