Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] loading and traversing aspects (.aj files)

I think I understand what you are trying to do.  You would like to
walk the parse tree to see what other files are referenced.
Unfortunately, the part of the AjAST hierarchy that you require has
not been completely implemented (look at
org.aspectj.org.eclipse.jdt.core.dom.PointcutDesignator and its
subclass DefaultPointcut).  So, the information that you require is
not really available from the AjAST.

I think your best bet is to use a
org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser object and
do the parsing yourself.  If you need some pointers on how to do this,
I can provide it.



On Sat, Mar 13, 2010 at 2:59 PM, saadbin abid
<saad.softwareengineer@xxxxxxxxx> wrote:
> Hello Andrew and Aspectj community,
> Thank you very much for the reply. well let me try to explain the problem
> again. First of all the classes and aspects are there in the project. all i
> need to do is to read the aspects (.aj files) to find out what java classes
> or aspects are affected by any particular aspect
>
>  for example
> In the earlier example i mentioned I have A.java and B.java. I made an
> aspect C.aj,which actually checks that if both A.java and B.java are running
> than modify A.java  or B.java so that both can actually run together. So I
> actually want to know which Java class function (A.java and B.java) is
> extended by C.aj
>
> Iets say I have aspect implements "requiredActivation" dependency between
> part
>
> @activation dependency
>  * When Hex is selected, the logical operators can be active
>
> "privileged aspect HexPanel_LogicalOp {
>     before(HexPanel panel) :
>         execution(* setButtons()) && this(panel) {
>         panel.buttons.elementAt(4).setPObject(new And());
>         panel.buttons.elementAt(9).setPObject(new Or());
>         panel.buttons.elementAt(14).setPObject(new Xor());
>     }
> }
> "
> The above mention aspect code is that this aspect advises
> HexPanel.setbuttons. I want to know this information "This aspect requires
> HexPanel so that logical operations can be activated". This aspect calls
> HexPanel and add some functionality to it (add buttons) so that logical
> operation can be performed.
>
> I hope i make you understand. All i want to traverse aspects present in the
> AspectJ project and find out calls to other .aj or .java files.
>
> How can i proceed with it?
>
> Best regards
>
>  Saad
>
> On Sat, Mar 13, 2010 at 9:44 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx>
> wrote:
>>
>> I am not exactly sure what you are trying to do.
>>
>> I think you are saying that you want to do some code generation in
>> C.aj based on the state of your A.java and B.java files.
>>
>> If this is the case, then you do not need to create your own builder,
>> but rather you need to implement and register an
>> IResourceChangeListener object with the workspace.  This listener will
>> be notified whenever a workspace resource is changed.  You should look
>> at the eclipse documentation for more information on this.
>>
>> As for the code generation, yes, you may need to use the AjAST for
>> this.  It is similar to the JDT DOM api, so have a look at that.
>>
>> I may have misinterpreted what you are trying to do, so please explain
>> more precisely and I can give a more detailed answer.
>>
>> On Sat, Mar 13, 2010 at 7:51 AM, saadbin abid
>> <saad.softwareengineer@xxxxxxxxx> wrote:
>> > Hello Aspectj Community,
>> > I am a newbie to AspectJ and AJDT world. I am currently working with a
>> > aj
>> > implementation. In aspectj project I have aspects and java files (.aj
>> > and
>> > .java files).For the start I am working out with  simple example of
>> > "helloworld" for developing a simple prototype. I have two java classes
>> > A.java, B.java and one aspect C.aj. C.aj has something like
>> >
>> > - If A.java and B.java are running, than put additional functionality
>> > (for
>> > example extend A.java with additional functionality if B.java is
>> > selected).
>> >
>> > A.java
>> >
>> > sayA()
>> > {print "sayA"}
>> >
>> > B.java
>> >
>> > sayB()
>> > {print "sayB"}
>> >
>> > C.aj (if A.java and B.java both are enable)
>> >
>> > sayAandB()
>> > {put "And" after running A.java and then execute B.java}
>> >
>> > after executing ant script build.xml
>> >
>> > print "SayA" "and" "SayB"
>> >
>> > I would like to implement a incremental builder plug-in which will run
>> > in
>> > the eclipse runtime environment and  traverse the .aj file and give me
>> > information like which java classes are affected? My questions are
>> >
>> > What could be the possible starting point?
>> > Do I have to workout with AjAST? although in the project I dont have
>> > many
>> > aspects in the project implementation.
>> > Can I traverse .aj file without creating AST?
>> > Is it possible to load .aj files using some code? (for example in my
>> > case
>> > can I load C.aj file with some code?)
>> >
>> >  Can you help me with this. I didn't get too far with the tutorial
>> > "Developer's guide to building tools on top of AJDT and AspectJ".
>> >
>> > best regards
>> > --
>> > SAAD
>> >
>> > _______________________________________________
>> > aspectj-users mailing list
>> > aspectj-users@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> >
>> >
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top