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

Classifier information view should show subtype hierarchy #2436

Closed
lwrage opened this issue Sep 14, 2020 · 25 comments · Fixed by #2488
Closed

Classifier information view should show subtype hierarchy #2436

lwrage opened this issue Sep 14, 2020 · 25 comments · Fixed by #2488
Assignees
Milestone

Comments

@lwrage
Copy link
Contributor

lwrage commented Sep 14, 2020

Summary

The classifier view should also show component types and implementations that extend the classifier that is currently in focus.

Expected and Current Behavior

Currently the view only shows types and implementations that are extended by the classifier in focus, i.e., the supertype hierarchy. Subtypes should also be displayed.

Compare the Java type hierarchy view, which has type hierarchy, supertye hierarchy, and subtype hierarchy.

image

Environment

  • OSATE Version: 2.8.0
  • Operating System: all
@lwrage lwrage changed the title Classifier information view shold show component implementations and extensions Classifier information view shold show subtype hierarchy Sep 15, 2020
@lwrage lwrage added this to the 2.9.1 milestone Oct 2, 2020
@lwrage lwrage changed the title Classifier information view shold show subtype hierarchy Classifier information view should show subtype hierarchy Oct 2, 2020
@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Oct 7, 2020

Constructing the subtype hiearchy rooted at the selected classifier is harder than getting the ancestors: Need to search the workspace for all references to the classifier and then see if the reference is in an extends or implementation clause. Need to identify the following:

  • type extension: i.e., system A extends B — type A extends type B — this is a TypeExtension node

  • type implementation: i.e., system implementation A.i — implementation A.i implements type A — this is a Realization node

  • implementation extension: i.e, system implementation A.i extends C.k — implementation A.i extends C.k (and also implements type A) — this is a ImplementationExtension node

Need to use the class org.osate.search.AadlFinder. See FindUnusedClassifiersAnalysis for example of usage.

@AaronGreenhouse
Copy link
Contributor

At first I thought that this was going to affect the changes made for Issue #2435 (updating when the file is changed). But this is not true. I must always watch the ancestors of the selected classifier for changes to update the RHS of the view. Even when the supertypes are not being shown I still need to watch them.

Not sure how important it is to live update the subtype hierarchy. The Java type hierarchy view does it. But I don't know now to do it efficiently. I'll have to experiment with this later. . . . So I should still branch this from 2435.

@AaronGreenhouse
Copy link
Contributor

I don't need to search the whole workspace. I only need to search the projects that recursively depend on the project in which the root classifier is located. I'm not sure if this really helps or not.

@AaronGreenhouse
Copy link
Contributor

It's probably a bad idea that the AncestorTree nodes hold on to Classifier nodes. Also MemberNode elements hold on to Element and Classifier nodes.

@AaronGreenhouse
Copy link
Contributor

As usual I nearly forgot about feature groups. We also have

  • feature group extension: i.e., feature group A extends B — feature group A extends feature group B — this is a GroupExtension node

  • feature group inverse: i.e., inverse of B appears in feature group A — feature group A is an inverse of feature group B — this is a direct reference in the FeatureGroupType for A.

@AaronGreenhouse
Copy link
Contributor

N.B. Need to refresh the descendants tree whenever a file in the project dependency tree changes.

@AaronGreenhouse
Copy link
Contributor

Fixed the AncestorTree and the MemberTree to not hold onto EObject nodes.

@AaronGreenhouse
Copy link
Contributor

Still need to update the resource change handling to work correctly with the descendant tree.

I current have 3 panes: ancestor, descendant, member. Lutz said he would prefer to switch between the ancestor and descendant trees, so I ahve to fix that.

@AaronGreenhouse
Copy link
Contributor

The three-pane classifier information view: Gets kinda cramped on small screens.

Screen Shot 2020-10-12 at 10.46.28 AM.png

Screen Shot 2020-10-12 at 10.46.36 AM.png

@lwrage
Copy link
Contributor Author

lwrage commented Oct 12, 2020

Is there a way to allow the user to switch between a two and three column layout?

