Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-03-28 19:49:34 +0000
committercletavernie2013-03-28 19:49:34 +0000
commitbe770ccce7438248a5a3763d4d5931ebb1d4ee08 (patch)
tree81503148ad24e4a080fd6ff3150938e05ca55c7d
parent01991bb0bf24aab5d52cc43fa86889c259816853 (diff)
downloadorg.eclipse.papyrus-be770ccce7438248a5a3763d4d5931ebb1d4ee08.tar.gz
org.eclipse.papyrus-be770ccce7438248a5a3763d4d5931ebb1d4ee08.tar.xz
org.eclipse.papyrus-be770ccce7438248a5a3763d4d5931ebb1d4ee08.zip
[Sandbox] Update the sample properties view/table integration
404531: [Table 2] Metamodel must be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=404531
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration82
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java29
2 files changed, 46 insertions, 65 deletions
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
index 884671d3b08..4566daabc62 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
@@ -1,52 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
-<nattableconfiguration:TableEditorConfiguration
- xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model"
- xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration"
- xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider"
- xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration"
- xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider"
- type="PapyruGenericNattable">
- <verticalAxisProvider xsi:type="nattableaxisprovider:DefaultAxisProvider">
- <javaContentProviderIds>org.eclipse.papyrus.uml.nattable.feature.axis.manager</javaContentProviderIds>
- <javaContentProviderIds>org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager</javaContentProviderIds>
- <axisConfiguration
- xsi:type="nattableaxisconfiguration:DefaultAxisConfiguration"
- indexStyle="ALPHABETIC" displayIndex="false">
- <labelConfiguration
- xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration"
- labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" />
- </axisConfiguration>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNegDJYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name" />
- </axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef_ZYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type" />
- </axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef-JYhEeKsVckQ7wUDqg">
- <element
- href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility" />
- </axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef7ZYhEeKsVckQ7wUDqg">
- <element
- href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/defaultValue" />
- </axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef8pYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/isDerived" />
- </axis>
- </verticalAxisProvider>
- <horizontalAxisProvider
- xsi:type="nattableaxisprovider:EMFFeatureValueAxisProvider">
- <javaContentProviderIds>org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager</javaContentProviderIds>
- <axisConfiguration
- xsi:type="nattableaxisconfiguration:DefaultAxisConfiguration"
- displayIndex="false">
- <labelConfiguration
- xsi:type="nattablelabelprovider:EObjectLabelProviderConfiguration"
- labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" />
- </axisConfiguration>
- <listenFeature xsi:type="ecore:EReference"
- href="platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//StructuredClassifier/ownedAttribute" />
- </horizontalAxisProvider>
-</nattableconfiguration:TableEditorConfiguration>
+<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" type="PapyruGenericNattable">
+ <rowAxisProvider xsi:type="nattableaxisprovider:EMFFeatureValueAxisProvider">
+ <javaAxisManagerIds>org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager</javaAxisManagerIds>
+ <axisConfiguration xsi:type="nattableaxisconfiguration:DefaultAxisConfiguration" displayIndex="false">
+ <labelConfiguration xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider"/>
+ </axisConfiguration>
+ <listenFeature xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/>
+ </rowAxisProvider>
+ <columnAxisProvider xsi:type="nattableaxisprovider:DefaultAxisProvider">
+ <javaAxisManagerIds>org.eclipse.papyrus.uml.nattable.feature.axis.manager</javaAxisManagerIds>
+ <javaAxisManagerIds>org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager</javaAxisManagerIds>
+ <axisConfiguration xsi:type="nattableaxisconfiguration:DefaultAxisConfiguration" indexStyle="ALPHABETIC" displayIndex="false">
+ <labelConfiguration xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" displayType="false"/>
+ </axisConfiguration>
+ <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNegDJYhEeKsVckQ7wUDqg">
+ <element href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/>
+ </axis>
+ <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef_ZYhEeKsVckQ7wUDqg">
+ <element href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/>
+ </axis>
+ <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef-JYhEeKsVckQ7wUDqg">
+ <element href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility"/>
+ </axis>
+ <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef7ZYhEeKsVckQ7wUDqg">
+ <element href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/defaultValue"/>
+ </axis>
+ <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef8pYhEeKsVckQ7wUDqg">
+ <element href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/isDerived"/>
+ </axis>
+ </columnAxisProvider>
+</nattableconfiguration:TableConfiguration>
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
index 0fc80957582..62d2db91d08 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
@@ -27,7 +27,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.EMFFeatureValueAxisProvider;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.views.properties.contexts.Property;
import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
@@ -135,7 +135,7 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
}
protected Table createTable(EObject sourceElement, EStructuralFeature synchronizedFeature) {
- final TableEditorConfiguration tableConfiguration = getTableEditorConfiguration();
+ final TableConfiguration tableConfiguration = getTableConfiguration();
if(tableConfiguration == null) {
return null;
}
@@ -154,36 +154,37 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
table.setName(getLabel());
table.setContext(sourceElement);
- AbstractAxisProvider rowProvider = tableConfiguration.getHorizontalAxisProvider();
+ AbstractAxisProvider rowProvider = tableConfiguration.getRowAxisProvider();
if(rowProvider == null) {
rowProvider = NattableaxisproviderFactory.eINSTANCE.createDefaultAxisProvider();
} else {
rowProvider = EcoreUtil.copy(rowProvider);
}
- if(rowProvider instanceof EMFFeatureValueAxisProvider) {
- EMFFeatureValueAxisProvider emfAxisProvider = (EMFFeatureValueAxisProvider)rowProvider;
-
- //FIXME: We should be able to manipulate EAttributes too.
- emfAxisProvider.setListenFeature(synchronizedFeature);
- }
- AbstractAxisProvider columnProvider = tableConfiguration.getVerticalAxisProvider();
+ AbstractAxisProvider columnProvider = tableConfiguration.getColumnAxisProvider();
if(columnProvider == null) {
columnProvider = NattableaxisproviderFactory.eINSTANCE.createDefaultAxisProvider();
} else {
columnProvider = EcoreUtil.copy(columnProvider);
}
- table.setHorizontalAxisProvider(rowProvider);
- table.setVerticalAxisProvider(columnProvider);
+
+ if(rowProvider instanceof EMFFeatureValueAxisProvider) {
+ EMFFeatureValueAxisProvider emfAxisProvider = (EMFFeatureValueAxisProvider)rowProvider;
+
+ emfAxisProvider.setListenFeature(synchronizedFeature);
+ }
+
+ table.setColumnAxisProvider(columnProvider);
+ table.setRowAxisProvider(rowProvider);
return table;
}
- protected TableEditorConfiguration getTableEditorConfiguration() {
+ protected TableConfiguration getTableConfiguration() {
ResourceSet resourceSet = new ResourceSetImpl();
try {
- TableEditorConfiguration tableConfiguration = (TableEditorConfiguration)EMFHelper.loadEMFModel(resourceSet, tableConfigURI);
+ TableConfiguration tableConfiguration = (TableConfiguration)EMFHelper.loadEMFModel(resourceSet, tableConfigURI);
return tableConfiguration;
} catch (Exception ex) {
Activator.log.error("Invalid table configuration", ex);

Back to the top