Re: Adding AspectJ Nature...


Subject: Re: Adding AspectJ Nature...
From: Paul Freeman (pfreeman@ccs.neu.edu)
Date: Fri Nov 22 2002 - 09:36:40 EST


I think the problem seems to be due to the fact that the AspectJ Plugins
are not loaded properly or perhaps not quickly enough. My plugin forces
the loading of the AspectJ plugin, but even so this won't correct an
issue that everyone has. If you do the following:
enable a checker plugin (i.e. give a project the AspectJ nature)
build your test project and make sure that AspectJ is used to build it
(i.e. just verify that the AspectJ Nature has been added)
shut down and restart eclipse
without looking at the property page, just attempt to build the project
that now has the AspectJ nature.

An error is thrown stating that Eclipse was unable to load one of the
AspectJ plugins. I think this occurrs because Eclipse does not load a
plugin untill it is required, i.e. something like our property page is
activated causing that plugin to be loaded as well as all other plugins
that plugin requires. Normally, when a project is AspectJ enabled there
are view's which are added to your Eclipse workbench and when Eclipse
starts up, those views are displayed immediately and therefore the
AspectJ plugin is loaded. In our case we have simply added the AspectJ
Nature and not activated any of the AspectJ views. So when we try and
build the project, an attempt is made to load the unloaded AspectJ
plugin, however this I think is occurring on two seperate threads. I'm
pretty sure Eclipse runs the build process on a thread separate from the
one the Eclipse workbench itself is running on. Therefore the Eclipse
thread attempts to load the AspectJ plugin, and either it is unavailable
to the already executing build thread or it is not loaded quickly enough
and the build thread attempts to use part of the AspectJ plugin which
has not been initialized properly.

Hopefully this will all be fixed when we add our own view to the Eclipse
environment, forcing both our thread and the AspectJ thread to be loaded
properly at startup.

Paul

Mario wrote:

>Paul,
>Could this be because you did not include the AspectJ project into the
>run-time workbench? You can do this by selecting "Run->Run..." from the
>toolbar menu, then selecting "Run-time Workbench" configuration, and going
>to the "Plug-ins and Fragments" tab. Include all the plug-ins you need.
>Here's a handy perl script to find all the recursively required plug-ins:
>
>#!/usr/bin/perl -l
># usage: fd <fully_qualified_plugin_name>
># will print out all the (recursively) required plugins to stdout
># must be run in eclipse's plugin directory
># doesn't sort or eliminate duplicates (pipe output to "sort -u" for that)
>
>@left2proc = @ARGV;
>while (@left2proc) {
> $plugname = shift @left2proc;
> opendir PLDIR, ".";
> @entries = (readdir PLDIR);
> @matching = grep /$plugname/, @entries;
> die "can't find plugin $plugname" if ($#matching == -1);
> $dirname = $matching[0];
> $MANIFILE = "${dirname}/plugin.xml";
> open MANIFILE;
> while (<MANIFILE>) {
> if (/<requires>/) {
> $collect = 1;
> next;
> }
> if ($collect && /plugin=\"([^"]*)\"/) {
> push @left2proc, $1;
> print $1;
> }
> }
>}
>
>
>That's all...
>
>Other than the fact that I don't have a working copy of HW6... what do you
>suggest?
>
>-Mario-
>
>>>===== Original Message From freeberm@earthlink.net =====
>>>
>>Hi All -
>>
>>I have been having a problem with the homework that I thought I should
>>share with you all. I think I found the solution.
>>
>>I have been building the plug-in using the PDE (plug-in development
>>environment) in Eclipse. Using this, you can test your plug-in using
>>the "runtime workbench" as you develop it (you still need to export the
>>jar file, but there is no need to shut down and start up the application
>>in between. It is conveinient, but there is a problem, at least with
>>the the windows implimentation.
>>
>>I noticed it when I tried to add the AspectJ Nature to the project.
>> Adding the nature should start the AspectJ plug-in automatically, but I
>>kept getting the following error message:
>>Unhandled exception caught in event loop.
>>Reason:
>>Attempt to load class
>>"org.eclipse.ajdt.internal.ui.AspectJProjectNature" from deactivated
>>plug-in "org.eclipse.ajdt.ui".
>>
>>It turns out, that just adding the nature will work, but you can no
>>longer use the run time workbench to test your plug-in. My plug-in
>>worked just fine, i.e. did not throw the error message, when I added the
>>jar and xml file directly to the plug-in directory and restarted
>>eclipse. However, using the same code with the runtime workbench causes
>>the afore mentioned error.
>>
>>Hope this helps,
>>Paul
>>
>
>



This archive was generated by hypermail 2b28 : Fri Nov 22 2002 - 09:39:54 EST