Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-01-17 14:43:09 +0000
committerLaurent Redor2017-01-23 16:17:44 +0000
commita1876f93d55aaa0242193d119cdeb61774a77ab1 (patch)
treed2edabb26016c2260df38cae1a099be303af5f60
parentee33758082b87e444c9ef5bea32984a4e19aa78f (diff)
downloadorg.eclipse.sirius-a1876f93d55aaa0242193d119cdeb61774a77ab1.tar.gz
org.eclipse.sirius-a1876f93d55aaa0242193d119cdeb61774a77ab1.tar.xz
org.eclipse.sirius-a1876f93d55aaa0242193d119cdeb61774a77ab1.zip
[510582] Fix pb of ignored file during conversion to modeling project v2.0.8v2.0.x
Some files can be ignored with the extension point "org.eclipse.sirius.ui.modelingprojectresourcelistener". But these files are only ignored when they are added to a Modeling Project. The conversion action (Convert to Modeling Project) does not ignore these kind of files. This difference of behavior appears like a bug. On maintenance branch, some deprecated "API" have been added to temporarily solved the problem. On Sirius 5.0.0 another approach will be done (probably with API breaks). Bug: 510582 Change-Id: I02ed099f654af6c4d03b08bd9e575327af6ed469 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.html38
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.textile14
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.ecore3
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.genmodel7
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/plugin.xml9
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/ConvertProjectToModelingProjectTest.java78
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/TestModelingProjectResourceListener.java51
-rw-r--r--plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/viewpoint/provider/SiriusEditPlugin.java16
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/DefaultModelingProjectResourceListener.java20
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java15
10 files changed, 234 insertions, 17 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
index 23d538b8fd..9ef4bdfa59 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
@@ -13,6 +13,15 @@
<a href="#ReleaseNotesforSirius">Release Notes for Sirius</a>
<ol style="list-style: disc;">
<li>
+ <a href="#sirius2.0.8">Changes in Sirius 2.0.8 (from Sirius 2.0.7)</a>
+ </li>
+ <li>
+ <a href="#sirius2.0.7">Changes in Sirius 2.0.7 (from Sirius 2.0.6)</a>
+ </li>
+ <li>
+ <a href="#sirius2.0.6">Changes in Sirius 2.0.6 (from Sirius 2.0.5)</a>
+ </li>
+ <li>
<a href="#sirius2.0.5">Changes in Sirius 2.0.5 (from Sirius 2.0.4)</a>
</li>
<li>
@@ -46,8 +55,19 @@
</li>
</ol>
<p>This document contains the release notes for all major releases of Sirius.</p>
- <h2 id="sirius2.0.5">Changes in Sirius 2.0.5 (from Sirius 2.0.4)</h2>
+ <h2 id="sirius2.0.8">Changes in Sirius 2.0.8 (from Sirius 2.0.7)</h2>
<h3 id="APIChanges">API Changes</h3>
+ <ul>
+ <li>The method
+ <code>org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener.DefaultModelingProjectResourceListener.isPotentialSemanticResource2(IFile)</code> has been added but directly in deprecated. Indeed, it is a part of a temporary fix, waiting for a more impacting fix made in Sirius 5.0.0. This method will be removed in Sirius 5.0.0. It is not intended to be used by clients.
+ </li>
+ </ul>
+ <h2 id="sirius2.0.7">Changes in Sirius 2.0.7 (from Sirius 2.0.6)</h2>
+ <p>Minor release without APi change.</p>
+ <h2 id="sirius2.0.6">Changes in Sirius 2.0.6 (from Sirius 2.0.5)</h2>
+ <p>Minor release without APi change.</p>
+ <h2 id="sirius2.0.5">Changes in Sirius 2.0.5 (from Sirius 2.0.4)</h2>
+ <h3 id="APIChanges2">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius">Changes in
<code>org.eclipse.sirius</code>
</h4>
@@ -66,7 +86,7 @@
</li>
</ul>
<h2 id="sirius2.0.4">Changes in Sirius 2.0.4 (from Sirius 2.0.3)</h2>
- <h3 id="APIChanges2">API Changes</h3>
+ <h3 id="APIChanges3">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius.common">Changes in
<code>org.eclipse.sirius.common</code>
</h4>
@@ -86,7 +106,7 @@
<ul>
<li>In Open menu, the menu is computed from the navigation tool label instead of its name/id.</li>
</ul>
- <h3 id="APIChanges3">API Changes</h3>
+ <h3 id="APIChanges4">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius.common2">Changes in
<code>org.eclipse.sirius.common</code>
</h4>
@@ -174,7 +194,7 @@
<em>New &gt; Viewpoint Specification Project</em>, the VSM name is now given according to the project name. If the project name is suffixed with &#171;design&#187;, the VSM name is provided by the last word before this suffix. Otherwise, the VSM name is given by the last word of the project name.
</li>
</ul>
- <h3 id="APIChanges4">API Changes</h3>
+ <h3 id="APIChanges5">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius2">Changes in
<code>org.eclipse.sirius</code>
</h4>
@@ -551,7 +571,7 @@
<em>Layer</em>. The corresponding property sections will be shown only for old VSM with reused elements.
</li>
</ul>
- <h3 id="APIChanges5">API Changes</h3>
+ <h3 id="APIChanges6">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius3">Changes in
<code>org.eclipse.sirius</code>
</h4>
@@ -609,7 +629,7 @@
<em>Time (ms)</em> column, harder to read/sort, and showed wrongly formatted results.
</li>
</ul>
- <h3 id="APIChanges6">API Changes</h3>
+ <h3 id="APIChanges7">API Changes</h3>
<h4 id="separationOfDiagramSpecificConcept-step3">Move diagram.ecore in its own plugin</h4>
<p>This milestone (Sirius 1.0M7) includes the third, and final, step towards a full separation of the diagram-specific stuff out of the core of Sirius (see
<a href="#separationOfDiagramSpecificConcept-step1">Step1</a> and
@@ -1165,7 +1185,7 @@
</li>
</ul>
<h2 id="sirius1.0M6">Changes in Sirius 1.0.0M6 (from Sirius 1.0M5)</h2>
- <h3 id="APIChanges7">API Changes</h3>
+ <h3 id="APIChanges8">API Changes</h3>
<h4 id="tests">High-level API for Automated Tests Using JUnit and SWTBot</h4>
<p>Starting from version 1.0.0M6, Sirius includes high-level APIs to help creating automated tests using JUnit and/or SWTBot. These can be used either to test Sirius itself or to test Sirius-based modelers. These APIs are provided by two plug-ins:</p>
<ul>
@@ -1306,7 +1326,7 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
<ul>
<li>The table csv export has been improved to handle cropped label. In some specific cases, the cell label is automatically cropped and &#8249;...&#8250; is concatenated to the resulting value. This cropped displayed label was previously exported, now the complete semantic value is exported.</li>
</ul>
- <h3 id="APIChanges8">API Changes</h3>
+ <h3 id="APIChanges9">API Changes</h3>
<h4 id="LibraryExtensions">Library Extensions</h4>
<p>This milestone (Sirius 1.0M5) introduces several new plug-ins, collectively called &#171;library extensions&#187;. They are all named
<code>org.eclipse.sirius.ext.LIB</code>, where
@@ -1442,7 +1462,7 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
<ul>
<li>The ability to print table representations, which had been disabled for the 0.9 release, has been re-enabled.</li>
</ul>
- <h3 id="APIChanges9">API Changes</h3>
+ <h3 id="APIChanges10">API Changes</h3>
<p>Sirius 1.0.0M4 includes a lots of API-breaking changes, as part of a global effort to improve the quality of the Sirius internals. In this milestone in particular, most of the APIs which were marked as deprecated in previous versions of Sirius (and before that of Viewpoint) have been either removed (if a replacement exists) or marked as non-deprecated (if no replacement exists yet).</p>
<h4 id="Changesinorg.eclipse.sirius.common5">Changes in
<code>org.eclipse.sirius.common</code>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
index 4e989e8975..d319fdf34a 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
@@ -4,6 +4,20 @@ h1. Release Notes for Sirius
This document contains the release notes for all major releases of Sirius.
+h2(#sirius2.0.8). Changes in Sirius 2.0.8 (from Sirius 2.0.7)
+
+h3. API Changes
+
+* The method @org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener.DefaultModelingProjectResourceListener.isPotentialSemanticResource2(IFile)@ has been added but directly in deprecated. Indeed, it is a part of a temporary fix, waiting for a more impacting fix made in Sirius 5.0.0. This method will be removed in Sirius 5.0.0. It is not intended to be used by clients.
+
+h2(#sirius2.0.7). Changes in Sirius 2.0.7 (from Sirius 2.0.6)
+
+Minor release without APi change.
+
+h2(#sirius2.0.6). Changes in Sirius 2.0.6 (from Sirius 2.0.5)
+
+Minor release without APi change.
+
h2(#sirius2.0.5). Changes in Sirius 2.0.5 (from Sirius 2.0.4)
h3. API Changes
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.ecore b/plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.ecore
new file mode 100644
index 0000000000..876a15ed7b
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.ecore
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ name="testName" nsURI="testURI" nsPrefix="testPrefix"/>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.genmodel b/plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.genmodel
new file mode 100644
index 0000000000..e1cea68f7e
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/project/modeling/My.genmodel
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel"
+ modelDirectory="/Aaaaaaa/src" modelPluginID="Aaaaaaa" modelName="My"
+ importerID="org.eclipse.emf.importer.ecore" complianceLevel="7.0" copyrightFields="false">
+ <foreignModel>My.ecore</foreignModel>
+ <genPackages prefix="TestName" disposableProviderFactory="true" ecorePackage="My.ecore#/"/>
+</genmodel:GenModel>
diff --git a/plugins/org.eclipse.sirius.tests.junit/plugin.xml b/plugins/org.eclipse.sirius.tests.junit/plugin.xml
index 7f724c4223..e3271a0715 100644
--- a/plugins/org.eclipse.sirius.tests.junit/plugin.xml
+++ b/plugins/org.eclipse.sirius.tests.junit/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
- Copyright (c) 2010, 2014 THALES GLOBAL SERVICES
+ Copyright (c) 2010, 2017 THALES GLOBAL SERVICES
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
@@ -78,4 +78,11 @@
id="sampleDataProvider">
</layoutDataManagerProvider>
</extension>
+ <extension
+ id="testModelingProjectResourceListener"
+ point="org.eclipse.sirius.ui.modelingprojectresourcelistener">
+ <resourcelistener
+ class="org.eclipse.sirius.tests.unit.api.convert.TestModelingProjectResourceListener">
+ </resourcelistener>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/ConvertProjectToModelingProjectTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/ConvertProjectToModelingProjectTest.java
index 41b1af51c8..fbee3e6229 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/ConvertProjectToModelingProjectTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/ConvertProjectToModelingProjectTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES.
* 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
@@ -24,6 +24,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -63,7 +64,8 @@ public class ConvertProjectToModelingProjectTest extends SiriusTestCase {
private static final String MODELING_PROJECT_NATURE = "Modeling project";
private static final String[] NON_LOADABLE_FILES = { ".checkstyle", ".classpath", ".options", ".project", "about.ini", "build.xml", "classpath.xml", "generate.mtl", "Glossary.html", "image.svg",
- "MANIFEST.MF", "plugin.xml", "pom.xml", "project.xml", "resourcelocator.exsd", "test.docx", "unknownMM.ummfortest", "web.xml", "representations.aird.old", "vsm.odesign.old", "vsm.odesign" };
+ "MANIFEST.MF", "plugin.xml", "pom.xml", "project.xml", "resourcelocator.exsd", "test.docx", "unknownMM.ummfortest", "web.xml", "representations.aird.old", "vsm.odesign.old",
+ "vsm.odesign" };
@Override
protected void setUp() throws Exception {
@@ -188,6 +190,74 @@ public class ConvertProjectToModelingProjectTest extends SiriusTestCase {
checkModelingProject(project, representationFile, 0);
}
+ /**
+ * Launch the conversion on project with an ignored file. This file is
+ * ignored through the extension point
+ * org.eclipse.sirius.ui.modelingprojectresourcelistener. This extension
+ * point is, in theory used only for resources added or removed in an
+ * existing Modeling Project. But ignored files by this extension point were
+ * not ignored during a conversion. A fix has been done in maintenance
+ * branch to also ignore the file during conversion. A new extension point,
+ * more general, will be added in Sirius 5.0.0.
+ */
+ public void testConverProjectToModelingProjectWithIgnoredFiles() {
+ // Create a project with no Modeling project nature
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(TEMPORARY_PROJECT_NAME);
+ assertNotNull("The project should not be null", project);
+
+ // Copy an ecore file and its associated genModel
+ copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, DATA_UNIT_PROJECT_MODELING, "My.ecore", "My.genmodel");
+
+ // Convert the project to a Modeling Project
+ createAndExecuteConvertAction(project);
+
+ // check project is a Modeling project
+ checkProjectNatureIsModeling(project);
+
+ // check representation file is created
+ IFile representationFile = checkRepresentationFileExists(project);
+
+ // check modeling project is loaded with 2 semantic files ("My.ecore",
+ // "My.genmodel")
+ Session session = checkModelingProject(project, representationFile, 2);
+
+ // Convert the project to a "non Modeling Project"
+ createAndExecuteConvertAction(project);
+
+ // check project is not a Modeling project
+ checkProjectNatureIsNotModeling(project);
+
+ // Close the existing session (the "Remove Modeling Project Nature"
+ // action does not close the session)
+ session.close(new NullProgressMonitor());
+ // Delete the representations file
+ try {
+ representationFile.delete(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ fail("Impossible to delete representation file " + representationFile.getLocation().toOSString() + ": " + e.getMessage());
+ }
+
+ try {
+ // Register the extension that ignores genmodel files
+ TestModelingProjectResourceListener.enable();
+
+ // create convert action
+ createAndExecuteConvertAction(project);
+
+ // check project is a Modeling project
+ checkProjectNatureIsModeling(project);
+
+ // check representation file is created
+ checkRepresentationFileExists(project);
+
+ // check modeling project is loaded with 1 semantic file
+ // ("My.genmodel" must be ignored)
+ checkModelingProject(project, representationFile, 1);
+ } finally {
+ TestModelingProjectResourceListener.disable();
+ }
+ }
+
private IFile createRepresentationFile(IProject project) {
try {
ModelingProjectManager.INSTANCE.createLocalRepresentationsFile(project, new NullProgressMonitor());
@@ -322,7 +392,7 @@ public class ConvertProjectToModelingProjectTest extends SiriusTestCase {
checkModelingProject(project, representationFile, 3);
}
- private void checkModelingProject(IProject project, IFile representationFile, int expectedSemanticResources) {
+ private Session checkModelingProject(IProject project, IFile representationFile, int expectedSemanticResources) {
Option<ModelingProject> modelingProject = ModelingProject.asModelingProject(project);
assertTrue(modelingProject.some());
URI representationFileURI = URI.createPlatformResourceURI(representationFile.getFullPath().toOSString(), true);
@@ -342,6 +412,8 @@ public class ConvertProjectToModelingProjectTest extends SiriusTestCase {
// check there are 1 session resource
assertEquals("The session should contains one session resource.", 1, modelingSession.getAllSessionResources().size());
+
+ return modelingSession;
}
private IFile checkRepresentationFileExists(IProject project) {
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/TestModelingProjectResourceListener.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/TestModelingProjectResourceListener.java
new file mode 100644
index 0000000000..24ff05e55e
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/convert/TestModelingProjectResourceListener.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.unit.api.convert;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener.DefaultModelingProjectResourceListener;
+
+/**
+ * This class overrides DefaultModelingProjectResourceListener and also ignores
+ * genmodel files (if it is enabled).<BR>
+ * It is only really enabled when the static method {@link #enable()} is called.
+ * This avoids to have side effect on others tests.
+ *
+ * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
+ */
+public class TestModelingProjectResourceListener extends DefaultModelingProjectResourceListener {
+
+ private static boolean enabled;
+
+ /**
+ * Default constructor
+ */
+ public TestModelingProjectResourceListener() {
+ super();
+ }
+
+ public static void enable() {
+ enabled = true;
+ }
+
+ public static void disable() {
+ enabled = false;
+ }
+
+ @Override
+ protected boolean isPotentialSemanticResource(IFile file) {
+ boolean result = super.isPotentialSemanticResource(file);
+ if (enabled) {
+ result = result && !"genmodel".equals(file.getFileExtension());
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/viewpoint/provider/SiriusEditPlugin.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/viewpoint/provider/SiriusEditPlugin.java
index 15dfca637c..4662075bdd 100644
--- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/viewpoint/provider/SiriusEditPlugin.java
+++ b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/viewpoint/provider/SiriusEditPlugin.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2014 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2017 THALES GLOBAL SERVICES 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
@@ -475,6 +475,20 @@ public final class SiriusEditPlugin extends EMFPlugin {
this.uiCallback = uiCallback;
}
+ /**
+ * Return the instantiated {@link IModelingProjectResourceListener}.
+ * This method has been added only in maintenance branch of Sirius,
+ * directly in deprecated as in will be removed in Sirius 5.0.0. It
+ * should not be used by clients. It has been added to avoid an API
+ * break.
+ *
+ * @return the instantiated {@link IModelingProjectResourceListener}.
+ * @deprecated
+ */
+ @Deprecated
+ public IModelingProjectResourceListener getModelingProjectListener() {
+ return modelingProjectListener;
+ }
}
/**
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/DefaultModelingProjectResourceListener.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/DefaultModelingProjectResourceListener.java
index 8bc5287674..c5ec0adc2a 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/DefaultModelingProjectResourceListener.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/DefaultModelingProjectResourceListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2017 THALES GLOBAL SERVICES.
* 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
@@ -196,4 +196,22 @@ public class DefaultModelingProjectResourceListener implements IModelingProjectR
return file != null && new ModelingProjectFileQuery(file).isPotentialSemanticResource();
}
+ /**
+ * Check if the file must be considered as semantic resource during semantic
+ * resource detection. If it is, this listener will check if is it loadable.
+ * <BR>
+ * Added only in maintenance branch to avoid an API break by changing the
+ * visibility of {@link #isPotentialSemanticResource(IFile)}. This method
+ * will be removed in Sirius 5.0.0.<BR>
+ * This method is not intended to be used by clients.
+ *
+ * @param file
+ * an added file
+ * @return <code>false</code> if the file should be ignored.
+ * @deprecated
+ */
+ @Deprecated
+ public boolean isPotentialSemanticResource2(IFile file) {
+ return isPotentialSemanticResource(file);
+ }
}
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java
index df6e65b5bb..a2daa9c40b 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2011, 2017 THALES GLOBAL SERVICES 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
@@ -48,6 +48,8 @@ import org.eclipse.sirius.common.tools.api.resource.ResourceSetFactory;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.tools.api.command.semantic.AddSemanticResourceCommand;
import org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager;
+import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener.DefaultModelingProjectResourceListener;
+import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener.IModelingProjectResourceListener;
import org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.ModelingProjectFileQuery;
import org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob;
import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin;
@@ -399,11 +401,20 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager {
private Command getSemanticResourcesAdditionCommand(IContainer container, Session session, IProgressMonitor monitor) throws CoreException {
CompoundCommand cc = new CompoundCommand();
if (container != null) {
+ IModelingProjectResourceListener modelingProjectResourceListener = SiriusEditPlugin.getPlugin().getModelingProjectListener();
for (IResource resource : container.members()) {
- if (resource instanceof IFile && new ModelingProjectFileQuery((IFile) resource).isPotentialSemanticResource() && isLoadableModel((IFile) resource, session)) {
+ if (resource instanceof IFile) {
+ boolean isPotentialSemanticResource;
+ if (modelingProjectResourceListener instanceof DefaultModelingProjectResourceListener) {
+ isPotentialSemanticResource = ((DefaultModelingProjectResourceListener) modelingProjectResourceListener).isPotentialSemanticResource2((IFile) resource);
+ } else {
+ isPotentialSemanticResource = new ModelingProjectFileQuery((IFile) resource).isPotentialSemanticResource();
+ }
+ if (isPotentialSemanticResource && isLoadableModel((IFile) resource, session)) {
final URI uri = URI.createPlatformResourceURI(resource.getFullPath().toOSString(), true);
AddSemanticResourceCommand cmd = new AddSemanticResourceCommand(session, uri, new SubProgressMonitor(monitor, 1));
cc.append(cmd);
+ }
} else if (resource instanceof IContainer) {
Command subCc = getSemanticResourcesAdditionCommand((IContainer) resource, session, monitor);
if (subCc.canExecute()) {

Back to the top