diff options
| author | Esteban Dugueperoux | 2015-10-27 15:46:38 +0000 |
|---|---|---|
| committer | Esteban Dugueperoux | 2015-11-09 16:33:13 +0000 |
| commit | a10c65ef20fb531528154b740b94c2adb746db9d (patch) | |
| tree | 947279d1004e11971995a5319e88b1232a1d7299 | |
| parent | de6a08e7c0af0de76bc4b990a065470e6de26b97 (diff) | |
| download | org.eclipse.sirius-a10c65ef20fb531528154b740b94c2adb746db9d.tar.gz org.eclipse.sirius-a10c65ef20fb531528154b740b94c2adb746db9d.tar.xz org.eclipse.sirius-a10c65ef20fb531528154b740b94c2adb746db9d.zip | |
[480203] Test IPermissionAuthority.canEditInstance() on edition
- Test IPermissionAuthority.canEditInstance() on properties edition
through properties view on ModelExplorer view selection.
- Release Notes has been updated.
Bug: 480203
Change-Id: I38601616485acf4bf8a056813fa31329ab6e7e5d
Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
6 files changed, 159 insertions, 24 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index 8d4d119db6..31d1ab0a7b 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -13,13 +13,24 @@ <a href="#ReleaseNotesforSirius">Release Notes for Sirius</a> <ol style="list-style: disc;"> <li> + <a href="#sirius3.1.2">Changes in Sirius 3.1.2</a> + <ol style="list-style: disc;"> + <li> + <a href="#UserVisibleChanges">User-Visible Changes</a> + </li> + <li> + <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a> + </li> + </ol> + </li> + <li> <a href="#sirius3.1.1">Changes in Sirius 3.1.1</a> <ol style="list-style: disc;"> <li> <a href="#SpecifierVisibleChanges">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a> </li> </ol> </li> @@ -27,13 +38,13 @@ <a href="#sirius3.1.0">Changes in Sirius 3.1.0</a> <ol style="list-style: disc;"> <li> - <a href="#UserVisibleChanges">User-Visible Changes</a> + <a href="#UserVisibleChanges2">User-Visible Changes</a> </li> <li> <a href="#SpecifierVisibleChanges2">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a> </li> </ol> </li> @@ -41,13 +52,13 @@ <a href="#sirius3.0.0">Changes in Sirius 3.0.0</a> <ol style="list-style: disc;"> <li> - <a href="#UserVisibleChanges2">User-Visible Changes</a> + <a href="#UserVisibleChanges3">User-Visible Changes</a> </li> <li> <a href="#SpecifierVisibleChanges3">Specifier-Visible Changes</a> </li> <li> - <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a> + <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a> </li> </ol> </li> @@ -55,7 +66,7 @@ <a href="#sirius2.0.0">Changes in Sirius 2.0.0</a> <ol style="list-style: disc;"> <li> - <a href="#UserVisibleChanges3">User-Visible Changes</a> + <a href="#UserVisibleChanges4">User-Visible Changes</a> </li> <li> <a href="#SpecifierVisibleChanges4">Specifier-Visible Changes</a> @@ -71,12 +82,42 @@ <p>This document contains the release notes for recent major releases of Sirius. See also <a href="Release_Notes_Previous.html">the release notes from previous versions</a> for details about older releases. </p> + <h2 id="sirius3.1.2">Changes in Sirius 3.1.2</h2> + <h3 id="UserVisibleChanges">User-Visible Changes</h3> + <ul> + <li><span class="label label-info">Modified</span> Now if an object is locked and cannot be modified according to + <code>IPermissionAuthority</code>, the properties view will not be editable if this locked object is selected from the Model Explorer view. + </li> + </ul> + <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3> + <h4 id="Changesinorg.eclipse.sirius.ext.emf.ui">Changes in + <code>org.eclipse.sirius.ext.emf.ui</code> + </h4> + <ul> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.ext.emf.ui.properties.ExtensiblePropertySource.collector</code> field is now in protected visibility to be modifiable and accessible by subclass. + </li> + </ul> + <h4 id="Changesinorg.eclipse.sirius.ui">Changes in + <code>org.eclipse.sirius.ui</code> + </h4> + <ul> + <li><span class="label label-success">Added</span> + <code>org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertyDescriptor</code> has been added to provide a specific + <code>ExtensiblePropertyDescriptor</code> which test + <code>IPermissionAuthority</code> to make properties view editable or not. + </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertySource</code> has been modified to use + <code>SiriusExtensiblePropertyDescriptor</code> to provide not editable properties view when the object, selected from the Model Explorer view, cannot be modified. + </li> + </ul> <h2 id="sirius3.1.1">Changes in Sirius 3.1.1</h2> <h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3> <ul> <li><span class="label label-info">Modified</span> The use of type literals in operations like filter() or oclIsKindOf() requires to explicitly add the domain meta-models plug-ins to the dependencies of the Viewpoint Specification Project. The documentation has been modified to recommend this.</li> </ul> - <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3> <h4 id="Changesinorg.eclipse.sirius">Changes in <code>org.eclipse.sirius</code> </h4> @@ -95,7 +136,7 @@ </li> </ul> <h2 id="sirius3.1.0">Changes in Sirius 3.1.0</h2> - <h3 id="UserVisibleChanges">User-Visible Changes</h3> + <h3 id="UserVisibleChanges2">User-Visible Changes</h3> <ul> <li><span class="label label-success">Added</span> A new feature allows to snap to all shapes (instead of just to snap to sibling shapes). The <kdb>F4</kdb> shortcut key activates this mode when you resize a node, move a node or move a bendpoint of an edge, see <a href="./user/diagrams/Diagrams.html#snap_to_shapes">the documentation</a> for details. @@ -181,7 +222,7 @@ <code>IPermissionAuthority</code>) of the potential to delete objects. This is the reverse order of what was done before, and can have performance impacts if the precondition is slow. The specifier will to take care to ensure a good performance for the precondition expression of the delete tool. </li> </ul> - <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3> <h4 id="Partialsupportforinternationalization">Partial support for internationalization</h4> <p>Sirius 3.1 introduces partial support for internationalization: all literal strings from the runtime part of Sirius are now externalized and can be localized by third parties by providing the appropriate «language packs» as OSGi fragments. Note that this does not concern the VSM editor’s UI, the VSMs themselves, or the parts of the UI inherited from Eclipse/EMF/GEF/GMF and other libraries and frameworks used by Sirius.</p> <p>Some API changes were required to enable this. While technically breaking changes if interpreting strictly the OSGi versioning rules, the major version number of the impacted bundles was not incremented as the changes only concern classes that should not impact the vast majority of users. Most breaking changes concern the plug-in/activator classes from each bundle. They are:</p> @@ -452,7 +493,7 @@ <code>org.eclipse.sirius.tools.api.command.IUndoableCommand</code> interface removed because it is useless since undo/redo is managed by EMF Transaction. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui2">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -630,7 +671,7 @@ </li> </ul> <h2 id="sirius3.0.0">Changes in Sirius 3.0.0</h2> - <h3 id="UserVisibleChanges2">User-Visible Changes</h3> + <h3 id="UserVisibleChanges3">User-Visible Changes</h3> <ul> <li><span class="label label-success">Added</span> The ability to print table representations has been re-introduced.</li> <li><span class="label label-success">Added</span> The quick outline feature has been added for tree and table editors, see documentation for details.</li> @@ -730,7 +771,7 @@ <em>EStructuralFeature</em> (inherited or with same name). </li> </ul> - <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3> + <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3> <p>The most important and impacting changes in this release are (details below in plug-in specific sections):</p> <ul> <li><span class="label label-success">Added</span> The new extension point @@ -1067,7 +1108,7 @@ <code>org.eclipse.sirius.viewpoint.DContainer</code> has been removed. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui2">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui3">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -1580,7 +1621,7 @@ <code>org.eclipse.sirius.xxx.ui.ext</code>, allowing them not have all that functionalities they may not want. </p> <h2 id="sirius2.0.0">Changes in Sirius 2.0.0</h2> - <h3 id="UserVisibleChanges3">User-Visible Changes</h3> + <h3 id="UserVisibleChanges4">User-Visible Changes</h3> <ul> <li>It is now possible to select element that intersects the selection rectangle and not that is completely contained by the selection rectangle. This new behavior is enabled when user selects elements from right to left. The normal mode (previous mode) remains when the user selects elements from left to right.</li> <li>The edges appearance is now kept, as much as possible, when one of its extremity is moved. A move of an extremity should move only the closest segment of the edge.</li> @@ -1717,7 +1758,7 @@ <code>org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter</code>. However considering the way Sirius uses GMF, this adapter is not needed. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui3">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui4">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 76c9209583..bd5143844c 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -4,6 +4,25 @@ h1. Release Notes for Sirius This document contains the release notes for recent major releases of Sirius. See also "the release notes from previous versions":Release_Notes_Previous.html for details about older releases. +h2(#sirius3.1.2). Changes in Sirius 3.1.2 + +h3. User-Visible Changes + +* <span class="label label-info">Modified</span> Now if an object is locked and cannot be modified according to @IPermissionAuthority@, the properties view will not be editable if this locked object is selected from the Model Explorer view. + +h3. Developer-Visible Changes + +h4. Changes in @org.eclipse.sirius.ext.emf.ui@ + +* <span class="label label-info">Modified</span> @org.eclipse.sirius.ext.emf.ui.properties.ExtensiblePropertySource.collector@ field is now in protected visibility to be modifiable and accessible by subclass. + +h4. Changes in @org.eclipse.sirius.ui@ + +* <span class="label label-success">Added</span> @org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertyDescriptor@ has been added to provide a specific @ExtensiblePropertyDescriptor@ which test @IPermissionAuthority@ to make properties view editable or not. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertySource@ has been modified to use @SiriusExtensiblePropertyDescriptor@ to provide not editable properties view when the object, selected from the Model Explorer view, cannot be modified. + + + h2(#sirius3.1.1). Changes in Sirius 3.1.1 h3. Specifier-Visible Changes diff --git a/plugins/org.eclipse.sirius.ext.emf.ui/src/org/eclipse/sirius/ext/emf/ui/properties/ExtensiblePropertySource.java b/plugins/org.eclipse.sirius.ext.emf.ui/src/org/eclipse/sirius/ext/emf/ui/properties/ExtensiblePropertySource.java index d5db3cf4b3..dda0f44489 100644 --- a/plugins/org.eclipse.sirius.ext.emf.ui/src/org/eclipse/sirius/ext/emf/ui/properties/ExtensiblePropertySource.java +++ b/plugins/org.eclipse.sirius.ext.emf.ui/src/org/eclipse/sirius/ext/emf/ui/properties/ExtensiblePropertySource.java @@ -26,7 +26,8 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor; */ public class ExtensiblePropertySource extends PropertySource { - private CellEditorProviderCollector collector; + /** The {@link CellEditorProviderCollector}. */ + protected CellEditorProviderCollector collector; /** * Default constructor. diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertyDescriptor.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertyDescriptor.java new file mode 100644 index 0000000000..7fc66a8d44 --- /dev/null +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertyDescriptor.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2015 Obeo. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.ui.tools.api.properties; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.sirius.business.api.query.EObjectQuery; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; +import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuthority; +import org.eclipse.sirius.ext.emf.ui.properties.CellEditorProviderCollector; +import org.eclipse.sirius.ext.emf.ui.properties.ExtensiblePropertyDescriptor; +import org.eclipse.swt.widgets.Composite; + +/** + * A specific {@link ExtensiblePropertyDescriptor} to test + * {@link IPermissionAuthority#canEditInstance(org.eclipse.emf.ecore.EObject)}. + * + * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> + */ +public class SiriusExtensiblePropertyDescriptor extends ExtensiblePropertyDescriptor { + + private IPermissionAuthority permissionAuthority; + + /** + * Creates a new instance of this class. + * + * @param object + * the semantic object. + * @param itemPropertyDescriptor + * the emf itemPropertyDescriptor + * @param collector + * the CellEditorProviderCollector used to retrieve the + * ICellEditorProviders + */ + public SiriusExtensiblePropertyDescriptor(Object object, IItemPropertyDescriptor itemPropertyDescriptor, CellEditorProviderCollector collector) { + super(object, itemPropertyDescriptor, collector); + } + + @Override + public CellEditor createPropertyEditor(Composite parent) { + CellEditor cellEditor = null; + if (!(object instanceof EObject) || getPermissionAuthority() != null && getPermissionAuthority().canEditInstance((EObject) object)) { + cellEditor = super.createPropertyEditor(parent); + } + return cellEditor; + } + + private IPermissionAuthority getPermissionAuthority() { + if (permissionAuthority == null && object instanceof EObject) { + Session session = new EObjectQuery((EObject) object).getSession(); + if (session != null) { + ModelAccessor modelAccessor = session.getModelAccessor(); + if (modelAccessor != null) { + permissionAuthority = modelAccessor.getPermissionAuthority(); + } + } + } + return permissionAuthority; + } + +} diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertySource.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertySource.java index df7e956963..b802dbbffb 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertySource.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/SiriusExtensiblePropertySource.java @@ -10,9 +10,11 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.api.properties; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.sirius.ext.emf.ui.properties.ExtensiblePropertySource; import org.eclipse.sirius.ui.tools.internal.properties.SiriusCellEditorProviderCollector; +import org.eclipse.ui.views.properties.IPropertyDescriptor; /** * Clients that want to provide custom cell editor through the extension point @@ -36,4 +38,9 @@ public class SiriusExtensiblePropertySource extends ExtensiblePropertySource { super(object, itemPropertySource, SiriusCellEditorProviderCollector.getInstance()); } + @Override + protected IPropertyDescriptor createPropertyDescriptor(IItemPropertyDescriptor itemPropertyDescriptor) { + return new SiriusExtensiblePropertyDescriptor(object, itemPropertyDescriptor, collector); + } + } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/property/SemanticPropertySection.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/property/SemanticPropertySection.java index 880de04dc7..9cd9e5cde3 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/property/SemanticPropertySection.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/property/SemanticPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 THALES GLOBAL SERVICES. + * Copyright (c) 2013, 2015 THALES GLOBAL SERVICES. * 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 @@ -15,9 +15,9 @@ import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; -import org.eclipse.emf.edit.ui.provider.PropertySource; import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertySource; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.IPropertySource; @@ -42,11 +42,7 @@ public class SemanticPropertySection extends AdvancedPropertySection implements page.setRootEntry(root); } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySourceProvider#getPropertySource(java.lang.Object) - */ + @Override public IPropertySource getPropertySource(final Object object) { IPropertySource propSrc = null; Object selectedObject = object; @@ -57,7 +53,7 @@ public class SemanticPropertySection extends AdvancedPropertySection implements if (af != null && (isSemanticEObject(selectedObject) || object instanceof PropertyValueWrapper)) { IItemPropertySource ips = (IItemPropertySource) af.adapt(selectedObject, IItemPropertySource.class); if (ips != null) { - propSrc = new PropertySource(selectedObject, ips); + propSrc = new SiriusExtensiblePropertySource(selectedObject, ips); } } return propSrc; |
