[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Finding if a selected piece of code is being affected by an advice
|
This is really a question for the ajdt-dev mailing list... I think
it'd be easier to get the info you need directly from the AJModel
class, as described here:
http://wiki.eclipse.org/index.php/Developer%27s_guide_to_building_tools_on_top_of_AJDT_and_AspectJ#Obtaining_crosscutting_relationship_information_from_AJDT
--Matt
On 02/05/07, Fernando Calheiros <xfernando@xxxxxxxxx> wrote:
Hi everyone, I'm trying to get some information about whether a piece of
method code selected from the user is being affected by an advice and if the
advice uses withincode.
Since apparently most of this information is available in the
cross-references view, I thought AJDT's visualizer content provider would be
the right place to look, and just as a test I tried the following code:
AJXReferenceProvider provider = new AJXReferenceProvider();
LinkedList<AJRelationshipType> relations = new
LinkedList<AJRelationshipType>();
//adding all relationship types, just to see if anything is returned
AJRelationshipType[] types =
AJRelationshipManager.getAllRelationshipTypes();
for (AJRelationshipType type : types) {
relations.add(type);
}
//refactoringInfo.getOrigin() returns the IFile for the .java class
open in the eclipse editor
Collection references = provider.getXReferences(JavaCore
.createCompilationUnitFrom(refactoringInfo.getOrigin()),
relations);
//print the references
for (Object object : references) {
IXReference reference = (IXReference) object;
System.out.println(reference.getName());
}
The IFile passed as parameter to create the ICompilationUnit is being
affected by advices and inter-type declarations, which are correctly
displayed in the cross-references view, but getXReferences is returning an
empty Collection, can anyone tell me what I'm doing wrong?
Thanks in advance,
Fernando Calheiros
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users