diff options
author | Vincent Lorenzo | 2017-05-18 14:22:52 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-05-23 13:57:57 +0000 |
commit | 15f5077b10889a0f7bf7c750777e1668f6df98b9 (patch) | |
tree | 705f9f12c3c34e66e93aeacd616251cb20afe849 /plugins | |
parent | 99f1de201d505d88d8f00206e642c7556256af47 (diff) | |
download | org.eclipse.papyrus-15f5077b10889a0f7bf7c750777e1668f6df98b9.tar.gz org.eclipse.papyrus-15f5077b10889a0f7bf7c750777e1668f6df98b9.tar.xz org.eclipse.papyrus-15f5077b10889a0f7bf7c750777e1668f6df98b9.zip |
Bug 512564: [Table][Matrix] Papyrus must provide a generic way to the user to create relationship matrix.
Bug 516579: [Table][Matrix]Papyrus must provide a dedicated Property View for Matrix
- provides a new nattableconfiguration file for a Generic Matrix For Relationship
- provides the required changes to interprete this new configuration file
- provides a dedicated property view
Change-Id: Ia56b23086891614ac332ca678a0967593789f691
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
92 files changed, 6938 insertions, 58 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF index f0e77c08cd9..27ab27b5165 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF @@ -13,11 +13,12 @@ Export-Package: org.eclipse.papyrus.infra.emf.nattable, Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)"
+ org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 3.0.0.qualifier
-Bundle-Name: EMF Nattable
+Bundle-Name: Papyrus EMF Nattable
Bundle-Activator: org.eclipse.papyrus.infra.emf.nattable.Activator
Bundle-ManifestVersion: 2
Bundle-Description: %pluginDescription
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml index 0607e42a007..764c6afb885 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml @@ -86,6 +86,10 @@ id="org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager" manager="org.eclipse.papyrus.infra.emf.nattable.manager.axis.EOperationAxisManager"> </axisManager> + <axisManager + id="org.eclipse.papyrus.infra.emf.nattable.axis.column.eobject.matrix.manager" + manager="org.eclipse.papyrus.infra.emf.nattable.manager.axis.EObjectColumnMatrixAxisManager"> + </axisManager> </extension> <extension point="org.eclipse.papyrus.infra.nattable.cellmanager"> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java new file mode 100755 index 00000000000..5f4321efc3c --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java @@ -0,0 +1,597 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.emf.nattable.manager.axis; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.papyrus.infra.emf.expressions.ExpressionsPackage; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.BooleanExpressionsFactory; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.IBooleanEObjectExpression; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.LiteralTrueExpression; +import org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList; +import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.MasterObjectAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.ICellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.IWrapper; +import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; + +/** + * This axis manager has been developed to manage the columns for Matrix. It can't be used row manager + * + * @since 3.0 + * + * + * TODO : update contents on stereotype application/unapplication (in case of stereotype expression) + * TODO : update contents when a property of a displayed object changes (in case of custom expression used to filter contents) + */ +public class EObjectColumnMatrixAxisManager extends AbstractSynchronizedOnEStructuralFeatureAxisManager { + + /** + * the expression returned when there is no expression registered in the TreeFillingConfiguration + */ + private final IBooleanEObjectExpression defaultFIlter = BooleanExpressionsFactory.eINSTANCE.createLiteralTrueExpression(); + + /** + * The table eobjects to listen to be notified when the table configuration changes + */ + private List<EObject> listenEObjects = new ArrayList<EObject>(); + + /** + * This map takes the {@link TreeFillingConfiguration} as key and its helper as value + */ + private Map<TreeFillingConfiguration, TreeFillingConfigurationHelper> map; + + /** + * This map takes a {@link EStructuralFeature} as key and the TreeFillingConfiguration providing it as value + */ + private Map<EStructuralFeature, TreeFillingConfiguration> featureVSConfiguration; + + /** + * The list of feature to listen to be notified when the table configuration change + */ + private List<EStructuralFeature> tableFeatureToListen = new ArrayList<EStructuralFeature>(); + + + /** + * the listener used to be notified when the table configuration change + */ + private Adapter tableConfigurationChangesListener = new AdapterImpl() { + + public void notifyChanged(final Notification msg) { + if (msg.isReset() || msg.isTouch()) { + return; + } + final Object listenFeature = msg.getFeature(); + boolean toListen = false; + if (listenFeature instanceof EStructuralFeature) { + final EClass eClass = (EClass) ((EStructuralFeature) listenFeature).getEContainingClass();// eContainer(); + toListen = ExpressionsPackage.eINSTANCE.getIExpression().isSuperTypeOf(eClass); + + } + // final boolean toListen = listenFeature instanceof EStructuralFeature && ((EClass) ((EStructuralFeature) listenFeature).eContainer()).isInstance(ExpressionsPackage.eINSTANCE.getIExpression()); + if (toListen || tableFeatureToListen.contains(msg.getFeature())) { + updateAxisAfterConfigurationChange(); + // 2. we init the listener to be notified when the current table configuration changes, to be able to update the columns list + cleanAndReinitListenObjects(); + + // 3. we init the list of feature to listen for the columns sources elements + cleanAndFillTreeFillingConfigurationMap(); + // TODO : update the values + // TODO reinit the listener + // TODO reinit the maps + } + }; + }; + + + + /** + * + * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#init(org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager, + * org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation, org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider) + * + * @param manager + * @param rep + * @param provider + */ + @Override + public void init(final INattableModelManager manager, final AxisManagerRepresentation rep, final AbstractAxisProvider provider) { + super.init(manager, rep, provider); + Assert.isTrue(getRepresentedContentProvider() instanceof MasterObjectAxisProvider); + // 1. we init list of feature to listen + this.listenEObjects = new ArrayList<EObject>(); + this.tableFeatureToListen = new ArrayList<EStructuralFeature>(); + this.tableFeatureToListen.add(NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration()); + this.tableFeatureToListen.add(NattableaxisconfigurationPackage.eINSTANCE.getLocalTableHeaderAxisConfiguration_AxisManagerConfigurations()); + this.tableFeatureToListen.add(NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_AxisUsedAsAxisProvider()); + this.tableFeatureToListen.add(NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule()); + this.tableFeatureToListen.add(NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources()); + + // 2. we init the listener to be notified when the current table configuration changes, to be able to update the columns list + cleanAndReinitListenObjects(); + + // 3. we init the list of feature to listen for the columns sources elements + cleanAndFillTreeFillingConfigurationMap(); + + } + + + /** + * This method add the {@link #tableConfigurationChangesListener} on this object + * + * @param eobject + * a table configuration obhect + */ + private void addListenerOnTableConfigurationObjects(final EObject eobject) { + if (null != eobject) { + if (!eobject.eAdapters().contains(this.tableConfigurationChangesListener)) {// to avoid infinite loop in some case ? + eobject.eAdapters().add(this.tableConfigurationChangesListener); + this.listenEObjects.add(eobject); + } + } + } + + /** + * This method remove the {@link #tableConfigurationChangesListener} on this object + * + * @param eobject + * a table configuration obhect + */ + private void removeListenersOnTableConfigurationObjects() { + for (final EObject current : this.listenEObjects) { + current.eAdapters().remove(this.tableConfigurationChangesListener); + } + } + + /** + * This method removes the registered listener {@link #tableConfigurationChangesListener} on all objects referenced by {@link #listenEObjects}, + * Then the listener {@link #tableConfigurationChangesListener} is applied on all interesting objects of the tableS + * + */ + private void cleanAndReinitListenObjects() { + removeListenersOnTableConfigurationObjects(); + + final Table table = getTableManager().getTable(); + if (null == table) { + return; + } + + addListenerOnTableConfigurationObjects(table); + final LocalTableHeaderAxisConfiguration columnHeaderAxisConfiguration = table.getLocalColumnHeaderAxisConfiguration(); + + // COLUMNS MANAGEMENT + // we add a listener on the columnHeaderAxisConfiguration + if (columnHeaderAxisConfiguration instanceof LocalTableHeaderAxisConfiguration) { + addListenerOnTableConfigurationObjects(columnHeaderAxisConfiguration); + + // the best way will be to listen the TreeFillingConfiguration of the AxisManagerConfigruation, but it is useless, because the referenced TreeFillingConfiguration are also accessible + // from the owned axis configuration + for (final IAxisConfiguration current : columnHeaderAxisConfiguration.getOwnedAxisConfigurations()) { + if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == 1) { + final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) current; + addListenerOnTableConfigurationObjects(treeFillingConfiguration); + + IAxis provider = treeFillingConfiguration.getAxisUsedAsAxisProvider(); + addListenerOnTableConfigurationObjects(provider); + final IBooleanEObjectExpression filterRule = treeFillingConfiguration.getFilterRule(); + addListenerOnTableConfigurationObjects(filterRule); + } + } + } + + final ICellEditorConfiguration cellEditorConfiguration = table.getOwnedCellEditorConfigurations(); + if (null != cellEditorConfiguration) { + addListenerOnTableConfigurationObjects(cellEditorConfiguration); + if (cellEditorConfiguration instanceof GenericRelationshipMatrixCellEditorConfiguration) { + final GenericRelationshipMatrixCellEditorConfiguration tmp = (GenericRelationshipMatrixCellEditorConfiguration) cellEditorConfiguration; + final IBooleanEObjectExpression filter = tmp.getCellContentsFilter(); + addListenerOnTableConfigurationObjects(filter); + } + } + + final AbstractAxisProvider axisProvider = table.getCurrentColumnAxisProvider(); + if (axisProvider instanceof IMasterAxisProvider) { + addListenerOnTableConfigurationObjects(axisProvider); + } + + final AbstractAxisProvider rowAxisProvider = table.getCurrentRowAxisProvider(); + if (rowAxisProvider instanceof IMasterAxisProvider) { + addListenerOnTableConfigurationObjects(rowAxisProvider); + } + } + + /** + * This method clear the map {@link #map} and {@link #featureVSConfiguration}, then fill them a new time with the new values + */ + private void cleanAndFillTreeFillingConfigurationMap() { + if (null == this.map) { + this.map = new HashMap<TreeFillingConfiguration, EObjectColumnMatrixAxisManager.TreeFillingConfigurationHelper>(); + } + if (null == featureVSConfiguration) { + this.featureVSConfiguration = new HashMap<EStructuralFeature, TreeFillingConfiguration>(); + } + this.map.clear(); + this.featureVSConfiguration.clear(); + + final Table table = getTableManager().getTable(); + if (null != table) { + final AbstractHeaderAxisConfiguration columnHeaderAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table); + + for (final IAxisConfiguration current : columnHeaderAxisConfiguration.getOwnedAxisConfigurations()) { + if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == 1) { + final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) current; + final TreeFillingConfigurationHelper helper = new TreeFillingConfigurationHelper(treeFillingConfiguration); + this.map.put(treeFillingConfiguration, helper); + this.featureVSConfiguration.put(helper.getEStructuralFeatureToListen(), treeFillingConfiguration); + } + } + } + } + + + + /** + * @return + * the features to listen according to the current table configuration or <code>null</code> if it is not defined + */ + protected Collection<EStructuralFeature> getListenFeatures() {// TODO : avoid to update listenfeature each time, maybe we should remove this field ? + if (null == this.map) { + cleanAndFillTreeFillingConfigurationMap(); + } + this.listenFeatures = new HashSet<EStructuralFeature>(); + for (TreeFillingConfigurationHelper helper : this.map.values()) {// TODO avoid to clean a fill each time! + final EStructuralFeature current = helper.getEStructuralFeatureToListen(); + this.listenFeatures.add(current); + } + return this.listenFeatures; + } + + + /** + * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#verifyFeatureMultiplicity() + * + */ + @Override + protected void verifyFeatureMultiplicity() { + // nothing to do + } + + /** + * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#verifyValues() + * + */ + @Override + protected void verifyValues() { + // nothing to do + } + + /** + * + * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#getFeaturesValue() + * + * @return + */ + @Override + protected List<Object> getFeaturesValue() { + getListenFeatures();// for initialization + final List<Object> values = new ArrayList<Object>(); + for (final EObject source : getColumnSources()) { + values.addAll(getListenFeatureValueFor(source)); + + } + return values; + } + + /** + * + * @param listenObject + * @return + */ + protected List<Object> getListenFeatureValueFor(final EObject listenObject) { + final List<Object> values = new ArrayList<Object>(); + for (final TreeFillingConfigurationHelper current : this.map.values()) { + final EStructuralFeature feature = current.getEStructuralFeatureToListen(); + final IBooleanEObjectExpression exp = current.getFilterRule(); + if (null != feature) { + Object value = listenObject.eGet(feature); + if (feature.isMany()) { + for (Object tmp : (Collection<?>) value) { + if (tmp instanceof EObject && exp.evaluate((EObject) tmp)) { + values.add(tmp); + } + } + } else if (value instanceof EObject && exp.evaluate((EObject) value)) { + values.add(value); + } + } + } + return values; + + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAllowedContents(java.lang.Object) + * + * @param object + * @return + */ + @Override + public boolean isAllowedContents(Object object) { + return true; + } + + /** + * This method returns <code>true</code> if the new object can be added to the column list and <code>false</code> otherwise + * + * The signature of this method has been copied from the interface {@link ITreeItemAxisManagerForEventList} + * + * @param objectToTest + * an object + * @param semanticParent + * the semantic parent of the object to test + * @param conf + * the configuration which provides the object to test + * @param depth + * the depth on which we want to apply this object + * @return + * <code>true</code> if the object is accepted and false if not + */ + public boolean isAllowedContents(final Object objectToTest, final Object semanticParent, final TreeFillingConfiguration conf, final int depth) { + boolean result = false; + if (semanticParent instanceof EObject && objectToTest instanceof EObject && null != conf && null != conf.getAxisUsedAsAxisProvider()) { + final IBooleanEObjectExpression filter = null != conf.getFilterRule() ? conf.getFilterRule() : this.defaultFIlter; + if (filter.evaluate((EObject) objectToTest)) { + result = CellManagerFactory.INSTANCE.getCrossValueAsCollection(semanticParent, conf.getAxisUsedAsAxisProvider(), this.tableManager).contains(objectToTest); + } + } + return result; + } + + /** + * + * @param notification + * update the list of the managed objects if its required + */ + @Override + protected void featureValueHasChanged(final Notification notification) { + if (notification.isTouch()) { + return; + } + final EStructuralFeature editedFeature = (EStructuralFeature) (notification.getFeature() instanceof EStructuralFeature ? notification.getFeature() : null); + if (null == editedFeature) { + return; + } + + final TreeFillingConfiguration configuration = this.featureVSConfiguration.get(editedFeature); + if (null == configuration) { + return; + } + + final int eventType = notification.getEventType(); + final EObject editedObject = (EObject) (notification.getNotifier() instanceof EObject ? notification.getNotifier() : null); + if (null == editedObject) { + return; + } + final List<Object> toAdd = new ArrayList<Object>(); + final List<Object> toRemove = new ArrayList<Object>(); + + switch (eventType) { + case Notification.REMOVING_ADAPTER: + break;// nothing to do + case Notification.ADD: + Object newValue = notification.getNewValue(); + if (isAllowedContents(newValue, editedObject, configuration, configuration.getDepth()) && !isAlreadyManaged(newValue)) { + toAdd.add(newValue); + } + break; + case Notification.ADD_MANY: + Collection<?> newValues = (Collection<?>) notification.getNewValue(); + for (final Object current : newValues) { + if (isAllowedContents(current, editedObject, configuration, configuration.getDepth()) && !isAlreadyManaged(current)) { + toAdd.add(current); + } + } + break; + case Notification.EVENT_TYPE_COUNT: + break; + case Notification.MOVE: + final Collection<EObject> collection = (Collection<EObject>) ((EObject) notification.getNotifier()).eGet((EStructuralFeature) notification.getFeature()); + final Collection<EObject> subList = getSubFromFirstNotEquals(collection, (Integer) notification.getOldValue(), getIndex(collection, (EObject) notification.getNewValue())); + + toRemove.addAll(subList); + toAdd.addAll(subList); + break; + case Notification.REMOVE: + final Object oldValue = notification.getOldValue(); + if (this.managedObject.contains(oldValue)) { + toRemove.add(oldValue); + } + break; + case Notification.REMOVE_MANY: + Collection<?> oldValues = (Collection<?>) notification.getOldValue(); + for (final Object current : oldValues) { + if (this.managedObject.contains(oldValues)) { + toRemove.add(current); + } + } + break; + case Notification.RESOLVE: + case Notification.SET: + case Notification.UNSET: + // case Notification.NO_FEATURE_ID: + // case Notification.NO_INDEX: + + default: + break; + } + if (toAdd.size() > 0 || toRemove.size() > 0) { + updateManagedList(toAdd, toRemove); + } + } + + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canBeUsedAsRowManager() + * + * @return + */ + @Override + public boolean canBeUsedAsRowManager() { + return false; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canBeUsedAsColumnManager() + * + * @return + */ + @Override + public boolean canBeUsedAsColumnManager() { + return true; + } + + /** + * + * @return + * the list of the objects used as sources to provide the columns + */ + protected List<EObject> getColumnSources() { + AbstractAxisProvider columnProvider = getTableManager().getTable().getCurrentColumnAxisProvider(); + List<EObject> context = new ArrayList<EObject>(); + if (columnProvider instanceof MasterObjectAxisProvider) { + for (IWrapper wrapper : ((MasterObjectAxisProvider) columnProvider).getSources()) { + if (wrapper.getElement() instanceof EObject) { + context.add((EObject) wrapper.getElement()); + } + } + } + return context; + } + + + /** + * This method allows to update the displayed column after changes in the table configuration + */ + protected void updateAxisAfterConfigurationChange() { + List<Object> allAxisToDisplay = new ArrayList<Object>(); + for (final IWrapper current : ((IMasterAxisProvider) getTableManager().getTable().getCurrentColumnAxisProvider()).getSources()) { + allAxisToDisplay = getListenFeatureValueFor((EObject) current.getElement()); + } + List<Object> toAdd = new ArrayList<Object>(allAxisToDisplay); + toAdd.removeAll(this.managedObject); + + + List<Object> toRemove = new ArrayList<Object>(this.managedObject); + toRemove.removeAll(allAxisToDisplay); + + updateManagedList(toAdd, toRemove); + } + + + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#dispose() + * + */ + @Override + public void dispose() { + removeListenersOnTableConfigurationObjects(); + getTableManager().getTable().eAdapters().remove(this.tableConfigurationChangesListener); + this.tableFeatureToListen.clear(); + this.featureVSConfiguration.clear(); + this.map.clear(); + super.dispose(); + } + + /** + * + * An helper to ease access to TreeFillingConfiguration data + * + */ + protected class TreeFillingConfigurationHelper { + + /** + * the expression returned when there is no expression registered in the TreeFillingConfiguration + */ + private final IBooleanEObjectExpression defaultExpression = BooleanExpressionsFactory.eINSTANCE.createLiteralTrueExpression(); + + /** + * The TreeFillingConfiguration + */ + private final TreeFillingConfiguration fillingConfiguration; + + /** + * + * Constructor. + * + * @param configuration + * the TreeFillingConfiguration on which will work this helper + */ + public TreeFillingConfigurationHelper(final TreeFillingConfiguration configuration) { + this.fillingConfiguration = configuration; + } + + /** + * + * @return + * the filter rule registered in the TreeFillingConfiguration or {@link LiteralTrueExpression} when no expression is registered + */ + public IBooleanEObjectExpression getFilterRule() { + return null == this.fillingConfiguration.getFilterRule() ? this.defaultExpression : this.fillingConfiguration.getFilterRule(); + } + + private Object getFeatureToListen() { + if (null != this.fillingConfiguration.getAxisUsedAsAxisProvider()) { + return this.fillingConfiguration.getAxisUsedAsAxisProvider().getElement(); + } + return null; + } + + /** + * + * @return + * the {@link EStructuralFeature} to listen + */ + public EStructuralFeature getEStructuralFeatureToListen() { + return (EStructuralFeature) (getFeatureToListen() instanceof EStructuralFeature ? getFeatureToListen() : null); + } + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java index 50d4c426794..f2d81d6de77 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java @@ -26,6 +26,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef; import org.eclipse.papyrus.infra.core.sashwindows.di.Window; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.IBooleanEObjectExpression; import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractTreeAxisManagerForEventList; @@ -116,10 +117,14 @@ public class EObjectTreeAxisManagerForEventList extends AbstractTreeAxisManagerF */ @Override public boolean isAllowedContents(Object objectToTest, Object semanticParent, TreeFillingConfiguration conf, int depth) { + boolean result = false; if (objectToTest instanceof EObject) { - return true; + if (null != conf && null != conf.getFilterRule() && conf.getFilterRule() instanceof IBooleanEObjectExpression) { + return ((IBooleanEObjectExpression) conf.getFilterRule()).evaluate((EObject) objectToTest).booleanValue(); + } + result = true; } - return false; + return result; } /** @@ -152,7 +157,7 @@ public class EObjectTreeAxisManagerForEventList extends AbstractTreeAxisManagerF * @param notification * a notification * @return - * <code>true</code> if the notification must be ignored + * <code>true</code> if the notification must be ignored */ protected boolean ignoreEvent(final Notification notification) { boolean res = super.ignoreEvent(notification); diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java index 00112572b60..eb4a42b15f2 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java @@ -40,6 +40,7 @@ import org.eclipse.papyrus.infra.nattable.common.Activator; import org.eclipse.papyrus.infra.nattable.common.helper.TableReconcileHelper; import org.eclipse.papyrus.infra.nattable.common.reconciler.TableVersioningUtils; import org.eclipse.papyrus.infra.nattable.common.utils.TableEditorInput; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage; @@ -238,6 +239,12 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na if (adapter == INattableModelManager.class) { return this.tableManager; } + if(adapter == IMatrixTableWidgetManager.class) { + if(this.tableManager instanceof IMatrixTableWidgetManager) { + return this.tableManager; + } + return null; + } // Give direct access to the Table model element // Most actions should be done through the TableManager. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF index e760eb8c197..5196ef686b6 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF @@ -1,5 +1,6 @@ Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.nattable.properties.constraints
+Export-Package: org.eclipse.papyrus.infra.nattable.properties.constraints,
+ org.eclipse.papyrus.infra.nattable.properties.observable
Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
@@ -8,7 +9,8 @@ Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3 org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 2.2.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx index bed8cc6b562..b83c60e1abe 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx @@ -204,7 +204,7 @@ <widget href="ui/EObjectInTreeTable.xwt#/"/> </sections> </tabs> - <tabs xmi:id="_bYfDCJLDEeWbp4A9_-WIrQ" label="Appearance" id="TableAppearance" category="org.eclipse.papyrus" afterTab="_bYd04ZLDEeWbp4A9_-WIrQ" priority="12"> + <tabs xmi:id="_bYfDCJLDEeWbp4A9_-WIrQ" label="Appearance" id="TableAppearance" category="org.eclipse.papyrus" afterTab="_bYd04ZLDEeWbp4A9_-WIrQ" priority="13"> <sections xmi:id="_hIAtIJQtEeWx9KtEop_Tug" name="SingleNormalTableAppearance" sectionFile="ui/SingleNormalTableAppearance.xwt"> <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_2SAlsJQtEeWx9KtEop_Tug" name="isNormalTable"> <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.nattable.properties/model/Environment.xmi#//@constraintTypes.0"/> @@ -282,7 +282,7 @@ <widget href="ui/EObjectInTableRowObjectLabelProviderConfiguration.xwt#/"/> </sections> </tabs> - <tabs xmi:id="_bYfDFpLDEeWbp4A9_-WIrQ" label="Paste" id="Paste In Table" category="org.eclipse.papyrus" afterTab="_bYfDCJLDEeWbp4A9_-WIrQ" priority="13"> + <tabs xmi:id="_bYfDFpLDEeWbp4A9_-WIrQ" label="Paste" id="Paste In Table" category="org.eclipse.papyrus" afterTab="_bYfDCJLDEeWbp4A9_-WIrQ" priority="14"> <sections xmi:id="_bYfDF5LDEeWbp4A9_-WIrQ" name="CanPasteEObjectColumnSection" sectionFile="ui/CanPasteEObjectColumnSection.xwt"> <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_bYfDGJLDEeWbp4A9_-WIrQ" name="canPasteColumnEObjectConstraint"> <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.properties.ui/model/Environment.xmi#//@constraintTypes.4"/> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java index e759b7a95ae..ee6662205aa 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java @@ -250,7 +250,7 @@ public class NatTableModelElement extends EMFModelElement { */ private void removeListeners() { // COLUMNS MANAGEMENT - // we add a listener on the columnHeaderAxisConfiguration + // we remove the listener on the columnHeaderAxisConfiguration if (columnHeaderAxisConfiguration != null) { columnHeaderAxisConfiguration.eAdapters().remove(tableListener); } @@ -258,20 +258,20 @@ public class NatTableModelElement extends EMFModelElement { if (this.columnLabelProviderConfigurations != null) { - // we add listener on all column label configurations + // we remove the listener on all column label configurations for (final ILabelProviderConfiguration conf : columnLabelProviderConfigurations) { conf.eAdapters().remove(tableListener); } } // ROW MANAGEMENT - // we add a listener on the rowHeaderAxisConfiguration + // we remove the listener on the rowHeaderAxisConfiguration if (rowHeaderAxisConfiguration != null) { rowHeaderAxisConfiguration.eAdapters().remove(tableListener); } if (this.rowLabelProviderConfigurations != null) { - // we add listener on all column label configurations + // we remove the listener on all row label configurations for (final ILabelProviderConfiguration conf : rowLabelProviderConfigurations) { conf.eAdapters().remove(tableListener); } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java index 81b821e066d..441dadc6141 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java @@ -24,7 +24,7 @@ import org.eclipse.swt.widgets.Listener; /** * Abstract Observable Value to update axis configuration * - * @author vl222926 + * @since 2.2 * */ public abstract class AbstractConfigurationElementObservableValue extends AbstractObservableValue implements Listener { @@ -42,7 +42,7 @@ public abstract class AbstractConfigurationElementObservableValue extends Abstra /** * the last value of the managed feature */ - private Object oldValue; + protected Object oldValue; /** * diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java new file mode 100755 index 00000000000..bfc65745969 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java @@ -0,0 +1,56 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.contentprovider; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EEnumLiteral; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage; +import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; + +/** + * This class provides the available relationship direction required to edit relationship in case of matrix table + * + * @since 3.0 + * + */ +public class MatrixDirectionContentProvider implements IStaticContentProvider { + + /** + * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) + * + * @param inputElement + * @return + */ + @Override + public Object[] getElements(Object inputElement) { + return getElements(); + } + + /** + * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements() + * + * @return + */ + @Override + public Object[] getElements() { + final List<Object> values = new ArrayList<Object>(); + for (EEnumLiteral lit : NattablecelleditorPackage.eINSTANCE.getMatrixRelationShipDirection().getELiterals()) { + values.add(lit.getInstance()); + } + return values.toArray(); + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java new file mode 100755 index 00000000000..6cf95d70e8b --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.contentprovider; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.ui.emf.utils.EcoreModelContentProvider; +import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; + +/** + * + * This class provides the elements of the model to used them as source for the rows and columns of the matrix + * + * @since 3.0 + * + */ +public class MatrixSourcesContentProvider extends EcoreModelContentProvider implements IStaticContentProvider { + + /** + * Constructor. + * + * @param root + */ + public MatrixSourcesContentProvider(EObject root) { + super(root); + } + + /** + * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements() + * + * @return + */ + @Override + public Object[] getElements() { + return getElements(null); + } + + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java index 84ac4e5de32..dad48147c3e 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java @@ -29,7 +29,6 @@ import org.eclipse.papyrus.infra.nattable.dataprovider.BodyDataProvider; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.sort.IPapyrusSortModel; import org.eclipse.papyrus.infra.nattable.sort.PapyrusCompositeGlazedListSortModel; -import org.eclipse.papyrus.infra.nattable.sort.PapyrusGlazedListsSortModel; import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils; /** diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java index a5e9842f24a..0919d528366 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java @@ -80,7 +80,7 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos */ @Override protected void axisManagerHasChanged(final Notification notification) { - if (notification.isTouch()) { + if (notification.isTouch() || NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis()!=notification.getFeature()) { return; } final List<Object> newListValue = new ArrayList<Object>(this.managedObject); diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java index 638feaa400f..c35b9bc4948 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java @@ -13,11 +13,13 @@ *****************************************************************************/ package org.eclipse.papyrus.infra.nattable.manager.cell; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -58,6 +60,11 @@ public final class CellManagerFactory { private final Map<Integer, Collection<ICellManager>> managersMap; /** + * The list of registered axis manager + */ + private final List<IGenericMatrixRelationshipCellManager> matrixManagers; + + /** * The cell manager factory */ public static final CellManagerFactory INSTANCE = new CellManagerFactory(); @@ -69,6 +76,7 @@ public final class CellManagerFactory { */ private CellManagerFactory() { this.managersMap = new TreeMap<Integer, Collection<ICellManager>>(); + this.matrixManagers = new ArrayList<IGenericMatrixRelationshipCellManager>(); final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); for (final IConfigurationElement iConfigurationElement : configElements) { @@ -81,6 +89,9 @@ public final class CellManagerFactory { if (!this.managersMap.containsKey(order)) { this.managersMap.put(order, new HashSet<ICellManager>()); } + if (solver instanceof IGenericMatrixRelationshipCellManager) { + this.matrixManagers.add((IGenericMatrixRelationshipCellManager) solver); + } this.managersMap.get(order).add(new StringResolutionProblemWrapperCellManager(solver)); } catch (final CoreException e) { Activator.log.error(e); @@ -385,4 +396,13 @@ public final class CellManagerFactory { } return null; } + + /** + * @return + * the list of known {@link IGenericMatrixRelationshipCellManager}. Warning, this method ignores the order defined by the user + * @since 3.0 + */ + public List<IGenericMatrixRelationshipCellManager> getRegisteredGenericMatrixRelationshipCellManager() { + return matrixManagers; + } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java new file mode 100755 index 00000000000..394dc80d6ca --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java @@ -0,0 +1,32 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.manager.cell; + +import org.eclipse.emf.ecore.EClass; + +/** + * Common interface for matrix cell manager + * + * @since 3.0 + * + */ +public interface IGenericMatrixRelationshipCellManager extends ICellManager /* , IUnsetValueCellManager */ { // unset have no sense for relationship + + /** + * + * @return + * the EClass representing the managed relationship + */ + public EClass getManagedRelationship(); +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java new file mode 100755 index 00000000000..e4f45b661cb --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java @@ -0,0 +1,23 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.manager.table; + +/** + * This interface is here to manage the code specific for Matrix + * + * @since 3.0 + */ +public interface IMatrixTableWidgetManager extends INattableModelManager { + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java index 098656b446b..91c03ed55f5 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * CEA LIST - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
*
*****************************************************************************/
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java new file mode 100755 index 00000000000..0bf56c01928 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java @@ -0,0 +1,183 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.manager.table; + +import java.util.Collection; + +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.selection.ISelectionExtractor; + +/** + * The manager to use for Matrix + * + * @since 3.0 + * + */ +public class MatrixTableWidgetModelManager extends TreeNattableModelManager implements IMatrixTableWidgetManager { + + /** + * Constructor. + * + * @param rawModel + * @param selectionExtractor + * @param initializeListeners + */ + public MatrixTableWidgetModelManager(Table rawModel, ISelectionExtractor selectionExtractor, boolean initializeListeners) { + super(rawModel, selectionExtractor, initializeListeners); + } + + /** + * Constructor. + * + * @param rawModel + * @param selectionExtractor + */ + public MatrixTableWidgetModelManager(Table rawModel, ISelectionExtractor selectionExtractor) { + super(rawModel, selectionExtractor); + } + + /** + * Constructor. + * + * @param rawModel + */ + public MatrixTableWidgetModelManager(Table rawModel) { + super(rawModel); + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canDropRowElement(java.util.Collection) + * + * @param objectsToAdd + * @return + */ + @Override + public boolean canDropRowElement(Collection<Object> objectsToAdd) { + return false; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canDropColumnsElement(java.util.Collection) + * + * @param objectsToAdd + * @return + */ + @Override + public boolean canDropColumnsElement(Collection<Object> objectsToAdd) { + return false; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canInvertAxis() + * + * @return + */ + @Override + public boolean canInvertAxis() { + return false; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateColumnElement(java.lang.String) + * + * @param elementType + * @return + */ + @Override + public boolean canCreateColumnElement(String elementType) { + return false; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateDestroyRowsAxis() + * + * @return + */ + @Override + public boolean canCreateDestroyRowsAxis() { + return false; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canMoveColumns() + * + * @return + */ + @Override + public boolean canMoveColumns() { + return false; + } + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canInsertRow(java.util.Collection, int) + * + * @param objectsToAdd + * @param index + * @return + */ + @Override + public boolean canInsertRow(Collection<Object> objectsToAdd, int index) { + return false; + } + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canInsertColumns(java.util.Collection, int) + * + * @param objectsToAdd + * @param index + * @return + */ + @Override + public boolean canInsertColumns(Collection<Object> objectsToAdd, int index) { + return false; + } + + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canMoveRows() + * + * @return + */ + @Override + public boolean canMoveRows() { + return false; + } + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateRowElement(java.lang.String) + * + * @param elementType + * @return + */ + @Override + public boolean canCreateRowElement(String elementType) { + return false; + } + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateDestroyColumnsAxis() + * + * @return + */ + @Override + public boolean canCreateDestroyColumnsAxis() { + return false; + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java index 5f6a26dce13..ef8e9290ce2 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java @@ -564,24 +564,37 @@ public class TreeNattableModelManager extends NattableModelManager implements IT if (columnAxisManager) { return super.createAxisManager(representations, contentProvider, columnAxisManager); } else { - CompositeTreeAxisManagerForEventList compositeAxisManager = new CompositeTreeAxisManagerForEventList(horizontalFilterList); - final List<IAxisManagerForEventList> managers = new ArrayList<IAxisManagerForEventList>(); - for (AxisManagerRepresentation current : representations) { - final IAxisManager manager = AxisManagerFactory.INSTANCE.getAxisManager(current); - Assert.isTrue(manager instanceof IAxisManagerForEventList); - manager.init(this, current, contentProvider); - managers.add((IAxisManagerForEventList) manager); - - } - compositeAxisManager.init(this, null, contentProvider); - DatumTreeFormat treeFormat = getTreeFormat(); - treeFormat.setTreeComparatorProvider(compositeAxisManager); - this.expansionModel.setAxisManager(compositeAxisManager); - ((CompositeAxisManagerForEventList) compositeAxisManager).setSubManagers(managers); - return compositeAxisManager; + return createTreeAxisManager(representations, contentProvider, columnAxisManager); } } + + /** + * + * @param representations + * @param contentProvider + * @param columnAxisManager + * @return + * the Composite axis manager used to manage Tree + * @since 3.0 + */ + protected ICompositeAxisManager createTreeAxisManager(List<AxisManagerRepresentation> representations, AbstractAxisProvider contentProvider, boolean columnAxisManager) { + CompositeTreeAxisManagerForEventList compositeAxisManager = new CompositeTreeAxisManagerForEventList(horizontalFilterList); + final List<IAxisManagerForEventList> managers = new ArrayList<IAxisManagerForEventList>(); + for (AxisManagerRepresentation current : representations) { + final IAxisManager manager = AxisManagerFactory.INSTANCE.getAxisManager(current); + Assert.isTrue(manager instanceof IAxisManagerForEventList); + manager.init(this, current, contentProvider); + managers.add((IAxisManagerForEventList) manager); + + } + compositeAxisManager.init(this, null, contentProvider); + DatumTreeFormat treeFormat = getTreeFormat(); + treeFormat.setTreeComparatorProvider(compositeAxisManager); + this.expansionModel.setAxisManager(compositeAxisManager); + ((CompositeAxisManagerForEventList) compositeAxisManager).setSubManagers(managers); + return compositeAxisManager; + } /** * @see org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager#getTreeFormat() diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java index 4094c995644..a7c441a628e 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java @@ -490,6 +490,12 @@ public class Messages extends NLS { */ public static String ExportTableDialog_OverrideConfirmMessasgeDialogText; + public static String MatrixRelationshipDirectionLabelProvider_None; + + public static String MatrixRelationshipDirectionLabelProvider_RowToColumn; + + public static String MatrixRelationshipDirectionLabelProvider_ColumnToRow; + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties index 257bb34c177..fbf2c43eae7 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties @@ -213,4 +213,7 @@ ExportTableDialog_SelectOutputFormatLabel=Select the output format ExportTableDialog_ContainerSelectionDialogTitle=Please select the output directory ExportTableDialog_SelectTreeActionLabel=Select the action for tree table ExportTableDialog_OverrideConfirmMessasgeDialogMessage=The destination directory already contains the file "{0}". Do you really want to override it? -ExportTableDialog_OverrideConfirmMessasgeDialogText=Override confirmation
\ No newline at end of file +ExportTableDialog_OverrideConfirmMessasgeDialogText=Override confirmation +MatrixRelationshipDirectionLabelProvider_None=None +MatrixRelationshipDirectionLabelProvider_RowToColumn=From Row To Column +MatrixRelationshipDirectionLabelProvider_ColumnToRow=From Column To Row diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF new file mode 100644 index 00000000000..e1781eafb36 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF @@ -0,0 +1,39 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.papyrus.customization.nattableconfiguration;singleton:=true +Bundle-Version: 2.0.0.qualifier +Bundle-Activator: org.eclipse.papyrus.customization.nattableconfiguration.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf.transaction;bundle-version="1.9.0", + org.eclipse.ui.forms, + org.eclipse.jface, + org.eclipse.swt, + org.eclipse.emf.common.ui, + org.eclipse.emf.edit.ui, + org.eclipse.ui.ide, + org.eclipse.pde.ui, + org.eclipse.nebula.widgets.nattable.core;bundle-version="1.4.0", + org.eclipse.gmf.runtime.emf.type.core, + org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.ui.emf;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.papyrus.customization.nattableconfiguration, + org.eclipse.papyrus.customization.nattableconfiguration.edition, + org.eclipse.papyrus.customization.nattableconfiguration.handlers, + org.eclipse.papyrus.customization.nattableconfiguration.helper, + org.eclipse.papyrus.customization.nattableconfiguration.messages, + org.eclipse.papyrus.customization.nattableconfiguration.pages, + org.eclipse.papyrus.customization.nattableconfiguration.utils +Bundle-Vendor: %Bundle-Vendor +Bundle-Description: %Bundle-Description +Bundle-Localization: plugin diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java new file mode 100755 index 00000000000..e90f124e62c --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java @@ -0,0 +1,113 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.provider; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.papyrus.infra.nattable.messages.Messages; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.MatrixRelationShipDirection; +import org.eclipse.swt.graphics.Image; + +/** + * The label provider to use for the enumeration used to define the relationship direction + * + * @since 3.0 + * + */ +public class MatrixRelationshipDirectionLabelProvider implements ILabelProvider { + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) + * + * @param listener + */ + @Override + public void addListener(ILabelProviderListener listener) { + + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() + * + */ + @Override + public void dispose() { + + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) + * + * @param element + * @param property + * @return + */ + @Override + public boolean isLabelProperty(Object element, String property) { + return false; + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) + * + * @param listener + */ + @Override + public void removeListener(ILabelProviderListener listener) { + + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + * + * @param element + * @return + */ + @Override + public Image getImage(Object element) { + return null; + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + * + * @param direction + * @return + */ + @Override + public String getText(Object direction) { + MatrixRelationShipDirection instance = null; + if (direction instanceof MatrixRelationShipDirection) { + instance = (MatrixRelationShipDirection) direction; + } + String label = ""; //$NON-NLS-1$ + if (null != instance) { + switch (instance.getValue()) { + case MatrixRelationShipDirection.NONE_VALUE: + label = Messages.MatrixRelationshipDirectionLabelProvider_None; + break; + case MatrixRelationShipDirection.FROM_ROW_TO_COLUMN_VALUE: + label = Messages.MatrixRelationshipDirectionLabelProvider_RowToColumn; + break; + case MatrixRelationShipDirection.FROM_COLUMN_TO_ROW_VALUE: + label = Messages.MatrixRelationshipDirectionLabelProvider_ColumnToRow; + break; + default: + // nothing to do + } + } + return label; + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java index 7b04732a7a9..7b47f84626b 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java @@ -17,9 +17,13 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
/**
@@ -39,7 +43,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* a table
* @return
- * the header configuration defined in the table and used for rows, mananing the inversion of the axis or <code>null</code> if we aer
+ * the header configuration defined in the table and used for rows, managing the inversion of the axis or <code>null</code> if we aer
* using the
* configuration defined in the table configuration
*/
@@ -56,7 +60,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* a table
* @return
- * the header configuration defined in the tableconfiguration for rows, mananing the inversion of the axis. The result can't be <code>null</code>
+ * the header configuration defined in the tableconfiguration for rows, managing the inversion of the axis. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisInTableConfiguration(final Table table) {
AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
@@ -72,7 +76,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* the table
* @return
- * the header configuration used for rows in the table. The result can't be <code>null</code>
+ * the header configuration used for rows in the table. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
@@ -88,7 +92,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* a table
* @return
- * the header configuration defined in the table and used for columns, managing the inversion of the axis or <code>null</code> if we are
+ * the header configuration defined in the table and used for columns, managing the inversion of the axis or <code>null</code> if we are
* using the configuration defined in the table configuration
*/
public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTable(final Table table) {
@@ -104,7 +108,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* a table
* @return
- * the header configuration defined in the tableconfiguration for columns, mananing the inversion of the axis. The result can't be <code>null</code>
+ * the header configuration defined in the tableconfiguration for columns, mananing the inversion of the axis. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTableConfiguration(final Table table) {
AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
@@ -120,7 +124,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* the table
* @return
- * the header configuration used for columns in the table. The result can't be <code>null</code>
+ * the header configuration used for columns in the table. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
AbstractHeaderAxisConfiguration config = getColumnAbstractHeaderAxisInTable(table);
@@ -136,7 +140,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param table
* the table
* @return
- * the header configuration used for row in the table. The result can't be <code>null</code>
+ * the header configuration used for row in the table. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisUsedInTable(final Table table) {
AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
@@ -152,7 +156,7 @@ public class HeaderAxisConfigurationManagementUtils { * @param configuration
* the configuration to duplicate
* @return
- * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
+ * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
*/
public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfiguration(final TableHeaderAxisConfiguration configuration) {
LocalTableHeaderAxisConfiguration conf = NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration();
@@ -167,4 +171,36 @@ public class HeaderAxisConfigurationManagementUtils { return conf;
}
+ /**
+ *
+ * @param configuration
+ * the configuration to duplicate, with all its configuration
+ * @return
+ * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
+ * @since 3.0
+ */
+ public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfigurationIncludingAllConfigurations(final TableHeaderAxisConfiguration configuration) {
+ final LocalTableHeaderAxisConfiguration conf = transformToLocalHeaderConfiguration(configuration);
+ for (final AxisManagerRepresentation axisManagers : configuration.getAxisManagers()) {
+ final AxisManagerConfiguration currentConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
+ currentConfiguration.setAxisManager(axisManagers);
+ for (final Style current : axisManagers.getStyles()) {
+ Style copy = EcoreUtil.copy(current);
+ axisManagers.getStyles().add(copy);
+ }
+
+ for (final IAxisConfiguration axisConf : axisManagers.getSpecificAxisConfigurations()) {
+ final IAxisConfiguration tmp = EcoreUtil.copy(axisConf);
+ conf.getOwnedAxisConfigurations().add(tmp);
+ currentConfiguration.getLocalSpecificConfigurations().add(tmp);
+ }
+ final ILabelProviderConfiguration labelProviderConfiguration = EcoreUtil.copy(axisManagers.getHeaderLabelConfiguration());
+ currentConfiguration.setLocalHeaderLabelConfiguration(labelProviderConfiguration);
+ conf.getOwnedLabelConfigurations().add(labelProviderConfiguration);
+ conf.getAxisManagerConfigurations().add(currentConfiguration);
+
+ }
+ return conf;
+ }
+
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java index 2c30cef5f39..efaa6ceb0f4 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.utils; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.manager.table.MatrixTableWidgetModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; @@ -58,6 +59,9 @@ public class NattableModelManagerFactory { * @since 3.0 */ public INattableModelManager createNatTableModelManager(final Table table, final ISelectionExtractor selectionExtractor, final boolean initializeListeners) { + if(TableHelper.isMatrixTreeTable(table)) { + return new MatrixTableWidgetModelManager(table, selectionExtractor, initializeListeners); + } if (TableHelper.isTreeTable(table)) { return new TreeNattableModelManager(table,selectionExtractor, initializeListeners); } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java index 51074485947..6cab18cdc17 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java @@ -25,6 +25,9 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorFactory; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.CellEditorDeclaration; import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration; import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle; @@ -122,6 +125,20 @@ public class TableHelper { IntListValueStyle copy = EcoreUtil.copy(style); table.getStyles().add(copy); } + + + if(isMatrixTreeTable(table)) { + if(null!=configuration.getOwnedCellEditorConfigurations()) { + table.setOwnedCellEditorConfigurations(EcoreUtil.copy(configuration.getOwnedCellEditorConfigurations())); + }else { + //we can do it because currently, we only have one possible type for that! + GenericRelationshipMatrixCellEditorConfiguration conf = NattablecelleditorFactory.eINSTANCE.createGenericRelationshipMatrixCellEditorConfiguration(); + conf.setCellEditorId("GenericRelationshipMatrixEditorConfiguration"); //$NON-NLS-1$ + table.setOwnedCellEditorConfigurations(conf); + } + Assert.isNotNull(table.getOwnedCellEditorConfigurations(), "A matrix must own a CellEditorConfiguration"); //$NON-NLS-1$ + } + return table; } @@ -349,5 +366,20 @@ public class TableHelper { parent = parent.getParent(); } } + + /** + * + * @param table + * a table + * @return + * <code>true</code> if the table is a matrix. That is to say + * @since 3.0 + */ + public static final boolean isMatrixTreeTable(final Table table) { + final AbstractAxisProvider rowsAxisProvider = table.getCurrentRowAxisProvider(); + final AbstractAxisProvider columnsAxisProvider = table.getCurrentColumnAxisProvider(); + return isTreeTable(table) && rowsAxisProvider instanceof IMasterAxisProvider && columnsAxisProvider instanceof IMasterAxisProvider; + + } } diff --git a/plugins/sysml/architecture/org.eclipse.papyrus.sysml.architecture/model/sysml.architecture b/plugins/sysml/architecture/org.eclipse.papyrus.sysml.architecture/model/sysml.architecture index 895107961df..4012c549e26 100644 --- a/plugins/sysml/architecture/org.eclipse.papyrus.sysml.architecture/model/sysml.architecture +++ b/plugins/sysml/architecture/org.eclipse.papyrus.sysml.architecture/model/sysml.architecture @@ -15,6 +15,7 @@ <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrus.uml.architecture/model/uml.architecture#_yeY0sHDvEeWh-MssWmCB_A"/>
<representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" href="#_m2D8IHDuEeWh-MssWmCB_A"/>
<representationKinds xsi:type="nattablerepresentation:PapyrusTable" href="#_lTE0gHDwEeWh-MssWmCB_A"/>
+ <representationKinds xsi:type="nattablerepresentation:PapyrusTable" href="platform:/plugin/org.eclipse.papyrus.uml.architecture/model/uml.architecture#_d4-QwCT-EeedRqoTe_1ZiA"/> </viewpoints>
<viewpoints xmi:id="_PAtvoMShEeaKZJ_pGfaSiA" name="Systems Design" description="A viewpoint allowing systems design with SysML" id="org.eclipse.papyrus.sysml.design">
<representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" href="#_m2D8IHDuEeWh-MssWmCB_A"/>
@@ -33,6 +34,7 @@ <representationKinds xsi:type="nattablerepresentation:PapyrusTable" href="platform:/plugin/org.eclipse.papyrus.uml.architecture/model/uml.architecture#_P3J1cEa7EeSVGbM3cmVSqQ"/>
<representationKinds xsi:type="nattablerepresentation:PapyrusTable" href="platform:/plugin/org.eclipse.papyrus.uml.architecture/model/uml.architecture#_WC1q0P4UEhSRsNBVzfUrzA"/>
<representationKinds xsi:type="nattablerepresentation:PapyrusTable" href="platform:/plugin/org.eclipse.papyrus.uml.architecture/model/uml.architecture#_wXztQHDwEwWh-MssWmCB_A"/>
+ <representationKinds xsi:type="nattablerepresentation:PapyrusTable" href="platform:/plugin/org.eclipse.papyrus.uml.architecture/model/uml.architecture#_d4-QwCT-EeedRqoTe_1ZiA"/> </viewpoints>
<elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.emf/model/infra-emf.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
<elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/gmfdiag-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture index 795155c1604..c6cd12f2d35 100644 --- a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture @@ -7,8 +7,8 @@ <concerns xmi:id="_HQhf48SYEeaKZJ_pGfaSiA" name="Structure" description="The concern of developing the system's structure"/>
<concerns xmi:id="_HQhf5MSYEeaKZJ_pGfaSiA" name="Behavior" description="The concern of developing the system's behavior"/>
<contexts xsi:type="architecture:ArchitectureDescriptionLanguage" xmi:id="_HQhf5cSYEeaKZJ_pGfaSiA" name="UML" description="The Unified Modeling Language" id="org.eclipse.papyrus.infra.services.edit.TypeContext" icon="platform:/plugin/org.eclipse.papyrus.uml.architecture/icons/uml.gif" creationCommandClass="org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand">
- <viewpoints xmi:id="_HQhf5sSYEeaKZJ_pGfaSiA" name="Software Analysis" description="A viewpoint allowing software analysis with UML" representationKinds="_yeY0sHDvEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A _zzf4cXDtEeWh-MssWmCB_A _P3J1cEb7EeRVGbM3cmVSqQ _Uz8agHDcEeWh-MssWmCB_A _P3J1cEa7EeSVGbM3cmVSqQ _WC1q0P4UEhSRsNBVzfUrzA _wXztQHDwEwWh-MssWmCB_A" id="org.eclipse.papyrus.uml.analysis"/>
- <viewpoints xmi:id="_OOrIUMSZEeaKZJ_pGfaSiA" name="Software Design" description="A viewpoint allowing software design with UML" representationKinds="_UzcgsHDtEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A _jRtroHDuEeWh-MssWmCB_A _fa4kAHDuEeWh-MssWmCB_A _fa4kBHDuEeWh-MssWmCB_A _bKiwMHDuEeWh-MssWmCB_A _bKiwNHDuEeWh-MssWmCB_A _ARGokHDuEeWh-MssWmCB_A _zzf4YHDtEeWh-MssWmCB_A _FuMjYHDuEeWh-MssWmCB_A _zzf4cXDtEeWh-MssWmCB_A _TR15IHDvEeWh-MssWmCB_A _PwD0cHDvEeWh-MssWmCB_A _LzyMIHDvEeWh-MssWmCB_A _P3J1cEb7EeRVGbM3cmVSqQ _Uz8agHDcEeWh-MssWmCB_A _P3J1cEa7EeSVGbM3cmVSqQ _WC1q0P4UEhSRsNBVzfUrzA _wXztQHDwEwWh-MssWmCB_A" id="org.eclipse.papyrus.uml.design"/>
+ <viewpoints xmi:id="_HQhf5sSYEeaKZJ_pGfaSiA" name="Software Analysis" description="A viewpoint allowing software analysis with UML" representationKinds="_yeY0sHDvEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A _zzf4cXDtEeWh-MssWmCB_A _P3J1cEb7EeRVGbM3cmVSqQ _Uz8agHDcEeWh-MssWmCB_A _P3J1cEa7EeSVGbM3cmVSqQ _WC1q0P4UEhSRsNBVzfUrzA _wXztQHDwEwWh-MssWmCB_A _d4-QwCT-EeedRqoTe_1ZiA" id="org.eclipse.papyrus.uml.analysis"/>
+ <viewpoints xmi:id="_OOrIUMSZEeaKZJ_pGfaSiA" name="Software Design" description="A viewpoint allowing software design with UML" representationKinds="_UzcgsHDtEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A _jRtroHDuEeWh-MssWmCB_A _fa4kAHDuEeWh-MssWmCB_A _fa4kBHDuEeWh-MssWmCB_A _bKiwMHDuEeWh-MssWmCB_A _bKiwNHDuEeWh-MssWmCB_A _ARGokHDuEeWh-MssWmCB_A _zzf4YHDtEeWh-MssWmCB_A _FuMjYHDuEeWh-MssWmCB_A _zzf4cXDtEeWh-MssWmCB_A _TR15IHDvEeWh-MssWmCB_A _PwD0cHDvEeWh-MssWmCB_A _LzyMIHDvEeWh-MssWmCB_A _P3J1cEb7EeRVGbM3cmVSqQ _Uz8agHDcEeWh-MssWmCB_A _P3J1cEa7EeSVGbM3cmVSqQ _WC1q0P4UEhSRsNBVzfUrzA _wXztQHDwEwWh-MssWmCB_A _d4-QwCT-EeedRqoTe_1ZiA" id="org.eclipse.papyrus.uml.design"/>
<elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.emf/model/infra-emf.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
<elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/notation.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
<elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/gmfdiag-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
@@ -423,6 +423,15 @@ </owningRules>
<configuration href="platform:/plugin/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration#/"/>
</representationKinds>
+ <representationKinds xsi:type="nattablerepresentation:PapyrusTable" xmi:id="_d4-QwCT-EeedRqoTe_1ZiA" name="Matrix of Relationships" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.matrix/icons/uml_generic_matrix_relationships.png" implementationID="UMLGenericMatrixOfRelationships">
+ <modelRules xmi:id="_d4-QwST-EeedRqoTe_1ZiA">
+ <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
+ </modelRules>
+ <owningRules xmi:id="_d4-QwiT-EeedRqoTe_1ZiA">
+ <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
+ </owningRules>
+ <configuration href="../../org.eclipse.papyrus.uml.nattable.matrix/configs/generic_matrix_of_relationships.nattableconfiguration#/"/>
+ </representationKinds>
<metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
</contexts>
<contexts xsi:type="architecture:ArchitectureFramework" xmi:id="__ZqwAMSlEeaCPPhpB0_9OQ" name="Profile" description="The Profile Definition Framework" id="org.eclipse.papyrus.uml.architecture.Profile" icon="platform:/plugin/org.eclipse.papyrus.uml.architecture/icons/profile.gif" extensionPrefix="profile" creationCommandClass="org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand">
diff --git a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsKindOfExpression.java b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsKindOfExpression.java index 64deeaa5771..4dca3876015 100755 --- a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsKindOfExpression.java +++ b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsKindOfExpression.java @@ -32,10 +32,8 @@ public class CustomIsKindOfExpression extends IsKindOfExpressionImpl { public Boolean evaluate(final EObject context) { boolean result = false; // check about element is not required for this expression - if (null != context) { - if (null != this.umlEClass) { - result = umlEClass.isInstance(context); - } + if (null != context && null != getUmlEClass()) { + result = getUmlEClass().isInstance(context); } return Boolean.valueOf(result); } diff --git a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsTypeOfExpression.java b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsTypeOfExpression.java index 0ee6129ca1a..c7827e0e859 100755 --- a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsTypeOfExpression.java +++ b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsTypeOfExpression.java @@ -33,10 +33,8 @@ public class CustomIsTypeOfExpression extends IsTypeOfExpressionImpl { public Boolean evaluate(final EObject context) { boolean result = false; // check about element is not required for this expression - if (null != context) { - if (null != this.umlEClass) { - result = umlEClass == context.eClass(); - } + if (null != context && null != getUmlEClass()) { + result = getUmlEClass() == context.eClass(); } return Boolean.valueOf(result); } diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/src/org/eclipse/papyrus/uml/nattable/clazz/config/manager/axis/UMLClassTreeAxisManagerForEventList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/src/org/eclipse/papyrus/uml/nattable/clazz/config/manager/axis/UMLClassTreeAxisManagerForEventList.java index 85716dcf8e7..c99af6f3f8c 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/src/org/eclipse/papyrus/uml/nattable/clazz/config/manager/axis/UMLClassTreeAxisManagerForEventList.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/src/org/eclipse/papyrus/uml/nattable/clazz/config/manager/axis/UMLClassTreeAxisManagerForEventList.java @@ -38,8 +38,8 @@ public class UMLClassTreeAxisManagerForEventList extends UMLElementTreeAxisManag * @return
*/
@Override
- public boolean isAllowedContents(Object objectToTest,
- Object semanticParent, TreeFillingConfiguration conf, int depth) {
+ public boolean isAllowedContents(Object objectToTest, Object semanticParent, TreeFillingConfiguration conf, int depth) {
+ //TODO : must be changed using filter rule
if (depth == 0) {
return objectToTest instanceof Class;
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.classpath b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.project b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.project new file mode 100755 index 00000000000..b4db060bc23 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.nattable.matrix</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..b3aa6d60f94 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.jdt.ui.prefs b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.pde.api.tools.prefs b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.pde.api.tools.prefs new file mode 100755 index 00000000000..23fb95e120f --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/.settings/org.eclipse.pde.api.tools.prefs @@ -0,0 +1,98 @@ +ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error +ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error +ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error +ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error +API_USE_SCAN_FIELD_SEVERITY=Error +API_USE_SCAN_METHOD_SEVERITY=Error +API_USE_SCAN_TYPE_SEVERITY=Error +CLASS_ELEMENT_TYPE_ADDED_METHOD=Error +CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error +CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error +CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error +CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error +CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error +CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error +CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error +CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error +CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error +CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error +ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error +ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error +ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error +ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +FIELD_ELEMENT_TYPE_ADDED_VALUE=Error +FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error +FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error +FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error +FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error +FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error +FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error +FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error +FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error +ILLEGAL_EXTEND=Warning +ILLEGAL_IMPLEMENT=Warning +ILLEGAL_INSTANTIATE=Warning +ILLEGAL_OVERRIDE=Warning +ILLEGAL_REFERENCE=Warning +INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore +INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error +INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error +INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error +INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error +INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error +INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error +INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +INVALID_ANNOTATION=Ignore +INVALID_JAVADOC_TAG=Ignore +INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore +LEAK_EXTEND=Warning +LEAK_FIELD_DECL=Warning +LEAK_IMPLEMENT=Warning +LEAK_METHOD_PARAM=Warning +LEAK_METHOD_RETURN_TYPE=Warning +METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error +METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error +METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error +METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error +METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error +METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error +METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error +METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +MISSING_EE_DESCRIPTIONS=Error +TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error +UNUSED_PROBLEM_FILTERS=Warning +automatically_removed_unused_problem_filters=Enabled +eclipse.preferences.version=1 +incompatible_api_component_version=Error +incompatible_api_component_version_include_major_without_breaking_change=Disabled +incompatible_api_component_version_include_minor_without_api_change=Disabled +invalid_since_tag_version=Error +malformed_since_tag=Error +missing_since_tag=Warning +report_api_breakage_when_major_version_incremented=Disabled +report_resolution_errors_api_component=Warning diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..3489f08475c --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Papyrys UML Nattable Matrix +Bundle-SymbolicName: org.eclipse.papyrus.uml.nattable.matrix;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Eclipse Modeling Project +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)", + org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)", + org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.emf.expressions;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)", + org.eclipse.ui.workbench;bundle-version="[3.110.0,4.0.0)", + org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)" +Bundle-Activator: org.eclipse.papyrus.uml.nattable.matrix.Activator +Bundle-Description: This plugin provides the specific code used to managed UML Table Matrix +Bundle-ActivationPolicy: lazy diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/README b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/README new file mode 100755 index 00000000000..e878f5a6ae2 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/README @@ -0,0 +1 @@ +This plugin has been created to avoid cyclic dependency with elementType, uml table used in property views and others, ...
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/TODO b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/TODO new file mode 100755 index 00000000000..a31029c0439 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/TODO @@ -0,0 +1,5 @@ +Too be more flexible, +the cell manager should return a wrapper (maybe only when required) +This wrapper could indicate a tooltip message, a IStatus, the number of end and the number of link in the case of matrix. + +Not possible yet, due to selection provider which will be broken selecting a cell for which we return a wrapper instead of the real value.
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/about.html b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/about.html new file mode 100755 index 00000000000..bbf2bd6aac7 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>January 30, 2017</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/build.properties b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/build.properties new file mode 100755 index 00000000000..2db04502d2f --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + configs/,\ + icons/,\ + about.html +src.includes = about.html diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/configs/generic_matrix_of_relationships.nattableconfiguration b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/configs/generic_matrix_of_relationships.nattableconfiguration new file mode 100755 index 00000000000..56b6198e98c --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/configs/generic_matrix_of_relationships.nattableconfiguration @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" 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" xmlns:nattablestyle="http://www.eclipse.org/papyrus/nattable/model/table/nattablestyle" description="This table allows to display relationship between UML elements as relationship" name="UMLGenericMatrixOfRelationships" type="UMLGenericMatrixOfRelationships" iconPath="platform:/plugin/org.eclipse.papyrus.uml.nattable.matrix/icons/uml_generic_matrix_relationships.png" defaultRowAxisProvider="//@columnAxisProviders.0" defaultColumnAxisProvider="//@rowAxisProviders.0"> + <styles xsi:type="nattablestyle:TableDisplayStyle" displayStyle="HIERARCHIC_SINGLE_TREE_COLUMN"/> + <styles xsi:type="nattablestyle:StringListValueStyle" name="dragRegions"> + <stringListValue>ROW_HEADER</stringListValue> + </styles> + <styles xsi:type="nattablestyle:IntListValueStyle" name="hiddenCategoriesByDepth"> + <intListValue>1</intListValue> + </styles> + <styles xsi:type="nattablestyle:BooleanValueStyle" name="expandAll" booleanValue="true"/> + <rowHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" indexStyle="NUMERIC"> + <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/> + <ownedLabelConfigurations xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" displayType="false" displayMultiplicity="false"/> + <ownedLabelConfigurations xsi:type="nattablelabelprovider:OperationLabelProviderConfiguration" displayType="false" displayMultiplicity="false"/> + <ownedAxisConfigurations xsi:type="nattableaxisconfiguration:TreeFillingConfiguration" depth="1" labelProvider="//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.1" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.treefilling.feature.labelprovider"> + <axisUsedAsAxisProvider xsi:type="nattableaxis:EStructuralFeatureAxis" alias=""> + <element xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedElement"/> + </axisUsedAsAxisProvider> + </ownedAxisConfigurations> + <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.uml.nattable.tree.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.0" specificAxisConfigurations="//@rowHeaderAxisConfiguration/@ownedAxisConfigurations.0"/> + </rowHeaderAxisConfiguration> + <columnHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration"> + <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/> + <ownedLabelConfigurations xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" displayType="false" displayMultiplicity="false"/> + <ownedLabelConfigurations xsi:type="nattablelabelprovider:OperationLabelProviderConfiguration" displayType="false" displayMultiplicity="false"/> + <ownedAxisConfigurations xsi:type="nattableaxisconfiguration:TreeFillingConfiguration" depth="1" labelProvider="//@columnHeaderAxisConfiguration/@ownedLabelConfigurations.1" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.treefilling.feature.labelprovider"> + <axisUsedAsAxisProvider xsi:type="nattableaxis:EStructuralFeatureAxis"> + <element xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedElement"/> + </axisUsedAsAxisProvider> + </ownedAxisConfigurations> + <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.emf.nattable.axis.column.eobject.matrix.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@columnHeaderAxisConfiguration/@ownedLabelConfigurations.0" specificAxisConfigurations="//@columnHeaderAxisConfiguration/@ownedAxisConfigurations.0"/> + </columnHeaderAxisConfiguration> + <columnAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider" description="This axis provider manages the rows, according to the wanted hierarchy" name="HierarchicalRowAxisManager" disconnectSlave="true"/> + <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider" description="This axis provider manages the columns, according to the wanted hierarchy" name="HierarchicalColumnsAxisManager" disconnectSlave="true"/> +</nattableconfiguration:TableConfiguration> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/icons/uml_generic_matrix_relationships.png b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/icons/uml_generic_matrix_relationships.png Binary files differnew file mode 100755 index 00000000000..9e5fd4be268 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/icons/uml_generic_matrix_relationships.png diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/plugin.xml new file mode 100755 index 00000000000..aa3d5d7c2cb --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/plugin.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.papyrus.infra.nattable.celleditor.configuration"> + <cellAxisConfiguration + class="org.eclipse.papyrus.uml.nattable.matrix.configs.GenericRelationshipMatrixCellEditorConfiguration" + order="3"> + </cellAxisConfiguration> + </extension> + <extension + point="org.eclipse.papyrus.infra.nattable.cellmanager"> + <cellManager + id="org.eclipse.papyrus.uml.nattable.matrix.cell.managers.DependencyMatrixCellManager" + manager="org.eclipse.papyrus.uml.nattable.matrix.cell.managers.DependencyMatrixCellManager" + order="1160"> + </cellManager> + <cellManager + id="org.eclipse.papyrus.uml.nattable.matrix.cell.AbstractionMatrixCellManager" + manager="org.eclipse.papyrus.uml.nattable.matrix.cell.managers.AbstractionMatrixCellManager" + order="1161"> + </cellManager> + </extension> + <extension + point="org.eclipse.papyrus.infra.nattable.configuration"> + <configuration + file="configs/generic_matrix_of_relationships.nattableconfiguration" + type="UMLGenericMatrixOfRelationships"> + </configuration> + </extension> +</plugin> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/pom.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/pom.xml new file mode 100755 index 00000000000..8a7cf03e525 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/pom.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.uml-nattable</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.nattable.matrix</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> + <description>This plugin provides the specific code used to managed UML Table Matrix</description> +</project> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/Activator.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/Activator.java new file mode 100755 index 00000000000..0882f8f8183 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/Activator.java @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.matrix; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.nattable.matrix"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(plugin); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/AbstractUMLGenericMatrixRelationshipCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/AbstractUMLGenericMatrixRelationshipCellManager.java new file mode 100755 index 00000000000..e90b2c4b76c --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/AbstractUMLGenericMatrixRelationshipCellManager.java @@ -0,0 +1,548 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.matrix.cell.managers; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EStructuralFeature.Setting; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.BooleanExpressionsFactory; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.IBooleanEObjectExpression; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager; +import org.eclipse.papyrus.infra.nattable.manager.cell.IGenericMatrixRelationshipCellManager; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.ICellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.MatrixRelationShipDirection; +import org.eclipse.papyrus.infra.nattable.utils.AxisUtils; +import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; +import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration; +import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration; +import org.eclipse.papyrus.uml.tools.helper.UMLRelationshipHelper; +import org.eclipse.uml2.uml.Element; + +/** + * Abstract class used to manage Cell Editor for Papyrus UML Relationship Matrixes. + */ +public abstract class AbstractUMLGenericMatrixRelationshipCellManager extends AbstractCellManager implements IGenericMatrixRelationshipCellManager { + + /** + * the EClass supported by this CellManager + */ + private EClass managedElement; + + /** + * The UML relationship helper + */ + protected UMLRelationshipHelper helper; + + /** + * the default filter to use to filter cell contents + */ + private IBooleanEObjectExpression defaultFilter = BooleanExpressionsFactory.eINSTANCE.createLiteralTrueExpression(); + + /** + * + * Constructor. + * + * @param managedElement + * the EClass supported by this cell manager + */ + public AbstractUMLGenericMatrixRelationshipCellManager(final EClass managedElement) { + this.managedElement = managedElement; + this.helper = getOrCreateUMLRelationshipHelper(); + } + + /** + * + * @return + * the relationship helper to use + */ + protected UMLRelationshipHelper getOrCreateUMLRelationshipHelper() { + if (null == this.helper) { + this.helper = new UMLRelationshipHelper(); + } + return this.helper; + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#handles(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + * + * @param columnElement + * @param rowElement + * @param manager + * @return + */ + @Override + public boolean handles(final Object columnElement, final Object rowElement, final INattableModelManager manager) { + boolean handle = manager instanceof IMatrixTableWidgetManager && isMatchingEditedElement(manager.getTable()) && manager.getTable().getContext() instanceof Element; + if (handle) { + handle = null != getElementTypeToCreate(getCellEditorConfiguration((IMatrixTableWidgetManager) manager)); + } + if (handle) { + final Object realColumn = AxisUtils.getRepresentedElement(columnElement); + final Object realRow = AxisUtils.getRepresentedElement(rowElement); + handle = realColumn instanceof Element && realRow instanceof Element; + } + return handle; + } + + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#isCellEditable(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + * + * @param columnElement + * @param rowElement + * @param manager + * @return + * <code>true</code> if the cell displayed in the table must be editable for the user. In case of too many ends or too many links to display, the cell won't be editable + */ + @Override + public final boolean isCellEditable(final Object columnElement, final Object rowElement, final INattableModelManager manager) { + final Element realColumn = (Element) AxisUtils.getRepresentedElement(columnElement); // we already know that it is UML Element due to the handles method + final Element realRow = (Element) AxisUtils.getRepresentedElement(rowElement); + boolean isEditable = isCellEditableIgnoringCurrentValue(columnElement, rowElement, manager); + if (isEditable) { + final List<Element> currentValues = getMatchingRelationships(realColumn, realRow, manager); + isEditable = currentValues.size() < 2; + if (currentValues.size() == 1 && canHaveMoreThan2Ends()) { + isEditable = getNumberOfEnds(currentValues.get(0)) == 2; + } + } + + // we don't check if the source and target element have the required applied stereotype and other stuff, we delegate to the Service type + if (isEditable) { + Command cmd = getSetValueCommand(TableEditingDomainUtils.getTableContextEditingDomain(manager.getTable()), columnElement, rowElement, Boolean.TRUE, manager); + isEditable = null == cmd ? false : cmd.canExecute(); + } + return isEditable; + } + + /** + * + * @param columnElement + * the column element + * @param rowElement + * the row element + * @param manager + * the table manager + * @return + * <code>true</code> if the cell must be ediatable according to the arguments; + */ + protected final boolean isCellEditableIgnoringCurrentValue(final Object columnElement, final Object rowElement, final INattableModelManager manager) { + final Element realColumn = (Element) AxisUtils.getRepresentedElement(columnElement); // we already know that it is UML Element due to the handles method + final Element realRow = (Element) AxisUtils.getRepresentedElement(rowElement); + final IMatrixTableWidgetManager matrixManager = (IMatrixTableWidgetManager) manager; + final GenericRelationshipMatrixCellEditorConfiguration conf = getCellEditorConfiguration(matrixManager); + + boolean isEditable = false; + switch (conf.getDirection()) { + case NONE: + if (isDirectedRelationship()) { + isEditable = false; + } else { + isEditable = (matchingSourceFeatureType(realRow) && matchingTargetFeatureType((Element) realColumn)) + && /* or || ?? */ matchingSourceFeatureType(realColumn) && matchingTargetFeatureType((Element) realRow); + } + break; + case FROM_ROW_TO_COLUMN: + isEditable = matchingSourceFeatureType(realRow) && matchingTargetFeatureType((Element) realColumn); + break; + case FROM_COLUMN_TO_ROW: + isEditable = matchingSourceFeatureType(realColumn) && matchingTargetFeatureType((Element) realRow); + break; + default: + break; + } + return isEditable; + } + + /** + * + * @param axisObject + * @return + * <code>true</code> if the object can be used as source + */ + protected boolean matchingSourceFeatureType(Object element) { + return getRelationshipSourceFeature().getEType().isInstance(element); + } + + /** + * + * @param axisObject + * @return + * <code>true</code> if the object can be used as target + */ + protected boolean matchingTargetFeatureType(final Element element) { + return getRelationshipTargetFeature().getEType().isInstance(element); + } + + /** + * + * @param elementTypeConfiguration + * the elemen type configruation declared in the table cell editor configuration + * @param source + * the source of the relationship to create + * @param target + * the target of the relationship to create + * @param context + * the context of the table + * @return + * the element which should own the relationship after its creation + */ + protected Element getBestOwner(final ElementTypeConfiguration elementTypeConfiguration, final Element source, final Element target, final EObject context) { + return this.helper.getBestOwner(elementTypeConfiguration, source, target, (Element) context); + } + + /** + * + * @param configuration + * the cell editor configuration declared in the edited table + * @return + * the element type to use as described in the table configuration + */ + protected IElementType getElementTypeToCreate(final GenericRelationshipMatrixCellEditorConfiguration configuration) { + final ElementTypeConfiguration editedElement = configuration.getEditedElement(); + if (null != editedElement) { + return ElementTypeRegistry.getInstance().getType(editedElement.getIdentifier()); + } + // editedElement.getIconEntry().getBundleId() + // IElementType a = null; + // a.getIconURL() + return null; + } + + /** + * + * @param configuration + * the cell editor configuration declared in the edited table + * @return + * the matcher to use, or <code>null</code> if not defined + * + */ + protected IElementMatcher getElementTypeMatcher(final GenericRelationshipMatrixCellEditorConfiguration configuration) { + final IElementType elementType = getElementTypeToCreate(configuration); + return elementType instanceof ISpecializationType ? ((ISpecializationType) elementType).getMatcher() : null; + } + + /** + * + * @return + * <code>true</code> if the managed EClass relationship can have more than 2 ends, and <code>false</code> if not OR if the relationship is not managed + */ + protected boolean canHaveMoreThan2Ends() { + return this.helper.canHaveMoreThan2Ends(this.managedElement); + } + + /** + * + * @return + * <code>true</code> if the managed EClass relationship is a directed relationship, and <code>false</code> if not OR if the relationship is not managed + */ + protected boolean isDirectedRelationship() { + return this.helper.isDirectedRelationship(this.managedElement); + } + + + /** + * + * @param manager + * the current edited table + * @return + * <code>true</code> if the current class manages the elementType configuration declared in the table + */ + protected final boolean isMatchingEditedElement(final Table table) { + final ElementTypeConfiguration elTypeConf = getEditedElementKind(table); + return handles(elTypeConf); + } + + /** + * + * @param elTypeConf + * an element type + * @return + * <code>true</code> if the current class manages this elementTypes + */ + protected final boolean handles(final ElementTypeConfiguration elTypeConf) { + if (elTypeConf instanceof MetamodelTypeConfiguration) { + return ((MetamodelTypeConfiguration) elTypeConf).getEClass() == this.managedElement; + } + if (elTypeConf instanceof SpecializationTypeConfiguration) { + if (((SpecializationTypeConfiguration) elTypeConf).getSpecializedTypes().size() == 1) { + return handles(((SpecializationTypeConfiguration) elTypeConf).getSpecializedTypes().get(0)); + } + } + return false; + } + + /** + * + * @param manager + * the matrix widget manager + * + * @return + * <code>true</code> if the table owns a {@link GenericRelationshipMatrixCellEditorConfiguration} and <code>false</code> otherwise + */ + protected final boolean hasGenericRelationshipMatrixCellEditorConfiguration(final IMatrixTableWidgetManager manager) { + return getCellEditorConfiguration(manager) != null; + } + + /** + * + * @param manager + * the matrix widget manager + * @return + * the cell editor configuration registered in the table or <code>null</code> when it is not defined + */ + protected final GenericRelationshipMatrixCellEditorConfiguration getCellEditorConfiguration(final IMatrixTableWidgetManager manager) { + final ICellEditorConfiguration conf = manager.getTable().getOwnedCellEditorConfigurations(); + if (conf instanceof GenericRelationshipMatrixCellEditorConfiguration) { + return (GenericRelationshipMatrixCellEditorConfiguration) conf; + } + return null; + } + + /** + * + * @param manager + * the current edited table + * @return + * the elementType to manage according to the table configuration or <code>null</code> when it is not defined + */ + protected ElementTypeConfiguration getEditedElementKind(final Table table) { + final ICellEditorConfiguration conf = table.getOwnedCellEditorConfigurations(); + if (conf instanceof GenericRelationshipMatrixCellEditorConfiguration) { + return ((GenericRelationshipMatrixCellEditorConfiguration) conf).getEditedElement(); + } + return null; + } + + /** + * + * @param relationship + * a relationship + * @return + * the feature used for the sources of the relationship + */ + protected EStructuralFeature getRelationshipSourceFeature() { + return this.helper.getRelationshipSourceFeature(this.managedElement); + } + + /** + * + * @param relationship + * a relationship + * @return + * the feature used for the sources of the relationship + */ + protected EStructuralFeature getRelationshipTargetFeature() { + return this.helper.getRelationshipTargetFeature(this.managedElement); + } + + /** + * + * @param relationship + * a relationship + * @return + * the sources of the relationship + */ + protected Collection<? extends Element> getSources(final Element relationship) { + return this.helper.getSources(relationship); + } + + /** + * + * @param relationship + * a relationship + * @return + * the targets of the relationship + */ + protected Collection<? extends Element> getTargets(final Element relationship) { + return this.helper.getTargets(relationship); + } + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#doGetValue(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + * + * @param columnElement + * @param rowElement + * @param tableManager + * @return + */ + @Override + protected Object doGetValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) { + if (isCellEditableIgnoringCurrentValue(columnElement, rowElement, tableManager)) { + // we already know that column and rows are UML Elemenr due to the handles methods + return getMatchingRelationships((Element) AxisUtils.getRepresentedElement(columnElement), (Element) AxisUtils.getRepresentedElement(rowElement), tableManager); + } + return NOT_AVALAIBLE; + } + + /** + * + * @param columnElement + * the column element + * @param rowElement + * the row element + * @param tableManager + * the table manager + * @return + * the relationship to display according to the these parameter and taking account the {@link GenericRelationshipMatrixCellEditorConfiguration} of the table + */ + protected List<Element> getMatchingRelationships(final Element columnElement, final Element rowElement, final INattableModelManager tableManager) { + final Object realColumn = AxisUtils.getRepresentedElement(columnElement); + final Object realRow = AxisUtils.getRepresentedElement(rowElement); + final IMatrixTableWidgetManager matrixManager = (IMatrixTableWidgetManager) tableManager; + List<Object> combined = new ArrayList<Object>(); + combined.add(realColumn); + combined.add(realRow); + Map<EObject, Collection<Setting>> refs = EcoreUtil.CrossReferencer.find(combined); + final List<Element> matchingRelationships = new ArrayList<Element>(); + final GenericRelationshipMatrixCellEditorConfiguration conf = getCellEditorConfiguration(matrixManager); + final MatrixRelationShipDirection dir = conf.getDirection(); + IBooleanEObjectExpression cellContentFilter = conf.getCellContentsFilter(); + if (null == cellContentFilter) { + cellContentFilter = this.defaultFilter; + } + for (final Element current : refs.keySet().stream().filter(Element.class::isInstance).map(Element.class::cast).collect(Collectors.toList())) { + final IElementMatcher matcher = getElementTypeMatcher(conf); + boolean isValid = matcher != null ? matcher.matches(current) : true; + if (isValid) { + isValid = current.eClass() == getManagedRelationship() && cellContentFilter.evaluate(current); + } + if (isValid) { + switch (dir) { + case NONE: + break; + case FROM_ROW_TO_COLUMN: + isValid = getSources(current).contains(realRow) && getTargets(current).contains(realColumn); + break; + case FROM_COLUMN_TO_ROW: + isValid = getSources(current).contains(realColumn) && getTargets(current).contains(realRow); + break; + default: + break; + + } + } + if (isValid) { + matchingRelationships.add(current); + } + } + return matchingRelationships; + } + + /** + * + * @param relationship + * a relationship + * @return + * the number of ends for the given relationship + */ + protected int getNumberOfEnds(final Element relationship) { + return this.helper.getNumberOfEnds(relationship); + } + + /** + * + * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#getSetValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.Object, + * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager) + * + * @param domain + * @param columnElement + * @param rowElement + * @param newValue + * @param tableManager + * @return + */ + @Override + public Command getSetValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) { + final Element realColumn = (Element) AxisUtils.getRepresentedElement(columnElement); + final Element realRow = (Element) AxisUtils.getRepresentedElement(rowElement); + + if (Boolean.FALSE.equals(newValue)) { + final List<Element> r = getMatchingRelationships(realColumn, realRow, tableManager); + if (r.size() == 1) {// according to the isCellEditable there are only 1 relationship + final DestroyElementRequest request = new DestroyElementRequest(r.get(0), false); + final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(r.get(0)); + final ICommand cmd = provider.getEditCommand(request); + if (null != cmd && cmd.canExecute()) { + return new GMFtoEMFCommandWrapper(cmd); + } + } + } + if (Boolean.TRUE.equals(newValue)) { + final GenericRelationshipMatrixCellEditorConfiguration conf = getCellEditorConfiguration((IMatrixTableWidgetManager) tableManager); + final MatrixRelationShipDirection dir = conf.getDirection(); + final IElementType elementType = getElementTypeToCreate(conf); + final CreateRelationshipRequest request; + final EObject owner; + + switch (dir) { + case FROM_ROW_TO_COLUMN: + owner = getBestOwner(conf.getEditedElement(), realRow, realColumn, tableManager.getTable().getContext()); + request = new CreateRelationshipRequest(owner, realRow, realColumn, elementType); + break; + case FROM_COLUMN_TO_ROW: + owner = getBestOwner(conf.getEditedElement(), realColumn, realRow, tableManager.getTable().getContext()); + request = new CreateRelationshipRequest(owner, realColumn, realRow, elementType); + break; + default: + request = null; + owner = null; + } + + final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(owner); + final ICommand cmd = provider.getEditCommand(request); + if (null != cmd && cmd.canExecute()) { + return new GMFtoEMFCommandWrapper(cmd); + } + } + return null; + } + + + /** + * @see org.eclipse.papyrus.infra.nattable.manager.cell.IGenericMatrixRelationshipCellManager#getManagedRelationship() + * + * @return + */ + @Override + public EClass getManagedRelationship() { + return this.managedElement; + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/AbstractionMatrixCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/AbstractionMatrixCellManager.java new file mode 100755 index 00000000000..4fa8d8d7bc3 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/AbstractionMatrixCellManager.java @@ -0,0 +1,33 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.matrix.cell.managers; + +import org.eclipse.uml2.uml.UMLPackage; + +/** + * + * The cell manager for UML Abstraction + * + */ +public class AbstractionMatrixCellManager extends AbstractUMLGenericMatrixRelationshipCellManager { + + /** + * + * Constructor. + * + */ + public AbstractionMatrixCellManager() { + super(UMLPackage.eINSTANCE.getAbstraction()); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/DependencyMatrixCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/DependencyMatrixCellManager.java new file mode 100755 index 00000000000..4a78bc15930 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/cell/managers/DependencyMatrixCellManager.java @@ -0,0 +1,32 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.matrix.cell.managers; + +import org.eclipse.uml2.uml.UMLPackage; + +/** + * + * The cell manager for UML Dependency + * + */ +public class DependencyMatrixCellManager extends AbstractUMLGenericMatrixRelationshipCellManager { + + /** + * + * Constructor. + * + */ + public DependencyMatrixCellManager() { + super(UMLPackage.eINSTANCE.getDependency()); + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/CellMatrixRelationshipEnum.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/CellMatrixRelationshipEnum.java new file mode 100755 index 00000000000..a9232660acb --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/CellMatrixRelationshipEnum.java @@ -0,0 +1,58 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.matrix.configs; + +/** + * + * Enumeration used by the class {@link MatrixRelationshipDisplayConverter} + * It allows to know how the check box must be displayed, and which is the optional message to display in the cell too. + * + */ +public enum CellMatrixRelationshipEnum { + + CHECKED(Boolean.TRUE.toString()), + + UNCHECKED(Boolean.FALSE.toString()), + + CHECKED_MORE_THAN_2_ENDS(">2 ends"), //$NON-NLS-1$ + + CHECKED_MORE_THAN_ONE_LINK(">1 link"), //$NON-NLS-1$ + + UNKNOWN_VALUE("Unknown value"); //$NON-NLS-1$ + + /** + * the name of the enum + */ + private String name = ""; //$NON-NLS-1$ + + /** + * + * Constructor. + * + * @param name + */ + private CellMatrixRelationshipEnum(String name) { + this.name = name; + } + + /** + * + * @see java.lang.Enum#toString() + * + * @return + */ + public String toString() { + return name; + } +}
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/GenericRelationshipMatrixCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/GenericRelationshipMatrixCellEditorConfiguration.java new file mode 100755 index 00000000000..e78593244f1 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/GenericRelationshipMatrixCellEditorConfiguration.java @@ -0,0 +1,86 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.matrix.configs; + +import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; +import org.eclipse.nebula.widgets.nattable.style.DisplayMode; +import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.utils.TableHelper; +import org.eclipse.papyrus.uml.nattable.matrix.editors.CustomCheckBoxCellEditor; +import org.eclipse.papyrus.uml.nattable.matrix.messages.Messages; +import org.eclipse.papyrus.uml.nattable.matrix.painters.MatrixRelationshipCellBoxPainter; + +/** + * + * The cell editor configuration for the UML Relationship Matrix + * + */ +public class GenericRelationshipMatrixCellEditorConfiguration implements ICellAxisConfiguration { + + /** + * the id of this editor + */ + private static final String ID = "org.eclipse.papyrus.uml.nattable.relationship.matrix.celleditor.configuration.CheckBox";//$NON-NLS-1$ + + /** + * @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationId() + * + * @return + */ + @Override + public String getConfigurationId() { + return ID; + } + + /** + * + * @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationDescription() + * + * @return + */ + @Override + public String getConfigurationDescription() { + return Messages.GenericMatrixRelationshipCellEditorConfiguration_description; + } + + /** + * + * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.config.SingleBooleanCellEditorConfiguration#handles(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object) + * + * @param table + * @param axisElement + * @return + */ + @Override + public boolean handles(final Table table, Object axisElement) { + return (TableHelper.isMatrixTreeTable(table)); + } + + /** + * @see org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String) + * + * @param configRegistry + * @param axis + * @param configLabel + */ + @Override + public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new MatrixRelationshipCellBoxPainter(), DisplayMode.NORMAL, configLabel); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CustomCheckBoxCellEditor(), DisplayMode.NORMAL, configLabel); + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new MatrixRelationshipDisplayConverter(), DisplayMode.NORMAL, configLabel); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/MatrixRelationshipDisplayConverter.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/MatrixRelationshipDisplayConverter.java new file mode 100755 index 00000000000..e8d3b9a680b --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/configs/MatrixRelationshipDisplayConverter.java @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.matrix.configs; + +import java.util.List; + +import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter; +import org.eclipse.papyrus.uml.tools.helper.UMLRelationshipHelper; +import org.eclipse.uml2.uml.Element; + +/** + * DisplayConvert used by Relationship's Matrix + * + */ +public class MatrixRelationshipDisplayConverter extends DisplayConverter { + + /** + * this class provide the method to known the number of ends of a relationship + */ + private UMLRelationshipHelper helper = new UMLRelationshipHelper(); + + /** + * @see org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter#canonicalToDisplayValue(java.lang.Object) + * + * @param canonicalValue + * @return + */ + @Override + public CellMatrixRelationshipEnum canonicalToDisplayValue(final Object canonicalValue) { + CellMatrixRelationshipEnum returnedValue = CellMatrixRelationshipEnum.UNKNOWN_VALUE; + if (canonicalValue instanceof List<?>) { + final List<?> list = (List<?>) canonicalValue; + if (list.size() == 0) { + returnedValue = CellMatrixRelationshipEnum.UNCHECKED; + } else if (list.size() == 1) { + final Object value = list.get(0); + if (value instanceof Element) { + int ends = this.helper.getNumberOfEnds((Element) value); + if (ends == 2) { + return CellMatrixRelationshipEnum.CHECKED; + } else { + return CellMatrixRelationshipEnum.CHECKED_MORE_THAN_2_ENDS; + } + } + } else { + returnedValue = CellMatrixRelationshipEnum.CHECKED_MORE_THAN_ONE_LINK; + } + } + return returnedValue; + } + + /** + * @see org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter#displayToCanonicalValue(java.lang.Object) + * + * @param displayValue + * @return + */ + @Override + public Object displayToCanonicalValue(final Object displayValue) { + if(displayValue instanceof Boolean) { + return (Boolean)displayValue; + } + return null; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/editors/CustomCheckBoxCellEditor.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/editors/CustomCheckBoxCellEditor.java new file mode 100755 index 00000000000..c499d021d9b --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/editors/CustomCheckBoxCellEditor.java @@ -0,0 +1,50 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.matrix.editors; + +import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor; +import org.eclipse.papyrus.uml.nattable.matrix.configs.CellMatrixRelationshipEnum; + +/** + * A customCheckbox Cell Editor for Relationship Matrix + * + */ +public class CustomCheckBoxCellEditor extends CheckBoxCellEditor { + + + /** + * @see org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor#setEditorValue(java.lang.Object) + * + * @param value + */ + @Override + public void setEditorValue(Object value) { + if (value instanceof CellMatrixRelationshipEnum) { + final CellMatrixRelationshipEnum val = (CellMatrixRelationshipEnum) value; + switch (val) { + case CHECKED: + case CHECKED_MORE_THAN_2_ENDS: + case CHECKED_MORE_THAN_ONE_LINK: + super.setEditorValue(Boolean.TRUE); + break; + default: + super.setEditorValue(Boolean.FALSE); + break; + } + return; + } + super.setEditorValue(value); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/messages/Messages.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/messages/Messages.java new file mode 100755 index 00000000000..91e35a2257b --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/messages/Messages.java @@ -0,0 +1,32 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.matrix.messages; + +import org.eclipse.osgi.util.NLS; + +/** + * The messages used in this plugin + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.nattable.matrix.messages.messages"; //$NON-NLS-1$ + public static String GenericMatrixRelationshipCellEditorConfiguration_description; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/messages/messages.properties b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/messages/messages.properties new file mode 100755 index 00000000000..f675673ad04 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/messages/messages.properties @@ -0,0 +1 @@ +GenericMatrixRelationshipCellEditorConfiguration_description=This configuration provides CellEditor, CellPainter and CellConverter used by UML Relationship matrix diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/painters/MatrixRelationshipCellBoxPainter.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/painters/MatrixRelationshipCellBoxPainter.java new file mode 100755 index 00000000000..33b6ba0ef1b --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.matrix/src/org/eclipse/papyrus/uml/nattable/matrix/painters/MatrixRelationshipCellBoxPainter.java @@ -0,0 +1,193 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.matrix.painters; + +import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter; +import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; +import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter; +import org.eclipse.nebula.widgets.nattable.style.CellStyleUtil; +import org.eclipse.nebula.widgets.nattable.style.IStyle; +import org.eclipse.nebula.widgets.nattable.util.GUIHelper; +import org.eclipse.papyrus.uml.nattable.matrix.configs.CellMatrixRelationshipEnum; +import org.eclipse.papyrus.uml.nattable.matrix.configs.MatrixRelationshipDisplayConverter; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + +/** + * + * CellPainter used to paint checkbox with an optional text for Matrix of Relationships + * + */ +public class MatrixRelationshipCellBoxPainter extends CheckBoxPainter {//we must extends CheckBoxPainter, if not, the edition is fully broken + + /** + * the text painter used to paint N/A + */ + private final Image checkedImg; + private final Image uncheckedImg; + private final Image checkedDisableImg; + + /** + * + * Constructor. + * + */ + public MatrixRelationshipCellBoxPainter() { + this(true); + } + + /** + * + * Constructor. + * + * @param paintBg + */ + public MatrixRelationshipCellBoxPainter(boolean paintBg) { + this(GUIHelper.getImage("checked"), GUIHelper.getImage("unchecked"), GUIHelper.getImage("checked_disabled"), paintBg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + /** + * + * Constructor. + * + * @param checkedImg + * @param uncheckedImg + * @param checkedDisableImg + */ + public MatrixRelationshipCellBoxPainter(final Image checkedImg, final Image uncheckedImg, final Image checkedDisableImg) { + this(checkedImg, uncheckedImg, checkedDisableImg, true); + } + + /** + * + * Constructor. + * + * @param checkedImg + * @param uncheckedImg + * @param checkedDisableImg + * @param paintBg + */ + public MatrixRelationshipCellBoxPainter(Image checkedImg, Image uncheckedImg, final Image checkedDisableImg, boolean paintBg) { + super(paintBg); + this.checkedImg = checkedImg; + this.uncheckedImg = uncheckedImg; + this.checkedDisableImg = checkedDisableImg; + } + + /** + * + * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getImage(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) + * + * @param cell + * @param configRegistry + * @return + */ + @Override + protected Image getImage(final ILayerCell cell, final IConfigRegistry configRegistry) { + final CellMatrixRelationshipEnum convertedValue = localConvertDataType(cell, configRegistry); + Image returnedImage = null; + switch (convertedValue) { + case UNCHECKED: + returnedImage = this.uncheckedImg; + break; + case CHECKED: + returnedImage = this.checkedImg; + break; + case CHECKED_MORE_THAN_2_ENDS: + case CHECKED_MORE_THAN_ONE_LINK: + returnedImage = this.checkedDisableImg; + break; + default: + break; + } + return returnedImage; + } + + /** + * + * @param cell + * @param configRegistry + * @return + * convert the cell value into a {@link CellMatrixRelationshipEnum}. The result can't not be <code>null</code> + */ + protected CellMatrixRelationshipEnum localConvertDataType(ILayerCell cell, IConfigRegistry configRegistry) { + IDisplayConverter displayConverter = configRegistry.getConfigAttribute( + CellConfigAttributes.DISPLAY_CONVERTER, + cell.getDisplayMode(), + cell.getConfigLabels().getLabels()); + CellMatrixRelationshipEnum convertedValue = null; + if (displayConverter instanceof MatrixRelationshipDisplayConverter) { + convertedValue = (CellMatrixRelationshipEnum) displayConverter.canonicalToDisplayValue( + cell, configRegistry, cell.getDataValue()); + } + if (convertedValue == null) { + convertedValue = CellMatrixRelationshipEnum.UNKNOWN_VALUE; + } + return convertedValue; + } + + /** + * + * @param cell + * @param configRegistry + * @return + * a text to display in addition of the checkbox. The text cannot be <code>null</code>. + */ + protected String getAdditionalText(final ILayerCell cell, final IConfigRegistry configRegistry) { + final CellMatrixRelationshipEnum convertedValue = localConvertDataType(cell, configRegistry); + String txt = ""; //$NON-NLS-1$ + switch (convertedValue) { + case CHECKED_MORE_THAN_2_ENDS: + case CHECKED_MORE_THAN_ONE_LINK: + txt = convertedValue.toString(); + break; + default: + break; + } + return txt; + + } + + /** + * @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle, + * org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) + * + * @param cell + * @param gc + * @param bounds + * @param configRegistry + */ + @Override + public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + super.paintCell(cell, gc, bounds, configRegistry); + final String txt = getAdditionalText(cell, configRegistry); + + if (!txt.isEmpty()) {// txt can't be null + + // To be consistent with all others painters, we probably should recalculate the preferred height and others stuff + // it maybe would be better to extends an other painter, to be able to display image AND text easily + + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + Image image = getImage(cell, configRegistry); + Rectangle imageBounds = image.getBounds(); + final Color previousForeground = gc.getForeground(); + gc.setForeground(GUIHelper.COLOR_BLACK); + gc.drawText(txt, bounds.x + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, bounds, imageBounds.width) + imageBounds.width, bounds.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, bounds, imageBounds.height), true); + gc.setForeground(previousForeground); + } + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.classpath b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.project b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.project new file mode 100755 index 00000000000..c16bcf59385 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.nattable.properties</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..b3aa6d60f94 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.jdt.ui.prefs b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.pde.api.tools.prefs b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.pde.api.tools.prefs new file mode 100755 index 00000000000..23fb95e120f --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/.settings/org.eclipse.pde.api.tools.prefs @@ -0,0 +1,98 @@ +ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error +ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error +ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error +ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error +API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error +API_USE_SCAN_FIELD_SEVERITY=Error +API_USE_SCAN_METHOD_SEVERITY=Error +API_USE_SCAN_TYPE_SEVERITY=Error +CLASS_ELEMENT_TYPE_ADDED_METHOD=Error +CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error +CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error +CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error +CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error +CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error +CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error +CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error +CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error +CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error +CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error +ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error +ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error +ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error +ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +FIELD_ELEMENT_TYPE_ADDED_VALUE=Error +FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error +FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error +FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error +FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error +FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error +FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error +FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error +FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error +ILLEGAL_EXTEND=Warning +ILLEGAL_IMPLEMENT=Warning +ILLEGAL_INSTANTIATE=Warning +ILLEGAL_OVERRIDE=Warning +ILLEGAL_REFERENCE=Warning +INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore +INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error +INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error +INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error +INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error +INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error +INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error +INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error +INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error +INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +INVALID_ANNOTATION=Ignore +INVALID_JAVADOC_TAG=Ignore +INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore +LEAK_EXTEND=Warning +LEAK_FIELD_DECL=Warning +LEAK_IMPLEMENT=Warning +LEAK_METHOD_PARAM=Warning +LEAK_METHOD_RETURN_TYPE=Warning +METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error +METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error +METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error +METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error +METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error +METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error +METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error +METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error +METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error +METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error +MISSING_EE_DESCRIPTIONS=Error +TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error +TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error +UNUSED_PROBLEM_FILTERS=Warning +automatically_removed_unused_problem_filters=Enabled +eclipse.preferences.version=1 +incompatible_api_component_version=Error +incompatible_api_component_version_include_major_without_breaking_change=Disabled +incompatible_api_component_version_include_minor_without_api_change=Disabled +invalid_since_tag_version=Error +malformed_since_tag=Error +missing_since_tag=Warning +report_api_breakage_when_major_version_incremented=Disabled +report_resolution_errors_api_component=Warning diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..718c16853b3 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Papyrus UML NatTable Properties +Bundle-SymbolicName: org.eclipse.papyrus.uml.nattable.properties;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Eclipse Modeling Framework +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0]", + org.eclipse.papyrus.infra.nattable.model;bundle-version="2.0.0", + org.eclipse.papyrus.infra.properties;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.nattable.properties;bundle-version="[2.2.0,3.0.0)", + org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.100,2.0.0)", + org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)", + org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.expressions;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.emf.expressions.properties;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.0.0,2.0.0)" +Bundle-Activator: org.eclipse.papyrus.uml.nattable.properties.Activator +Bundle-Description: This plugin provides properties views specialized for Papyrus UML Table +Bundle-ActivationPolicy: lazy diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/about.html b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/about.html new file mode 100755 index 00000000000..bbf2bd6aac7 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>January 30, 2017</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/build.properties b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/build.properties new file mode 100755 index 00000000000..7d408a78370 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/build.properties @@ -0,0 +1,8 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html,\ + properties/ +src.includes = about.html diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/plugin.xml new file mode 100755 index 00000000000..22cca0790c4 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/plugin.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.papyrus.infra.properties.contexts"> + <context + contextModel="properties/GenericUMLRelationshipMatrix.ctx" + isCustomizable="true"> + </context> + </extension> + <extension + point="org.eclipse.papyrus.infra.properties.environments"> + <environment + environmentModel="properties/Environment.xmi"> + </environment> + </extension> + +</plugin> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/pom.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/pom.xml new file mode 100755 index 00000000000..cbd74c828a2 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/pom.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.uml-nattable</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.nattable.properties</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> + <description>This plugin provides properties views specialized for Papyrus UML Table.</description> +</project> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/Environment.xmi b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/Environment.xmi new file mode 100755 index 00000000000..fa52d41f491 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/Environment.xmi @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="ASCII"?> +<environment:Environment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9"> + <constraintTypes label="IsGenericUMLRelationshipMatrix" constraintClass="org.eclipse.papyrus.uml.nattable.properties.constraints.IsGenericUMLRelationshipMatrixEditor"/> + <modelElementFactories name="GenericUMLRelationshipMatrixFactory" factoryClass="org.eclipse.papyrus.uml.nattable.properties.modelelements.GenericUMLRelationshipMatrixFactory"/> +</environment:Environment> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/GenericUMLRelationshipMatrix.ctx b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/GenericUMLRelationshipMatrix.ctx new file mode 100755 index 00000000000..0b23b408048 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/GenericUMLRelationshipMatrix.ctx @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="ASCII"?> +<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" xmi:id="_bYd04JLDEeWbp4A9_-WJrQ" name="UMLNatTable" label="UML Table Configuration Models"> + <tabs xmi:id="_TYJSEPnXEeaHC6GkLFwmEw" label="Matrix" id="Matrix" category="org.eclipse.papyrus" priority="12"> + <sections xmi:id="_eVSqMPnZEeaHC6GkLFwmEw" name="Matrix" sectionFile="ui/Matrix.xwt"> + <widget href="ui/Matrix.xwt#/"/> + </sections> + </tabs> + <views xmi:id="_c4fxMCwPEeeKOdJYr-htag" name="MatrixConfiguration" sections="_eVSqMPnZEeaHC6GkLFwmEw"> + <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_2SAlsJQtEeWx9KtEop_Tug" name="isGenericMatrixRelationshipTable"> + <constraintType href="Environment.xmi#//@constraintTypes.0"/> + <properties xsi:type="constraints:ValueProperty" xmi:id="_1knLypMSEeWeQ8lFehLIEQ" name="expectedValue" value="true"/> + </constraints> + </views> + <dataContexts xmi:id="_d43IMCvyEeeezcTZxBVD8g" name="GenericUMLRelationshipMatrixDataContext" label="GenericUMLRelationshipMatrixDataContext"> + <elements xmi:id="_TDc0ICwOEeeKOdJYr-htag" name="GenericRelationshipMatrixCellEditorConfiguration"> + <properties xmi:id="_TDc0IywOEeeKOdJYr-htag" name="rowFilter" type="Reference"/> + <properties xmi:id="_TDc0JCwOEeeKOdJYr-htag" name="columnFilter" type="Reference"/> + <properties xmi:id="_qWk8YCwOEeeKOdJYr-htag" name="rowSources" type="Reference" multiplicity="-1"/> + <properties xmi:id="_s9kMwCwOEeeKOdJYr-htag" name="columnSources" type="Reference" multiplicity="-1"/> + <properties xmi:id="_TDc0ISwOEeeKOdJYr-htag" name="managedElementType" type="Reference"/> + <properties xmi:id="_TDc0IiwOEeeKOdJYr-htag" name="relationshipDirection" type="Enumeration"/> + <properties xmi:id="_7ml2MCwPEeeKOdJYr-htag" name="cellContentsFilter" type="Reference"/> + </elements> + <modelElementFactory href="Environment.xmi#//@modelElementFactories.0"/> + </dataContexts> +</contexts:Context> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/ui/Matrix.xwt b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/ui/Matrix.xwt new file mode 100755 index 00000000000..1f1c197ecae --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/properties/ui/Matrix.xwt @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Composite xmlns="http://www.eclipse.org/xwt/presentation" + xmlns:expressions="clr-namespace:org.eclipse.papyrus.infra.emf.expressions.properties.widget.property" + xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets" + xmlns:ppel="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets.layout" + xmlns:x="http://www.eclipse.org/xwt"> + <Composite.layout> + <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout> + </Composite.layout> + <Composite> + <Composite.layout> + <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout> + </Composite.layout> + <Group text="Rows"> + <Group.layout> + <ppel:PropertiesLayout></ppel:PropertiesLayout> + </Group.layout> + <ppe:ReferenceDialog input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:rowFilter" + customLabel="Filter"></ppe:ReferenceDialog> + <ppe:MultiReference input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:rowSources" + customLabel="Sources"></ppe:MultiReference> + </Group> + <Group text="Columns"> + <Group.layout> + <ppel:PropertiesLayout></ppel:PropertiesLayout> + </Group.layout> + <ppe:ReferenceDialog input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:columnFilter" + customLabel="Filter"></ppe:ReferenceDialog> + <ppe:MultiReference input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:columnSources" + customLabel="Sources"></ppe:MultiReference> + </Group> + </Composite> + <Group text="Cell Contents"> + <Group.layout> + <ppel:PropertiesLayout></ppel:PropertiesLayout> + </Group.layout> + <ppe:ReferenceDialog input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:managedElementType" + customLabel="Relation Kind"></ppe:ReferenceDialog> + <ppe:EnumCombo input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:relationshipDirection" + customLabel="Direction"></ppe:EnumCombo> + <ppe:ReferenceDialog input="{Binding}" + property="GenericUMLRelationshipMatrixDataContext:GenericRelationshipMatrixCellEditorConfiguration:cellContentsFilter" + customLabel="Contents Filter"></ppe:ReferenceDialog> + </Group> +</Composite>
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/Activator.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/Activator.java new file mode 100755 index 00000000000..e571c17e81a --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/Activator.java @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.nattable.properties"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/constraints/IsGenericUMLRelationshipMatrixEditor.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/constraints/IsGenericUMLRelationshipMatrixEditor.java new file mode 100755 index 00000000000..dc8140fd213 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/constraints/IsGenericUMLRelationshipMatrixEditor.java @@ -0,0 +1,50 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.constraints; + +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.properties.constraints.IsEObjectInFlatTableConstraint; +import org.eclipse.papyrus.infra.nattable.utils.TableHelper; +import org.eclipse.papyrus.uml.nattable.properties.utils.MatrixHelper; + +/** + * The constraint which allow to determinate if the Matrix tab can be displayed + * We only show the matrix tab when the selected Table is opened in the current editor. + * It is to avoid trouble with GlazedList during refresh when the user edit the row sources fields + * + * We forbid to display the Matrix tab for closed table + */ +public class IsGenericUMLRelationshipMatrixEditor extends IsEObjectInFlatTableConstraint { + + /** + * @see org.eclipse.papyrus.infra.nattable.properties.constraints.IsEObjectInFlatTableConstraint#checkMoreTableConstraint(org.eclipse.papyrus.infra.nattable.model.nattable.Table) + * + * @param table + * @return + */ + @Override + protected boolean checkMoreTableConstraint(Table table) { + return TableHelper.isMatrixTreeTable(table) && null != MatrixHelper.getMatrixTableWidgetModelManagerFromCurrentEditor(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint#equivalent(org.eclipse.papyrus.infra.constraints.constraints.Constraint) + */ + @Override + protected boolean equivalent(final Constraint constraint) { + return constraint == this || constraint instanceof IsGenericUMLRelationshipMatrixEditor; + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/modelelements/GenericUMLRelationshipMatrixFactory.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/modelelements/GenericUMLRelationshipMatrixFactory.java new file mode 100755 index 00000000000..1013fadde81 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/modelelements/GenericUMLRelationshipMatrixFactory.java @@ -0,0 +1,111 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.modelelements; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; +import org.eclipse.papyrus.infra.properties.contexts.DataContextElement; +import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement; +import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElementFactory; +import org.eclipse.papyrus.infra.ui.util.EditorHelper; +import org.eclipse.papyrus.uml.nattable.properties.Activator; +import org.eclipse.papyrus.uml.nattable.properties.utils.MatrixHelper; +import org.eclipse.ui.IEditorPart; + +/** + * + * The factory for the tab Matrix when we manage Relationship + */ +public class GenericUMLRelationshipMatrixFactory extends EMFModelElementFactory { + + + /** + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractEMFModelElementFactory#updateModelElement(org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement, java.lang.Object) + * + * @param modelElement + * @param newSourceElement + */ + @Override + protected void updateModelElement(EMFModelElement modelElement, Object newSourceElement) { + final NatTableEditor nattableEditor = getCurrentNatTableEditor(); + final IMatrixTableWidgetManager tableManager = (IMatrixTableWidgetManager) nattableEditor.getAdapter(IMatrixTableWidgetManager.class); + if (null != nattableEditor && null != tableManager) { + if (modelElement instanceof GenericUMLRelationshipMatrixModelElement) { + updateTableModelElement((GenericUMLRelationshipMatrixModelElement) modelElement, tableManager); + } + updateEMFModelElement(modelElement, nattableEditor.getTable()); + } else { + super.updateModelElement(modelElement, newSourceElement); + } + } + + /** + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElementFactory#doCreateFromSource(java.lang.Object, org.eclipse.papyrus.infra.properties.contexts.DataContextElement) + * + * @param sourceElement + * @param context + * @return + */ + @Override + protected EMFModelElement doCreateFromSource(Object sourceElement, DataContextElement context) { + final EObject source = EMFHelper.getEObject(sourceElement); + if (null == source) { + Activator.log.warn("Unable to resolve the selected element to a Table"); //$NON-NLS-1$ + return null; + } + // this manager is the manager of the current table editor. It already has been checked by the constraint {@link IsGenericUMLRelationshipMatrix} + final IMatrixTableWidgetManager manager = MatrixHelper.getMatrixTableWidgetModelManagerFromCurrentEditor(); + final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(manager.getTable()); + if (null != manager && null != domain) { + return new GenericUMLRelationshipMatrixModelElement(manager, domain); + } + + return super.doCreateFromSource(sourceElement, context); + } + + /** + * This allows to get the current nattable editor when this is available. + * + * @return The current nattable editor if available or <code>null</code>. + */ + protected NatTableEditor getCurrentNatTableEditor() { + NatTableEditor result = null; + + final IEditorPart currentEditor = EditorHelper.getCurrentEditor(); + if (currentEditor instanceof IMultiPageEditorPart) { + result = ((IMultiPageEditorPart) currentEditor).getActiveEditor().getAdapter(NatTableEditor.class); + } else if (currentEditor instanceof IAdaptable) { + result = ((IAdaptable) currentEditor).getAdapter(NatTableEditor.class); + } + + return result; + } + + /** + * Modify the table property of the nattable model element. + * + * @param nattableModelElement + * The nattable model element. + * @param table + * The table. + */ + protected void updateTableModelElement(final GenericUMLRelationshipMatrixModelElement nattableModelElement, final IMatrixTableWidgetManager tableModelManager) { + nattableModelElement.updateTableWidgetMatrixManager(tableModelManager); + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/modelelements/GenericUMLRelationshipMatrixModelElement.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/modelelements/GenericUMLRelationshipMatrixModelElement.java new file mode 100755 index 00000000000..21ebbf15c24 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/modelelements/GenericUMLRelationshipMatrixModelElement.java @@ -0,0 +1,553 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.modelelements; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.databinding.observable.IObservable; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.IBooleanEObjectExpression; +import org.eclipse.papyrus.infra.emf.expressions.properties.utils.BooleanEObjectExpressionPropertyEditorFactory; +import org.eclipse.papyrus.infra.nattable.contentprovider.MatrixSourcesContentProvider; +import org.eclipse.papyrus.infra.nattable.contentprovider.MatrixDirectionContentProvider; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.ICellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.EObjectWrapper; +import org.eclipse.papyrus.infra.nattable.provider.MatrixRelationshipDirectionLabelProvider; +import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement; +import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory; +import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; +import org.eclipse.papyrus.uml.expressions.umlexpressions.UMLExpressionsPackage; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixCellContentsFilterObservableValue; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixColumnSourcesEMFObservableList; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixColumnRootFilterObservableValue; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixDirectionObservableValue; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixManagedElementTypeObservableValue; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixRowSourcesEMFObservableList; +import org.eclipse.papyrus.uml.nattable.properties.observables.MatrixRowRootFilterObservableValue; +import org.eclipse.papyrus.uml.nattable.properties.providers.GenericRelationshipMatrixElementTypeContentProvider; +import org.eclipse.papyrus.uml.nattable.properties.providers.GenericRelationshipMatrixElementTypeLabelProvider; +import org.eclipse.papyrus.uml.nattable.properties.utils.MatrixPropertyConstants; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * Observable used for Generic UML Relationship Matrix + * + */ +public class GenericUMLRelationshipMatrixModelElement extends EMFModelElement { + + /** + * the current table manager of the open editor + */ + private IMatrixTableWidgetManager tableModelManager; + + /** + * The adapter used to listen all changes in interesting objects + */ + private Adapter changeListener; + + /** + * the list of the estructural feature to listen (it is the feature shown in the Matrix tab) + */ + private List<EStructuralFeature> interestingFeatures; + + /** + * the list of the listen object + */ + private List<EObject> listenEObjects; + + /** + * Constructor. + * + * @param source + * @param domain + */ + public GenericUMLRelationshipMatrixModelElement(final IMatrixTableWidgetManager tableManager, final TransactionalEditingDomain domain) { + super(tableManager.getTable(), domain); + this.tableModelManager = tableManager; + init(); + + } + + /** + * init fields and listener + */ + protected void init() { + // TODO : create observable inheriting from PapyrusObservableValue could help to remove these listeners, but not sure + this.listenEObjects = new ArrayList<EObject>(); + this.interestingFeatures = new ArrayList<EStructuralFeature>(); + this.interestingFeatures.add(NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration()); + this.interestingFeatures.add(NattableaxisconfigurationPackage.eINSTANCE.getLocalTableHeaderAxisConfiguration_AxisManagerConfigurations()); + this.interestingFeatures.add(NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_AxisUsedAsAxisProvider()); + this.interestingFeatures.add(NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule()); + this.interestingFeatures.add(NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources()); + this.interestingFeatures.add(NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_CellContentsFilter()); + this.interestingFeatures.add(NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_Direction()); + this.interestingFeatures.add(NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_EditedElement()); + + + this.changeListener = new AdapterImpl() { + + /** + * + * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification) + * + * @param msg + */ + @Override + public void notifyChanged(Notification msg) { + if (interestingFeatures.contains(msg.getFeature())) { + updateValues(); + } + } + }; + cleanAndReinitListenObjects(); + } + + /** + * This method removes the registered listener on all objects referenced by {@link #listenEObjects}, + * then the listener are reapplied on all interesting objects + * + */ + private void cleanAndReinitListenObjects() { + removeListener(); + + final Table table = getEditedTable(); + if (null == table) { + return; + } + registerListener(table); + final LocalTableHeaderAxisConfiguration columnHeaderAxisConfiguration = table.getLocalColumnHeaderAxisConfiguration(); + + // COLUMNS MANAGEMENT + // we add a listener on the columnHeaderAxisConfiguration + if (columnHeaderAxisConfiguration instanceof LocalTableHeaderAxisConfiguration) { + registerListener(columnHeaderAxisConfiguration); + + // the best way will be to listen the TreeFillingConfiguration of the AxisManagerConfigruation, but it is useless, because the referenced TreeFillingConfiguration are also accessible + // from the owned axis configuration + for (final IAxisConfiguration current : columnHeaderAxisConfiguration.getOwnedAxisConfigurations()) { + if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == 1) { + final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) current; + registerListener(treeFillingConfiguration); + + IAxis provider = treeFillingConfiguration.getAxisUsedAsAxisProvider(); + registerListener(provider); + final IBooleanEObjectExpression filterRule = treeFillingConfiguration.getFilterRule(); + registerListener(filterRule); + } + } + } + final LocalTableHeaderAxisConfiguration rowHeaderAxisConfiguration = table.getLocalRowHeaderAxisConfiguration(); + + if (rowHeaderAxisConfiguration instanceof LocalTableHeaderAxisConfiguration) { + registerListener(rowHeaderAxisConfiguration); + + // the best way will be to listen the TreeFillingConfiguration of the AxisManagerConfigruation, but it is useless, because the referenced TreeFillingConfiguration are also accessible + // from the owned axis configuration + for (final IAxisConfiguration current : rowHeaderAxisConfiguration.getOwnedAxisConfigurations()) { + if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == 1) { + final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) current; + registerListener(treeFillingConfiguration); + + IAxis provider = treeFillingConfiguration.getAxisUsedAsAxisProvider(); + registerListener(provider); + final IBooleanEObjectExpression filterRule = treeFillingConfiguration.getFilterRule(); + registerListener(filterRule); + } + } + } + + + final ICellEditorConfiguration cellEditorConfiguration = table.getOwnedCellEditorConfigurations(); + if (null != cellEditorConfiguration) { + registerListener(cellEditorConfiguration); + if (cellEditorConfiguration instanceof GenericRelationshipMatrixCellEditorConfiguration) { + final GenericRelationshipMatrixCellEditorConfiguration tmp = (GenericRelationshipMatrixCellEditorConfiguration) cellEditorConfiguration; + final IBooleanEObjectExpression filter = tmp.getCellContentsFilter(); + registerListener(filter); + } + } + + final AbstractAxisProvider axisProvider = getEditedTable().getCurrentColumnAxisProvider(); + if (axisProvider instanceof IMasterAxisProvider) { + registerListener(axisProvider); + } + + final AbstractAxisProvider axisProvider2 = getEditedTable().getCurrentRowAxisProvider(); + if (axisProvider2 instanceof IMasterAxisProvider) { + registerListener(axisProvider2); + } + } + + /** + * This method add the eobject parameter in {@link #listenEObjects} and register the listener {@link #changeListener} + * + * @param eobject + * the eobject to listen + */ + private void registerListener(final EObject eobject) { + if (null != eobject && null != this.changeListener) { + eobject.eAdapters().add(this.changeListener); + this.listenEObjects.add(eobject); + } + } + + + /** + * This method clear the list {@link #listenEObjects} and remove the listener {@link #changeListener} for each of them + */ + private void removeListener() { + for (final EObject current : this.listenEObjects) { + current.eAdapters().remove(this.changeListener); + } + this.listenEObjects.clear(); + } + + /** + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElement#dispose() + * + */ + @Override + public void dispose() { + removeListener(); + this.tableModelManager = null; + super.dispose(); + this.changeListener = null; + } + + /** + * + * @return the edited table + */ + private Table getEditedTable() { + return tableModelManager.getTable(); + } + + /** + * + * @param tableModelManager + * this method changes the listen table + */ + public void updateTableWidgetMatrixManager(final IMatrixTableWidgetManager tableModelManager) { + this.tableModelManager = tableModelManager; + updateValues(); + } + + /** + * update all values in the property view + */ + private void updateValues() { + // We have to manage it as synExec because this is notified that the value changed (so done after) + Display.getDefault().syncExec(new Runnable() { + + /** + * + * @see java.lang.Runnable#run() + * + */ + @Override + public void run() { + cleanAndReinitListenObjects(); + final Event event = new Event(); + final Iterator<IObservable> observableIterator = getObservables().values().iterator(); + while (observableIterator.hasNext()) { + final IObservable current = observableIterator.next(); + if (!current.isDisposed() && current instanceof Listener) { + ((Listener) current).handleEvent(event); + } + } + } + }); + } + + @Override + protected IObservable doGetObservable(String propertyPath) { + IObservable value = null; + if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { + value = new MatrixRowSourcesEMFObservableList(getDomain(), getEditedTable(), this.tableModelManager); + } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { + value = new MatrixColumnSourcesEMFObservableList(getDomain(), getEditedTable(), this.tableModelManager); + } else if (MatrixPropertyConstants.MATRIX_ROW_FILTER.equals(propertyPath)) { + value = new MatrixRowRootFilterObservableValue(getEditedTable()); + } else if (MatrixPropertyConstants.MATRIX_COLUMN_FILTER.equals(propertyPath)) { + value = new MatrixColumnRootFilterObservableValue(getEditedTable()); + } else if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { + value = new MatrixManagedElementTypeObservableValue(getEditedTable()); + } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { + value = new MatrixDirectionObservableValue(getEditedTable()); + } else if (MatrixPropertyConstants.MATRIX_CELL_FILTER.equals(propertyPath)) { + value = new MatrixCellContentsFilterObservableValue(getEditedTable()); + } else { + value = super.doGetObservable(propertyPath); + } + return value; + } + + /** + * + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getContentProvider(java.lang.String) + * + * @param propertyPath + * @return + */ + @Override + public IStaticContentProvider getContentProvider(String propertyPath) { + IStaticContentProvider provider = null; + if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { + provider = new MatrixSourcesContentProvider(getRoot(getEditedTable().getContext())); + } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { + provider = new MatrixSourcesContentProvider(getRoot(getEditedTable().getContext())); + } else if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { + provider = new GenericRelationshipMatrixElementTypeContentProvider(getRoot(getEditedTable().getContext())); + } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { + provider = new MatrixDirectionContentProvider(); + } else { + provider = super.getContentProvider(propertyPath); + } + return provider; + } + + /** + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getFeature(java.lang.String) + * + * @param propertyPath + * @return + */ + @Override + public EStructuralFeature getFeature(final String propertyPath) { + if (MatrixPropertyConstants.MATRIX_ROW_FILTER.equals(propertyPath) || MatrixPropertyConstants.MATRIX_COLUMN_FILTER.equals(propertyPath)) { + return NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule(); + } + if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath) || MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { + return NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources(); + } + if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { + return NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_Direction(); + } + if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { + return NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_EditedElement(); + } + if (MatrixPropertyConstants.MATRIX_CELL_FILTER.equals(propertyPath)) { + return NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_CellContentsFilter(); + } + return super.getFeature(propertyPath); + } + + /** + * Gets the root EObject from the given one + * + * @param obj + * An object + * @return The root object which is an ancestor of the given one + */ + private EObject getRoot(EObject obj) { + EObject current = obj; + EObject parent = obj.eContainer(); + while (parent != null) { + current = parent; + parent = parent.eContainer(); + } + return current; + } + + /** + * + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getLabelProvider(java.lang.String) + * + * @param propertyPath + * @return + */ + @Override + public ILabelProvider getLabelProvider(String propertyPath) { + ILabelProvider provider = super.getLabelProvider(propertyPath); + if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath) || MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { + provider = new WrappedLabelProvider(provider); + } + if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { + provider = new MatrixRelationshipDirectionLabelProvider(); + } + if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { + provider = new GenericRelationshipMatrixElementTypeLabelProvider(); + } + return provider; + } + + /** + * + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#isOrdered(java.lang.String) + * + * @param propertyPath + * @return + */ + @Override + public boolean isOrdered(String propertyPath) { + if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { + return false; // to avoid refresh problem in the table + } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { + return false; // to avoid refresh problem in the table + } else if (MatrixPropertyConstants.MATRIX_CELL_FILTER.equals(propertyPath)) { + return false; // to avoid refresh problem in the table + } + return super.isOrdered(propertyPath); + } + + /** + * + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getDirectCreation(java.lang.String) + * + * @param propertyPath + * @return + */ + @Override + public boolean getDirectCreation(String propertyPath) { + if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath) || MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { + return false;// it is a containment feature, but we need to open a dialog to wrapper the selected element + } + return super.getDirectCreation(propertyPath); + } + + /** + * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#getValueFactory(java.lang.String) + * + * @param propertyPath + * @return + */ + @Override + public ReferenceValueFactory getValueFactory(String propertyPath) { + if (MatrixPropertyConstants.MATRIX_ROW_FILTER.equals(propertyPath) || MatrixPropertyConstants.MATRIX_COLUMN_FILTER.equals(propertyPath)) { + if (this.domain instanceof AdapterFactoryEditingDomain) { + BooleanEObjectExpressionPropertyEditorFactory factory = new BooleanEObjectExpressionPropertyEditorFactory((AdapterFactoryEditingDomain) domain, NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule()); + factory.setNsUri(UMLExpressionsPackage.eNS_URI); + return factory; + } + } else if (MatrixPropertyConstants.MATRIX_CELL_FILTER.equals(propertyPath)) { + if (this.domain instanceof AdapterFactoryEditingDomain) { + BooleanEObjectExpressionPropertyEditorFactory factory = new BooleanEObjectExpressionPropertyEditorFactory((AdapterFactoryEditingDomain) domain, + NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_CellContentsFilter()); + factory.setNsUri(UMLExpressionsPackage.eNS_URI); + return factory; + } + } + return super.getValueFactory(propertyPath); + } + + /** + * + * private label provider used to display label for TreeFillingConfiguration#sources + * This labelprovider wrap the super labelprovider + */ + private class WrappedLabelProvider implements ILabelProvider { + + private ILabelProvider wrappedLabelProvider; + + public WrappedLabelProvider(final ILabelProvider provider) { + this.wrappedLabelProvider = provider; + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) + * + * @param listener + */ + @Override + public void addListener(ILabelProviderListener listener) { + + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() + * + */ + @Override + public void dispose() { + + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) + * + * @param element + * @param property + * @return + */ + @Override + public boolean isLabelProperty(Object element, String property) { + return false; + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) + * + * @param listener + */ + @Override + public void removeListener(ILabelProviderListener listener) { + + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + * + * @param element + * @return + */ + @Override + public Image getImage(Object element) { + if (element instanceof EObjectWrapper) { + return this.wrappedLabelProvider.getImage(((EObjectWrapper) element).getElement()); + } + return this.wrappedLabelProvider.getImage(element); + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + * + * @param element + * @return + */ + @Override + public String getText(Object element) { + if (element instanceof EObjectWrapper) { + return this.wrappedLabelProvider.getText(((EObjectWrapper) element).getElement()); + } + return this.wrappedLabelProvider.getText(element); + } + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable.java new file mode 100755 index 00000000000..37776f4a6db --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable.java @@ -0,0 +1,179 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration; +import org.eclipse.papyrus.infra.nattable.properties.observable.AbstractConfigurationElementObservableValue; +import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils; +import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; + +/** + * This abstract class provide the observable value to edit the filer defined in the first TreeFillingConfiguration found for depth=0 + * + */ +public abstract class AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable extends AbstractConfigurationElementObservableValue { + + /** + * the depth of the managed TreeFillingConfiguration + */ + protected final int depth; + + /** + * <code>true</code> if we are working on column + */ + protected final boolean isColumn; + + /** + * Constructor. + * + * @param table + * the current edited table + * @param managedFeature + * the managed feature + */ + public AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable(final Table table, final int depth, final boolean isColumn) { + super(table, NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule()); + this.depth = depth; + this.isColumn = isColumn; + oldValue = doGetValue(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + */ + @Override + public Object getValueType() { + return NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule().getEType(); + } + + /** + * @see org.eclipse.papyrus.infra.nattable.properties.observable.AbstractConfigurationElementObservableValue#getEditedEObject() + * + * @return + */ + @Override + protected EObject getEditedEObject() { + final Table table = getTable(); + final AbstractHeaderAxisConfiguration conf; + if (isColumn) { + conf = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table); + } else { + conf = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(table); + } + if (null != conf) { + // we assume that there is only one AxisManagerConfiguration and only one TreeFillingConfiguration with depth==1 for it + if (conf instanceof LocalTableHeaderAxisConfiguration) { + final List<AxisManagerConfiguration> axisManagerConfigurations = ((LocalTableHeaderAxisConfiguration) conf).getAxisManagerConfigurations(); + for (final AxisManagerConfiguration current : axisManagerConfigurations) { + for (IAxisConfiguration axisConfig : current.getLocalSpecificConfigurations()) { + if (axisConfig instanceof TreeFillingConfiguration) { + if (this.depth == ((TreeFillingConfiguration) axisConfig).getDepth()) { + return axisConfig; + } + } + } + } + // we assume that there is only one AxisManagerConfiguration and only one TreeFillingConfiguration with depth==1 for it + } else if (conf instanceof TableHeaderAxisConfiguration) { + final List<AxisManagerRepresentation> axisManagers = ((TableHeaderAxisConfiguration) conf).getAxisManagers(); + for (final AxisManagerRepresentation rep : axisManagers) { + for (final IAxisConfiguration axisConfig : rep.getSpecificAxisConfigurations()) { + if (axisConfig instanceof TreeFillingConfiguration) { + if (this.depth == ((TreeFillingConfiguration) axisConfig).getDepth()) { + return axisConfig; + } + } + } + } + } + } + return null; + } + + /** + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected void doSetValue(Object value) { + String labelCommand; + if (isColumn) { + labelCommand = "ChangeColumnExpressionCommand"; //$NON-NLS-1$ + } else { + labelCommand = "ChangeRowExpressionCommand"; //$NON-NLS-1$ + } + final CompositeCommand compositeCommand = new CompositeCommand(labelCommand); + + Table table = getTable(); + TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table); + TreeFillingConfiguration configuration = (TreeFillingConfiguration) getEditedEObject(); + if (null != configuration) { + if (configuration.eContainer() instanceof TableHeaderAxisConfiguration) { + // we must copy it in the table; + LocalTableHeaderAxisConfiguration localHeaderconfig = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfigurationIncludingAllConfigurations((TableHeaderAxisConfiguration) configuration.eContainer()); + + SetRequest request = null; + if ((isColumn && !table.isInvertAxis()) || (!isColumn && table.isInvertAxis())) { + request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration(), localHeaderconfig); + } else { + request = new SetRequest(domain, table, NattablePackage.eINSTANCE.getTable_LocalRowHeaderAxisConfiguration(), localHeaderconfig); + } + final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(table); + final ICommand cmd = provider.getEditCommand(request); + compositeCommand.add(cmd); + + // we need to found the real edited TreeFillingConfiguration + // we assume that there is only one AxisManagerConfiguration and only one TreeFillingConfiguration with depth==1 for it + for (final AxisManagerConfiguration config : localHeaderconfig.getAxisManagerConfigurations()) { + for (IAxisConfiguration axisConfiguration : config.getLocalSpecificConfigurations()) { + if (axisConfiguration instanceof TreeFillingConfiguration && this.depth == ((TreeFillingConfiguration) axisConfiguration).getDepth()) { + configuration = (TreeFillingConfiguration) axisConfiguration; + break; + } + } + } + } + + // now we have the configuration + SetRequest request = new SetRequest(domain, configuration, getManagedFeature(), value); + final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(configuration); + final ICommand cmd = provider.getEditCommand(request); + compositeCommand.add(cmd); + domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(compositeCommand)); + } + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixRelationshipCellEditorConfigurationObservableValue.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixRelationshipCellEditorConfigurationObservableValue.java new file mode 100755 index 00000000000..1a0ecc9a46d --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixRelationshipCellEditorConfigurationObservableValue.java @@ -0,0 +1,154 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import org.eclipse.core.databinding.observable.value.AbstractObservableValue; +import org.eclipse.core.databinding.observable.value.ValueDiff; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.ICellEditorConfiguration; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + + +/** + * Abstract Observable for {@link ICellEditorConfiguration} + */ +public abstract class AbstractMatrixRelationshipCellEditorConfigurationObservableValue extends AbstractObservableValue implements Listener { + + /** + * The current editing domain. + */ + private EditingDomain domain; + + /** + * The managed table. + */ + private ICellEditorConfiguration matrixRelationshipCellEditorConfiguration; + + /** + * The managed feature. + */ + private EStructuralFeature managedFeature; + + /** + * The last value of the managed feature. + */ + private Object oldValue; + + /** + * Constructor. + * + * @param table + * The managed table. + * @param managedFeature + * The managed feature. + */ + public AbstractMatrixRelationshipCellEditorConfigurationObservableValue(final EditingDomain domain, final Table table, final EStructuralFeature managedFeature) { + this.domain = domain; + this.matrixRelationshipCellEditorConfiguration = table.getOwnedCellEditorConfigurations(); + this.managedFeature = managedFeature; + this.oldValue = doGetValue(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue() + * + * @return + * the current value + */ + @Override + protected Object doGetValue() { + EObject editedObject = getEditedEObject(); + if (null != editedObject) { + return editedObject.eGet(getManagedFeature()); + } + return null; + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected final void doSetValue(Object value) { + final Command setCommand = SetCommand.create(this.domain, getEditedEObject(), getManagedFeature(), value); + if (setCommand.canExecute()) { + this.domain.getCommandStack().execute(setCommand); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + */ + @Override + public Object getValueType() { + return getManagedFeature().getEType(); + } + + /** + * Get the managed feature. + * + * @return + * The managed feature. + */ + public EStructuralFeature getManagedFeature() { + return managedFeature; + } + + /** + * Get the matrix relationship cell editor configuration. + * + * @return + * The matrix relationship cell editor configuration. + */ + protected EObject getEditedEObject() { + return matrixRelationshipCellEditorConfiguration; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + @Override + public void handleEvent(Event event) { + final Object newValue = doGetValue(); + // big test required to avoid NPE when we receive event during the exchange of the axis + if ((newValue != oldValue) && ((newValue != null && oldValue == null) || newValue == null && oldValue != null || (oldValue != null && !oldValue.equals(newValue)))) { + final Object localOldValue = oldValue; + oldValue = newValue; + fireValueChange(new ValueDiff() { + + @Override + public Object getOldValue() { + return localOldValue; + } + + @Override + public Object getNewValue() { + return newValue; + } + }); + } + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixSourcesEMFObservableList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixSourcesEMFObservableList.java new file mode 100755 index 00000000000..043dd2bc480 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/AbstractMatrixSourcesEMFObservableList.java @@ -0,0 +1,85 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.IWrapper; +import org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList; + +/** + * Abstract Observable list to matrix sources + */ +public abstract class AbstractMatrixSourcesEMFObservableList extends EMFObservableList { + + /** the current matrix table manager */ + protected IMatrixTableWidgetManager manager; + + /** + * Constructor. + * + * @param wrappedList + * @param domain + * @param source + * @param feature + */ + @SuppressWarnings("unchecked") + public AbstractMatrixSourcesEMFObservableList(final EditingDomain domain, final Table table, final IMatrixTableWidgetManager manager, final IMasterAxisProvider provider, final EStructuralFeature editedFeature) { + super(EMFProperties.list(editedFeature).observe(provider), domain, provider, editedFeature); + this.manager = manager; + } + + /** + * @see org.eclipse.core.databinding.observable.list.ObservableList#toArray() + * + * @return + */ + @Override + public Object[] toArray() { // override to be able to manage the isUnique value for the edited feature + List<Object> toReturn = new ArrayList<Object>(); + for (Object current : super.toArray()) { + if (current instanceof IWrapper) { + toReturn.add(((IWrapper) current).getElement()); + } + } + return toReturn.toArray(new Object[toReturn.size()]); + } + + /** + * @see org.eclipse.core.databinding.observable.list.ObservableList#indexOf(java.lang.Object) + * + * @param o + * @return + */ + @Override + public int indexOf(Object o) { + for (int i = 0; i < this.wrappedList.size(); i++) { + Object current = this.wrappedList.get(i); + if (o == current) { + return i; + } + if (current instanceof IWrapper && o == ((IWrapper) current).getElement()) { + return i; + } + } + return -1; + } +}
\ No newline at end of file diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixCellContentsFilterObservableValue.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixCellContentsFilterObservableValue.java new file mode 100755 index 00000000000..13b250562a3 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixCellContentsFilterObservableValue.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage; +import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; + +/** + * + * Observable for the filter of the cell contents feature + * + */ +public class MatrixCellContentsFilterObservableValue extends AbstractMatrixRelationshipCellEditorConfigurationObservableValue { + + /** + * Constructor. + * + * @param table + * @param managedFeature + */ + public MatrixCellContentsFilterObservableValue(final Table table) { + super(TableEditingDomainUtils.getTableEditingDomain(table), table, NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_CellContentsFilter()); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnRootFilterObservableValue.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnRootFilterObservableValue.java new file mode 100755 index 00000000000..5ec53435021 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnRootFilterObservableValue.java @@ -0,0 +1,32 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; + + +/** + * This class provide the observable value to edit the filer defined in the first TreeFillingConfiguration found for depth=0 and defined for column + */ +public class MatrixColumnRootFilterObservableValue extends AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable { + + /** + * Constructor. + * + * @param table + * The managed table. + */ + public MatrixColumnRootFilterObservableValue(final Table table) { + super(table, 1, true); + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java new file mode 100755 index 00000000000..0561ef638ae --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java @@ -0,0 +1,345 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.EObjectWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.IWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperFactory; + +/** + * Observable for Matrix column sources feature + * + */ +public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesEMFObservableList { + + + /** + * Constructor. + * + * @param wrappedList + * @param domain + * @param source + * @param feature + */ + public MatrixColumnSourcesEMFObservableList(final EditingDomain domain, final Table table, final IMatrixTableWidgetManager manager) { + super(domain, table, manager, (IMasterAxisProvider) table.getCurrentColumnAxisProvider(), NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources()); + } + + /** + * @Override + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#remove(java.lang.Object) + * + * @param o + * @return + */ + public boolean remove(Object o) { + if (isDisposed()) { + return true; + } + Object toRemove = null; + if (o instanceof IWrapper) { + toRemove = (IWrapper) o; + } else { + for (final Object currentContext : ((IMasterAxisProvider) this.source).getSources()) { + if (currentContext instanceof IWrapper && (((IWrapper) currentContext).getElement() == o)) { + toRemove = currentContext; + break; + } + } + } + Assert.isNotNull(toRemove); + return super.remove(toRemove); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#addAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean addAll(Collection c) { + // 1. we build EOBjectWrapper to wrap the element selected by the user and be able to store them in the Table as column context + final Collection<IWrapper> toAdd = new ArrayList<IWrapper>(); + for (final Object current : c) { + if (current instanceof IWrapper) { + // we recreate a wrapper, because the previous one will be destroyed in few time by the remove all command previously executed + final EObjectWrapper wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper(); + wrapper.setElement((EObject) ((IWrapper) current).getElement()); + toAdd.add(wrapper); + } else if (current instanceof EObject) { + final EObjectWrapper wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper(); + wrapper.setElement((EObject) current); + toAdd.add(wrapper); + } + } + Assert.isTrue(c.size() == toAdd.size()); + return super.addAll(toAdd); + } + + /** + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getRemoveCommand(java.lang.Object) + * + * @param value + * @return + */ + @Override + public Command getRemoveCommand(Object value) { + return super.getRemoveCommand(value); + } + + /** + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(java.util.Collection) + * + * @param values + * @return + */ + @Override + public Command getAddAllCommand(final Collection<?> values) { + return super.getAddAllCommand(values); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#clear() + * + */ + @Override + public void clear() { + super.clear(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddCommand(int, java.lang.Object) + * + * @param index + * @param value + * @return + */ + @Override + public Command getAddCommand(int index, Object value) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddCommand(java.lang.Object) + * + * @param value + * @return + */ + @Override + public Command getAddCommand(Object value) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public Command getAddAllCommand(int index, Collection<?> values) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public Command getRemoveCommand(int index) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public Command getRemoveAllCommand(Collection<?> values) { + // 1. we edit the field column context + Command cmd = super.getRemoveAllCommand(values); + return cmd; + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public Command getRetainAllCommand(Collection<?> values) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public Command getSetCommand(int index, Object value) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public void add(int index, Object value) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public boolean add(Object o) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public boolean addAll(int index, Collection c) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#removeAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean removeAll(Collection c) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#retainAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean retainAll(Collection c) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#move(int, int) + * + * @param oldIndex + * @param newIndex + * @return + */ + @Override + public Object move(int oldIndex, int newIndex) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#remove(int) + * + * @param index + * @return + */ + @Override + public Object remove(int index) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.list.ObservableList#contains(java.lang.Object) + * + * @param o + * @return + */ + @Override + public boolean contains(Object o) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.list.ObservableList#containsAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean containsAll(Collection c) { + throw new UnsupportedOperationException(); + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixDirectionObservableValue.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixDirectionObservableValue.java new file mode 100755 index 00000000000..4a0017c59ab --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixDirectionObservableValue.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage; +import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; + + +/** + * Observable for the direction of the relationships to create and display feature + */ +public class MatrixDirectionObservableValue extends AbstractMatrixRelationshipCellEditorConfigurationObservableValue { + + /** + * Constructor. + * + * @param domain + * The current editing domain. + * @param table + * The managed table. + */ + public MatrixDirectionObservableValue(final Table table) { + super(TableEditingDomainUtils.getTableEditingDomain(table), table, NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_Direction()); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixManagedElementTypeObservableValue.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixManagedElementTypeObservableValue.java new file mode 100755 index 00000000000..81bf1377c41 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixManagedElementTypeObservableValue.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage; +import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils; + + +/** + * Observable for the element type configruation feature. + */ +public class MatrixManagedElementTypeObservableValue extends AbstractMatrixRelationshipCellEditorConfigurationObservableValue { + + /** + * Constructor. + * + * @param domain + * The current editing domain. + * @param table + * The managed table. + */ + public MatrixManagedElementTypeObservableValue(final Table table) { + super(TableEditingDomainUtils.getTableEditingDomain(table), table, NattablecelleditorPackage.eINSTANCE.getGenericRelationshipMatrixCellEditorConfiguration_EditedElement()); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowRootFilterObservableValue.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowRootFilterObservableValue.java new file mode 100755 index 00000000000..2e777baf76f --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowRootFilterObservableValue.java @@ -0,0 +1,46 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; + + +/** + * This class provide the observable value to edit the filer defined in the first TreeFillingConfiguration found for depth=0 and defined for row + */ +public class MatrixRowRootFilterObservableValue extends AbstractMatrixFirstTreeFillingConfigurationFilterEMFObservable { + + + + /** + * Constructor. + * + * @param table + * The managed table. + */ + public MatrixRowRootFilterObservableValue(final Table table) { + super(table, 1, false); + } + + /** + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected void doSetValue(Object value) { + super.doSetValue(value); + } + + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java new file mode 100755 index 00000000000..cea0fc0d392 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java @@ -0,0 +1,383 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.observables; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.EObjectWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.IWrapper; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperFactory; + +/** + * Observable for Matrix row sources feature + * + */ +public class MatrixRowSourcesEMFObservableList extends AbstractMatrixSourcesEMFObservableList { + + /** + * Constructor. + * + * @param wrappedList + * @param domain + * @param source + * @param feature + */ + public MatrixRowSourcesEMFObservableList(final EditingDomain domain, final Table table, final IMatrixTableWidgetManager manager) { + super(domain, table, manager, (IMasterAxisProvider) table.getCurrentRowAxisProvider(), NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources()); + } + + + + /** + * @Override + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#remove(java.lang.Object) + * + * @param o + * @return + */ + public boolean remove(Object o) { + if (isDisposed()) { + return true; + } + Object toRemove = null; + if (o instanceof IWrapper) { + toRemove = (IWrapper) o; + } else { + for (final Object currentContext : ((IMasterAxisProvider) this.source).getSources()) { + if (currentContext instanceof IWrapper && (((IWrapper) currentContext).getElement() == o)) { + toRemove = currentContext; + break; + } + } + } + Assert.isNotNull(toRemove); + return super.remove(toRemove); + } + + /** + * @Override + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#addAll(java.util.Collection) + * + * @param c + * @return + */ + public boolean addAll(Collection c) { + // 1. we build EOBjectWrapper to wrap the element selected by the user and be able to store them in the Table as row context + final Collection<IWrapper> toAdd = new ArrayList<IWrapper>(); + for (final Object current : c) { + if (current instanceof IWrapper) { + toAdd.add((IWrapper) current); + } else if (current instanceof EObject) { + final EObjectWrapper wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper(); + wrapper.setElement((EObject) current); + toAdd.add(wrapper); + } + } + Assert.isTrue(c.size() == toAdd.size()); + return super.addAll(toAdd); + } + + /** + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getRemoveCommand(java.lang.Object) + * + * @param value + * @return + */ + @Override + public Command getRemoveCommand(Object value) { + // 1. we remove the row context + Command cmd = super.getRemoveCommand(value); + + // 2. we remove the ITreeItemAxis representing this row context + if (value instanceof IWrapper) {// always true in the current implementation + // TransactionalEditingDomain domain; + Collection<Object> coll = Collections.singletonList(((IWrapper) value).getElement()); + final Command tmp = this.manager.getRowAxisManager().getDestroyAxisCommand((TransactionalEditingDomain) editingDomain, coll); + if (null != tmp && tmp.canExecute()) { + cmd = cmd.chain(tmp); + } + } + + return cmd; + } + + /** + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(java.util.Collection) + * + * @param values + * @return + */ + @Override + public Command getAddAllCommand(final Collection<?> values) { + // if(true) return IdentityCommand.INSTANCE; + Command cmd = super.getAddAllCommand(values); + final List<Object> toAdd = new ArrayList<Object>(); + for (Object current : values) { + if (current instanceof EObjectWrapper) {// always true in the current implementation + toAdd.add(((EObjectWrapper) current).getElement()); + } + } + Assert.isTrue(values.size() == toAdd.size()); + final Command tmp = this.manager.getAddRowElementCommand(toAdd); + if (null != tmp && tmp.canExecute()) { + cmd = cmd.chain(tmp); + } + return cmd; + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#clear() + * + */ + @Override + public void clear() { + super.clear(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddCommand(int, java.lang.Object) + * + * @param index + * @param value + * @return + */ + @Override + public Command getAddCommand(int index, Object value) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddCommand(java.lang.Object) + * + * @param value + * @return + */ + @Override + public Command getAddCommand(Object value) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getAddAllCommand(int, java.util.Collection) + * + * @param index + * @param values + * @return + */ + @Override + public Command getAddAllCommand(int index, Collection<?> values) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getRemoveCommand(int) + * + * @param index + * @return + */ + @Override + public Command getRemoveCommand(int index) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getRemoveAllCommand(java.util.Collection) + * + * @param values + * @return + */ + @Override + public Command getRemoveAllCommand(Collection<?> values) { + // 1. we edit the field row context + Command cmd = super.getRemoveAllCommand(values); + + // 2. we are looking for the element represented by the deleted row contexts + final List<Object> toRemove = new ArrayList<Object>(); + for (Object current : values) { + if (current instanceof EObjectWrapper) {// always true in the current implementation + toRemove.add(((EObjectWrapper) current).getElement()); + } + } + + Assert.isTrue(values.size() == toRemove.size()); + // 3. we chain the command to delete the ITreeItemAxis of the table representing the deleted row contexts + final Command tmp = this.manager.getRowAxisManager().getDestroyAxisCommand((TransactionalEditingDomain) this.editingDomain, toRemove); + if (null != tmp && tmp.canExecute()) { + cmd = cmd.chain(tmp); + } + return cmd; + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getRetainAllCommand(java.util.Collection) + * + * @param values + * @return + */ + @Override + public Command getRetainAllCommand(Collection<?> values) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#getSetCommand(int, java.lang.Object) + * + * @param index + * @param value + * @return + */ + @Override + public Command getSetCommand(int index, Object value) { + throw new UnsupportedOperationException(); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#add(int, java.lang.Object) + * + * @param index + * @param value + */ + @Override + public void add(int index, Object value) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#add(java.lang.Object) + * + * @param o + * @return + */ + @Override + public boolean add(Object o) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#addAll(int, java.util.Collection) + * + * @param index + * @param c + * @return + */ + @Override + public boolean addAll(int index, Collection c) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#removeAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean removeAll(Collection c) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#retainAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean retainAll(Collection c) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#move(int, int) + * + * @param oldIndex + * @param newIndex + * @return + */ + @Override + public Object move(int oldIndex, int newIndex) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.emf.databinding.EMFObservableList#remove(int) + * + * @param index + * @return + */ + @Override + public Object remove(int index) { + throw new UnsupportedOperationException(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.list.ObservableList#contains(java.lang.Object) + * + * @param o + * @return + */ + @Override + public boolean contains(Object o) { + throw new UnsupportedOperationException(); + } + + /** + * S + * + * @see org.eclipse.core.databinding.observable.list.ObservableList#containsAll(java.util.Collection) + * + * @param c + * @return + */ + @Override + public boolean containsAll(Collection c) { + throw new UnsupportedOperationException(); + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/GenericRelationshipMatrixElementTypeContentProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/GenericRelationshipMatrixElementTypeContentProvider.java new file mode 100755 index 00000000000..19945f83165 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/GenericRelationshipMatrixElementTypeContentProvider.java @@ -0,0 +1,346 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.properties.providers; + +import java.util.Collection; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.papyrus.infra.architecture.ArchitectureDescriptionUtils; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureContext; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory; +import org.eclipse.papyrus.infra.nattable.manager.cell.IGenericMatrixRelationshipCellManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage; +import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; +import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration; +import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration; +import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration; +import org.eclipse.papyrus.infra.widgets.providers.IGraphicalContentProvider; +import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider; +import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; +import org.eclipse.swt.widgets.Composite; + +/** + * The content provider used by Generic Matrix to choose relationship element type + */ +public final class GenericRelationshipMatrixElementTypeContentProvider implements IStaticContentProvider, IGraphicalContentProvider, IHierarchicContentProvider, ITreeContentProvider, IContentProvider { + + /** + * The architecture context which allows to get all available element types + */ + private final MergedArchitectureContext architextureContext; + + /** + * The list of the metamodel uri to ignore + */ + private Collection<String> nsURIToIgnore; + + /** + * The list of the managed relationship identified by their EClass + */ + private Collection<EClass> managedRelationships; + + /** + * The list of the identifiers of the ElementTypeSetConfiguration to ignore + */ + private Collection<String> elementTypeSetConfigurationToIgnore; + + /** + * separator used in the display name field of the IElementType + */ + private final String displayNameSeparator = "::"; //$NON-NLS-1$ + + /** + * the map with the available configuration organized by the metamodel name deduced from the display name of the IElementType + */ + private Map<String, Collection<ElementTypeConfiguration>> configurationByMetamodelMap; + + /** + * The compartor used to sort Element typess + */ + private Comparator<ElementTypeConfiguration> comparator = new ElementTypeConfigurationComparator(); + + + /** + * Constructor. + * + * @param context + */ + public GenericRelationshipMatrixElementTypeContentProvider(final EObject context) { + if (null != context && null != context.eResource() && null != context.eResource().getResourceSet()) { + this.architextureContext = new ArchitectureDescriptionUtils((ModelSet) context.eResource().getResourceSet()).getArchitectureContext(); + } else { + this.architextureContext = null; + } + initFields(); + } + + /** + * This method allows to init the field of this class + */ + private void initFields() { + this.nsURIToIgnore = initURIToIgnore(); + this.managedRelationships = initManagedRelationships(); + this.elementTypeSetConfigurationToIgnore = initElementTypeSetConfigurations(); + this.configurationByMetamodelMap = initMapContents(); + } + + /** + * @return + */ + private Map<String, Collection<ElementTypeConfiguration>> initMapContents() { + Map<String, Collection<ElementTypeConfiguration>> mapByMetamodel = new TreeMap<String, Collection<ElementTypeConfiguration>>(); + if (null == this.architextureContext) { + return null; + } + + // we build the set of the supported configuration according to the context and the existing Matrix Cell Managers + for (final ElementTypeSetConfiguration typeSet : this.architextureContext.getElementTypes()) { + if (this.elementTypeSetConfigurationToIgnore.contains(typeSet.getIdentifier()) || typeSet.getMetamodelNsURI() == null || this.nsURIToIgnore.contains(typeSet.getMetamodelNsURI())) { + continue; + } + for (final ElementTypeConfiguration config : typeSet.getElementTypeConfigurations()) { + if (isManagedElementTypeConfiguration(config)) { + // 1. we determine the metamodel name from the display name (I know, this pattern is not sure, but it works for UML and SysML 1.1) + String metamodelName = ""; //$NON-NLS-1$ + final String displayName = ProviderUtils.getElementTypeDisplayName(config); + + + final String[] res = displayName.split(this.displayNameSeparator); + if (res.length > 2) { + continue;// we ignore it, probably an element type to define a feature inside an object (ie : UML::CollaborationUse::RoleBinding + } + if (res.length == 2) { + metamodelName = res[0]; + } + + final Collection<ElementTypeConfiguration> list; + if (!mapByMetamodel.containsKey(metamodelName)) { + list = new TreeSet<ElementTypeConfiguration>(comparator); + mapByMetamodel.put(metamodelName, list); + } + mapByMetamodel.get(metamodelName).add(config); + } + } + } + return mapByMetamodel; + } + + + /** + * @return + * the list of the nsURI of metamodels to ignore + */ + private Collection<String> initURIToIgnore() { + final Collection<String> uriToIgnore = new HashSet<String>(); + uriToIgnore.add(EcorePackage.eINSTANCE.getNsURI()); + uriToIgnore.add(NattablePackage.eINSTANCE.getNsURI()); + uriToIgnore.add(NotationPackage.eINSTANCE.getNsURI());// to avoid dependency on GMF + return uriToIgnore; + } + + /** + * + * @return + * a collection with the managed relationship identified by their EClass + */ + private Collection<EClass> initManagedRelationships() { + final Set<EClass> managedRelationships = new HashSet<EClass>(); + for (final IGenericMatrixRelationshipCellManager current : CellManagerFactory.INSTANCE.getRegisteredGenericMatrixRelationshipCellManager()) { + managedRelationships.add(current.getManagedRelationship()); + } + return managedRelationships; + } + + /** + * @return + * a collection with the identifier of the ElementTypeSetConfigurations to ignore + */ + private Collection<String> initElementTypeSetConfigurations() { + final Set<String> ignoredStypeSets = new HashSet<String>(); + ignoredStypeSets.add("org.eclipse.papyrus.umldi.service.types.UMLDIElementTypeSet"); //$NON-NLS-1$ + return ignoredStypeSets; + } + + /** + * + * @param configuration + * an element type configuration + * @return + * <code>true</code> if the element type is managed by a CellManager and <code>false</code> otherwise + */ + private boolean isManagedElementTypeConfiguration(final ElementTypeConfiguration configuration) { + if (configuration instanceof MetamodelTypeConfiguration) { + return this.managedRelationships.contains(((MetamodelTypeConfiguration) configuration).getEClass()); + } + if (configuration instanceof SpecializationTypeConfiguration) { + final SpecializationTypeConfiguration a = (SpecializationTypeConfiguration) configuration; + if (a.getSpecializedTypes().size() == 1) { + return isManagedElementTypeConfiguration(a.getSpecializedTypes().get(0)); + } + } + return false; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) + */ + @Override + public Object[] getElements(final Object inputElement) { + return getElements(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements() + */ + @Override + public Object[] getElements() { + if (null != this.configurationByMetamodelMap) { + // this.configurationByMetamodelMap.s + return this.configurationByMetamodelMap.keySet().toArray(); + } + return new Object[0]; + } + + /** + * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) + * + * @param parentElement + * @return + */ + @Override + public Object[] getChildren(final Object parentElement) { + if (parentElement instanceof String && this.configurationByMetamodelMap.containsKey(parentElement)) { + return this.configurationByMetamodelMap.get(parentElement).toArray(); + } + return null; + } + + /** + * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) + * + * @param element + * @return + */ + @Override + public Object getParent(final Object element) { + if (element instanceof String) { + return null; + } + if (element instanceof ElementTypeConfiguration) { + for (final Entry<String, Collection<ElementTypeConfiguration>> entry : this.configurationByMetamodelMap.entrySet()) { + if (entry.getValue().contains(element)) { + return entry.getKey(); + } + } + } + return null; + } + + /** + * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) + * + * @param element + * @return + */ + @Override + public boolean hasChildren(final Object element) { + if (element instanceof String) { + return 0 != this.configurationByMetamodelMap.get(element).size(); + } + return false; + } + + /** + * @see org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider#isValidValue(java.lang.Object) + * + * @param element + * @return + */ + @Override + public boolean isValidValue(Object element) { + final IElementType elementType; + + if (element instanceof MetamodelTypeConfiguration) { + elementType = ElementTypeRegistry.getInstance().getType(((MetamodelTypeConfiguration) element).getIdentifier()); + } else if (element instanceof SpecializationTypeConfiguration) { + elementType = ElementTypeRegistry.getInstance().getType(((SpecializationTypeConfiguration) element).getIdentifier()); + } else { + elementType = null; + } + return null != elementType; + } + + /** + * @see org.eclipse.papyrus.infra.widgets.providers.IGraphicalContentProvider#createBefore(org.eclipse.swt.widgets.Composite) + * + * @param parent + */ + @Override + public void createBefore(Composite parent) { + // nothing to do + } + + /** + * @see org.eclipse.papyrus.infra.widgets.providers.IGraphicalContentProvider#createAfter(org.eclipse.swt.widgets.Composite) + * + * @param parent + */ + @Override + public void createAfter(Composite parent) { + // nothing to do + } + + /** + * This comparator is used to sort the provider {@link ElementTypeConfiguration} + */ + private class ElementTypeConfigurationComparator implements Comparator<ElementTypeConfiguration> { + + /** + * the label provider used to compare the {@link ElementTypeConfiguration} + */ + private ILabelProvider provider = new GenericRelationshipMatrixElementTypeLabelProvider(); + + /** + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + * + * @param arg0 + * @param arg1 + * @return + */ + @Override + public int compare(ElementTypeConfiguration arg0, ElementTypeConfiguration arg1) { + return provider.getText(arg0).compareToIgnoreCase(provider.getText(arg1)); + } + + } +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/GenericRelationshipMatrixElementTypeLabelProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/GenericRelationshipMatrixElementTypeLabelProvider.java new file mode 100755 index 00000000000..da6cb86fb9c --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/GenericRelationshipMatrixElementTypeLabelProvider.java @@ -0,0 +1,233 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.providers; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; +import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration; +import org.eclipse.papyrus.infra.types.IconEntry; +import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration; +import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration; +import org.eclipse.papyrus.uml.nattable.properties.Activator; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.Bundle; + +/** + * Custom Label provider for {@link ElementTypeConfiguration}. + * This label provider has been created to hide that manipulated object are not UML Element or Profile + * + */ +public class GenericRelationshipMatrixElementTypeLabelProvider implements ILabelProvider { + + /** + * 2 of the possibles contants returned by {@link GenericRelationshipMatrixElementTypeContentProvider} as root of the tree + */ + private final String UML = "UML"; //$NON-NLS-1$ + + private final String SYSML = "SysML"; //$NON-NLS-1$ + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) + * + * @param listener + */ + @Override + public void addListener(final ILabelProviderListener listener) { + // nothing to do + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() + * + */ + @Override + public void dispose() { + // nothing to do + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) + * + * @param element + * @param property + * @return + */ + @Override + public boolean isLabelProperty(final Object element, final String property) { + // nothing to do + return false; + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) + * + * @param listener + */ + @Override + public void removeListener(final ILabelProviderListener listener) { + // nothing to do + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + * + * @param element + * @return + */ + @Override + public Image getImage(final Object element) { + URL url = null; + if (element instanceof String) {// currently we have 2 levels in the displayed tree and the first one is String + if (UML.equals(element)) { + Bundle bundle = Platform.getBundle("org.eclipse.papyrus.uml.architecture"); //$NON-NLS-1$ + + //TODO get the icons defined for the EPackage if exist ???? + + url = bundle.getEntry("icons/uml.gif"); //$NON-NLS-1$ + } else if (SYSML.equals(element)) { + Bundle bundle = Platform.getBundle("org.eclipse.papyrus.sysml.architecture"); //$NON-NLS-1$ + + //TODO get the icons defined for the EPackage if exist ???? + url = bundle.getEntry("icons/sysml.gif"); //$NON-NLS-1$ + } + } else if (element instanceof ElementTypeConfiguration) { + url = getIconURL((ElementTypeConfiguration) element); + if (null == url) { + IElementType elementType = null; + + if (element instanceof MetamodelTypeConfiguration) { + elementType = ElementTypeRegistry.getInstance().getType(((MetamodelTypeConfiguration) element).getIdentifier()); + } else if (element instanceof SpecializationTypeConfiguration) { + elementType = ElementTypeRegistry.getInstance().getType(((SpecializationTypeConfiguration) element).getIdentifier()); + } + if (null != elementType) { + url = getIconURL(elementType); + } + } + } + if (null != url) { + final Image im = ExtendedImageRegistry.INSTANCE.getImage(url); // $NON-NLS-1$ + if (null == im) { + Activator.log.warn(NLS.bind("The image located at {0} as not been found", url)); //$NON-NLS-1$ + } + return im; + } else if (element instanceof ElementTypeConfiguration && !(element instanceof String)) {// we don't have a clean way currently to define icon for string excepted hard-coding + Activator.log.warn(NLS.bind("No icon defined for ", element)); //$NON-NLS-1$ + } + return null; + } + + /** + * Duplicated code from org.eclipse.papyrus.infra.gmfdiag.common.providers.ElementTypeIconProvider + * + * @param elementType + * an element type + * @return + * the url of the icon to {@link Display} or <code>null</code> if not found + */ + private URL getIconURL(final IElementType elementType) { + URL result = elementType.getIconURL(); + + if ((result == null) && (elementType instanceof ISpecializationType)) { + ISpecializationType subtype = (ISpecializationType) elementType; + IElementType[] supertypes = subtype.getSpecializedTypes(); + if (supertypes != null) { + for (int i = 0; (result == null) && (i < supertypes.length); i++) { + result = getIconURL(supertypes[i]); + } + } + } + + return result; + } + + /** + * Duplicated code from AbstractElementTypeConfigurationFactory + * + * @param elementTypeConfiguration + * an element type configuration + * @return + * the url of the icon to use or <code>null</code> when not found + */ + private URL getIconURL(final ElementTypeConfiguration elementTypeConfiguration) { + // icon associated to the elementType (GUI) + IconEntry entry = elementTypeConfiguration.getIconEntry(); + URL iconURL = null; + if (entry != null) { + iconURL = getURLFromEntry(entry); + } + return iconURL; + } + + /** + * Duplicated code from AbstractElementTypeConfigurationFactory + * + * @param entry + * an icon entry + * @return + * the url of the icon or <code>null</code> if not found + * + */ + private URL getURLFromEntry(final IconEntry entry) { + Bundle bundle = Platform.getBundle(entry.getBundleId()); + if (bundle == null) { + Activator.log.warn(NLS.bind("Bundle {0} doesn't exist. I cannot found the expected icon {1}.", entry.getBundleId(), entry.getIconPath())); //$NON-NLS-1$ + return null; + } + URL result = bundle.getEntry(entry.getIconPath()); + if (result == null) { + try { + result = new URL(entry.getIconPath()); + } catch (MalformedURLException e) { + Activator.log.error(NLS.bind("The icon path {0} seems invalid, I can't found this icon in the bundle {1}.", entry.getIconPath(), entry.getBundleId()), e); //$NON-NLS-1$ + result = null; + } + } + return result; + } + + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + * + * @param element + * @return + */ + @Override + public String getText(final Object element) { + String returnedName = ""; //$NON-NLS-1$ + if (null != element) { + returnedName = element.toString(); + if (element instanceof ElementTypeSetConfiguration) { + returnedName = ((ElementTypeSetConfiguration) element).getName(); + } + if (element instanceof ElementTypeConfiguration) { + returnedName = ProviderUtils.getNameToDisplay((ElementTypeConfiguration) element); + } + } + return returnedName; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/ProviderUtils.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/ProviderUtils.java new file mode 100755 index 00000000000..19bdd3e748f --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/providers/ProviderUtils.java @@ -0,0 +1,90 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.providers; + +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; +import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration; +import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration; + +/** + * This class provides utils method for Label and Content Provider + * + */ +public class ProviderUtils { + + /** + * separator used in the display name field of the IElementType + */ + public static final String ELEMENT_TYPE_DISPLAY_NAME_SEPARATOR = "::"; //$NON-NLS-1$ + + /** + * + * Constructor. + * + */ + private ProviderUtils() { + // to prevent instanciation + } + + /** + * + * @param element + * an element type configuration + * @return + * the display name for the element name or an empty string + */ + public static String getElementTypeDisplayName(final ElementTypeConfiguration element) { + String result = ""; //$NON-NLS-1$ + final IElementType elementType; + + if (element instanceof MetamodelTypeConfiguration) { + elementType = ElementTypeRegistry.getInstance().getType(((MetamodelTypeConfiguration) element).getIdentifier()); + } else if (element instanceof SpecializationTypeConfiguration) { + elementType = ElementTypeRegistry.getInstance().getType(((SpecializationTypeConfiguration) element).getIdentifier()); + } else { + elementType = null; + } + if (null != elementType) { + result = null != elementType.getDisplayName() && !elementType.getDisplayName().isEmpty() ? elementType.getDisplayName() : result; + } + + return result; + } + + /** + * + * @param configuration + * a configuration + * @return + * the display name to use for the configuration or an empty string + */ + public static final String getNameToDisplay(final ElementTypeConfiguration configuration) { + final String displayName = ProviderUtils.getElementTypeDisplayName(configuration); + final String[] res = displayName.split(ELEMENT_TYPE_DISPLAY_NAME_SEPARATOR); + String metamodelName = null; + if (res.length == 2) { + metamodelName = res[1]; + } + String returnedValue = ""; //$NON-NLS-1$ + if (null != metamodelName && !metamodelName.isEmpty()) { + returnedValue = metamodelName; + } else if (null != configuration.getName() && !configuration.getName().isEmpty()) { + returnedValue = configuration.getName(); + } + return returnedValue; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/utils/MatrixHelper.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/utils/MatrixHelper.java new file mode 100755 index 00000000000..9d915eed391 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/utils/MatrixHelper.java @@ -0,0 +1,89 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.utils; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart; +import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; +import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.manager.table.MatrixTableWidgetModelManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.ICellEditorConfiguration; +import org.eclipse.papyrus.infra.ui.util.EditorHelper; +import org.eclipse.ui.IEditorPart; + +/** + * TODO : maybe the dependency on >NatTableEditor could be remove ? + * Same method also exist in infra NatTable property + */ +public class MatrixHelper { + + /** + * + * Constructor. + * + */ + private MatrixHelper() { + // to prevent instanciation + } + + + /** + * This allows to get the current nattable editor when this is available. + * + * @return The current nattable editor if available or <code>null</code>. + */ + public static final NatTableEditor getCurrentNatTableEditor() { + NatTableEditor result = null; + + final IEditorPart currentEditor = EditorHelper.getCurrentEditor(); + if (currentEditor instanceof IMultiPageEditorPart && null != ((IMultiPageEditorPart) currentEditor).getActiveEditor()) { + result = ((IMultiPageEditorPart) currentEditor).getActiveEditor().getAdapter(NatTableEditor.class); + } else if (currentEditor instanceof IAdaptable) { + result = ((IAdaptable) currentEditor).getAdapter(NatTableEditor.class); + } + return result; + } + + /** + * + * @return + * the {@link MatrixTableWidgetModelManager} from the current editor or <code>null</code> when the editor doesn't represent a matrix + */ + public static final IMatrixTableWidgetManager getMatrixTableWidgetModelManagerFromCurrentEditor() { + final NatTableEditor editor = getCurrentNatTableEditor(); + if (null != editor && editor.getAdapter(INattableModelManager.class) instanceof MatrixTableWidgetModelManager) { + final INattableModelManager manager = (INattableModelManager) editor.getAdapter(INattableModelManager.class); + if (manager instanceof IMatrixTableWidgetManager) { + return (IMatrixTableWidgetManager) manager; + } + } + return null; + } + + /** + * + * @param table + * a table + * @return + * <code>true</code> if the table owns a cell editor configuration + */ + public static final boolean isGenericRelationshipMatrixCellEditorConfiguration(final Table table) { + final ICellEditorConfiguration cellEditor = table.getOwnedCellEditorConfigurations(); + return cellEditor instanceof GenericRelationshipMatrixCellEditorConfiguration; + } +} + diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/utils/MatrixPropertyConstants.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/utils/MatrixPropertyConstants.java new file mode 100755 index 00000000000..df53df35bf0 --- /dev/null +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/utils/MatrixPropertyConstants.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.properties.utils; + +/** + * + * These constants are used in the property view model to identify the edited feature + * + */ +public class MatrixPropertyConstants { + + private MatrixPropertyConstants() { + // to prevent instanciation + } + + public static final String MATRIX_ROW_SOURCES = "rowSources";//$NON-NLS-1$ + + public static final String MATRIX_COLUMN_SOURCES = "columnSources";//$NON-NLS-1$ + + public static final String MATRIX_ROW_FILTER = "rowFilter";//$NON-NLS-1$ + + public static final String MATRIX_COLUMN_FILTER = "columnFilter";//$NON-NLS-1$ + + public static final String MATRIX_CELL_TYPE = "managedElementType";//$NON-NLS-1$ + + public static final String MATRIX_CELL_FILTER = "cellContentsFilter";//$NON-NLS-1$ + + public static final String MATRIX_RELATIONSHIP_DIRECTION = "relationshipDirection";//$NON-NLS-1$ +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml index 940a0a964ae..940a0a964ae 100644..100755 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/UMLElementTreeAxisManagerForEventList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/UMLElementTreeAxisManagerForEventList.java index 78d0353c53f..f67df832d32 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/UMLElementTreeAxisManagerForEventList.java +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/UMLElementTreeAxisManagerForEventList.java @@ -55,9 +55,9 @@ public class UMLElementTreeAxisManagerForEventList extends EObjectTreeAxisManage */ @Override public boolean isAllowedContents(Object objectToTest, Object semanticParent, TreeFillingConfiguration conf, int depth) { - return objectToTest instanceof Element; + return objectToTest instanceof Element && super.isAllowedContents(objectToTest, semanticParent, conf, depth); } - + /** * * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canCreateAxisElement(java.lang.String) @@ -219,7 +219,7 @@ public class UMLElementTreeAxisManagerForEventList extends EObjectTreeAxisManage if (values.isEmpty()) { if (confRep != null) { ITreeItemAxis toDestroy = getITreeItemAxisRepresentingObject(confRep.getChildren(), baseElement); - if(null != toDestroy){ + if (null != toDestroy) { removeObject(toDestroy); } } @@ -254,7 +254,7 @@ public class UMLElementTreeAxisManagerForEventList extends EObjectTreeAxisManage * @param notification * a notification * @return - * <code>true</code> if the notification concerns a stereotype application + * <code>true</code> if the notification concerns a stereotype application */ protected boolean isStereotypeApplicationNotification(final Notification notification) { Object notifier = notification.getNotifier(); diff --git a/plugins/uml/nattable/pom.xml b/plugins/uml/nattable/pom.xml index 01162032c17..d8c68d7c54d 100755 --- a/plugins/uml/nattable/pom.xml +++ b/plugins/uml/nattable/pom.xml @@ -18,7 +18,9 @@ <module>org.eclipse.papyrus.uml.nattable.clazz.config</module> <module>org.eclipse.papyrus.uml.nattable.generic</module> <module>org.eclipse.papyrus.uml.nattable.generic.config</module> + <module>org.eclipse.papyrus.uml.nattable.matrix</module> <module>org.eclipse.papyrus.uml.nattable.menu</module> + <module>org.eclipse.papyrus.uml.nattable.properties</module> <module>org.eclipse.papyrus.uml.nattable.richtext</module> <module>org.eclipse.papyrus.uml.nattable.stereotype.display</module> <module>org.eclipse.papyrus.uml.nattable.xtext.integration</module> diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/UMLRelationshipHelper.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/UMLRelationshipHelper.java new file mode 100755 index 00000000000..d17e529aa7c --- /dev/null +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/helper/UMLRelationshipHelper.java @@ -0,0 +1,244 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) - vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.tools.helper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.papyrus.infra.types.ElementTypeConfiguration; +import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration; +import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration; +import org.eclipse.uml2.uml.Dependency; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * This class provides useful method to manipulate UML element which can be shown as Relationship. + * + * @since 3.0 + * + */ +public class UMLRelationshipHelper { + + /** + * the managed relationship represented by their EClass + */ + private List<EClass> managedEClasses; + + /** + * + * Constructor. + * + */ + public UMLRelationshipHelper() { + // public to be extensible if required + List<EClass> managedEClasses = new ArrayList<EClass>(); + managedEClasses.add(UMLPackage.eINSTANCE.getAbstraction()); + managedEClasses.add(UMLPackage.eINSTANCE.getDependency()); + this.managedEClasses = Collections.unmodifiableList(managedEClasses); + } + + /** + * + * @return + * the list of managed relationship + */ + public List<EClass> getManagedEClass() { + return this.managedEClasses; + } + + /** + * + * @param relationshipEClass + * an EClass representing a relationship + * @return + * <ul> + * <li><code>true</code> when the relationship is managed by this class AND when the relationship can have more than 2 ends</li> + * <li><code>false</code> otherwise</li> + * </ul> + */ + public boolean canHaveMoreThan2Ends(final EClass relationshipEClass) { + if (UMLPackage.eINSTANCE.getAbstraction() == relationshipEClass) { + return true; + } + if (UMLPackage.eINSTANCE.getDependency() == relationshipEClass) { + return true; + } + + return false; + } + + + /** + * + * @param relationshipEClass + * an EClass representing a relationship + * @return + * <ul> + * <li><code>true</code> when the relationship is managed by this class AND when the relationship is a directed relationship</li> + * <li><code>false</code> otherwise</li> + * </ul> + */ + public boolean isDirectedRelationship(final EClass relationshipEClass) { + if (UMLPackage.eINSTANCE.getAbstraction() == relationshipEClass) { + return true; + } + if (UMLPackage.eINSTANCE.getDependency() == relationshipEClass) { + return true; + } + return false; + } + + + /** + * + * @param relationshipEClass + * an EClass representing a relationship + * @return + * the feature used as source or <code>null</code> when the relationship is not managed + */ + public EStructuralFeature getRelationshipSourceFeature(final EClass relationshipEClass) { + if (UMLPackage.eINSTANCE.getAbstraction() == relationshipEClass) { + return UMLPackage.eINSTANCE.getDependency_Client();// an abstraction is a Dependency + } + if (UMLPackage.eINSTANCE.getDependency() == relationshipEClass) { + return UMLPackage.eINSTANCE.getDependency_Client(); + } + return null; + } + + /** + * + * @param relationshipEClass + * an EClass representing a relationship + * @return + * the feature used as target or <code>null</code> when the relationship is not managed + */ + public EStructuralFeature getRelationshipTargetFeature(final EClass relationshipEClass) { + if (UMLPackage.eINSTANCE.getAbstraction() == relationshipEClass) { + return UMLPackage.eINSTANCE.getDependency_Supplier();// an abstraction is a Dependency + } + if (UMLPackage.eINSTANCE.getDependency() == relationshipEClass) { + return UMLPackage.eINSTANCE.getDependency_Supplier(); + } + return null; + } + + + /** + * + * @param relationship + * a relationship + * @return + * the sources of this relationship or an empty list when the kind of relationship is not managed + */ + public Collection<? extends Element> getSources(final Element relationship) { + if (relationship instanceof Dependency) {// works for Abstraction too + return ((Dependency) relationship).getClients(); + } + return Collections.emptyList(); + } + + /** + * + * @param relationship + * a relationship + * @return + * the targets of this relationship or or an empty list when the kind of relationship is not managed + */ + public Collection<? extends Element> getTargets(final Element relationship) { + if (relationship instanceof Dependency) {// works for Abstraction too + return ((Dependency) relationship).getSuppliers(); + } + return Collections.emptyList(); + } + + + /** + * @param elementTypeConfiguration + * an element type configuration + * @param source + * the source element for the relationship + * @param target + * the target element for the relationship + * @param editorContext + * the context of the current editor when available + * @return + * the best owner for the relationship to create or <code>null</code> when the kind of relationship is not managed + */ + public Element getBestOwner(final MetamodelTypeConfiguration elementTypeConfiguration, final Element source, final Element target, final Element editorContext) { + final EClass relationshipToCreate = elementTypeConfiguration.getEClass(); + if (UMLPackage.eINSTANCE.getAbstraction() == relationshipToCreate) { + return source.getOwner(); + } + if (UMLPackage.eINSTANCE.getDependency() == relationshipToCreate) { + return source.getOwner(); + } + return null; + } + + /** + * @param elementTypeConfiguration + * an element type configuration + * @param source + * the source element for the relationship + * @param target + * the target element for the relationship + * @param editorContext + * the context of the current editor when available + * @return + * the best owner for the relationship to create or <code>null</code> when the kind of relationship is not managed + */ + public Element getBestOwner(final ElementTypeConfiguration elementTypeConfiguration, final Element source, final Element target, final Element editorContext) { + if (elementTypeConfiguration instanceof MetamodelTypeConfiguration) { + return getBestOwner((MetamodelTypeConfiguration) elementTypeConfiguration, source, target, editorContext); + } + if (elementTypeConfiguration instanceof SpecializationTypeConfiguration) { + return getBestOwner((SpecializationTypeConfiguration) elementTypeConfiguration, source, target, editorContext); + + } + return null; + } + + /** + * @param elementTypeConfiguration + * an element type configuration + * @param source + * the source element for the relationship + * @param target + * the target element for the relationship + * @param editorContext + * the context of the current editor when available + * @return + * the best owner for the relationship to create or <code>null</code> when the kind of relationship is not managed + */ + public Element getBestOwner(final SpecializationTypeConfiguration elementTypeConfiguration, final Element source, final Element target, final Element editorContext) { + return 1 == elementTypeConfiguration.getSpecializedTypes().size() ? getBestOwner(elementTypeConfiguration.getSpecializedTypes().get(0), source, target, editorContext) : null; + } + + /** + * + * @param relationship + * a relationhip + * @return + * the number of ends for the current relationship or 0 when the relationship is not managed + */ + public int getNumberOfEnds(final Element relationship) { + return getSources(relationship).size() + getTargets(relationship).size(); + } +} |