Subject: Re: Hw5 questions
From: Kojarski Sergei (email@example.com)
Date: Sun Nov 03 2002 - 23:31:35 EST
> I managed to add a "LoD checker properties" page. I was wondering what the
> content of this page should be. For now I just added some Label. I can add different widgets. I
> guess we should have some text fields where the user can input the stable classes and configure
> the checker. But the checker as it is now (from hw4) doesn't allow an user interaction. The
> stable classes (Stable pointcut) are hard-coded.
It's not really necessary on this stage, I suppose.
1. checkbox for enabling/disabling checker
2. checkbox that allows user to remove AspectJ nature if possible &
checker turned off.
> 1.So how can we congigure it using the properties page ?
At this moment we don't need this.
> You say the property page must appear only for Java projects. I
> implemented org.eclipse.ui.IWorkbenchPropertyPage by extending the default
> implementation PropertyPage class but there is nothing in this class about
> the project nature.
See manifest file -> each extension to the propertyPage point can have
filter. Try to take a look at AspectJ plugin.xml. Good example how to set
> 2.Should I define another extension to org.eclipse.team.core.repository
> then implement a repository provider and get an IProject resource and then
> find its nature or there is another way to find what the project nature is
> and if it's Java display the properties page? Or we just need to provide
> an implementation for the extension point
> org.eclipse.core.resources.natures ?
We need only one extension to propertyPage point.
Use manifest file to filter on project natures,
and API to find out if project has AspectJ nature
in the code of your property page.
> >From part2.
> 3. The code I have to add for part 2 should be again in the LoDChecker
> plugin, right ? We are not suposed to touch neither aspectj nor java plugins, right ?
> We have to find out if the Java project has also an Aspect nature , and
> if not and the Lod Checker is enabled - add it.
More on it: use resources API. Take a look at IProject interface.
Use IProject.getDescription() to obtain IProjectDescription.
Use IProjectDescription to get/set all the nature-relative information
(Don't forget to say IProject.setDescription(IDescription,null) after
you put new information into IProjectDescription object)
> 4. How our plugin will be enabled and what is the extension point we have
> to supply a behaviour for, in order to check for an aspect nature? What extension point is
> activated when the plugin is enabled and when exactly the "enabling" occurs ?
Ok, the "enabling" of the plug-in code occurs when you
right-click-on-the-project->properties->select your prop. page->
See org.eclipse.ui.IWorkbenchProperyPage to find out what will happen in
your implementation class at this moment and any other events.
At this moment the Platform will call some method and inside this method
you can easily find out, for what resource (project) this page is shown.
Having the project, you can easily find all the natures it has and
add/remove some of them (see above)
> 5. Should we use repository provider and provide an extesion to
> org.eclipse.team.core.repository extension point in order to get to the IProject object and make the
> appropiate check for an aspect nature
Use (IProject)IWorkbenchPropertyPage.getElement() -> it'll return you
selected resource, atually, the project.
> 6. last question - you said in class we have to copy the checker files
> into every java project we want to check for LoD violations. Why we need the Lod.jar (this is my jar
> containing all the checker files)
Actually, you can not to copy but just add LoD.jar to classpath of your
project -> compile ->it should work.
BUT, in the future we'll need to set Stable&GlobalPreffered, that is
done by rewriting java source code & can be unique for each project ->
it's better to copy java files from your plugin directory to project
and change source code correspondingly to user's properties for
Use resource API, org.eclipse.core.runtime.Plugin to find out how to
find file in your plugin dir and copy into the project +
see JDT api to find out how to tell Eclipse the file you copied is java
Hope it'll help,
This archive was generated by hypermail 2b28 : Sun Nov 03 2002 - 23:31:37 EST