Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-11-30 09:15:36 +0000
committerNicolas FAUVERGUE2016-12-01 08:42:25 +0000
commit4037a189c90f8bb8685dc1af23047673e16fbde0 (patch)
tree4975305e1c9a58aaaa2b146eb31fb223bfb7a56c /plugins/infra
parent6391b10bc090c6e9cc4227cbbf96c5ea0edc2036 (diff)
downloadorg.eclipse.papyrus-4037a189c90f8bb8685dc1af23047673e16fbde0.tar.gz
org.eclipse.papyrus-4037a189c90f8bb8685dc1af23047673e16fbde0.tar.xz
org.eclipse.papyrus-4037a189c90f8bb8685dc1af23047673e16fbde0.zip
Bug 496905: [Diagram][ModelExplorer][Table][Dialog] Papyrus must
integrate the internationalization feature provided by UML. https://bugs.eclipse.org/bugs/show_bug.cgi?id=496905 Fix JUnit tests problem with master rebase. Change-Id: I9406b6c002c07b01514fa03f43594f6eb05cb411 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.classpath7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/META-INF/MANIFEST.MF13
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/build.properties11
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.xml17
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/src/org/eclipse/papyrus/infra/internationalization/internal/readonly/InternationalizationPropertiesReadOnlyHandler.java98
-rw-r--r--plugins/infra/internationalization/pom.xml1
11 files changed, 250 insertions, 0 deletions
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.project
new file mode 100644
index 00000000000..d1b6a066f27
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization.readonly</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..72d6dd36edc
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization.readonly;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="[2.3.0,3.0.0)",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)"
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/build.properties
new file mode 100644
index 00000000000..2964bc2d7b1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/build.properties
@@ -0,0 +1,11 @@
+#
+
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.properties
new file mode 100644
index 00000000000..6c873a2e337
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Papyrus Internationalization Read Only
+providerName = Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.xml
new file mode 100644
index 00000000000..ba2215053e0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/plugin.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.papyrus.infra.emf.readonly.readOnlyHandler">
+ <readOnlyHandler
+ class="org.eclipse.papyrus.infra.internationalization.internal.readonly.InternationalizationPropertiesReadOnlyHandler"
+ id="org.eclipse.papyrus.infra.internationalization.readonly.InternationalizationPropertiesReadOnlyHandler"
+ priority="21">
+ <affinity
+ axis="discretion">
+ </affinity>
+ </readOnlyHandler>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/pom.xml
new file mode 100644
index 00000000000..1241ccc0832
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization.readonly</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/src/org/eclipse/papyrus/infra/internationalization/internal/readonly/InternationalizationPropertiesReadOnlyHandler.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/src/org/eclipse/papyrus/infra/internationalization/internal/readonly/InternationalizationPropertiesReadOnlyHandler.java
new file mode 100644
index 00000000000..04c13621aad
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.readonly/src/org/eclipse/papyrus/infra/internationalization/internal/readonly/InternationalizationPropertiesReadOnlyHandler.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.internationalization.internal.readonly;
+
+import java.util.Set;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel;
+
+import com.google.common.base.Optional;
+
+/**
+ * A ReadOnlyHandler for the Sash Model (*.internationalization or *.notation).
+ *
+ * If the model is located in the user preferences space, it may be considered
+ * read-only by other read-only handlers, whereas it shouldn't.
+ *
+ * Its priority should be greater than EMFReadOnlyHandler, FSReadOnlyHandler and
+ * ...
+ *
+ * This handler is discretion-based.
+ *
+ */
+public class InternationalizationPropertiesReadOnlyHandler extends AbstractReadOnlyHandler {
+
+ /**
+ * The model set.
+ */
+ private ModelSet modelSet;
+
+ /**
+ * Constructor.
+ *
+ * @param editingDomain
+ * The current editing domain.
+ */
+ public InternationalizationPropertiesReadOnlyHandler(final EditingDomain editingDomain) {
+ super(editingDomain);
+
+ if (getEditingDomain().getResourceSet() instanceof ModelSet) {
+ modelSet = (ModelSet) getEditingDomain().getResourceSet();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2#anyReadOnly(java.util.Set,
+ * org.eclipse.emf.common.util.URI[])
+ */
+ @Override
+ public Optional<Boolean> anyReadOnly(final Set<ReadOnlyAxis> axes, final URI[] uris) {
+ if ((null == modelSet) || !axes.contains(ReadOnlyAxis.DISCRETION)) {
+ return Optional.absent();
+ }
+
+ // Only answer false if all of the resources in question are ones that
+ // we know must be allowed to be written
+ int knownWritableCount = 0;
+ for (URI uri : uris) {
+ if (InternationalizationPreferenceModel.INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION
+ .equals(uri.fileExtension())
+ || InternationalizationPreferenceModel.NOTATION_FILE_EXTENSION.equals(uri.fileExtension())) {
+ knownWritableCount++;
+ }
+ }
+
+ return (knownWritableCount == uris.length) ? Optional.of(false) : Optional.<Boolean>absent();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2#makeWritable(java.util.Set,
+ * org.eclipse.emf.common.util.URI[])
+ */
+ @Override
+ public Optional<Boolean> makeWritable(final Set<ReadOnlyAxis> axes, final URI[] uris) {
+ return Optional.absent(); // If the file is read-only, it can probably
+ // made writable by other read-only handlers
+ // (e.g. FSReadOnlyHandler).
+ }
+
+}
diff --git a/plugins/infra/internationalization/pom.xml b/plugins/infra/internationalization/pom.xml
index 7c0b3134b06..2a526602589 100644
--- a/plugins/infra/internationalization/pom.xml
+++ b/plugins/infra/internationalization/pom.xml
@@ -19,6 +19,7 @@
<module>org.eclipse.papyrus.infra.internationalization.ui</module>
<module>org.eclipse.papyrus.infra.internationalization.controlmode</module>
<module>org.eclipse.papyrus.infra.internationalization.common</module>
+ <module>org.eclipse.papyrus.infra.internationalization.readonly</module>
<module>org.eclipse.papyrus.infra.editor.welcome.internationalization</module>
</modules>

Back to the top