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

Bug 494175

Summary: Allow the deactivation of the properties view with the new EEF runtime
Product: [Modeling] Sirius Reporter: Stephane Begaudeau <stephane.begaudeau>
Component: PropertiesAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Laurent Redor <laurent.redor>
Severity: enhancement    
Priority: P3 CC: laurent.redor, pierre-charles.david
Version: 3.1.0Keywords: triaged
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/73304
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3110d15a103a894399e5e66bdc69110377946e70
https://bugs.eclipse.org/bugs/show_bug.cgi?id=482528
Whiteboard:

Description Stephane Begaudeau CLA 2016-05-20 10:29:02 EDT
In the various call to the properties sheet page provider in :
- SiriusDiagramEditor#getAdapter()
- AbstractDTreeEditor#getAdapter()
- ModelExplorerView#getAdapter()

Instead of giving the property sheet page provider the variable "type" which will always be the IPropertySheetPage class, it should be given the variable "this" which would give access to the current editor.

As a result, in org.eclipse.sirius.ui.properties.internal.EEFPropertySheetPageProvider.getPropertySheetPage(Object, String), it should be possible to case the source, now the Sirius editor, to a DRepresentationEditor (if that exist) and then look for the odesign used for the representation and if the odesign involve contains in its Group object the string "NO_PROPERTIES_VIEW_WITH_EEF" we should return null which would thus deactivate the properties view with EEF. Something like this :

public class EEFPropertySheetPageProvider implements ISiriusPropertySheetPageProvider {
    @Override
    public IPropertySheetPage getPropertySheetPage(Object source, String contributorId) {
        if (source instanceof DRepresentationEditor) {
            DRepresentation representation = ((DRepresentationEditor)source).getRepresentation().getDefinition();
            if (representation.getGroup().getDocumentation.contains("NO_PROPERTIES_VIEW_WITH_EEF")) {
                // Deactivate EEF support
                return null;
            }
        }
        return new EEFTabbedPropertySheetPage(source, contributorId);
    }
}
Comment 1 Eclipse Genie CLA 2016-05-20 11:00:15 EDT
New Gerrit change created: https://git.eclipse.org/r/73304
Comment 3 Pierre-Charles David CLA 2016-05-24 09:12:34 EDT
Fixed by 3110d15a103a894399e5e66bdc69110377946e70.
Comment 4 Laurent Redor CLA 2016-05-27 03:36:14 EDT
The keyword FORCE_LEGACY_PROPERTIES disables the new properties view. But it is not documented. Even the description of this bugzilla does not indicate the correct keyword.
Comment 5 Pierre-Charles David CLA 2016-05-27 10:41:26 EDT
To clarify: if the current selection comes from a Sirius representation whose definition (the RepresentationDescription in the VSM) contains the special string "FORCE_LEGACY_PROPERTIES" in its "documentation" field (or in any of its ancestors documentation in the VSM), Sirius falls back to the previous behavior, as if support for EEF-based properties views was not installed.

This allows specifiers to opt-out of this new feature even if it is installed, for specific representations, viewpoints or whole VSMs (by putting the keyword in the top-level Group's documentation).
Comment 6 Pierre-Charles David CLA 2016-05-30 03:48:00 EDT
After discussion with the team, we don't plan do document this mechanism (at least in the official doc). It is more of a temporary hack that we hope will never be needed, and will normally be removed for the next version.

If we need to refer someone to it, the bugzilla comment above will do.
Comment 7 Laurent Redor CLA 2016-05-31 04:43:39 EDT
Verified on Sirius 4.0.0 RC2 (No change since comment 4 but OK according to comment 5 and comment 6).
Comment 8 Pierre-Charles David CLA 2016-06-24 08:03:20 EDT
Available in Sirius 4.0.0.