Skip to content

Commit

Permalink
#2822 Fix for Richtext description
Browse files Browse the repository at this point in the history
If the tracked element is owned by a closed session, do no save it

Change-Id: Icc0819da76221c5c2be21a23ae834ff54981270e
Signed-off-by: Erwann Traisnel <erwann.traisnel@obeo.fr>
  • Loading branch information
etraisnel2 authored and pdulth committed Mar 1, 2024
1 parent a96087e commit 07b161b
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -22,6 +22,8 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.sirius.business.api.session.Session;
import org.eclipse.sirius.business.api.session.SessionManager;
import org.eclipse.sirius.common.tools.api.query.IllegalStateExceptionQuery;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
Expand Down Expand Up @@ -211,7 +213,7 @@ protected void checkSubclass() {
public void aboutToBeShown() {
if (updateDescriptionEditability(semanticElement, semanticFeature)) {
try {
if (semanticElement != null && semanticFeature != null) {
if (semanticElement != null && semanticFeature != null) {
((SavingStrategy) descriptionTextField.getSaveStrategy()).ensureLastSave();
descriptionTextField.bind(semanticElement, semanticFeature);
descriptionTextField.setSaveStrategy(new SavingStrategy(semanticElement, semanticFeature));
Expand All @@ -233,6 +235,12 @@ public void aboutToBeShown() {
* Remove the editor before the Property tab is disposed
*/
public void aboutToBeHidden() {
Session session = SessionManager.INSTANCE.getSession(semanticElement);
if(session == null) {
//If the semanticElement doesn't belong to a session, clear it
semanticElement = null;
semanticFeature = null;
}
hideEditor();
}

Expand Down

0 comments on commit 07b161b

Please sign in to comment.