Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBelqassim Djafer2015-03-09 14:29:07 +0000
committerPierre-Charles David2015-03-18 10:03:53 +0000
commit798d97d52eca4f06c216b442028f797ed0a6c5b6 (patch)
treee2f3f38d3ae9b8aca8a2c6fe2b3918bdc494c750
parent62d40e3ba733f3f3e5ee408640460d9bdf2ca71c (diff)
downloadorg.eclipse.sirius-798d97d52eca4f06c216b442028f797ed0a6c5b6.tar.gz
org.eclipse.sirius-798d97d52eca4f06c216b442028f797ed0a6c5b6.tar.xz
org.eclipse.sirius-798d97d52eca4f06c216b442028f797ed0a6c5b6.zip
[447057] Fix Tree/Table editor properties issue
If we move a Tree/Table editor near to the model explorer view, we can not change values in properties view because EclipseUIUtils.getActiveEditor() always returns the Eclipse Editor view Bug: 447057 Change-Id: Id6cde6967643621ca675035e9e1a159fa15a18db Signed-off-by: Belqassim Djafer <belqassim.djafer@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractEObjectPropertySource.java30
1 files changed, 13 insertions, 17 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractEObjectPropertySource.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractEObjectPropertySource.java
index b67edbf5a5..b1e9933635 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractEObjectPropertySource.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractEObjectPropertySource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008, 2009 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2008, 2009, 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
@@ -11,9 +11,8 @@
package org.eclipse.sirius.ui.tools.api.properties;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
-import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil;
-import org.eclipse.sirius.ui.tools.internal.editor.AbstractDTreeEditor;
-import org.eclipse.ui.IEditorPart;
+import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuthority;
+import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry;
/**
* Specialization for the manage of DTable elements.
@@ -39,19 +38,16 @@ public abstract class AbstractEObjectPropertySource extends AbstractCompositeEOb
public void setPropertyValue(final Object id, final Object value) {
final Identifier identifier = (Identifier) id;
- final IEditorPart part = EclipseUIUtil.getActiveEditor();
- if (part instanceof AbstractDTreeEditor) {
- final AbstractDTreeEditor tableEditor = (AbstractDTreeEditor) part;
- if (tableEditor.getAccessor().getPermissionAuthority().canEditInstance(identifier.getEObject())) {
- // Test if the value is different
- boolean isDifferent = true;
- final Object propertyValue = getPropertySource(identifier).getPropertyValue(identifier.getId());
- if (propertyValue instanceof PropertyValueWrapper && value != null) {
- isDifferent = !value.equals(((PropertyValueWrapper) propertyValue).getEditableValue(propertyValue));
- }
- if (isDifferent) {
- getPropertySource(identifier).setPropertyValue(identifier.getId(), value);
- }
+ IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(identifier.getEObject());
+ if (permissionAuthority == null || permissionAuthority.canEditInstance(identifier.getEObject())) {
+ // Test if the value is different
+ boolean isDifferent = true;
+ final Object propertyValue = getPropertySource(identifier).getPropertyValue(identifier.getId());
+ if (propertyValue instanceof PropertyValueWrapper && value != null) {
+ isDifferent = !value.equals(((PropertyValueWrapper) propertyValue).getEditableValue(propertyValue));
+ }
+ if (isDifferent) {
+ getPropertySource(identifier).setPropertyValue(identifier.getId(), value);
}
}

Back to the top