Skip to content

Commit 13ba37a

Browse files
froueneAxelRICHARD
authored andcommitted
[1000] Add support for semantic undo redo
Bug: #1000 Signed-off-by: Florian ROUËNÉ <florian.rouene@obeosoft.com>
1 parent 9c82a0a commit 13ba37a

File tree

5 files changed

+39
-263
lines changed

5 files changed

+39
-263
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The changes are:
5454
- https://github.com/eclipse-syson/syson/issues/977[#977] [validation] SysON now implements the constraints (a.k.a. validation rules) from the SysMLv2 specification.
5555
The _Validation_ view show the results of the execution of the constraints on your models.
5656
- https://github.com/eclipse-syson/syson/issues/987[#987] Implementation of drag and drop in Explorer view.
57+
- https://github.com/eclipse-syson/syson/issues/1000[#1000] Add support for semantic undo redo.
5758

5859

5960
== v2025.1.0

doc/content/modules/user-manual/pages/release-notes/2025.2.0.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ The _Validation_ view show the results of the execution of the constraints on yo
99

1010
- *Right-click to display contextual menu (a.k.a. palette)*: In all diagrams, the contextual menu is now available on right-click instead of left-click.
1111

12-
- *Drag and drop in Explorer view* : User can now move semantic elements using a drag and drop operation in the _Explorer_ view.
12+
- *Drag and drop in Explorer view* : Users can now move semantic elements using a drag and drop operation in the _Explorer_ view.
13+
14+
- *Undo/redo*: Users can now undo and redo any semantic change (i.e. in _Explorer_ and _Details_ views) with "CTRL + z" and "CTRL + y".
15+
Undo/redo is not available yet in diagrams.
16+
1317

1418
== Breaking changes
1519

@@ -69,7 +73,10 @@ In this case it corresponds to the members of _Package 1_ that you can also see
6973

7074
- The _Validation_ view now displays the result of the execution of the constraints (a.k.a. validation rules) from the SysMLv2 specification.
7175

72-
- User can now move semantic elements using the drag and drop operation in the _Explorer_ view.
76+
- Users can now move semantic elements using the drag and drop operation in the _Explorer_ view.
77+
78+
- Users can now undo and redo any semantic change (i.e. in _Explorer_ and _Details_ views) with "CTRL + z" and "CTRL + y".
79+
Undo/redo is not available yet in diagrams.
7380

7481
== Improvements
7582

frontend/syson/src/extensions/ReferenceWidgetDocumentTransform.ts

Lines changed: 0 additions & 244 deletions
This file was deleted.

frontend/syson/src/extensions/SysONExtensionRegistryMergeStrategy.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024 Obeo.
2+
* Copyright (c) 2024, 2025 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -11,7 +11,11 @@
1111
* Obeo - initial API and implementation
1212
*******************************************************************************/
1313

14-
import { ComponentExtension, ExtensionRegistryMergeStrategy } from '@eclipse-sirius/sirius-components-core';
14+
import {
15+
ComponentExtension,
16+
ExtensionRegistryMergeStrategy,
17+
DataExtension,
18+
} from '@eclipse-sirius/sirius-components-core';
1519
import { DefaultExtensionRegistryMergeStrategy } from '@eclipse-sirius/sirius-web-application';
1620
import { treeItemContextMenuEntryExtensionPoint } from '@eclipse-sirius/sirius-components-trees';
1721

@@ -39,4 +43,25 @@ export class SysONExtensionRegistryMergeStrategy
3943
}
4044
return super.mergeComponentExtensions(_identifier, existingValues, newValues);
4145
}
46+
47+
public override mergeDataExtensions(
48+
identifier: string,
49+
existingValues: DataExtension<any>,
50+
newValues: DataExtension<any>
51+
): DataExtension<any> {
52+
if (identifier === 'apolloClient#apolloClientOptionsConfigurers') {
53+
return this.mergeApolloClientContributions(existingValues, newValues);
54+
}
55+
return newValues;
56+
}
57+
58+
private mergeApolloClientContributions(
59+
existingApolloClientContributions: DataExtension<any>,
60+
newApolloClientContributions: DataExtension<any>
61+
): DataExtension<any> {
62+
return {
63+
identifier: 'syson_apolloClient#apolloClientOptionsConfigurers',
64+
data: [...existingApolloClientContributions.data, ...newApolloClientContributions.data],
65+
};
66+
}
4267
}

frontend/syson/src/index.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import {
4747
import { createRoot } from 'react-dom/client';
4848

4949
import { httpOrigin, wsOrigin } from './core/URL';
50-
import { referenceWidgetDocumentTransform } from './extensions/ReferenceWidgetDocumentTransform';
5150
import { SysONDocumentTreeItemContextMenuContribution } from './extensions/SysONDocumentTreeItemContextMenuContribution';
5251
import { SysONExtensionRegistryMergeStrategy } from './extensions/SysONExtensionRegistryMergeStrategy';
5352
import { SysONFooter } from './extensions/SysONFooter';
@@ -75,18 +74,6 @@ extensionRegistry.putData(navigationBarMenuHelpURLExtensionPoint, {
7574
data: 'https://doc.mbse-syson.org',
7675
});
7776

78-
const widgetsApolloClientOptionsConfigurer: ApolloClientOptionsConfigurer = (currentOptions) => {
79-
const { documentTransform } = currentOptions;
80-
81-
const newDocumentTransform = documentTransform
82-
? documentTransform.concat(referenceWidgetDocumentTransform)
83-
: referenceWidgetDocumentTransform;
84-
return {
85-
...currentOptions,
86-
documentTransform: newDocumentTransform,
87-
};
88-
};
89-
9077
const apolloClientOptionsConfigurer: ApolloClientOptionsConfigurer = (currentOptions) => {
9178
const { documentTransform } = currentOptions;
9279

@@ -99,8 +86,8 @@ const apolloClientOptionsConfigurer: ApolloClientOptionsConfigurer = (currentOpt
9986
};
10087
};
10188
extensionRegistry.putData(apolloClientOptionsConfigurersExtensionPoint, {
102-
identifier: `siriusWeb_${apolloClientOptionsConfigurersExtensionPoint.identifier}`,
103-
data: [apolloClientOptionsConfigurer, widgetsApolloClientOptionsConfigurer],
89+
identifier: `syson_${apolloClientOptionsConfigurersExtensionPoint.identifier}`,
90+
data: [apolloClientOptionsConfigurer],
10491
});
10592

10693
extensionRegistry.addComponent(diagramPanelActionExtensionPoint, {

0 commit comments

Comments
 (0)