These pages is meant to support people building hardware to extend or utilize AJDT/AspectJ. Be sure to play a role in this site with any pertinent info, such as instance laws utilising the AJDT and/or AspectJ APIs.
This site may be out of day. Our goal is modify this site for AJDT 1.6.1, but we not have time with this yet. Be sure to understand that some of what’s on this web page may no lengthier end up being proper. If you have any questions, kindly deliver these to the mailing list ajdt-dev.
- 1 Obtaining crosscutting commitment records from AJDT
- 2 Collection Models in AJDT
- 2.1 Acquiring the items in an AJCompilationUnit
- 3 by using the AspectJ AST parser
- 4 Known limits, insects, and outstanding problem
- 5 The screen methods are required to use to get the AspectJ compiler
Getting crosscutting partnership information from AJDT
If you are developing an eclipse plug-in and need use of crosscutting information whenever a task is created, possible enter a listener with AJDT. Your own plug-in will need to depend on org.eclipse.ajdt.core, org.eclipse.core.resources and org.eclipse.jdt.core, and org.aspectj.weaver. When you look at the org.eclipse.ajdt.core plug-in there clearly was an IAdviceChangedListener user interface with an individual adviceChanged() approach.
Register this utilizing the AJBuilder lessons in this way (inside plug-in’s start() way for instance):
Presently (AJDT 1.6) this is certainly labeled as after each develop of an AspectJ job (for example. every *potential* information modification). In a future production this can be optimized as best known as if suggestions possess actually altered. AJDT/UI makes use of this method to upgrade the lime arrow graphics decorator.
Crosscutting details can then feel obtained from the AJProjectModelFacade course. Discover an illustration with some pseudo-code it is possible to adjust:
Several records relating to this:
- The API possess some slight changes in tomorrow. Be sure to submit a message for the ajdt-dev mailing list if everything on this page is beyond day.
- The AJProjectModelFacade object was a light-weight entrance into the AspectJ community. It is simply valid till the then create. Therefore, cannot shop them. Make use of them and dispose as required.
- AJProjectModelFacade things best have data after the first successful create. It is possible to phone the hasModel() method to find out if an AspectJ model prevails your venture.
- Perhaps you have realized, obtain the partnership both in information. See AJRelationshipManager your complete selection of relationships, so you can simply request the partnership type you are interested in.
- IRelationship.getSourceHandle() and IRelationship.getobjectives() return chain that express AspectJ component handles. You should use the subsequent AJProjectModelFacade techniques to become model areas:
- toProgramElement(sequence) — returns IProgramElement. From here you are able to get details about the pointcut, intertype factor, or declare aspect.
- programElementToJavaElement(sequence) or programElementToJavaElement(IProgramElement) — comes back IJavaElement. From this point you are able to connect into JDT tooling.
- There’s no needs to register a suggestions changed listener. You could get accessibility the crosscutting model whenever you want (provided that the project has experienced an effective acquire) with the next signal:
Compilation Products in AJDT
JDT brings compilation models (instances of ICompilationproduct) for .java data files. AJDT produces collection products for .aj documents, which are instances of AJCompilationUnit (which implements ICompilationUnit). The category AJCompilationUnitManager (from inside the org.eclipse.ajdt.core plug-in) includes some of use practices with this, including:
From an AJCompilationUnit possible receive numerous architectural records eg getAllTypes(). The primary means for “.aj” documents is usually an element, which can be displayed by AspectElement course, containing aspect-specific techniques for example getPointcuts() and getAdvice(). These return furthermore aspect-specific characteristics particularly PointcutElement and AdviceElement.
Since AJDT 1.6.2 for Eclispe 3.4, we use the Eclipse weaving service to incorporate into JDT. One pair of join factors that are suggested are those related to the development of CompilationUnit things. If document has is *.aj document, AJCompilationUnit is made in place of a general Java collectionUnit.
Having the belongings in an AJCompilationUnit
Because JDT anticipates that supply it works with is true coffee signal, JDT can not work really with AspectJ. To get with this, AJCompilationUnits preserve two buffers that have supply materials. The very first is a java appropriate buffer and also the 2nd could be the earliest information buffer. The coffee appropriate buffer will be the buffer definitely came back automagically whenever AJCompilationUnit.getContents() is known as. This buffer provides the AspectJ laws along with aspect-specific syntax removed completely. The initial contents buffer consists of (just like you would anticipate) the original contents in the file.
For instance in the event the earliest content buffer appears to be:
the coffee suitable buffer is
Observe that the origin locations associated with the identifiers are identical both in buffers. This helps to ensure that resource researching and hyperlinking really works as expected.
Should you require cooperating with the original content of an AspectJ CompilationUnit ajdevice, you could do the following:
Exactly what this technique does requests for the AJCU to temporarily turn the buffer towards AJ buffer from the Java buffer. It’s always best to repeat this in a synchronized block so that you don’t risk some other threads coming by and inadvertently utilizing the completely wrong buffer (AJDT itself does not use a synchronized block because of this, but it should).
Utilizing the AspectJ AST parser
Standard example, obtained from bug 88861
Make these and operate they:
Understood limits, pests, and exceptional problem
Constraint: there can be currently no AST assistance for resolving type bindings: insect 146528