Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Barbin2015-02-18 08:12:17 +0000
committerFlorian Barbin2015-03-03 15:37:44 +0000
commit627efd46df90d25a96e4c3d9af54aeb2711a6eba (patch)
tree2db0df13d3aee15a1992c363fc4eeeeff4e71e67
parentd67b44194739d47d973075ba0d78f81a29a8218a (diff)
downloadorg.eclipse.sirius-627efd46df90d25a96e4c3d9af54aeb2711a6eba.tar.gz
org.eclipse.sirius-627efd46df90d25a96e4c3d9af54aeb2711a6eba.tar.xz
org.eclipse.sirius-627efd46df90d25a96e4c3d9af54aeb2711a6eba.zip
[444261] Reload the resource during the dispose.
The reload was performed during the call of promptToSaveOnClose. That was causing the refresh of the editor before to close it. Bug: 444261 Change-Id: I954787ea897b3e82ee77378368308a4402f29a43 Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java6
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.html64
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.textile5
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/IEditingSession.java12
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java14
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java25
6 files changed, 85 insertions, 41 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java
index 7a683d8c37..ebc17830d0 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java
@@ -312,6 +312,8 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
private Job refreshJob;
+ private int choice = ISaveablePart2.DEFAULT;
+
/**
* Create a new instance.
*/
@@ -683,7 +685,7 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
if (getSession() != null) {
final IEditingSession editingSession = SessionUIManager.INSTANCE.getUISession(getSession());
if (editingSession != null) {
- editingSession.detachEditor(this);
+ editingSession.detachEditor(this, choice == ISaveablePart2.NO);
}
}
@@ -1835,7 +1837,7 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
* @see ISaveablePart2#promptToSaveOnClose()
*/
public int promptToSaveOnClose() {
- int choice = ISaveablePart2.DEFAULT;
+ choice = ISaveablePart2.DEFAULT;
if (session != null && session.isOpen()) {
IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
// Close all && Still open elsewhere detection.
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
index b03dd564c5..2c286912be 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
@@ -75,7 +75,7 @@
<code>org.eclipse.sirius.business.api.helper.SiriusUtil.ENVIRONMENT_URI_SCHEME</code> declares environment URI scheme.
</li>
<li>Constant
- <code>org.eclipse.sirius.business.api.helper.SiriusUtil.VIEWPOINT_ENVIRONMENT_RESOURCE_URI</code> declares &#171;environment:/viewpoint&#187; resource uri.
+ <code>org.eclipse.sirius.business.api.helper.SiriusUtil.VIEWPOINT_ENVIRONMENT_RESOURCE_URI</code> declares &#8220;environment:/viewpoint&#8221; resource uri.
</li>
<li>Constant
<code>org.eclipse.sirius.viewpoint.description.util.DescriptionResourceImpl.OPTION_SIRIUS_USE_URI_FRAGMENT_AS_ID</code> added to define a option to enable the use of a id map for odesign resource, id being uri&#8217;s fragment.
@@ -89,6 +89,14 @@
<code>org.eclipse.sirius.business.api.session.Session.createSemanticResource()</code> method has been removed. Use
<code>Session.addSemanticResource()</code> instead.
</li>
+ </ul>
+ <h4 id="Changesinorg.eclipse.sirius.ui">Changes in
+ <code>org.eclipse.sirius.ui</code>
+ </h4>
+ <ul>
+ <li>The method
+ <code>org.eclipse.sirius.ui.business.api.session.IEditingSession.detachEditor(DialectEditor, boolean)</code> has been added to choose whether we should revert the user changes when detaching the editor.
+ </li>
<li>
<code>org.eclipse.sirius.viewpoint.RGBValues</code> has been changed from an
<code>EClass</code> to an
@@ -295,7 +303,7 @@
<code>org.eclipse.sirius.diagram.tools.api.command.ChangeLayerActivationCommand</code> has been added. This command was previously internal.
</li>
<li>Constant
- <code>org.eclipse.sirius.diagram.business.api.helper.SiriusDiagramUtil.DIAGRAM_ENVIRONMENT_RESOURCE_URI</code> declares &#171;environment:/diagram&#187; resource uri.
+ <code>org.eclipse.sirius.diagram.business.api.helper.SiriusDiagramUtil.DIAGRAM_ENVIRONMENT_RESOURCE_URI</code> declares &#8220;environment:/diagram&#8221; resource uri.
</li>
<li>The method
<code>org.eclipse.sirius.diagram.business.api.diagramtype.IDiagramDescriptionProvider.completeToolTipText(String, EObject, EStructuralFeature)</code> has been added to customize the tooltip displayed in the VSM editor by using the feature of the current object. The old method
@@ -457,13 +465,13 @@
<img border="0" src="images/containerResize-changedBehavior.gif"/>
</p>
<ul>
- <li>The &#171;snap to shapes&#187; is now enabled by default (see
+ <li>The &#8220;snap to shapes&#8221; is now enabled by default (see
<em>Sirius &gt; Sirius Diagram &gt; Rulers and Grid</em> preference page). This is true only for new diagrams. The existing diagrams are not impacted.
</li>
- <li>The &#171;Navigate&#187; top-level contextual menu entry with mixed actions for creating new representations and opening existing ones has been changed by two top-level menus:
+ <li>The &#8220;Navigate&#8221; top-level contextual menu entry with mixed actions for creating new representations and opening existing ones has been changed by two top-level menus:
<ul>
- <li>One named &#171;New&#187;, which lists only the available actions to create new representations on the selected element.</li>
- <li>One named &#171;Open&#187;, which lists only the existing representations on the selected element. </li>
+ <li>One named &#8220;New&#8221;, which lists only the available actions to create new representations on the selected element.</li>
+ <li>One named &#8220;Open&#8221;, which lists only the existing representations on the selected element. </li>
</ul>
</li>
<li>When a shape is resized (no matter the direction), the edge(s) connection location (toward or from this one) is kept. Before that, edges connections moved according to the ratio of the resizing.</li>
@@ -488,19 +496,19 @@
<li>Distribute centers vertically</li>
</ul>
</li>
- <li>The end user can now remove all bend-points between the two edge ends. This action is available on edge context menu &#171;Remove Bend-points&#187; or by using the shortcut &#171;Ctrl&#187; + &#171;Shift&#187; + &#171;-&#187;.</li>
+ <li>The end user can now remove all bend-points between the two edge ends. This action is available on edge context menu &#8220;Remove Bend-points&#8221; or by using the shortcut &#8220;Ctrl&#8221; + &#8220;Shift&#8221; + &#8220;-&#8221;.</li>
<li>Reconnection of an edge will only now move the minimum necessary bendpoints instead of reseting it to default.</li>
<li>A new action has been added to reset the diagram (or container) origin: the diagram (or container) bounds (the rectangle formed by the highest, the leftmost, the lowest and the rightmost children elements) can have a negative origin or can be shifted toward the bottom-right with a blank zone at the top-left. This action aims to move all diagram (or container) elements so that the it retrieves its origin while keeping elements layout.</li>
</ul>
<h3 id="SpecifierVisibleChanges2">Specifier-Visible Changes</h3>
<ul>
- <li>The specifier can now choose to hold the edge ends toward the center of the source, target or both. New fields within the &#171;advance&#187; tab of EdgeStyle description have been added to choose for which source or target mappings an edge should be centered. See
+ <li>The specifier can now choose to hold the edge ends toward the center of the source, target or both. New fields within the &#8220;advance&#8221; tab of EdgeStyle description have been added to choose for which source or target mappings an edge should be centered. See
<a href="specifier/diagrams/Diagrams.html#edges_styles">Edges Styles &gt; Edge Centering</a> in the specifier manual for more details.
</li>
<li>When creating a new Viewpoint Specification Project using the supplied wizard:
- <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.
+ <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 &#8220;design&#8221;, 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>
- <li>&#171;Lozenge&#187; is replaced by &#171;Diamond&#187; in diagram style.</li>
+ <li>&#8220;Lozenge&#8221; is replaced by &#8220;Diamond&#8221; in diagram style.</li>
</ul>
<h3 id="APIChanges2">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius2">Changes in
@@ -928,7 +936,7 @@
<h3 id="SpecifierVisibleChanges4">Specifier-Visible Changes</h3>
<ul>
<li>The default value of the
- <em>Semantic Candidates Expression</em> for Tree Items has changed from an empty string (meaning &#171;any compatible element in the session&#187;) to
+ <em>Semantic Candidates Expression</em> for Tree Items has changed from an empty string (meaning &#8220;any compatible element in the session&#8221;) to
<code>feature:eAllContents</code> which only looks for compatible candidates inside the current element (recursively). The new behavior is more efficient on large models and consistent with what happens for diagrams. The change does not affect existing VSMs which continue to work as before whatever was the expression they used. Users who want the old behavior on specific mappings can simply remove the expression in the properties view.
</li>
<li>In the
@@ -961,7 +969,7 @@
<code>org.eclipse.diagram</code> again.
</p>
<p>Unlike, the
- <a href="#separationOfDiagramSpecificConcept-step1">Step1</a>, a simple &#171;Organize Imports&#187; operation is not enough. First, you will probably need to add dependencies to
+ <a href="#separationOfDiagramSpecificConcept-step1">Step1</a>, a simple &#8220;Organize Imports&#8221; operation is not enough. First, you will probably need to add dependencies to
<code>org.eclipse.sirius.diagram</code>,
<code>org.eclipse.sirius.diagram.ui</code> or
<code>org.eclipse.sirius.editor.diagram</code> in the MANIFEST.MF of your projects that depend on Sirius diagram classes. The dependencies to add depend on what you really use.
@@ -1388,7 +1396,7 @@
<code>Multimap</code>.
</li>
<li>
- <code>org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager.initializeAfterLoad()</code> method has been removed. There is no replacement for this method documented as &#171;Not intended to be used by client&#187;.
+ <code>org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager.initializeAfterLoad()</code> method has been removed. There is no replacement for this method documented as &#8220;Not intended to be used by client&#8221;.
</li>
</ul>
<h4 id="Changesinorg.eclipse.sirius.ecore.extender3">Changes in
@@ -1632,27 +1640,27 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
<h2 id="sirius1.0M5">Changes in Sirius 1.0.0M5 (from Sirius 1.0M4)</h2>
<h3 id="UserVisibleChanges3">User-Visible Changes</h3>
<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>
+ <li>The table csv export has been improved to handle cropped label. In some specific cases, the cell label is automatically cropped and &#8216;...&#8217; is concatenated to the resulting value. This cropped displayed label was previously exported, now the complete semantic value is exported.</li>
</ul>
<h3 id="APIChanges6">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
+ <p>This milestone (Sirius 1.0M5) introduces several new plug-ins, collectively called &#8220;library extensions&#8221;. They are all named
<code>org.eclipse.sirius.ext.LIB</code>, where
- <code>LIB</code> is the name of a library or component Sirius depends on. These plug-ins are used to isolate generic code which extends existing libraries with features and helpers needed for Sirius, but which do not depend on Sirius themselves. A relatively large part of the code in Sirius is of this kind: things that could/should be in EMF, GMF, Eclipse itself, etc. and which are not Sirius-specific but which make it easier to build Sirius itself. Sirius 1.0M5 introduces several of these library extensions and starts to fill them with existing classes which were &#171;hidden&#187; inside Sirius and are now exposed in library extensions. Most of the time, existing code which used the Sirius API will only need to:
+ <code>LIB</code> is the name of a library or component Sirius depends on. These plug-ins are used to isolate generic code which extends existing libraries with features and helpers needed for Sirius, but which do not depend on Sirius themselves. A relatively large part of the code in Sirius is of this kind: things that could/should be in EMF, GMF, Eclipse itself, etc. and which are not Sirius-specific but which make it easier to build Sirius itself. Sirius 1.0M5 introduces several of these library extensions and starts to fill them with existing classes which were &#8220;hidden&#8221; inside Sirius and are now exposed in library extensions. Most of the time, existing code which used the Sirius API will only need to:
</p>
<ol>
<li>Add the necessary
<code>Import-Package</code> (recommended) or
<code>Require-Bundle</code> to depend on the library extension(s) where the code they use now lives;
</li>
- <li>Perform a simple &#171;Organize Imports&#187; operation, which should find the classes and interfaces in their new locations.</li>
+ <li>Perform a simple &#8220;Organize Imports&#8221; operation, which should find the classes and interfaces in their new locations.</li>
</ol>
<h4 id="separationOfDiagramSpecificConcept-step1">Move diagram-specific EClasses into a separate EPackage</h4>
<p>For historical reasons, the core Sirius metamodels defined in viewpoint.ecore contain both generic (dialect-independant like Viewpoint, RepresentationDescription, DAnalysis...) concepts and diagram-specific ones (e.g. DNode, EdgeStyle, ContainerCreationDescription...). The table and tree metamodels are more cleanly separated.
<br/>This milestone (Sirius 1.0M5) includes the first step towards a full separation of the diagram-specific stuff out of the core of Sirius. So many EClasses have been moved.
</p>
- <p>Most of the time, existing code which used these Sirius EClasses will only need to perform a simple &#171;Organize Imports&#187; operation, which should find the classes and interfaces in their new locations.
- <br/>The &#171;Organize imports&#187; is not sufficient in case of imported classes existing several time in different packages (
+ <p>Most of the time, existing code which used these Sirius EClasses will only need to perform a simple &#8220;Organize Imports&#8221; operation, which should find the classes and interfaces in their new locations.
+ <br/>The &#8220;Organize imports&#8221; is not sufficient in case of imported classes existing several time in different packages (
<code>EFactory</code> classes for example with
<code>DescriptionFactory</code>, or
<code>EPackage</code> classes for example with
@@ -2067,7 +2075,7 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
</li>
</ul>
<h2 id="sirius0.9">Changes in Sirius 0.9.0</h2>
- <p>Version 0.9.0 is the first release under the Sirius name and under the Eclipse Foundation umbrella. Except for the few cases mentioned below (in the &#171;Other API Changes&#187;, &#171;Specifier-Visible Changes&#187; and &#171;User-Visible Changes&#187; sections), Sirius 0.9.0 is functionally equivalent to the latest version of Viewpoint (version 6.10), which was the name of the project before it was open sourced at Eclipse. See the rest of the documentation for the complete list of feature of the Sirius platform.</p>
+ <p>Version 0.9.0 is the first release under the Sirius name and under the Eclipse Foundation umbrella. Except for the few cases mentioned below (in the &#8220;Other API Changes&#8221;, &#8220;Specifier-Visible Changes&#8221; and &#8220;User-Visible Changes&#8221; sections), Sirius 0.9.0 is functionally equivalent to the latest version of Viewpoint (version 6.10), which was the name of the project before it was open sourced at Eclipse. See the rest of the documentation for the complete list of feature of the Sirius platform.</p>
<h3 id="MigratingfromObeoDesignerorViewpointtoSirius">Migrating from Obeo Designer or Viewpoint to Sirius</h3>
<p>If you have existing projects which used this technology before it became Eclipse Sirius and want to migrate to Sirius, you must:</p>
<ol>
@@ -2091,9 +2099,9 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
<code>org.eclipse.sirius.componentization</code> extension point id. The identifier changes for the other extension points follow the same rules as the name changes of the plug-ins they are defined in.
</li>
<li>The migration of your VSMs (
- <code>*.odesign</code> files) is automatic: simply open your files once in the VSM editor, perform some no-op change to make the editor &#171;dirty&#187; and save it. The saved version will have been migrated to Sirius.
+ <code>*.odesign</code> files) is automatic: simply open your files once in the VSM editor, perform some no-op change to make the editor &#8220;dirty&#8221; and save it. The saved version will have been migrated to Sirius.
</li>
- <li>If you had Java code which used the Viewpoint APIs, you will need to update it to use the Sirius APIs. A simple &#171;Source &gt; Organize Imports&#187; on your source folders should find most classes you used in their new namespace. The Viewpoint code base and APIs used the term &#171;Viewpoint&#187; both for the name of the product and for the name of the concept. When it refered to the name of the product, the names were changed to use &#171;Sirius&#187; instead, so you may need to adjust some names in your code beyond just updating the imports (for example,
+ <li>If you had Java code which used the Viewpoint APIs, you will need to update it to use the Sirius APIs. A simple &#8220;Source &gt; Organize Imports&#8221; on your source folders should find most classes you used in their new namespace. The Viewpoint code base and APIs used the term &#8220;Viewpoint&#8221; both for the name of the product and for the name of the concept. When it refered to the name of the product, the names were changed to use &#8220;Sirius&#8221; instead, so you may need to adjust some names in your code beyond just updating the imports (for example,
<code>ViewpointControlCommand</code> is now
<code>SiriusControlCommand</code>).
</li>
@@ -2108,7 +2116,7 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
<h4 id="MigratingModelingProjectsandRepresentationFiles">Migrating Modeling Projects and Representation Files</h4>
<ul>
<li>First migrate any modeler definitions used by your modeling projects and representation files (see the section above).</li>
- <li>Modeling projects created using Viewpoint will not be recognized directly by Sirius, because the nature identfier has changed. You must use the &#171;Configure/Convert to Modeling Project&#187; action in the project&#8217;s context menu to make it a Sirius-compatible modeling project (see the section below for the technical details of the change).</li>
+ <li>Modeling projects created using Viewpoint will not be recognized directly by Sirius, because the nature identfier has changed. You must use the &#8220;Configure/Convert to Modeling Project&#8221; action in the project&#8217;s context menu to make it a Sirius-compatible modeling project (see the section below for the technical details of the change).</li>
<li>The migration of you representation files (
<code>*.aird</code>) is performed automatically when they are loaded in memory. It will become permanent the first time you save it (you can force this by opening a representation, making some arbitrary change and saving the session).
</li>
@@ -2284,20 +2292,20 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
</tr>
</table>
<h4 id="JavaPackagesandClassesNames">Java Packages and Classes Names</h4>
- <p>The Java package names have changed to start with the identifier of the plug-in they are defined in (which has changed). A simple &#171;Source &gt; Organize Imports&#187; on your source folders should find most classes you used in their new namespace.</p>
- <p>The Viewpoint code base and APIs used the term &#171;Viewpoint&#187; both for the name of the product and for the name of the concept. When it refered to the name of the product, the names where changed to use &#171;Sirius&#187; instead (for example,
+ <p>The Java package names have changed to start with the identifier of the plug-in they are defined in (which has changed). A simple &#8220;Source &gt; Organize Imports&#8221; on your source folders should find most classes you used in their new namespace.</p>
+ <p>The Viewpoint code base and APIs used the term &#8220;Viewpoint&#8221; both for the name of the product and for the name of the concept. When it refered to the name of the product, the names where changed to use &#8220;Sirius&#8221; instead (for example,
<code>ViewpointControlCommand</code> is now
<code>SiriusControlCommand</code>).
</p>
<h4 id="ModelsnamespaceURIs">Models namespace URIs</h4>
- <p>All namespace URIs have also been changed from &#171;http://www.obeo.fr/dsl/viewpoint*&#187; to &#171;http://www.eclipse.org/sirius/&#187;.</p>
+ <p>All namespace URIs have also been changed from &#8220;http://www.obeo.fr/dsl/viewpoint*&#8221; to &#8220;http://www.eclipse.org/sirius/&#8221;.</p>
<p>If you have created VSM file (.odesign) or representations file (.aird) with Viewpoint, the changes of the namespace URIs will be automatically migrated during the loading of your VSM or your representations file. These new nsURIs will be stored physically in the file during the first save. If the file is not saved, the automatic migration will be replayed at the next opening.</p>
<h3 id="NatureID">Nature ID</h3>
<p>The modeling project has a specific nature (
<code>org.eclipse.sirius.nature.modelingproject</code>).
- <br/>If you have modeling project created with Viewpoint, you must launch the action &#171;Configure/Convert to Modeling Project&#187; to replace old nature id (
+ <br/>If you have modeling project created with Viewpoint, you must launch the action &#8220;Configure/Convert to Modeling Project&#8221; to replace old nature id (
<code>fr.obeo.dsl.viewpoint.nature.modelingproject</code>) by the new one.
- <br/>If you have many modeling projects to &#171;migrate&#187;, you can easily make a script to replace
+ <br/>If you have many modeling projects to &#8220;migrate&#8221;, you can easily make a script to replace
<code>fr.obeo.dsl.viewpoint.nature.modelingproject</code> by
<code>org.eclipse.sirius.nature.modelingproject</code> in all
<code>.project</code> file of each modeling projects.
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
index 2213f862fa..acb152a329 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
@@ -37,6 +37,11 @@ h4. Changes in @org.eclipse.sirius.ui@
* The class @org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertySource@ has been added. It allows developers to make their properties views CellEditor customizable by using the new extension point @org.eclipse.sirius.ui.siriuspropertiescelleditor@
* The interface @org.eclipse.sirius.ext.emf.ui.ICellEditorProvider@ has been added to allow clients to provide their own @CellEditor@ - in the Sirius semantic properties views - through the new extension point @org.eclipse.sirius.ui.siriuspropertiescelleditor@.
+
+h4. Changes in @org.eclipse.sirius.ui@
+
+* The method @org.eclipse.sirius.ui.business.api.session.IEditingSession.detachEditor(DialectEditor, boolean)@ has been added to choose whether we should revert the user changes when detaching the editor.
+
h4. Changes in @org.eclipse.sirius.common@
* The @org.eclipse.sirius.common.tools.api.util.SiriusCrossReferenceAdapter@ interface and the @org.eclipse.sirius.common.tools.api.util.SiriusCrossReferenceAdapterImpl@ have been added to have the capability to disable the proxy resolution. This feature is typically used to prevent loading a resource during its unloading. *Warning* : _Every additional custom CrossReferenceAdapter_ should extend @SiriusCrossReferenceAdapterImpl@ or at least implement @SiriusCrossReferenceAdapter@ with the same implementation as @SiriusCrossReferenceAdapterImpl@.
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/IEditingSession.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/IEditingSession.java
index 27307ab4d8..9d6c778e3e 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/IEditingSession.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/IEditingSession.java
@@ -65,6 +65,18 @@ public interface IEditingSession {
void detachEditor(DialectEditor editor);
/**
+ * Detach an editor from the current Session. This is called when a
+ * DialectEditor is closed. Revert all changes since the last save if the
+ * last opened editor is closed and the revertChanges is true.
+ *
+ * @param dialectEditor
+ * editor to detach.
+ * @param revertChanges
+ * true if we should revert all user changes.
+ */
+ void detachEditor(DialectEditor dialectEditor, boolean revertChanges);
+
+ /**
* Returns editors.
*
* @return editors
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java
index 6a624fd06f..3e21de73d2 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java
@@ -188,6 +188,18 @@ public class EditingSession implements IEditingSession, ISaveablesSource, Refres
}
@Override
+ public void detachEditor(final DialectEditor dialectEditor, boolean revertChanges) {
+
+ // We need to compute the closeAllDetected() before to execute the
+ // detachEditor since this editor will be removed from the list.
+ boolean returnToSyncState = revertChanges && (getEditors().size() == 1 || closeAllDetected());
+ detachEditor(dialectEditor);
+ if (returnToSyncState) {
+ returnToSyncState();
+ }
+ }
+
+ @Override
public void closeEditors(final boolean save, final Collection<? extends DialectEditor> editorParts) {
for (final DialectEditor editor : new ArrayList<DialectEditor>(editorParts)) {
closeEditor(editor, save);
@@ -240,8 +252,6 @@ public class EditingSession implements IEditingSession, ISaveablesSource, Refres
if (choice == ISaveablePart2.CANCEL) {
needSaveOnCloseDetec.reInit();
- } else if (choice == ISaveablePart2.NO && (getEditors().size() == 1 || closeAllDetected())) {
- returnToSyncState();
}
}
return choice;
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java
index 4106c171ad..2ae520603d 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java
@@ -192,6 +192,8 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE
*/
private Image noWritePermissionImage;
+ private int choice = ISaveablePart2.DEFAULT;
+
/**
* Default constructor.
*/
@@ -515,14 +517,6 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE
if (this.undoRedoActionHandler != null) {
this.undoRedoActionHandler.dispose();
}
-
- if (session != null) {
- session.removeListener(this);
- final IEditingSession sess = SessionUIManager.INSTANCE.getUISession(session);
- if (sess != null) {
- sess.detachEditor(this);
- }
- }
super.dispose();
if (getTableViewer() != null) {
getTableViewer().dispose();
@@ -532,6 +526,19 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE
if (getEditorInput() instanceof SessionEditorInput) {
((SessionEditorInput) getEditorInput()).dispose();
}
+
+ // We need to perform the detachEditor after having disposed the viewer
+ // and the editor input to avoid a refresh. A refresh can occurs in the
+ // case where the detach triggers the reload of the modified resources
+ // (if choice == ISaveablePart2.NO)
+ if (session != null) {
+ session.removeListener(this);
+ final IEditingSession sess = SessionUIManager.INSTANCE.getUISession(session);
+ if (sess != null) {
+ sess.detachEditor(this, choice == ISaveablePart2.NO);
+ }
+ }
+
}
/**
@@ -701,7 +708,7 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE
* @see ISaveablePart2#promptToSaveOnClose()
*/
public int promptToSaveOnClose() {
- int choice = ISaveablePart2.DEFAULT;
+ choice = ISaveablePart2.DEFAULT;
if (session != null && session.isOpen()) {
IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
// Close all && Still open elsewhere detection.

Back to the top