Skip to content

Commit bc7084a

Browse files
committed
[5762] Apply the selection requested by a tool to the workbench
Bug: #5762 Signed-off-by: Pierre-Charles David <[email protected]>
1 parent d1a4ad3 commit bc7084a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Use `org.eclipse.emf.ecore.util.ECrossReferenceAdapter.getCrossReferenceAdapter(
125125
- https://github.com/eclipse-sirius/sirius-web/issues/5694[#5694] [trees] Ensure that expand all is available in read only workbenches
126126
- https://github.com/eclipse-sirius/sirius-web/issues/5245[#5245] [sirius-web] Ensure that representations cannot be forked in read only workbenches
127127
- https://github.com/eclipse-sirius/sirius-web/issues/5737[#5737] [sirius-web] Fix a regression where sharing a workbench URL did not include all the opened representations
128-
128+
- https://github.com/eclipse-sirius/sirius-web/issues/5762[#5762] [diagram] Fix an issue where the selection requested by a diagram tool was no longer applied globaly to the workbench
129129

130130
=== New Features
131131

packages/diagrams/frontend/sirius-components-diagrams/src/renderer/DiagramRenderer.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Obeo - initial API and implementation
1212
*******************************************************************************/
1313

14-
import { useData } from '@eclipse-sirius/sirius-components-core';
14+
import { useData, useSelection } from '@eclipse-sirius/sirius-components-core';
1515
import {
1616
Background,
1717
BackgroundVariant,
@@ -100,6 +100,7 @@ export const DiagramRenderer = memo(({ diagramRefreshedEventPayload }: DiagramRe
100100
const { onNodeDragStart, onNodeDrag, onNodeDragStop } = useDropNode();
101101
const { backgroundColor, largeGridColor, smallGridColor } = useDropDiagramStyle();
102102
const { nodeTypes } = useNodeType();
103+
const { setSelection } = useSelection();
103104

104105
const { nodeConverters } = useContext<NodeTypeContextValue>(NodeTypeContext);
105106

@@ -218,7 +219,10 @@ export const DiagramRenderer = memo(({ diagramRefreshedEventPayload }: DiagramRe
218219
}
219220
});
220221
}
221-
}, [diagramRefreshedEventPayload, diagramDescription]);
222+
if (selectionFromTool) {
223+
setSelection(selectionFromTool);
224+
}
225+
}, [diagramRefreshedEventPayload, diagramDescription, setSelection]);
222226

223227
useEffect(() => {
224228
if (toolSelections.has(diagramRefreshedEventPayload.id)) {
@@ -269,6 +273,9 @@ export const DiagramRenderer = memo(({ diagramRefreshedEventPayload }: DiagramRe
269273
setEdges(newEdges);
270274
setNodes(newNodes);
271275
toolSelections.delete(diagramRefreshedEventPayload.id);
276+
if (selectionFromTool) {
277+
setSelection(selectionFromTool);
278+
}
272279
}
273280
}, [toolSelections]);
274281

0 commit comments

Comments
 (0)