Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 482785

Summary: Refactor hiding related parts of Zest.FX
Product: [Tools] GEF Reporter: Alexander Nyßen <nyssen>
Component: GEF ZestAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.wienand
Version: 0.2.0   
Target Milestone: 4.0.0 / 3.11.0 (Neon) M4   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Alexander Nyßen CLA 2015-11-22 09:26:35 EST
Those parts of Zest.FX that are related to hiding/unhiding of nodes need to be refactored. First, the HidingBehaviors have to be merged into the respective policies. Second the HidingPolicy needs to be transferred into an AbstractTransactionalPolicy. It could be a good idea to split it into a hide and how policy.
Comment 1 Alexander Nyßen CLA 2015-11-22 10:57:58 EST
As a start, I performed some initial cleanup:

- Split HideNodePolicy into HidePolicy and ShowHiddenNeighboursPolicy and ensured both extend AbstractTransactionPolicy.
- Extracted ShowHiddenNeightboursOnTypePolicy from HideOnTypePolicy.
- Split ExpandFirstAnchorageOnClickPolicy into ShowHiddenNeighboursOfFirstAnchorageOnClickPolicy and HideFirstAnchorageOnClickPolicy.
- Changed NodeHidingBehavior now extends AbstractHidingBehavior.
- Renamed HiddenNeighboursPart to HiddenNeighboursFeedbackPart.
- Renamed ZestFxExpandingHandlePart to ShowHiddenNeighboursHandlePart.
- Renamed ZestFxHidingHandlePart to HideHandlePart.

A closer look is still needed.
Comment 2 Alexander Nyßen CLA 2015-11-23 12:44:51 EST
(In reply to Alexander Nyßen from comment #0)
> First, the HidingBehaviors have to be merged into the
> respective policies. 

That does not seem to be appropriate, a behavior is ok here. However, we could think of centralizing it to the root part, so everything could be updated in a single place.
Comment 3 Alexander Nyßen CLA 2015-11-23 13:04:29 EST
Further, the hiding model could hold references to IContentParts, rather than content elements. That would make the reverse lookup, using the content part map, obsolete.
Comment 4 Alexander Nyßen CLA 2015-11-23 13:54:25 EST
Performed some further refactorings:
- Renamed HideOnType to HideOnTypePolicy.
- Remove HoverFirstAnchorageOnHoverPolicy, as it does not seem to be needed.
- Adjusted image constant names in ShowHiddenNeighborsHandlePart and HideHandlePart
- Removed unnecessary register() overwrite within AbstractHidingHandlePart, ensured unregister is performed properly.
- Remove unnecessary anchorage change listening in NodeHidingBehavior.
Comment 5 Alexander Nyßen CLA 2015-11-25 02:39:24 EST
Continued refactoring (hover handle parts):

-Extracted functionality for registering and unregistering nested visuals from AbstractFXContentPart into FXPartUtils and ensured the logic is also applied by AbstractFXHandlePart and AbstractFXFeedbackPart.
-Removed AbstractHidingHandlePart, as it predominantly took care of registering/unregistering the nested visuals (which is now already performed by the super class AbstractFXHandlePart).
-Renamed HideHandlePart to HideHoverHandlePart, and ShowHiddenNeighborsHandlePart to ShowHiddenNeighborsHoverHandlePart.
Comment 6 Matthias Wienand CLA 2015-11-27 05:23:19 EST
I ensured that the interaction policies that make use of the HidePolicy or the ShowHiddenNeighborsPolicy do execute the respective commit operation on the operation history.

Furthermore, I extended the HidingModel API to also allow passing in NodeContentPart objects, so that the code using the model does not need to lookup content parts/content objects.

Complementary to the rest of the API, I introduced a ShowHiddenNeighborsOperation. The respective code was previously contained within ShowHiddenNeighborsPolicy.

The code is published on the master branch. Therefore, I resolve this ticket as fixed for 3.11.0M4.