Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lwrage opened this Issue Apr 16, 2018 · 10 comments

Comments

Projects
None yet
2 participants
@lwrage
Copy link
Contributor

lwrage commented Apr 16, 2018

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

@lwrage lwrage changed the title OSATE can't find unused classifiers in a package Need a way to find unused classifiers in a package Oct 31, 2018

@lwrage lwrage added the backlog label Oct 31, 2018

@AaronGreenhouse AaronGreenhouse added next and removed backlog labels Nov 1, 2018

@AaronGreenhouse

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 5, 2018

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

  • in the context menu for a package. Probably also should be applicable across an entire package (scan all the packages In the project (and the projects it depends on))
  • in the OSATE menu

@AaronGreenhouse AaronGreenhouse added in progress and removed next labels Nov 5, 2018

@AaronGreenhouse

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 8, 2018

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

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 12, 2018

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

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 13, 2018

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

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 13, 2018

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

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 15, 2018

Marker resolution is done.

Need to figure out the editor opening problem still.

@AaronGreenhouse

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 16, 2018

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.

@lwrage lwrage added this to the 2.4.0 milestone Nov 27, 2018

@AaronGreenhouse

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 27, 2018

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

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 28, 2018

Navigator action moved over

@AaronGreenhouse

This comment has been minimized.

Copy link
Contributor

AaronGreenhouse commented Nov 30, 2018

Added help file.

Added autogeneration of html from md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.