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

Bug 454020

Summary: Usage of org.eclipse.sirius.eef.adapters.sectionFilters extension points breaks the sections order
Product: [Modeling] Sirius Reporter: Vincent HEMERY <vincent.hemery>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: esteban.dugueperoux, pierre-charles.david, vincent.hemery
Version: 2.0.0Keywords: triaged
Target Milestone: 4.0.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Plugin project to reproduce none

Description Vincent HEMERY CLA 2014-12-03 09:02:59 EST
In a new plugin, set the plugin.xml content with

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
  <!-- Hide Sirius default tab-->
	<extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
	   <propertyContributor
	      contributorId="org.eclipse.sirius.ui.tools.views.model.explorer"
	      sectionDescriptorProvider="org.eclipse.sirius.eef.section.SiriusFilteringSectionDescriptor">
	   </propertyContributor>
	</extension>
	<extension point="org.eclipse.sirius.eef.adapters.sectionFilters">
	   <propertyContributorFilters contributorId="org.eclipse.sirius.ui.tools.views.model.explorer">
	      <sectionFilter id="org.eclipse.sirius.ui.tools.views.model.explorer.section"/>
	   </propertyContributorFilters>
	</extension>
  <!-- Tabbed properties views extension -->
	<extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
		<propertyTabs contributorId="org.eclipse.sirius.ui.tools.views.model.explorer">
			<propertyTab
				category="default"
				id="tabId"
				label="Naming and Description"
				afterTab="top"/>
		</propertyTabs>
	</extension>

	<extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
		<propertySections contributorId="org.eclipse.sirius.ui.tools.views.model.explorer">
			<propertySection
				id="section1"
				tab="tabId"
				class="com.example.MyClassSection1"
				filter="com.example.MyClassSection1$EditionFilter">
			</propertySection>
			<propertySection
				id="section2"
				tab="tabId"
				afterSection="section1"
				class="com.example.MyClassSection2"
				filter="com.example.MyClassSection2$EditionFilter">
			</propertySection>
		</propertySections>
	</extension>
</plugin>

Create the corresponding sections and filters classes, extending org.eclipse.ui.views.properties.tabbed.AbstractPropertySection and implementing org.eclipse.jface.viewers.IFilter.

When launching sirius and selecting an element in the model explorer view, the two sections are displayed, but in the wrong order : section2 is displayed, then section1.

If we add other sections, we see that sections are displayed in their reverse declaration order, no matter the "afterSection" attributes. (which makes playing with the declaration order a potential workaround when all sections are in the same plugin)
If we remove part of the tab hiding mechanism, sections are displayed in the correct order.

This bug also happens with the diagram contributor.

This bug has been reproduced with classic sections extending org.eclipse.ui.views.properties.tabbed.AbstractPropertySection, I haven't tested it with EEF-generated sections.
Comment 1 Esteban DUGUEPEROUX CLA 2015-01-23 10:11:20 EST
Created attachment 250186 [details]
Plugin project to reproduce

I reproduce the issue with the attached project, scenario to reproduce :

1. Launch a Eclipse with Sirius and this plugin
2. Create a Modeling Project containing a ecore model in the Sirius perspective
3. Display the Properties view on EPackage selection from the Model Explorer => KO we see Section2 before Section1.
Comment 2 Vincent HEMERY CLA 2016-10-31 07:39:52 EDT
This bug no longer appear in Sirius 4.0.0.
I had a workaround in a project for it. Made all my properties in the reverse order. Once I reverted my workaround, everything works like a charm.

I don't know when the fix occurred, but anyway, you can mark it fixed for 4.0.0
Comment 3 Pierre-Charles David CLA 2016-11-03 12:48:05 EDT
Hi.

The only change in that plug-in since quite a while is https://git.eclipse.org/r/#/c/64179/. It looks like it could be the fix, as the code failed to properly read the "afterSection" attribute, which means every section was added at ITabDescriptor.TOP in turn, in the order they were read from the plugin.xml.

Thanks for the heads-up.