@AaronGreenhouse
Copy link
Contributor

@lwrage Yes, I don't see why we couldn't toggle between two and three columns, and then in the two column view have a toggle to switch between ancestors and descendants.

@AaronGreenhouse
Copy link
Contributor

Fixed the resource change listener to monitor for the descendants as well by triggering a refresh whenever a file in the project tree changes.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Oct 13, 2020

Fixed the refresh to happen in a separate job launched in such a way that the view is marked as busy then later as changed. (Still need to fix the progress bar.)

Need to get the view's "progress service":

	final IWorkbenchSiteProgressService service = getSite().getService(IWorkbenchSiteProgressService.class);

Schedule using the service:

	service.schedule(refreshJob, 0, true);

The true is supposed to make the cursor "half-busy", but it doesn't seem to do anything on my Mac.

Can mark as changed when done:

	service.warnOfContentChange();

@AaronGreenhouse
Copy link
Contributor

Added "Clear View" button to the view's toolbar so that large models can be removed from the view if they become annoying.

@AaronGreenhouse
Copy link
Contributor

Added Progress monitor to the AADLFinder methods so that I can better handle progress in the Classifier Info view. Still need to handle "cancel" of the job.

@AaronGreenhouse
Copy link
Contributor

Need to redo the "image" caching in the view because i'm probably leaking images.

Come back to this.

@AaronGreenhouse
Copy link
Contributor

Need to add an option to suspend automatic refresh, and enable manual refresh to handle the case of big models.

@AaronGreenhouse
Copy link
Contributor

Need a status line in the view that shows which classifier is being displayed, and whether a refressh is needed. This is necessary because cancelling a refresh can cause the display to be cleared.

@AaronGreenhouse
Copy link
Contributor

Added menu option to the view to disable automatic refresh. When disabled, a refresh button on the toolbar will be enabled when a refresh is required.

@AaronGreenhouse
Copy link
Contributor

Switched back to a 2-paned view, with ancestor and descendant toggle buttons on the toolbar. It is too hard to have an option to switch between a 2- and 3-paned view.

@AaronGreenhouse
Copy link
Contributor

Discussed it with @lwrage and we decided the view does not need a context menu that allows refocusing the view on a the selected classifier. Adding this would lead down the rabbit hole of having to remember past classifiers on which the view was focused, and we don't want to do that.

So last item remaining is to update the help text.

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Oct 23, 2020

Overlooked a lot in the resource listener needed to refresh.

  • First, every time the view jumps to the source text, the view refreshes. This is caused by the adding/removing of markers to the source text file to perform the jump. Obviously we can ignore all marker changes.

  • We can ignore all changes to any resource that isn't an IFile that ends in ".aadl". I think we have a utility method that checks for AADL Files somewhere.

  • We need to handle the case of the resource that contains the classifier being viewed being deleted. In this case the view needs to clear its input.

@AaronGreenhouse
Copy link
Contributor

Also see what happens when the project is closed.

@AaronGreenhouse
Copy link
Contributor

Just checking for the IResourceChange.REMOVED kind on the resource delta is good enough to catch

  • The file being moved

  • The file being deleted

  • The file being renamed

  • The containing project being closed

@AaronGreenhouse
Copy link
Contributor

So I made these changes, and found out something annoying/interesting. When a refresh is reacting to the removal of an .aadl file, building the descendant tree throws an exception. The resource finder complains that it cannot find the recently deleted file.

Upon close inspection, what was happening was notification of the .aadl file being deleted, the refresh of the view would run (and fail), and then another resource change notification comes in that .aadlbin files have been updated. These files are needed to for the resource finder.

More testing shows that any interesting change to an .aadl file (content change, creation, deletion, rename, closing the project) results in changes to the .aadlbin file corresponding to that file.

So, I need to

  1. Just watch for changes to the .aadlbin files in the projects of interest. (Marker changes to the .aadl file do not affect the .aadlbin file.).
  2. Check that the resource of the currently viewed URI exists in refresh() and handle the case that it doesn't, instead of trying to use the events to determine that the resource was deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants