Skip to content

Commit

Permalink
[4326] Add quickAccessTools to diagram's palette in view dsl
Browse files Browse the repository at this point in the history
Bug: #4326
Signed-off-by: Michaël Charfadi <[email protected]>
  • Loading branch information
mcharfadi committed Dec 30, 2024
1 parent 4b778e9 commit f7e1abb
Show file tree
Hide file tree
Showing 21 changed files with 475 additions and 47 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -78,6 +78,7 @@ public Collection<? extends EStructuralFeature> 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;
Expand Down Expand Up @@ -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;
Expand All @@ -164,9 +166,22 @@ protected void collectNewChildDescriptors(Collection<Object> 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}. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @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. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -81,6 +81,7 @@ public Collection<? extends EStructuralFeature> 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);
}
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -175,6 +177,8 @@ protected void collectNewChildDescriptors(Collection<Object> 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()));
Expand All @@ -186,20 +190,11 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
* This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -80,6 +80,7 @@ public Collection<? extends EStructuralFeature> 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);
}
Expand Down Expand Up @@ -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));
Expand All @@ -168,11 +170,23 @@ protected void collectNewChildDescriptors(Collection<Object> 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}. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @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. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,21 @@ _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
_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
Expand Down
Loading

0 comments on commit f7e1abb

Please sign in to comment.