Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ajdt-dev] package granularity crosscutting view mock-up and APIs

Rory, Andy,

Linked in this message you will find my mock-up screenshot of a package-granularity crosscutting structure view for Eclipse, and a new AJDE Framework plug-in with all of the APIs needed to generate the view pictured here.  

http://aspectj.org/home/ea/packageGranularityCrosscutt.gif 
http://aspectj.org/home/ea/aspectj-eclipsePlugin-1.0.X.zip

What the screenshot shows:

* A perspective based on the JDT's "Java Browsing".

* Suggested packing UI for the view.  I think that ideally the UI would use a non-scrolling packing algorithm.  Since that can be a harder problem the "zoom-in/out" buttons on top of the view could help the user deal with larger packages.  Note that the packing algorithm could also save real-estate by stacking files on top of each other.  

* "expand into aspect" button on aspect-list view--this could have the property of showing the advice and pointcuts in the aspect.

* Selection UI: if a colored line is moused-over tooltip text shows the text of the affected source line.  Clicking on the line causes the corresponding aspect to be highlighted in the aspect view, and the corresponding source line to be selected in the editor.

APIs

* All of the methods that you need are in org.aspectj.ajde.ui.StructureModelUtil and have a bit of Javadoc explaining their usage.  You'll find the sources within the plug-in bundle in "aspectjtoolssrc.zip".

* This API uses the structure model directly.  You should look at how it is traversed in case you want to expand on this behavior.  Once we settle on the functionality we will create a new StructureView that will behave very similarly.  One of the benefits of using structure views will be the fact that they are updated automatically once the model has changed (e.g. after a compile).  

* To get more familiar with the structure model read through the sources in org.aspectj.asm.  I will send you a UML diagram of that API by Tuesday.

* The following code is from my test case.  It goes through the algorithm you'll probably want to use: 

-----------------------
List packages = StructureModelUtil.getPackagesInModel();
System.err.println("> packages: " + packages);
ProgramElementNode packageNode = (ProgramElementNode)packages.get(0);
System.err.println("> package node: " + packageNode);
List files = StructureModelUtil.getFilesInPackage(packageNode);
System.err.println("> file list: " + files);
Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap(
	((ProgramElementNode)files.get(0)).getSourceLocation().
	getSourceFilePath());
System.err.println("> line->advice map: " + lineAdviceMap);			
Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode);
System.err.println("> aspects affecting package: " + aspects);	
-----------------------

Suggestions: 

* I suggest that you start with this sort of package view and save the one that nests packages for later.  Doing this one right will be a feat in itself and adding that level of genericty early on might not pay off.

* In terms of Eclipse/AJDT integration you should probably start by creating a new "perspective".  The sources for the JDT's Java Browsing perspective should be useful for that.

Please send on any questions or issues you may have.  Let's chat more about this during the Tuesday AJDT meeting.

Regards,

Mik

--
Mik Kersten
Development Tools Lead
AspectJ Team, Palo Alto Research Center



Back to the top