Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-05-23 02:44:04 +0000
committerCamille Letavernier2014-08-07 09:17:38 +0000
commitec9e7064748f00f1cbaea710103064b1738356b8 (patch)
treee14655f44e32bb9127a06e1ea2618297d9bed062 /plugins/customization/org.eclipse.papyrus.customization.properties
parentb0896efe2e99b9eb52b80d5caea3bf3693c9d661 (diff)
downloadorg.eclipse.papyrus-ec9e7064748f00f1cbaea710103064b1738356b8.tar.gz
org.eclipse.papyrus-ec9e7064748f00f1cbaea710103064b1738356b8.tar.xz
org.eclipse.papyrus-ec9e7064748f00f1cbaea710103064b1738356b8.zip
417409: [Performances - Properties view] Delay in UI when reorganizing diagram layout.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417409 Make property sheet views reusable, with updating of the bound selection when the selection changes to another element that shows the same views. This employs new capability of the DataSource to update the selection that it encapsulates, pushing the new selection into the ModelElements that it creates, using a new delegating observable framework. Property sheet controls are re-used on a per-tab basis. Because of the new delegation pattern introduced here, we need to be able to ensure that delegate observables are disposed of when they are no longer needed. This includes not only the delegates of the new DelegatingObservables, but also the delegates of MultipleObservableValue and similar aggregates. As these delegates can be shared amongst multiple wrappers of different kinds, we use a simple reference counting scheme to ensure that observables are not disposed while they are still in use. This averts the exceptions discovered in multi-observable (multiple selection) scenarios on a previous iteration of this patch set. Change-Id: Ide8f3fcea4228083a68bc9d5d39dc5a50217af62
Diffstat (limited to 'plugins/customization/org.eclipse.papyrus.customization.properties')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java9
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java6
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java27
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java8
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java22
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java22
6 files changed, 73 insertions, 21 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
index 176eb5e4ced..50befdfc36a 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2013 CEA LIST.
+ * Copyright (c) 2010, 2014 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
@@ -9,6 +9,8 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Use URIs to support non-URL-compatible storage (CDO)
+ * Christian W. Damus (CEA) - bug 417409
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.editor.preview;
@@ -327,6 +329,11 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
setPreviewError(null);
+ if(displayEngine != null) {
+ // Dispose of the old engine before employing a new one
+ displayEngine.dispose();
+ }
+
displayEngine = new DefaultDisplayEngine();
Map<Tab, Composite> tabs = new HashMap<Tab, Composite>();
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
index 08963971b18..63d01c00974 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 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
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 417409
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.modelelement;
@@ -65,7 +67,7 @@ import org.eclipse.papyrus.views.properties.ui.PropertyEditor;
*/
public class CustomizationModelElement extends AbstractModelElement {
- private EMFModelElement delegate;
+ protected EMFModelElement delegate;
private static Map<EClassifier, IStaticContentProvider> providers;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java
index 63c2495ac89..9a3d00d99d1 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 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
@@ -8,23 +8,40 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 417409
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.modelelement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.modelelement.AbstractEMFModelElementFactory;
+import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElementFactory;
import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
import org.eclipse.papyrus.views.properties.modelelement.EMFModelElementFactory;
-import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
/**
* A Factory for build {@link CustomizationModelElement}s
*
* @author Camille Letavernier
*/
-public class CustomizationModelElementFactory extends EMFModelElementFactory {
+public class CustomizationModelElementFactory extends AbstractModelElementFactory<CustomizationModelElement> {
+ private static final EMFModelElementFactory emfFactory = new EMFModelElementFactory();
+
+ @Override
+ protected CustomizationModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
+ return new CustomizationModelElement((EMFModelElement)emfFactory.createFromSource(sourceElement, context));
+ }
+
@Override
- public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
- return new CustomizationModelElement((EMFModelElement)super.createFromSource(sourceElement, context));
+ protected void updateModelElement(CustomizationModelElement modelElement, Object newSourceElement) {
+ EObject eObject = EMFHelper.getEObject(newSourceElement);
+ if(eObject == null) {
+ throw new IllegalArgumentException("Cannot resolve EObject selection: " + newSourceElement);
+ }
+
+ AbstractEMFModelElementFactory.updateEMFModelElement(modelElement.delegate, eObject);
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java
index b5e124cca1e..06f1e8ebbde 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 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
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 417409
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.modelelement;
@@ -63,9 +65,9 @@ import org.eclipse.papyrus.views.properties.ui.WidgetAttribute;
*/
public class GenericAttributeModelElement extends AbstractModelElement {
- private EObject source;
+ protected EObject source;
- private EditingDomain domain;
+ protected EditingDomain domain;
private EStructuralFeature createIn;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java
index 6dcb389a966..063125a3c1f 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 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
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 417409
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.modelelement;
@@ -19,21 +21,22 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.customization.properties.Activator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
-import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
-import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
+import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElementFactory;
import org.eclipse.papyrus.views.properties.ui.UiFactory;
import org.eclipse.papyrus.views.properties.ui.UiPackage;
+import org.eclipse.papyrus.views.properties.ui.WidgetAttribute;
/**
* A ModelElementFactory for handling {@link WidgetAttribute} properties
*
* @author Camille Letavernier
*/
-public class GenericAttributeModelElementFactory implements ModelElementFactory {
+public class GenericAttributeModelElementFactory extends AbstractModelElementFactory<GenericAttributeModelElement> {
//Source : Group
//context : Custom:Attribute:Group
- public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
+ @Override
+ protected GenericAttributeModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
EObject source = EMFHelper.getEObject(sourceElement);
if(source == null) {
Activator.log.warn("Unable to resolve the source element to an EObject"); //$NON-NLS-1$
@@ -53,4 +56,13 @@ public class GenericAttributeModelElementFactory implements ModelElementFactory
// throw new UnsupportedOperationException();
// }
+ @Override
+ protected void updateModelElement(GenericAttributeModelElement modelElement, Object newSourceElement) {
+ EObject eObject = EMFHelper.getEObject(newSourceElement);
+ if(eObject == null) {
+ throw new IllegalArgumentException("Cannot resolve EObject selection: " + newSourceElement);
+ }
+ modelElement.source = eObject;
+ modelElement.domain = EMFHelper.resolveEditingDomain(eObject);
+ }
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
index 15df8d144f7..4745a06dc1c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 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
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 417409
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.modelelement;
@@ -17,23 +19,24 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.customization.properties.Activator;
+import org.eclipse.papyrus.infra.constraints.ConfigProperty;
import org.eclipse.papyrus.infra.constraints.ConstraintsFactory;
import org.eclipse.papyrus.infra.constraints.ConstraintsPackage;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
-import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
-import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
+import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElementFactory;
/**
* A ModelElementFactory for handling {@link ConfigProperty} properties
*
* @author Camille Letavernier
*/
-public class GenericPropertyModelElementFactory implements ModelElementFactory {
+public class GenericPropertyModelElementFactory extends AbstractModelElementFactory<GenericAttributeModelElement> {
//Source : Group
//context : Custom:Attribute:Group
- public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
+ @Override
+ protected GenericAttributeModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
EObject source = EMFHelper.getEObject(sourceElement);
if(source == null) {
@@ -54,4 +57,13 @@ public class GenericPropertyModelElementFactory implements ModelElementFactory {
// throw new UnsupportedOperationException();
// }
+ @Override
+ protected void updateModelElement(GenericAttributeModelElement modelElement, Object newSourceElement) {
+ EObject eObject = EMFHelper.getEObject(newSourceElement);
+ if(eObject == null) {
+ throw new IllegalArgumentException("Cannot resolve EObject selection: " + newSourceElement);
+ }
+ modelElement.source = eObject;
+ modelElement.domain = EMFHelper.resolveEditingDomain(eObject);
+ }
}

Back to the top