Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremie.tatibouet2019-12-10 22:03:37 +0000
committervincent lorenzo2019-12-12 16:01:59 +0000
commitf5da536ddb200c8044975c5f33a7ea1e12593e27 (patch)
tree5153a6f5c2290c37eec8f289f3dc0b7e844cf0d1
parent980a3ae4d8a141ea89e75cf92183df3afbdd3e5a (diff)
downloadorg.eclipse.papyrus-bugs/558456-AutoSizeableClasses.tar.gz
org.eclipse.papyrus-bugs/558456-AutoSizeableClasses.tar.xz
org.eclipse.papyrus-bugs/558456-AutoSizeableClasses.zip
Bug 553878 - Invalid internationalization preference model URIbugs/558456-AutoSizeableClasses
Change-Id: I2a9d9f07ddb118c7036e13c472ce59ce548b3611 Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml5
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java44
3 files changed, 28 insertions, 23 deletions
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF
index 563a47f0112..72006f3dead 100644
--- a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization;singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.100.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml
index 8f0f5289a8c..a2dca607d18 100644
--- a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml
@@ -1,5 +1,6 @@
<?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>
@@ -8,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.internationalization</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java
index 6578a02c4fa..0c01dec8d45 100644
--- a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
+ * Copyright (c) 2016, 2019 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Jeremie Tatibouet (CEA LIST) jeremie.tatibouet@cea.fr - Bug 553878
*****************************************************************************/
package org.eclipse.papyrus.infra.internationalization.modelresource;
@@ -20,6 +20,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
@@ -69,14 +71,15 @@ class InternationalizationPreferenceModelProviderManager {
/**
* Constructor.
*
- * @param modelSet The current model set.
+ * @param modelSet
+ * The current model set.
*/
public InternationalizationPreferenceModelProviderManager(final ModelSet modelSet) {
super();
this.modelSet = modelSet;
this.defaultInternationalizationPrefModelProvider = createDefaultInternationalizationPrefModelProvider();
- this.descriptors = new CopyOnWriteArrayList<InternationalizationPreferenceModelProviderManager.ProviderDescriptor>(createDescriptors());
+ this.descriptors = new CopyOnWriteArrayList<>(createDescriptors());
}
/**
@@ -91,7 +94,8 @@ class InternationalizationPreferenceModelProviderManager {
/**
* Obtains the most appropriate sash model provider for the specified URI.
*
- * @param userModelURI The initial user model URI.
+ * @param userModelURI
+ * The initial user model URI.
*
* @return the sash model provider, never {@code null} (there is always a default available)
*/
@@ -122,7 +126,7 @@ class InternationalizationPreferenceModelProviderManager {
/**
* This allows to create the descriptors.
- *
+ *
* @return The list of created descriptors.
*/
private List<ProviderDescriptor> createDescriptors() {
@@ -146,7 +150,7 @@ class InternationalizationPreferenceModelProviderManager {
/**
* This allows to create the default internationalization preference model provider.
- *
+ *
* @return The created {@link IInternationalizationPreferenceModelProvider}.
*/
private IInternationalizationPreferenceModelProvider createDefaultInternationalizationPrefModelProvider() {
@@ -154,19 +158,19 @@ class InternationalizationPreferenceModelProviderManager {
@Override
public URI getInternationalizationPreferenceModelURI(final URI userModelURI) {
- final URI uriWithoutExtension = userModelURI.trimFileExtension();
-
- IPath stateLocation = Activator.getDefault().getStateLocation();
-
- if (uriWithoutExtension.isPlatform()) {
- stateLocation = stateLocation.append(uriWithoutExtension.toPlatformString(true));
- } else {
- stateLocation = stateLocation.append(URI.decode(uriWithoutExtension.toString()));
+ Assert.isNotNull(userModelURI);
+ final IPath internationalizationWorkspaceLocation = Activator.getDefault().getStateLocation();
+ final URI modelURI = userModelURI.trimFileExtension();
+ URI internationalizationModelURI = null;
+ if (modelURI.isPlatform()) {
+ internationalizationModelURI = URI.createFileURI(internationalizationWorkspaceLocation.append(modelURI.toPlatformString(true)).toString());
+ internationalizationModelURI = internationalizationModelURI.appendFileExtension(InternationalizationPreferenceModel.INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION);
+ } else if (modelURI.isFile()) {
+ final String workspaceURI = ResourcesPlugin.getWorkspace().getRoot().getLocationURI().toString();
+ internationalizationModelURI = URI.createFileURI(internationalizationWorkspaceLocation.append(modelURI.toString().replaceFirst(workspaceURI, "")).toString()); //$NON-NLS-1$
+ internationalizationModelURI = internationalizationModelURI.appendFileExtension(InternationalizationPreferenceModel.INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION);
}
-
- URI workspaceFileURI = URI.createFileURI(stateLocation.toString()).appendFileExtension(InternationalizationPreferenceModel.INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION);
-
- return workspaceFileURI;
+ return internationalizationModelURI;
}
};
}

Back to the top