Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2019-02-18 15:39:11 -0500
committerVincent Lorenzo2019-08-23 08:42:17 -0400
commit40c0a844cdb4543c9d082c5ab68726f12c454972 (patch)
tree3abc085cd6d20c6b9e730654e3ab8fc87d6773d5
parent3c19bf0fa644e3d187e04cbe2d64e21bdd5da968 (diff)
downloadorg.eclipse.papyrus-collaborativemodeling-40c0a844cdb4543c9d082c5ab68726f12c454972.tar.gz
org.eclipse.papyrus-collaborativemodeling-40c0a844cdb4543c9d082c5ab68726f12c454972.tar.xz
org.eclipse.papyrus-collaborativemodeling-40c0a844cdb4543c9d082c5ab68726f12c454972.zip
Bug 507763: [CDO] CDOAwareModelSet adds invalidationListener multiple times
Change-Id: If81661520959c49fe10a301ace6e3232b7754146 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rwxr-xr-xcdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF2
-rwxr-xr-xcdo/bundles/org.eclipse.papyrus.cdo.core/pom.xml9
-rwxr-xr-xcdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java36
-rwxr-xr-xcdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/pom.xml5
4 files changed, 29 insertions, 23 deletions
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF b/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
index 3cebc62..b87f3bb 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
@@ -60,7 +60,7 @@ Export-Package: org.eclipse.papyrus.cdo.core,
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.1.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.cdo.internal.core.Activator
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/pom.xml b/cdo/bundles/org.eclipse.papyrus.cdo.core/pom.xml
index d51e817..c6eea78 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/pom.xml
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/pom.xml
@@ -1,17 +1,18 @@
<?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"
+<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 of this POM -->
<parent>
<groupId>org.eclipse.papyrus.cdo</groupId>
<artifactId>org.eclipse.papyrus.cdo-bundles</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
-
+
<!-- Project POM -->
<artifactId>org.eclipse.papyrus.cdo.core</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
index d72736b..6c277e4 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2017 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2013, 2017, 2019 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,11 +16,12 @@
* Christian W. Damus - bug 436998
* Eike Stepper (CEA) - bug 466520
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
- *
+ * Vincent LORENZO (CEA) - bug 507763
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
import java.io.IOException;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
@@ -223,8 +224,11 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet {
view = cdoResource.cdoView();
if (view != null) {
- view.addListener(getInvalidationListener());
- checkout = CDOExplorerUtil.getCheckout(view);
+ final IListener invalidationListener = getInvalidationListener();
+ if (false == Arrays.asList(view.getListeners()).contains(invalidationListener)) {
+ view.addListener(getInvalidationListener());
+ checkout = CDOExplorerUtil.getCheckout(view);
+ }
// URI from = URI.createURI("cdo://" + view.getSession().getRepositoryInfo().getName() + "/");
// URI to = URI.createURI("cdo.checkout://" + checkout.getID() + "/" + checkout.getRepository().getID() + "/");
@@ -248,8 +252,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet {
try {
super.unload();
} catch (Exception ex) {
- if (logError)
- {
+ if (logError) {
Activator.log.error(ex);
}
} finally {
@@ -270,18 +273,19 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet {
}
protected IListener createInvalidationListener() {
- return new IListener() {
-
- @Override
- public void notifyEvent(IEvent event) {
- if (event instanceof CDOViewInvalidationEvent) {
- TransactionalEditingDomain domain = getTransactionalEditingDomain();
- if (domain instanceof CDOAwareTransactionalEditingDomain) {
- ((CDOAwareTransactionalEditingDomain) domain).fireResourceSetChanged((CDOViewInvalidationEvent) event);
- }
+ return new InvalidationListener();
+ }
+
+ private class InvalidationListener implements IListener {
+ @Override
+ public void notifyEvent(IEvent event) {
+ if (event instanceof CDOViewInvalidationEvent) {
+ TransactionalEditingDomain domain = getTransactionalEditingDomain();
+ if (domain instanceof CDOAwareTransactionalEditingDomain) {
+ ((CDOAwareTransactionalEditingDomain) domain).fireResourceSetChanged((CDOViewInvalidationEvent) event);
}
}
- };
+ }
}
@Override
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/pom.xml b/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/pom.xml
index a9557dc..3cb856f 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/pom.xml
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/pom.xml
@@ -1,8 +1,9 @@
<?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"
+<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 of this POM -->
<parent>
<groupId>org.eclipse.papyrus.cdo</groupId>

Back to the top