diff options
author | Christian W. Damus | 2017-12-08 17:27:11 +0000 |
---|---|---|
committer | Christian W. Damus | 2017-12-20 19:08:43 +0000 |
commit | d4b80d9f68cba0e9637c64c87adafe095e8f566a (patch) | |
tree | 9eaa186e6acfbfb6245849a7e898125f9ed7b2f0 /plugins/infra/core/org.eclipse.papyrus.infra.core | |
parent | f2e8c0e8156eadce40d9ab26df610b1cabcb1e6e (diff) | |
download | org.eclipse.papyrus-d4b80d9f68cba0e9637c64c87adafe095e8f566a.tar.gz org.eclipse.papyrus-d4b80d9f68cba0e9637c64c87adafe095e8f566a.tar.xz org.eclipse.papyrus-d4b80d9f68cba0e9637c64c87adafe095e8f566a.zip |
Bug 528343: [I18N] Preference checking overhead for models that don't use i18n
Rework the InternationalizationUMLItemProviderAdapterFactory to
provide standard UML item-providers for resource sets that don’t
enabled i18n support, until such time as it is needed. At that point,
dispose the standard item-providers and let the i18n-enabled ones
replace them. An new event-listener protocol lets the item-provider
detect this change in i18n status.
Also improve performance of the i18n utility's tracking of
preference stores and fix the hash code calculation of the
PapyrusProjectScope (as it matters now that it is used as the
key in a map).
(cherry-picked from streams/3.0-maintenance)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=528343
Change-Id: Ifb415da65d6af26e5bfaac0ea3f1b9718b758227
Diffstat (limited to 'plugins/infra/core/org.eclipse.papyrus.infra.core')
3 files changed, 24 insertions, 8 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF index f6d621c2349..1c870582133 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF @@ -31,7 +31,7 @@ Require-Bundle: org.eclipse.emf.workspace;bundle-version="[1.5.0,2.0.0)", org.eclipse.papyrus.infra.core.architecture;bundle-version="[1.0.0,2.0.0)";visibility:=reexport Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy -Bundle-Version: 3.0.0.qualifier +Bundle-Version: 3.0.100.qualifier Bundle-Name: %pluginName Bundle-Localization: plugin Bundle-Activator: org.eclipse.papyrus.infra.core.Activator diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml index 0907a49f8c4..dcb0047c077 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/pom.xml @@ -6,6 +6,6 @@ <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.core</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/PapyrusProjectScope.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/PapyrusProjectScope.java index c792d8c1de0..5efef5e01e3 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/PapyrusProjectScope.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/PapyrusProjectScope.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
+ * Copyright (c) 2016, 2017 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 v1.0
@@ -8,11 +8,14 @@ *
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ * Christian W. Damus - bug 528343
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
+import java.util.Objects;
+
import org.eclipse.core.internal.preferences.AbstractScope;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
@@ -36,14 +39,19 @@ public class PapyrusProjectScope extends AbstractScope { /**
* The papyrus project name.
*/
- private String papyrusProjectName;
+ private final String papyrusProjectName;
/**
* The context project.
*/
- private IProject context;
+ private final IProject context;
/**
+ * Cached hash code.
+ */
+ private int hash = 0;
+
+ /**
* Constructor.
*
* @param project
@@ -105,10 +113,10 @@ public class PapyrusProjectScope extends AbstractScope { public boolean equals(final Object obj) {
if (this == obj)
return true;
- if (!super.equals(obj))
- return false;
if (!(obj instanceof PapyrusProjectScope))
return false;
+ if (!super.equals(obj))
+ return false;
PapyrusProjectScope other = (PapyrusProjectScope) obj;
return context.equals(other.context) && papyrusProjectName.equals(other.papyrusProjectName);
}
@@ -120,7 +128,15 @@ public class PapyrusProjectScope extends AbstractScope { */
@Override
public int hashCode() {
- return super.hashCode() + context.getFullPath().hashCode() + "/".hashCode() + papyrusProjectName.hashCode(); //$NON-NLS-1$
+ if (hash == 0) {
+ int h = super.hashCode();
+ h = 37 * h + Objects.hashCode(context);
+ h = 37 * h + Objects.hashCode(papyrusProjectName);
+
+ hash = h;
+ }
+
+ return hash;
}
}
|