Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » What will AST ultimately support?
What will AST ultimately support? [message #155456] Wed, 21 April 2004 21:37 Go to next message
Guillaume Pothier is currently offline Guillaume PothierFriend
Messages: 107
Registered: July 2009
Senior Member
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
Re: What will AST ultimately support? [message #155474 is a reply to message #155456] Wed, 21 April 2004 23:33 Go to previous messageGo to next message
Eclipse UserFriend
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 #155568 is a reply to message #155474] Thu, 22 April 2004 12:07 Go to previous messageGo to next message
Guillaume Pothier is currently offline Guillaume PothierFriend
Messages: 107
Registered: July 2009
Senior Member
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 #155591 is a reply to message #155568] Thu, 22 April 2004 17:18 Go to previous messageGo to next message
Charles-Philip Bentley is currently offline Charles-Philip BentleyFriend
Messages: 60
Registered: July 2009
Member
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 #155640 is a reply to message #155591] Thu, 22 April 2004 20:47 Go to previous messageGo to next message
Guillaume Pothier is currently offline Guillaume PothierFriend
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 Go to previous message
Charles-Philip Bentley is currently offline Charles-Philip BentleyFriend
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 Go to previous message
Guillaume Pothier is currently offline Guillaume PothierFriend
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.
>>>>>
>>>
>
Previous Topic:Run Ant... Error: Config file is not of expected XML Type
Next Topic:CDT install error in eclipse
Goto Forum:
  


Current Time: Sat Nov 09 23:13:26 GMT 2024

Powered by FUDForum. Page generated in 0.04561 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top