Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354523 - Support visible when expression for diagram nodes
Summary: Support visible when expression for diagram nodes
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Shenxue Zhou CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-11 12:17 EDT by Shenxue Zhou CLA
Modified: 2021-11-19 09:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shenxue Zhou CLA 2011-08-11 12:17:01 EDT
My use case is my diagram editor needs to switch between two modes. Certain node element types are only applicable to one mode. Diagram editor's palette needs to dynamically change when mode switches.
Comment 1 Shenxue Zhou CLA 2011-09-19 12:46:28 EDT
The bug has been fixed a while ago. I just added enhancement doc for it.
Comment 2 Konstantin Komissarchik CLA 2011-09-20 15:34:40 EDT
Change in the visible-when condition does not cause the diagram or the palette to update accordingly.
Comment 3 Konstantin Komissarchik CLA 2011-09-30 10:35:21 EDT
What is the status of this bug? Are you on track to wrap this up by the end of day today?
Comment 4 Shenxue Zhou CLA 2011-09-30 13:06:17 EDT
The issue in Comment 2 has been addressed.
Comment 5 Konstantin Komissarchik CLA 2011-09-30 13:46:33 EDT
The palette now updates as expected, but the nodes themselves are still visible when they shouldn't be and the Add context menu still shows the option for invisible node types.

Repro via Sapphire samples:

1. Edit ArchitectureEditor.sdef. In Component node's definition add visible when condition of "${ Root().DetailLevel == 1 }".

2. Create architecture.xml file and create a few components with dependencies.

3. Switch detail level to 2 via properties view.

4. Notice that the palette updates, but the nodes are still shown. Expect the nodes to hide and the add context menu to no longer offer "add component" option.
Comment 6 Shenxue Zhou CLA 2011-09-30 14:17:48 EDT
I've checked in a fix to hide invisible node types from the context Add menu.

As for hiding the nodes and their associated connections, I did attempt to do that but it became very messy and complex. Since the underlying model doesn't change when the visible-when condition for nodes changes, I can't simply delete the corresponding parts and their visual representations from the editor.

An alternative way would be through validations on the model. That's implemented in our adopter product's JDev counter part.

Another point I want to make is due to the limitation of Sapphire 0.3.1's support on dynamic list binding, the Add for those nodes are still available in the form editor. So developers still need to handle invisible nodes added there.
Comment 7 Shenxue Zhou CLA 2011-10-03 16:58:08 EDT
Add support for showing/hiding node PEs when the visible-when condition changes.
Comment 8 Konstantin Komissarchik CLA 2011-10-04 10:09:02 EDT
Works very well now. The only issue I found is that when the last node in a palette compartment is hidden, the empty palette compartment remains visible. Would be best to hide it as well. I opened a separate Bug 359839 for 0.4 to track that.

Verified. Closing.