[how to create an .aj file]

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[how to create an .aj file]

Alex Vasc
Hello everybody,
  Do you know how can I create an empty .aj file? In JDT, I used a
code like this:

--------------------
public ICompilationUnit generateEmptyClass(String newClassName,
        IPackageFragment iPackageFragment) throws JavaModelException,
        BadLocationException {

        ICompilationUnit iCU = iPackageFragment.createCompilationUnit(
                newClassName + ".java", "", true, null);
               
        return iCU;
}
----------------------

  Afterwards, I would like to open the new file in the Editor by the
source code. Any thoughts?
 
  Best regards,

--
Alexandre Vasconcelos
www.cin.ufpe.br/~atv
_______________________________________________
aspectj-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-dev
Reply | Threaded
Open this post in threaded view
|

Re: [how to create an .aj file]

Matt Chapman-2

Alex Vasc <[hidden email]> wrote on 10/06/2005 17:48:21:
> Hello everybody,
>   Do you know how can I create an empty .aj file? In JDT, I used a
> code like this:
>
> --------------------
> public ICompilationUnit generateEmptyClass(String newClassName,
>    IPackageFragment iPackageFragment) throws JavaModelException,
>    BadLocationException {
>
>    ICompilationUnit iCU = iPackageFragment.createCompilationUnit(
>       newClassName + ".java", "", true, null);
>      
>    return iCU;
> }  
> ----------------------
>
>   Afterwards, I would like to open the new file in the Editor by the
> source code. Any thoughts?

Hi Alex,

Try looking at the code for the New Aspect wizard in AJDT, as it creates a .aj file and then opens it in the editor. The code is in NewAspectCreationWizard.java - look at the finish() method. It just does a workspace operation to create the file. You can then get an ICompilationUnit from the file with AJCompilationUnitManager.getAJCompilationUnit(file);

Note that the AJDT source code is now under "AJDT_src" in CVS as per my earlier note to ajdt-dev.

Regards,

Matt.
_______________________________________________
aspectj-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-dev
Reply | Threaded
Open this post in threaded view
|

Re: [how to create an .aj file]

Alex Vasc
Thanks, Matt!
  I´ll try this.
Best regards,
--
Alexandre Vasconcelos
www.cin.ufpe.br/~atv
 
On 6/13/05, Matt Chapman <[hidden email]> wrote:

>  
> Alex Vasc <[hidden email]> wrote on 10/06/2005 17:48:21:
>  > Hello everybody,
>  >   Do you know how can I create an empty .aj file? In JDT, I used a
>  > code like this:
>  >
>  > --------------------
>  > public ICompilationUnit generateEmptyClass(String newClassName,
>  >    IPackageFragment iPackageFragment) throws JavaModelException,
>  >    BadLocationException {
>  >
>  >    ICompilationUnit iCU =
> iPackageFragment.createCompilationUnit(
>  >       newClassName + ".java", "", true, null);
>  >      
>  >    return iCU;
>  > }  
>  > ----------------------
>  >
>  >   Afterwards, I would like to open the new file in the Editor by the
>  > source code. Any thoughts?
>  
> Hi Alex,
>  
> Try looking at the code for the New Aspect wizard in AJDT, as it creates a
> .aj file and then opens it in the editor. The code is in
> NewAspectCreationWizard.java - look at the finish() method. It just does a
> workspace operation to create the file. You can then get an ICompilationUnit
> from the file with
> AJCompilationUnitManager.getAJCompilationUnit(file);
>  
> Note that the AJDT source code is now under "AJDT_src" in CVS as per my
> earlier note to ajdt-dev.
>  
> Regards,
>  
> Matt.
> _______________________________________________
> aspectj-dev mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>
>
_______________________________________________
aspectj-dev mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-dev