osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
39 stars 8 forks source link

Need a way to find unused classifiers in a package #1135

Closed lwrage closed 5 years ago

lwrage commented 6 years ago

There should be a way to check a single package or all packages in a directory or project for unused elements. This is probably most useful for classifiers.

Currently one has to select each classifier individually and display the references to it.

child of #1371

AaronGreenhouse commented 6 years ago

Okay, general principle of operations:

  1. Find all the classifiers declared in a package
  2. For each classifier, find all references to it. (Limited to what scope? Everything, I should think.)
  3. If the declaration has no references, create a warning marker.
  4. Bonus points: use a quick fix on the warning marker to remove the declaration.

This should be a command

AaronGreenhouse commented 6 years ago

Making a test project for this and I just realized the obvious: the top-level system is always going to be viewed as unused.

Do we want some kind of heuristic to avoid flagging this, or do we just let the user sort it out?

AaronGreenhouse commented 6 years ago

Basic analysis is done. Markers are generated.

Problem: What ever mechanism "opens markers" from the problem view doesn't open the URI embedded in the marker I generate. Soemthing needs to be updated to handle this.

Next step: look into quick fixes.

AaronGreenhouse commented 6 years ago

Double-clicking on the marker causes the XtextEditor to open on the .aadl file, and the IGotoMarker implementation it uses tries to use text positions from the marker. I cannot figure out how to introduce something into the middle that hijacks the process and uses the same mechanism we use in the search results view and AADL Navigator view to jump to URIs.

I'll come back to this after looking at quick fixes.

AaronGreenhouse commented 6 years ago

Quick fixes: use the extension point org.eclipse.ui.ide.markerResolution

Need to implement IMarkerResolutionGenerator and specific IMarkerResolution classes. Subclass WorkbenchMarkerResolution to allow the applying multiple resolutions at once.

AaronGreenhouse commented 5 years ago

Marker resolution is done.

Need to figure out the editor opening problem still.

AaronGreenhouse commented 5 years ago

I got the marker location problem fixed. I dug around in the Xtext stuff for a while, and I found that it uses ILocationProvider instances to get the text location of EObjects. I updated my marker creation to use this to add start and end attributes to the marker. This makes things work. I left the URI in the marker as well, because it seems like it should be useful for something.

AaronGreenhouse commented 5 years ago

Moved from org.osate.ui to org.osate.analysis.architecture. Moved the menu command to be in a new Model Maintenance submenu.

Still need to move navigator action over.

AaronGreenhouse commented 5 years ago

Navigator action moved over

AaronGreenhouse commented 5 years ago

Added help file.

Added autogeneration of html from md