[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] obtaining ajdt cross cutting information

Yes, this is a bit out of date.  It is for AJDT 1.4, now we are at
1.6.  I will update the documentation.  The getCurrentProject() method
doesn't make any sense because there is no "current project" in a
multi-project workspace.

If you are looking for crosscutting information for a particular
IProject or IJavaElement, you need to pass it to the
AJProjectModelFactory:

IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject("MyProject");
AJProjectModelFacade model =
AJProjectModelFactory.getInstance().getModelForProject(project);
AJRelationshipType[] relsTypes = AJRelationshipManager
               .getAllRelationshipTypes();
model.getRelationshipsForProject(relTypes);

--or--

for a particular IJavaElement
IJavaElement elt = <some_java_elt>;
AJProjectModelFacade model =
AJProjectModelFactory.getInstance().getModelForJavaElementelt);
model.getRelationshipsForElement(elt, relTypes);

AJProjectModelFacade also has a bunch of other interesting methods,
such as those that allow you to translate between IJavaElements and
IProgramElements (the units of the AspectJ model).


Note a few things:

1. AJProjectModelFacade objects are a lightweight way to access the
underlying AspectJ model.  They should not be held for longer than you
need them. Use them and discard them before the next build.
2. AJProjectModelFacade objects only have data after the project has
been built.  So, the hasModel() method checks to see if the underlying
AspectJ Model actually exists.

Please explain what you are trying to do and I will let you know how
to use AJDT to get there.

--a

On Mon, Dec 1, 2008 at 1:30 AM, tamal nath <tmlnth@xxxxxxxxx> wrote:
> Hi,
>
> I was trying to obtian the AJDT cross cutting information for TJB example as
> shown in the AJDT wiki:
> http://wiki.eclipse.org/index.php/Developer%27s_guide_to_building_tools_on_top_of_AJDT_and_AspectJ
>
> But I found that getCurrentProject is now undefined! Also most of the
> methods are deprecated. Is there a new method which does the same job as
> getCurrentProject? Is there a better way to do this in the new version?
>
> IProject project = AspectJPlugin.getDefault().getCurrentProject();
>
> Tml
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>