From f7e1abb1ce6f07203a6fa774eb42200d17c26b19 Mon Sep 17 00:00:00 2001 From: Michael Charfadi Date: Wed, 18 Dec 2024 16:02:26 +0100 Subject: [PATCH] [4326] Add quickAccessTools to diagram's palette in view dsl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/eclipse-sirius/sirius-web/issues/4326 Signed-off-by: Michaƫl Charfadi --- CHANGELOG.adoc | 2 + .../diagram/DiagramPaletteBuilder.java | 12 ++ .../generated/diagram/EdgePaletteBuilder.java | 12 ++ .../generated/diagram/NodePaletteBuilder.java | 12 ++ .../provider/DiagramPaletteItemProvider.java | 17 ++- .../provider/EdgePaletteItemProvider.java | 19 ++- .../provider/NodePaletteItemProvider.java | 16 ++- .../src/main/resources/plugin.properties | 3 + .../view/diagram/DiagramPackage.java | 111 ++++++++++++++++-- .../view/diagram/DiagramPalette.java | 14 +++ .../components/view/diagram/EdgePalette.java | 14 +++ .../components/view/diagram/NodePalette.java | 14 +++ .../view/diagram/impl/DiagramPackageImpl.java | 52 +++++++- .../view/diagram/impl/DiagramPaletteImpl.java | 40 ++++++- .../view/diagram/impl/EdgePaletteImpl.java | 40 ++++++- .../view/diagram/impl/NodePaletteImpl.java | 40 ++++++- .../src/main/resources/model/diagram.ecore | 6 + .../src/main/resources/model/diagram.genmodel | 3 + .../view/emf/diagram/ToolConverter.java | 34 ++++-- .../view/emf/diagram/ToolFinder.java | 24 ++++ .../view/emf/diagram/ViewPaletteProvider.java | 37 ++++-- 21 files changed, 475 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index c8806953ae..4a461174a1 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -22,6 +22,8 @@ === New Features +- https://github.com/eclipse-sirius/sirius-web/issues/4326[#4326] [diagram] Add quickAccessTools to diagram's palette in view dsl + === Improvements diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/DiagramPaletteBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/DiagramPaletteBuilder.java index 4dc749dd46..e042fad41c 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/DiagramPaletteBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/DiagramPaletteBuilder.java @@ -72,6 +72,18 @@ public DiagramPaletteBuilder nodeTools(org.eclipse.sirius.components.view.diagra return this; } + /** + * Setter for QuickAccessTools. + * + * @generated + */ + public DiagramPaletteBuilder quickAccessTools(org.eclipse.sirius.components.view.diagram.NodeTool ... values) { + for (org.eclipse.sirius.components.view.diagram.NodeTool value : values) { + this.getDiagramPalette().getQuickAccessTools().add(value); + } + return this; + } + /** * Setter for ToolSections. * diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/EdgePaletteBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/EdgePaletteBuilder.java index ea3a77a681..487277932b 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/EdgePaletteBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/EdgePaletteBuilder.java @@ -90,6 +90,18 @@ public EdgePaletteBuilder nodeTools(org.eclipse.sirius.components.view.diagram.N return this; } + /** + * Setter for QuickAccessTools. + * + * @generated + */ + public EdgePaletteBuilder quickAccessTools(org.eclipse.sirius.components.view.diagram.NodeTool ... values) { + for (org.eclipse.sirius.components.view.diagram.NodeTool value : values) { + this.getEdgePalette().getQuickAccessTools().add(value); + } + return this; + } + /** * Setter for EdgeReconnectionTools. * diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/NodePaletteBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/NodePaletteBuilder.java index 02b15b05cc..1a6339330d 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/NodePaletteBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/diagram/NodePaletteBuilder.java @@ -81,6 +81,18 @@ public NodePaletteBuilder nodeTools(org.eclipse.sirius.components.view.diagram.N return this; } + /** + * Setter for QuickAccessTools. + * + * @generated + */ + public NodePaletteBuilder quickAccessTools(org.eclipse.sirius.components.view.diagram.NodeTool ... values) { + for (org.eclipse.sirius.components.view.diagram.NodeTool value : values) { + this.getNodePalette().getQuickAccessTools().add(value); + } + return this; + } + /** * Setter for EdgeTools. * diff --git a/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/DiagramPaletteItemProvider.java b/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/DiagramPaletteItemProvider.java index 34a69f3389..8b7c94232a 100644 --- a/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/DiagramPaletteItemProvider.java +++ b/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/DiagramPaletteItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2023 Obeo. + * Copyright (c) 2021, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -78,6 +78,7 @@ public Collection getChildrenFeatures(Object objec this.childrenFeatures.add(DiagramPackage.Literals.DIAGRAM_PALETTE__DROP_TOOL); this.childrenFeatures.add(DiagramPackage.Literals.DIAGRAM_PALETTE__DROP_NODE_TOOL); this.childrenFeatures.add(DiagramPackage.Literals.DIAGRAM_PALETTE__NODE_TOOLS); + this.childrenFeatures.add(DiagramPackage.Literals.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS); this.childrenFeatures.add(DiagramPackage.Literals.DIAGRAM_PALETTE__TOOL_SECTIONS); } return this.childrenFeatures; @@ -141,6 +142,7 @@ public void notifyChanged(Notification notification) { case DiagramPackage.DIAGRAM_PALETTE__DROP_TOOL: case DiagramPackage.DIAGRAM_PALETTE__DROP_NODE_TOOL: case DiagramPackage.DIAGRAM_PALETTE__NODE_TOOLS: + case DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS: case DiagramPackage.DIAGRAM_PALETTE__TOOL_SECTIONS: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; @@ -164,9 +166,22 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.DIAGRAM_PALETTE__NODE_TOOLS, DiagramFactory.eINSTANCE.createNodeTool())); + newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS, DiagramFactory.eINSTANCE.createNodeTool())); + newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.DIAGRAM_PALETTE__TOOL_SECTIONS, DiagramFactory.eINSTANCE.createDiagramToolSection())); } + /** + * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. + * + * + * @generated NOT + */ + @Override + public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) { + return this.getFeatureText(feature); + } + /** * Return the resource locator for this item provider's resources. * diff --git a/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/EdgePaletteItemProvider.java b/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/EdgePaletteItemProvider.java index c5faa6d257..f58af0de66 100644 --- a/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/EdgePaletteItemProvider.java +++ b/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/EdgePaletteItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2023 Obeo. + * Copyright (c) 2021, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -81,6 +81,7 @@ public Collection getChildrenFeatures(Object objec this.childrenFeatures.add(DiagramPackage.Literals.EDGE_PALETTE__BEGIN_LABEL_EDIT_TOOL); this.childrenFeatures.add(DiagramPackage.Literals.EDGE_PALETTE__END_LABEL_EDIT_TOOL); this.childrenFeatures.add(DiagramPackage.Literals.EDGE_PALETTE__NODE_TOOLS); + this.childrenFeatures.add(DiagramPackage.Literals.EDGE_PALETTE__QUICK_ACCESS_TOOLS); this.childrenFeatures.add(DiagramPackage.Literals.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS); this.childrenFeatures.add(DiagramPackage.Literals.EDGE_PALETTE__TOOL_SECTIONS); } @@ -147,6 +148,7 @@ public void notifyChanged(Notification notification) { case DiagramPackage.EDGE_PALETTE__BEGIN_LABEL_EDIT_TOOL: case DiagramPackage.EDGE_PALETTE__END_LABEL_EDIT_TOOL: case DiagramPackage.EDGE_PALETTE__NODE_TOOLS: + case DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS: case DiagramPackage.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS: case DiagramPackage.EDGE_PALETTE__TOOL_SECTIONS: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); @@ -175,6 +177,8 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.EDGE_PALETTE__NODE_TOOLS, DiagramFactory.eINSTANCE.createNodeTool())); + newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.EDGE_PALETTE__QUICK_ACCESS_TOOLS, DiagramFactory.eINSTANCE.createNodeTool())); + newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS, DiagramFactory.eINSTANCE.createSourceEdgeEndReconnectionTool())); newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS, DiagramFactory.eINSTANCE.createTargetEdgeEndReconnectionTool())); @@ -186,20 +190,11 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. * * - * @generated + * @generated NOT */ @Override public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) { - Object childFeature = feature; - Object childObject = child; - - boolean qualify = childFeature == DiagramPackage.Literals.EDGE_PALETTE__CENTER_LABEL_EDIT_TOOL || childFeature == DiagramPackage.Literals.EDGE_PALETTE__BEGIN_LABEL_EDIT_TOOL - || childFeature == DiagramPackage.Literals.EDGE_PALETTE__END_LABEL_EDIT_TOOL; - - if (qualify) { - return this.getString("_UI_CreateChild_text2", new Object[] { this.getTypeText(childObject), this.getFeatureText(childFeature), this.getTypeText(owner) }); - } - return super.getCreateChildText(owner, feature, child, selection); + return this.getFeatureText(feature); } /** diff --git a/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/NodePaletteItemProvider.java b/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/NodePaletteItemProvider.java index 852d0b7a8e..711ba674f3 100644 --- a/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/NodePaletteItemProvider.java +++ b/packages/view/backend/sirius-components-view-diagram-edit/src/main/java/org/eclipse/sirius/components/view/diagram/provider/NodePaletteItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2023 Obeo. + * Copyright (c) 2021, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -80,6 +80,7 @@ public Collection getChildrenFeatures(Object objec this.childrenFeatures.add(DiagramPackage.Literals.NODE_PALETTE__LABEL_EDIT_TOOL); this.childrenFeatures.add(DiagramPackage.Literals.NODE_PALETTE__DROP_NODE_TOOL); this.childrenFeatures.add(DiagramPackage.Literals.NODE_PALETTE__NODE_TOOLS); + this.childrenFeatures.add(DiagramPackage.Literals.NODE_PALETTE__QUICK_ACCESS_TOOLS); this.childrenFeatures.add(DiagramPackage.Literals.NODE_PALETTE__EDGE_TOOLS); this.childrenFeatures.add(DiagramPackage.Literals.NODE_PALETTE__TOOL_SECTIONS); } @@ -145,6 +146,7 @@ public void notifyChanged(Notification notification) { case DiagramPackage.NODE_PALETTE__LABEL_EDIT_TOOL: case DiagramPackage.NODE_PALETTE__DROP_NODE_TOOL: case DiagramPackage.NODE_PALETTE__NODE_TOOLS: + case DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS: case DiagramPackage.NODE_PALETTE__EDGE_TOOLS: case DiagramPackage.NODE_PALETTE__TOOL_SECTIONS: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); @@ -168,11 +170,23 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.NODE_PALETTE__LABEL_EDIT_TOOL, defaultToolsFactory.createDefaultLabelEditTool())); newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.NODE_PALETTE__DROP_NODE_TOOL, DiagramFactory.eINSTANCE.createDropNodeTool())); newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.NODE_PALETTE__NODE_TOOLS, defaultToolsFactory.createDefaultNodeCreationTool())); + newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.NODE_PALETTE__QUICK_ACCESS_TOOLS, defaultToolsFactory.createDefaultNodeCreationTool())); newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.NODE_PALETTE__EDGE_TOOLS, defaultToolsFactory.createDefaultEdgeTool())); newChildDescriptors.add(this.createChildParameter(DiagramPackage.Literals.NODE_PALETTE__TOOL_SECTIONS, DiagramFactory.eINSTANCE.createNodeToolSection())); } + /** + * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. + * + * + * @generated NOT + */ + @Override + public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) { + return this.getFeatureText(feature); + } + /** * Return the resource locator for this item provider's resources. * diff --git a/packages/view/backend/sirius-components-view-diagram-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-diagram-edit/src/main/resources/plugin.properties index 6038f598af..accc243d85 100644 --- a/packages/view/backend/sirius-components-view-diagram-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-diagram-edit/src/main/resources/plugin.properties @@ -153,11 +153,13 @@ _UI_EdgeStyle_maxWidthExpression_feature=Max Width Expression _UI_DiagramPalette_dropTool_feature=Drop Tool _UI_DiagramPalette_dropNodeTool_feature=Drop Node Tool _UI_DiagramPalette_nodeTools_feature=Node Tools +_UI_DiagramPalette_quickAccessTools_feature=Quick Access Node Tools _UI_DiagramPalette_toolSections_feature=Tool Sections _UI_NodePalette_deleteTool_feature=Delete Tool _UI_NodePalette_labelEditTool_feature=Label Edit Tool _UI_NodePalette_dropNodeTool_feature=Drop Node Tool _UI_NodePalette_nodeTools_feature=Node Tools +_UI_NodePalette_quickAccessTools_feature=Quick Access Node Tools _UI_NodePalette_edgeTools_feature=Edge Tools _UI_NodePalette_toolSections_feature=Tool Sections _UI_EdgePalette_deleteTool_feature=Delete Tool @@ -165,6 +167,7 @@ _UI_EdgePalette_centerLabelEditTool_feature=Center Label Edit Tool _UI_EdgePalette_beginLabelEditTool_feature=Begin Label Edit Tool _UI_EdgePalette_endLabelEditTool_feature=End Label Edit Tool _UI_EdgePalette_nodeTools_feature=Node Tools +_UI_EdgePalette_quickAccessTools_feature=Quick Access Node Tools _UI_EdgePalette_edgeReconnectionTools_feature=Edge Reconnection Tools _UI_EdgePalette_toolSections_feature=Tool Sections _UI_Tool_name_feature=Name diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPackage.java b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPackage.java index e60a8294cd..06cd8d68ca 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPackage.java +++ b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPackage.java @@ -101,6 +101,14 @@ public interface DiagramPackage extends EPackage { */ int DIAGRAM_DESCRIPTION__TITLE_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION__TITLE_EXPRESSION; + /** + * The feature id for the 'Icon Expression' attribute. + * + * @generated + * @ordered + */ + int DIAGRAM_DESCRIPTION__ICON_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION__ICON_EXPRESSION; + /** * The feature id for the 'Auto Layout' attribute. * @@ -2318,6 +2326,15 @@ public interface DiagramPackage extends EPackage { */ int DIAGRAM_PALETTE__NODE_TOOLS = 2; + /** + * The feature id for the 'Quick Access Tools' containment reference list. + * + * + * @generated + * @ordered + */ + int DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS = 3; + /** * The feature id for the 'Tool Sections' containment reference list. @@ -2325,7 +2342,7 @@ public interface DiagramPackage extends EPackage { * @generated * @ordered */ - int DIAGRAM_PALETTE__TOOL_SECTIONS = 3; + int DIAGRAM_PALETTE__TOOL_SECTIONS = 4; /** * The number of structural features of the 'Palette' class. @@ -2333,7 +2350,7 @@ public interface DiagramPackage extends EPackage { * @generated * @ordered */ - int DIAGRAM_PALETTE_FEATURE_COUNT = 4; + int DIAGRAM_PALETTE_FEATURE_COUNT = 5; /** * The number of operations of the 'Palette' class. @@ -2389,6 +2406,15 @@ public interface DiagramPackage extends EPackage { */ int NODE_PALETTE__NODE_TOOLS = 3; + /** + * The feature id for the 'Quick Access Tools' containment reference list. + * + * + * @generated + * @ordered + */ + int NODE_PALETTE__QUICK_ACCESS_TOOLS = 4; + /** * The feature id for the 'Edge Tools' containment reference list. @@ -2396,7 +2422,7 @@ public interface DiagramPackage extends EPackage { * @generated * @ordered */ - int NODE_PALETTE__EDGE_TOOLS = 4; + int NODE_PALETTE__EDGE_TOOLS = 5; /** * The feature id for the 'Tool Sections' containment reference list. @@ -2479,6 +2505,15 @@ public interface DiagramPackage extends EPackage { */ int EDGE_PALETTE__NODE_TOOLS = 4; + /** + * The feature id for the 'Quick Access Tools' containment reference list. + * + * + * @generated + * @ordered + */ + int EDGE_PALETTE__QUICK_ACCESS_TOOLS = 5; + /** * The feature id for the 'Edge Reconnection Tools' containment reference list. @@ -2486,7 +2521,7 @@ public interface DiagramPackage extends EPackage { * @generated * @ordered */ - int EDGE_PALETTE__EDGE_RECONNECTION_TOOLS = 5; + int EDGE_PALETTE__EDGE_RECONNECTION_TOOLS = 6; /** * The feature id for the 'Tool Sections' containment reference list. @@ -4923,6 +4958,18 @@ public interface DiagramPackage extends EPackage { */ EReference getDiagramPalette_NodeTools(); + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getQuickAccessTools Quick Access + * Tools}'. + * + * @return the meta object for the containment reference list 'Quick Access Tools'. + * @see org.eclipse.sirius.components.view.diagram.DiagramPalette#getQuickAccessTools() + * @see #getDiagramPalette() + * @generated + */ + EReference getDiagramPalette_QuickAccessTools(); + /** * Returns the meta object for the containment reference list * '{@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getToolSections Tool Sections}'. + * + * @return the meta object for the containment reference list 'Quick Access Tools'. + * @see org.eclipse.sirius.components.view.diagram.NodePalette#getQuickAccessTools() + * @see #getNodePalette() + * @generated + */ + EReference getNodePalette_QuickAccessTools(); + /** * Returns the meta object for the containment reference list * '{@link org.eclipse.sirius.components.view.diagram.NodePalette#getEdgeTools Edge Tools}'. + * + * @return the meta object for the containment reference list 'Quick Access Tools'. + * @see org.eclipse.sirius.components.view.diagram.EdgePalette#getQuickAccessTools() + * @see #getEdgePalette() + * @generated + */ + EReference getEdgePalette_QuickAccessTools(); + /** * Returns the meta object for the containment reference list * '{@link org.eclipse.sirius.components.view.diagram.EdgePalette#getEdgeReconnectionTools Edge Reconnection @@ -6712,6 +6783,14 @@ interface Literals { */ EReference DIAGRAM_PALETTE__NODE_TOOLS = eINSTANCE.getDiagramPalette_NodeTools(); + /** + * The meta object literal for the 'Quick Access Tools' containment reference list feature. + * + * @generated + */ + EReference DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS = eINSTANCE.getDiagramPalette_QuickAccessTools(); + /** * The meta object literal for the 'Tool Sections' containment reference list feature. @@ -6762,6 +6841,14 @@ interface Literals { */ EReference NODE_PALETTE__NODE_TOOLS = eINSTANCE.getNodePalette_NodeTools(); + /** + * The meta object literal for the 'Quick Access Tools' containment reference list feature. + * + * @generated + */ + EReference NODE_PALETTE__QUICK_ACCESS_TOOLS = eINSTANCE.getNodePalette_QuickAccessTools(); + /** * The meta object literal for the 'Edge Tools' containment reference list feature. @@ -6828,6 +6915,14 @@ interface Literals { */ EReference EDGE_PALETTE__NODE_TOOLS = eINSTANCE.getEdgePalette_NodeTools(); + /** + * The meta object literal for the 'Quick Access Tools' containment reference list feature. + * + * @generated + */ + EReference EDGE_PALETTE__QUICK_ACCESS_TOOLS = eINSTANCE.getEdgePalette_QuickAccessTools(); + /** * The meta object literal for the 'Edge Reconnection Tools' containment reference list feature. * diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPalette.java b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPalette.java index 056b7378f1..9dd8da0bf6 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPalette.java +++ b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/DiagramPalette.java @@ -25,6 +25,8 @@ *
  • {@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getDropTool Drop Tool}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getDropNodeTool Drop Node Tool}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getNodeTools Node Tools}
  • + *
  • {@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getQuickAccessTools Quick Access + * Tools}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.DiagramPalette#getToolSections Tool Sections}
  • * * @@ -90,6 +92,18 @@ public interface DiagramPalette extends EObject { */ EList getNodeTools(); + /** + * Returns the value of the 'Quick Access Tools' containment reference list. The list contents are + * of type {@link org.eclipse.sirius.components.view.diagram.NodeTool}. + * + * @return the value of the 'Quick Access Tools' containment reference list. + * @see org.eclipse.sirius.components.view.diagram.DiagramPackage#getDiagramPalette_QuickAccessTools() + * @model containment="true" keys="name" + * @generated + */ + EList getQuickAccessTools(); + /** * Returns the value of the 'Tool Sections' containment reference list. The list contents are of * type {@link org.eclipse.sirius.components.view.diagram.DiagramToolSection}. + * + * @return the value of the 'Quick Access Tools' containment reference list. + * @see org.eclipse.sirius.components.view.diagram.DiagramPackage#getEdgePalette_QuickAccessTools() + * @model containment="true" keys="name" + * @generated + */ + EList getQuickAccessTools(); + /** * Returns the value of the 'Edge Reconnection Tools' containment reference list. The list contents * are of type {@link org.eclipse.sirius.components.view.diagram.EdgeReconnectionTool}. + * + * @return the value of the 'Quick Access Tools' containment reference list. + * @see org.eclipse.sirius.components.view.diagram.DiagramPackage#getNodePalette_QuickAccessTools() + * @model containment="true" keys="name" + * @generated + */ + EList getQuickAccessTools(); + /** * Returns the value of the 'Edge Tools' containment reference list. The list contents are of type * {@link org.eclipse.sirius.components.view.diagram.EdgeTool}. diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPackageImpl.java b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPackageImpl.java index e8a15d1aed..865ad9b421 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPackageImpl.java +++ b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPackageImpl.java @@ -1647,10 +1647,20 @@ public EReference getDiagramPalette_NodeTools() { * @generated */ @Override - public EReference getDiagramPalette_ToolSections() { + public EReference getDiagramPalette_QuickAccessTools() { return (EReference) this.diagramPaletteEClass.getEStructuralFeatures().get(3); } + /** + * + * + * @generated + */ + @Override + public EReference getDiagramPalette_ToolSections() { + return (EReference) this.diagramPaletteEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -1707,7 +1717,7 @@ public EReference getNodePalette_NodeTools() { * @generated */ @Override - public EReference getNodePalette_EdgeTools() { + public EReference getNodePalette_QuickAccessTools() { return (EReference) this.nodePaletteEClass.getEStructuralFeatures().get(4); } @@ -1717,10 +1727,20 @@ public EReference getNodePalette_EdgeTools() { * @generated */ @Override - public EReference getNodePalette_ToolSections() { + public EReference getNodePalette_EdgeTools() { return (EReference) this.nodePaletteEClass.getEStructuralFeatures().get(5); } + /** + * + * + * @generated + */ + @Override + public EReference getNodePalette_ToolSections() { + return (EReference) this.nodePaletteEClass.getEStructuralFeatures().get(6); + } + /** * * @@ -1787,7 +1807,7 @@ public EReference getEdgePalette_NodeTools() { * @generated */ @Override - public EReference getEdgePalette_EdgeReconnectionTools() { + public EReference getEdgePalette_QuickAccessTools() { return (EReference) this.edgePaletteEClass.getEStructuralFeatures().get(5); } @@ -1797,10 +1817,20 @@ public EReference getEdgePalette_EdgeReconnectionTools() { * @generated */ @Override - public EReference getEdgePalette_ToolSections() { + public EReference getEdgePalette_EdgeReconnectionTools() { return (EReference) this.edgePaletteEClass.getEStructuralFeatures().get(6); } + /** + * + * + * @generated + */ + @Override + public EReference getEdgePalette_ToolSections() { + return (EReference) this.edgePaletteEClass.getEStructuralFeatures().get(7); + } + /** * * @@ -2554,6 +2584,7 @@ public void createPackageContents() { this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__DROP_TOOL); this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__DROP_NODE_TOOL); this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__NODE_TOOLS); + this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS); this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__TOOL_SECTIONS); this.nodePaletteEClass = this.createEClass(NODE_PALETTE); @@ -2561,6 +2592,7 @@ public void createPackageContents() { this.createEReference(this.nodePaletteEClass, NODE_PALETTE__LABEL_EDIT_TOOL); this.createEReference(this.nodePaletteEClass, NODE_PALETTE__DROP_NODE_TOOL); this.createEReference(this.nodePaletteEClass, NODE_PALETTE__NODE_TOOLS); + this.createEReference(this.nodePaletteEClass, NODE_PALETTE__QUICK_ACCESS_TOOLS); this.createEReference(this.nodePaletteEClass, NODE_PALETTE__EDGE_TOOLS); this.createEReference(this.nodePaletteEClass, NODE_PALETTE__TOOL_SECTIONS); @@ -2570,6 +2602,7 @@ public void createPackageContents() { this.createEReference(this.edgePaletteEClass, EDGE_PALETTE__BEGIN_LABEL_EDIT_TOOL); this.createEReference(this.edgePaletteEClass, EDGE_PALETTE__END_LABEL_EDIT_TOOL); this.createEReference(this.edgePaletteEClass, EDGE_PALETTE__NODE_TOOLS); + this.createEReference(this.edgePaletteEClass, EDGE_PALETTE__QUICK_ACCESS_TOOLS); this.createEReference(this.edgePaletteEClass, EDGE_PALETTE__EDGE_RECONNECTION_TOOLS); this.createEReference(this.edgePaletteEClass, EDGE_PALETTE__TOOL_SECTIONS); @@ -2938,6 +2971,9 @@ public void initializePackageContents() { this.initEReference(this.getDiagramPalette_NodeTools(), this.getNodeTool(), null, "nodeTools", null, 0, -1, DiagramPalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getDiagramPalette_NodeTools().getEKeys().add(this.getTool_Name()); + this.initEReference(this.getDiagramPalette_QuickAccessTools(), this.getNodeTool(), null, "quickAccessTools", null, 0, -1, DiagramPalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.getDiagramPalette_QuickAccessTools().getEKeys().add(this.getTool_Name()); this.initEReference(this.getDiagramPalette_ToolSections(), this.getDiagramToolSection(), null, "toolSections", null, 0, -1, DiagramPalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getDiagramPalette_ToolSections().getEKeys().add(this.getToolSection_Name()); @@ -2952,6 +2988,9 @@ public void initializePackageContents() { this.initEReference(this.getNodePalette_NodeTools(), this.getNodeTool(), null, "nodeTools", null, 0, -1, NodePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getNodePalette_NodeTools().getEKeys().add(this.getTool_Name()); + this.initEReference(this.getNodePalette_QuickAccessTools(), this.getNodeTool(), null, "quickAccessTools", null, 0, -1, NodePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.getNodePalette_QuickAccessTools().getEKeys().add(this.getTool_Name()); this.initEReference(this.getNodePalette_EdgeTools(), this.getEdgeTool(), null, "edgeTools", null, 0, -1, NodePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getNodePalette_EdgeTools().getEKeys().add(this.getTool_Name()); @@ -2971,6 +3010,9 @@ public void initializePackageContents() { this.initEReference(this.getEdgePalette_NodeTools(), this.getNodeTool(), null, "nodeTools", null, 0, -1, EdgePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getEdgePalette_NodeTools().getEKeys().add(this.getTool_Name()); + this.initEReference(this.getEdgePalette_QuickAccessTools(), this.getNodeTool(), null, "quickAccessTools", null, 0, -1, EdgePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.getEdgePalette_QuickAccessTools().getEKeys().add(this.getTool_Name()); this.initEReference(this.getEdgePalette_EdgeReconnectionTools(), this.getEdgeReconnectionTool(), null, "edgeReconnectionTools", null, 0, -1, EdgePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getEdgePalette_EdgeReconnectionTools().getEKeys().add(this.getTool_Name()); diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPaletteImpl.java b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPaletteImpl.java index 3c651f8c92..3e66bfcd7f 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPaletteImpl.java +++ b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/DiagramPaletteImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Obeo. + * Copyright (c) 2023, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -40,6 +40,8 @@ *
  • {@link org.eclipse.sirius.components.view.diagram.impl.DiagramPaletteImpl#getDropNodeTool Drop Node * Tool}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.DiagramPaletteImpl#getNodeTools Node Tools}
  • + *
  • {@link org.eclipse.sirius.components.view.diagram.impl.DiagramPaletteImpl#getQuickAccessTools Quick Access + * Tools}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.DiagramPaletteImpl#getToolSections Tool * Sections}
  • * @@ -77,6 +79,16 @@ public class DiagramPaletteImpl extends MinimalEObjectImpl.Container implements */ protected EList nodeTools; + /** + * The cached value of the '{@link #getQuickAccessTools() Quick Access Tools}' containment reference list. + * + * + * @see #getQuickAccessTools() + * @generated + * @ordered + */ + protected EList quickAccessTools; + /** * The cached value of the '{@link #getToolSections() Tool Sections}' containment reference list. @@ -215,6 +227,19 @@ public EList getNodeTools() { return this.nodeTools; } + /** + * + * + * @generated + */ + @Override + public EList getQuickAccessTools() { + if (this.quickAccessTools == null) { + this.quickAccessTools = new EObjectContainmentEList<>(NodeTool.class, this, DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS); + } + return this.quickAccessTools; + } + /** * * @@ -242,6 +267,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return this.basicSetDropNodeTool(null, msgs); case DiagramPackage.DIAGRAM_PALETTE__NODE_TOOLS: return ((InternalEList) this.getNodeTools()).basicRemove(otherEnd, msgs); + case DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS: + return ((InternalEList) this.getQuickAccessTools()).basicRemove(otherEnd, msgs); case DiagramPackage.DIAGRAM_PALETTE__TOOL_SECTIONS: return ((InternalEList) this.getToolSections()).basicRemove(otherEnd, msgs); } @@ -262,6 +289,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getDropNodeTool(); case DiagramPackage.DIAGRAM_PALETTE__NODE_TOOLS: return this.getNodeTools(); + case DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS: + return this.getQuickAccessTools(); case DiagramPackage.DIAGRAM_PALETTE__TOOL_SECTIONS: return this.getToolSections(); } @@ -287,6 +316,10 @@ public void eSet(int featureID, Object newValue) { this.getNodeTools().clear(); this.getNodeTools().addAll((Collection) newValue); return; + case DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS: + this.getQuickAccessTools().clear(); + this.getQuickAccessTools().addAll((Collection) newValue); + return; case DiagramPackage.DIAGRAM_PALETTE__TOOL_SECTIONS: this.getToolSections().clear(); this.getToolSections().addAll((Collection) newValue); @@ -312,6 +345,9 @@ public void eUnset(int featureID) { case DiagramPackage.DIAGRAM_PALETTE__NODE_TOOLS: this.getNodeTools().clear(); return; + case DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS: + this.getQuickAccessTools().clear(); + return; case DiagramPackage.DIAGRAM_PALETTE__TOOL_SECTIONS: this.getToolSections().clear(); return; @@ -333,6 +369,8 @@ public boolean eIsSet(int featureID) { return this.dropNodeTool != null; case DiagramPackage.DIAGRAM_PALETTE__NODE_TOOLS: return this.nodeTools != null && !this.nodeTools.isEmpty(); + case DiagramPackage.DIAGRAM_PALETTE__QUICK_ACCESS_TOOLS: + return this.quickAccessTools != null && !this.quickAccessTools.isEmpty(); case DiagramPackage.DIAGRAM_PALETTE__TOOL_SECTIONS: return this.toolSections != null && !this.toolSections.isEmpty(); } diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/EdgePaletteImpl.java b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/EdgePaletteImpl.java index d42388bd8a..69e914882c 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/EdgePaletteImpl.java +++ b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/EdgePaletteImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Obeo. + * Copyright (c) 2023, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -45,6 +45,8 @@ *
  • {@link org.eclipse.sirius.components.view.diagram.impl.EdgePaletteImpl#getEndLabelEditTool End Label Edit * Tool}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.EdgePaletteImpl#getNodeTools Node Tools}
  • + *
  • {@link org.eclipse.sirius.components.view.diagram.impl.EdgePaletteImpl#getQuickAccessTools Quick Access + * Tools}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.EdgePaletteImpl#getEdgeReconnectionTools Edge * Reconnection Tools}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.EdgePaletteImpl#getToolSections Tool @@ -104,6 +106,16 @@ public class EdgePaletteImpl extends MinimalEObjectImpl.Container implements Edg */ protected EList nodeTools; + /** + * The cached value of the '{@link #getQuickAccessTools() Quick Access Tools}' containment reference list. + * + * + * @see #getQuickAccessTools() + * @generated + * @ordered + */ + protected EList quickAccessTools; + /** * The cached value of the '{@link #getEdgeReconnectionTools() Edge Reconnection Tools}' containment * reference list. @@ -348,6 +360,19 @@ public EList getNodeTools() { return this.nodeTools; } + /** + * + * + * @generated + */ + @Override + public EList getQuickAccessTools() { + if (this.quickAccessTools == null) { + this.quickAccessTools = new EObjectContainmentEList<>(NodeTool.class, this, DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS); + } + return this.quickAccessTools; + } + /** * * @@ -392,6 +417,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return this.basicSetEndLabelEditTool(null, msgs); case DiagramPackage.EDGE_PALETTE__NODE_TOOLS: return ((InternalEList) this.getNodeTools()).basicRemove(otherEnd, msgs); + case DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS: + return ((InternalEList) this.getQuickAccessTools()).basicRemove(otherEnd, msgs); case DiagramPackage.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS: return ((InternalEList) this.getEdgeReconnectionTools()).basicRemove(otherEnd, msgs); case DiagramPackage.EDGE_PALETTE__TOOL_SECTIONS: @@ -418,6 +445,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getEndLabelEditTool(); case DiagramPackage.EDGE_PALETTE__NODE_TOOLS: return this.getNodeTools(); + case DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS: + return this.getQuickAccessTools(); case DiagramPackage.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS: return this.getEdgeReconnectionTools(); case DiagramPackage.EDGE_PALETTE__TOOL_SECTIONS: @@ -451,6 +480,10 @@ public void eSet(int featureID, Object newValue) { this.getNodeTools().clear(); this.getNodeTools().addAll((Collection) newValue); return; + case DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS: + this.getQuickAccessTools().clear(); + this.getQuickAccessTools().addAll((Collection) newValue); + return; case DiagramPackage.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS: this.getEdgeReconnectionTools().clear(); this.getEdgeReconnectionTools().addAll((Collection) newValue); @@ -486,6 +519,9 @@ public void eUnset(int featureID) { case DiagramPackage.EDGE_PALETTE__NODE_TOOLS: this.getNodeTools().clear(); return; + case DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS: + this.getQuickAccessTools().clear(); + return; case DiagramPackage.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS: this.getEdgeReconnectionTools().clear(); return; @@ -514,6 +550,8 @@ public boolean eIsSet(int featureID) { return this.endLabelEditTool != null; case DiagramPackage.EDGE_PALETTE__NODE_TOOLS: return this.nodeTools != null && !this.nodeTools.isEmpty(); + case DiagramPackage.EDGE_PALETTE__QUICK_ACCESS_TOOLS: + return this.quickAccessTools != null && !this.quickAccessTools.isEmpty(); case DiagramPackage.EDGE_PALETTE__EDGE_RECONNECTION_TOOLS: return this.edgeReconnectionTools != null && !this.edgeReconnectionTools.isEmpty(); case DiagramPackage.EDGE_PALETTE__TOOL_SECTIONS: diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/NodePaletteImpl.java b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/NodePaletteImpl.java index 903d9b7662..e7c1bb4cb8 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/NodePaletteImpl.java +++ b/packages/view/backend/sirius-components-view-diagram/src/main/java/org/eclipse/sirius/components/view/diagram/impl/NodePaletteImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Obeo. + * Copyright (c) 2023, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -44,6 +44,8 @@ *
  • {@link org.eclipse.sirius.components.view.diagram.impl.NodePaletteImpl#getDropNodeTool Drop Node * Tool}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.NodePaletteImpl#getNodeTools Node Tools}
  • + *
  • {@link org.eclipse.sirius.components.view.diagram.impl.NodePaletteImpl#getQuickAccessTools Quick Access + * Tools}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.NodePaletteImpl#getEdgeTools Edge Tools}
  • *
  • {@link org.eclipse.sirius.components.view.diagram.impl.NodePaletteImpl#getToolSections Tool * Sections}
  • @@ -92,6 +94,16 @@ public class NodePaletteImpl extends MinimalEObjectImpl.Container implements Nod */ protected EList nodeTools; + /** + * The cached value of the '{@link #getQuickAccessTools() Quick Access Tools}' containment reference list. + * + * + * @see #getQuickAccessTools() + * @generated + * @ordered + */ + protected EList quickAccessTools; + /** * The cached value of the '{@link #getEdgeTools() Edge Tools}' containment reference list. @@ -288,6 +300,19 @@ public EList getNodeTools() { return this.nodeTools; } + /** + * + * + * @generated + */ + @Override + public EList getQuickAccessTools() { + if (this.quickAccessTools == null) { + this.quickAccessTools = new EObjectContainmentEList<>(NodeTool.class, this, DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS); + } + return this.quickAccessTools; + } + /** * * @@ -330,6 +355,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return this.basicSetDropNodeTool(null, msgs); case DiagramPackage.NODE_PALETTE__NODE_TOOLS: return ((InternalEList) this.getNodeTools()).basicRemove(otherEnd, msgs); + case DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS: + return ((InternalEList) this.getQuickAccessTools()).basicRemove(otherEnd, msgs); case DiagramPackage.NODE_PALETTE__EDGE_TOOLS: return ((InternalEList) this.getEdgeTools()).basicRemove(otherEnd, msgs); case DiagramPackage.NODE_PALETTE__TOOL_SECTIONS: @@ -354,6 +381,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getDropNodeTool(); case DiagramPackage.NODE_PALETTE__NODE_TOOLS: return this.getNodeTools(); + case DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS: + return this.getQuickAccessTools(); case DiagramPackage.NODE_PALETTE__EDGE_TOOLS: return this.getEdgeTools(); case DiagramPackage.NODE_PALETTE__TOOL_SECTIONS: @@ -384,6 +413,10 @@ public void eSet(int featureID, Object newValue) { this.getNodeTools().clear(); this.getNodeTools().addAll((Collection) newValue); return; + case DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS: + this.getQuickAccessTools().clear(); + this.getQuickAccessTools().addAll((Collection) newValue); + return; case DiagramPackage.NODE_PALETTE__EDGE_TOOLS: this.getEdgeTools().clear(); this.getEdgeTools().addAll((Collection) newValue); @@ -416,6 +449,9 @@ public void eUnset(int featureID) { case DiagramPackage.NODE_PALETTE__NODE_TOOLS: this.getNodeTools().clear(); return; + case DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS: + this.getQuickAccessTools().clear(); + return; case DiagramPackage.NODE_PALETTE__EDGE_TOOLS: this.getEdgeTools().clear(); return; @@ -442,6 +478,8 @@ public boolean eIsSet(int featureID) { return this.dropNodeTool != null; case DiagramPackage.NODE_PALETTE__NODE_TOOLS: return this.nodeTools != null && !this.nodeTools.isEmpty(); + case DiagramPackage.NODE_PALETTE__QUICK_ACCESS_TOOLS: + return this.quickAccessTools != null && !this.quickAccessTools.isEmpty(); case DiagramPackage.NODE_PALETTE__EDGE_TOOLS: return this.edgeTools != null && !this.edgeTools.isEmpty(); case DiagramPackage.NODE_PALETTE__TOOL_SECTIONS: diff --git a/packages/view/backend/sirius-components-view-diagram/src/main/resources/model/diagram.ecore b/packages/view/backend/sirius-components-view-diagram/src/main/resources/model/diagram.ecore index 185823150a..cd5f0e68da 100644 --- a/packages/view/backend/sirius-components-view-diagram/src/main/resources/model/diagram.ecore +++ b/packages/view/backend/sirius-components-view-diagram/src/main/resources/model/diagram.ecore @@ -280,6 +280,8 @@ containment="true"/> + @@ -292,6 +294,8 @@ containment="true"/> + + + @@ -225,6 +226,7 @@ + @@ -234,6 +236,7 @@ + diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolConverter.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolConverter.java index 4c388dacb2..bbd098d034 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolConverter.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolConverter.java @@ -96,13 +96,19 @@ public List createPaletteBasedToolSections(org.eclipse.sirius.component // Palette for the diagram itself String diagramPaletteId = "siriusComponents://diagramPalette?diagramId=" + this.objectService.getId(viewDiagramDescription); + var diagramNodeTools = new ArrayList(); + toolFinder.findNodeTools(viewDiagramDescription).stream() + .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, true)) + .forEach(diagramNodeTools::add); + toolFinder.findQuickAccessDiagramTools(viewDiagramDescription).stream() + .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, true)) + .forEach(diagramNodeTools::add); + var diagramPalette = Palette.newPalette(diagramPaletteId) .toolSections(toolFinder.findToolSections(viewDiagramDescription).stream() .map(toolSection -> this.createToolSection(toolSection, converterContext)) .toList()) - .tools(toolFinder.findNodeTools(viewDiagramDescription).stream() - .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, true)) - .toList()) + .tools(diagramNodeTools) .build(); allPalettes.add(diagramPalette); @@ -111,9 +117,15 @@ public List createPaletteBasedToolSections(org.eclipse.sirius.component for (var nodeDescription : converterContext.getConvertedNodes().keySet()) { String nodePaletteId = "siriusComponents://nodePalette?nodeId=" + this.objectService.getId(nodeDescription); var tools = new ArrayList(); - tools.addAll(toolFinder.findNodeTools(nodeDescription).stream() + var nodeTools = new ArrayList(); + toolFinder.findNodeTools(nodeDescription).stream() .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, false)) - .toList()); + .forEach(nodeTools::add); + toolFinder.findQuickAccessNodeTools(nodeDescription).stream() + .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, false)) + .forEach(nodeTools::add); + + tools.addAll(nodeTools); tools.addAll(toolFinder.findEdgeTools(nodeDescription).stream() .map(edgeTool -> this.createEdgeTool(edgeTool, nodeDescription, converterContext)) .toList()); @@ -131,10 +143,16 @@ public List createPaletteBasedToolSections(org.eclipse.sirius.component // One palette for each EdgeDescription for (var edgeDescription : converterContext.getConvertedEdges().keySet()) { String edgePaletteId = "siriusComponents://edgePalette?edgeId=" + this.objectService.getId(edgeDescription); + var edgeNodeTools = new ArrayList(); + toolFinder.findNodeTools(edgeDescription).stream() + .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, false)) + .forEach(edgeNodeTools::add); + toolFinder.findQuickAccessEdgeTools(edgeDescription).stream() + .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, false)) + .forEach(edgeNodeTools::add); + var edgePalette = Palette.newPalette(edgePaletteId) - .tools(toolFinder.findNodeTools(edgeDescription).stream() - .map(nodeTool -> this.createNodeTool(nodeTool, converterContext, false)) - .toList()) + .tools(edgeNodeTools) .toolSections(toolFinder.findToolSections(edgeDescription).stream() .map(edgeToolSection -> this.createToolSection(edgeToolSection, converterContext)) .toList()) diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolFinder.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolFinder.java index 04b976f819..2dbfc57755 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolFinder.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ToolFinder.java @@ -102,10 +102,34 @@ public List findNodeTools(DiagramElementDescription diagramElementDesc return result; } + public List findQuickAccessNodeTools(DiagramElementDescription diagramElementDescription) { + EList result = new BasicEList<>(); + if (diagramElementDescription instanceof NodeDescription nodeDescription) { + result = Optional.of(nodeDescription).map(NodeDescription::getPalette).map(NodePalette::getQuickAccessTools).orElse(new BasicEList<>()); + } else if (diagramElementDescription instanceof EdgeDescription edgeDescription) { + result = Optional.of(edgeDescription).map(EdgeDescription::getPalette).map(EdgePalette::getQuickAccessTools).orElse(new BasicEList<>()); + } + return result; + } + + public List findQuickAccessDiagramTools(DiagramDescription diagramDescription) { + return Optional.ofNullable(diagramDescription) + .map(DiagramDescription::getPalette) + .map(DiagramPalette::getQuickAccessTools) + .orElse(new BasicEList<>()); + } + public List findEdgeTools(NodeDescription nodeDescription) { return Optional.ofNullable(nodeDescription).map(NodeDescription::getPalette).map(NodePalette::getEdgeTools).orElse(new BasicEList<>()); } + public List findQuickAccessEdgeTools(EdgeDescription edgeDescription) { + return Optional.ofNullable(edgeDescription) + .map(EdgeDescription::getPalette) + .map(EdgePalette::getQuickAccessTools) + .orElse(new BasicEList<>()); + } + public List findToolSections(DiagramDescription diagramDescription) { return Optional.ofNullable(diagramDescription) .map(DiagramDescription::getPalette) diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ViewPaletteProvider.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ViewPaletteProvider.java index cc18f1ba80..afeb36171b 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ViewPaletteProvider.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/ViewPaletteProvider.java @@ -140,16 +140,22 @@ private Palette getDiagramPalette(DiagramDescription diagramDescription, org.ecl List paletteEntries = new ArrayList<>(); toolFinder.findNodeTools(viewDiagramDescription).stream() - .filter(tool -> this.checkPrecondition(tool, variableManager, interpreter)) - .map(tool -> this.createDiagramRootNodeTool(tool, variableManager, interpreter)) - .forEach(paletteEntries::add); + .filter(tool -> this.checkPrecondition(tool, variableManager, interpreter)) + .map(tool -> this.createDiagramRootNodeTool(tool, variableManager, interpreter)) + .forEach(paletteEntries::add); toolFinder.findToolSections(viewDiagramDescription).stream() - .map(toolSection -> this.createToolSection(toolSection, variableManager, interpreter)) - .forEach(paletteEntries::add); + .map(toolSection -> this.createToolSection(toolSection, variableManager, interpreter)) + .forEach(paletteEntries::add); + + List quickAccessTools = new ArrayList<>(); + toolFinder.findQuickAccessDiagramTools(viewDiagramDescription).stream() + .filter(tool -> this.checkPrecondition(tool, variableManager, interpreter)) + .map(tool -> this.createNodeTool(tool, variableManager, interpreter)) + .forEach(quickAccessTools::add); diagramPalette = Palette.newPalette(diagramPaletteId) - .quickAccessTools(List.of()) + .quickAccessTools(quickAccessTools) .paletteEntries(paletteEntries) .build(); } @@ -195,7 +201,6 @@ private ITool createNodeTool(NodeTool viewNodeTool, boolean appliesToDiagramRoot } private Palette getNodePalette(IEditingContext editingContext, DiagramDescription diagramDescription, Object diagramElement, NodeDescription nodeDescription, VariableManager variableManager, AQLInterpreter interpreter) { - Optional sourceElementId = this.getSourceElementId(nodeDescription.getId()); Palette nodePalette = null; var toolFinder = new ToolFinder(); @@ -206,11 +211,18 @@ private Palette getNodePalette(IEditingContext editingContext, DiagramDescriptio List extraToolSections = new ArrayList<>(); paletteToolsProviders.stream().map(paletteToolsProvider -> paletteToolsProvider.createExtraToolSections(nodeDescription, diagramElement)).flatMap(List::stream) .forEach(extraToolSections::add); + List quickAccessTools = new ArrayList<>(); paletteToolsProviders.stream().map(paletteToolsProvider -> paletteToolsProvider.createQuickAccessTools(nodeDescription, diagramElement)).flatMap(List::stream) .forEach(quickAccessTools::add); + org.eclipse.sirius.components.view.diagram.NodeDescription viewNodeDescription = optionalNodeDescription.get(); + toolFinder.findQuickAccessNodeTools(viewNodeDescription).stream() + .filter(tool -> this.checkPrecondition(tool, variableManager, interpreter)) + .map(tool -> this.createNodeTool(tool, variableManager, interpreter)) + .forEach(quickAccessTools::add); + var paletteEntries = new ArrayList(); toolFinder.findNodeTools(viewNodeDescription).stream() .filter(tool -> this.checkPrecondition(tool, variableManager, interpreter)) @@ -229,7 +241,8 @@ private Palette getNodePalette(IEditingContext editingContext, DiagramDescriptio paletteEntries.addAll(extraToolSections); String nodePaletteId = "siriusComponents://nodePalette?nodeId=" + sourceElementId.get(); - nodePalette = Palette.newPalette(nodePaletteId).quickAccessTools(quickAccessTools) + nodePalette = Palette.newPalette(nodePaletteId) + .quickAccessTools(quickAccessTools) .paletteEntries(paletteEntries) .build(); } @@ -295,6 +308,12 @@ private Palette getEdgePalette(IEditingContext editingContext, EdgeDescription e if (optionalEdgeDescription.isPresent()) { org.eclipse.sirius.components.view.diagram.EdgeDescription viewEdgeDescription = optionalEdgeDescription.get(); + List quickAccessTools = new ArrayList<>(); + toolFinder.findQuickAccessNodeTools(viewEdgeDescription).stream() + .filter(tool -> this.checkPrecondition(tool, variableManager, interpreter)) + .map(tool -> this.createNodeTool(tool, variableManager, interpreter)) + .forEach(quickAccessTools::add); + List paletteEntries = new ArrayList<>(); toolFinder.findToolSections(viewEdgeDescription).stream() .map(edgeToolSection -> this.createToolSection(edgeToolSection, variableManager, interpreter)) @@ -309,7 +328,7 @@ private Palette getEdgePalette(IEditingContext editingContext, EdgeDescription e String edgePaletteId = "siriusComponents://edgePalette?edgeId=" + sourceElementId; edgePalette = Palette.newPalette(edgePaletteId) - .quickAccessTools(List.of()) + .quickAccessTools(quickAccessTools) .paletteEntries(paletteEntries) .build();