Skip to content

Commit

Permalink
[2044] Custom icons to edges and nodes label in view dsl
Browse files Browse the repository at this point in the history
Bug: #2044
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
  • Loading branch information
mcharfadi committed Aug 17, 2023
1 parent 964e832 commit 31bedef
Show file tree
Hide file tree
Showing 26 changed files with 1,270 additions and 139 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Expand Up @@ -23,6 +23,8 @@ Without the dependency to notistack in `sirius-components-core`, it will be easi

=== New Features

- https://github.com/eclipse-sirius/sirius-components/issues/2044[#2044] [view] Add custom icons to edges and nodes label in view dsl


=== Improvements

Expand Down
Expand Up @@ -75,7 +75,6 @@ describe('/projects/:projectId/edit - Color Palette', () => {
cy.getByTestId('LinkedTo Edge-toggle').click();
cy.get('[title="diagram::EdgeStyle"]').click();
cy.getByTestId('Color').click();
cy.contains('FixedColor color_blue').click();
cy.contains('color_blue').click();
});
});

Expand Up @@ -64,6 +64,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
this.addTargetArrowStylePropertyDescriptor(object);
this.addEdgeWidthPropertyDescriptor(object);
this.addShowIconPropertyDescriptor(object);
this.addLabelIconPropertyDescriptor(object);
}
return this.itemPropertyDescriptors;
}
Expand Down Expand Up @@ -189,6 +190,17 @@ protected void addShowIconPropertyDescriptor(Object object) {
DiagramPackage.Literals.EDGE_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Label Icon feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addLabelIconPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_EdgeStyle_labelIcon_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_EdgeStyle_labelIcon_feature", "_UI_EdgeStyle_type"),
DiagramPackage.Literals.EDGE_STYLE__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This returns ConditionalEdgeStyle.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -243,6 +255,7 @@ public void notifyChanged(Notification notification) {
case DiagramPackage.CONDITIONAL_EDGE_STYLE__TARGET_ARROW_STYLE:
case DiagramPackage.CONDITIONAL_EDGE_STYLE__EDGE_WIDTH:
case DiagramPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON:
case DiagramPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
Expand Down
Expand Up @@ -61,6 +61,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
this.addTargetArrowStylePropertyDescriptor(object);
this.addEdgeWidthPropertyDescriptor(object);
this.addShowIconPropertyDescriptor(object);
this.addLabelIconPropertyDescriptor(object);
}
return this.itemPropertyDescriptors;
}
Expand Down Expand Up @@ -175,6 +176,17 @@ protected void addShowIconPropertyDescriptor(Object object) {
DiagramPackage.Literals.EDGE_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Label Icon feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addLabelIconPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_EdgeStyle_labelIcon_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_EdgeStyle_labelIcon_feature", "_UI_EdgeStyle_type"),
DiagramPackage.Literals.EDGE_STYLE__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This returns EdgeStyle.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -228,6 +240,7 @@ public void notifyChanged(Notification notification) {
case DiagramPackage.EDGE_STYLE__TARGET_ARROW_STYLE:
case DiagramPackage.EDGE_STYLE__EDGE_WIDTH:
case DiagramPackage.EDGE_STYLE__SHOW_ICON:
case DiagramPackage.EDGE_STYLE__LABEL_ICON:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
Expand Down
Expand Up @@ -65,6 +65,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
this.addWidthComputationExpressionPropertyDescriptor(object);
this.addHeightComputationExpressionPropertyDescriptor(object);
this.addShowIconPropertyDescriptor(object);
this.addLabelIconPropertyDescriptor(object);
}
return this.itemPropertyDescriptors;
}
Expand Down Expand Up @@ -218,6 +219,18 @@ protected void addShowIconPropertyDescriptor(Object object) {
DiagramPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Label Icon feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addLabelIconPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_NodeStyleDescription_labelIcon_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_NodeStyleDescription_labelIcon_feature", "_UI_NodeStyleDescription_type"),
DiagramPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This returns IconLabelNodeStyleDescription.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -274,6 +287,7 @@ public void notifyChanged(Notification notification) {
case DiagramPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION:
case DiagramPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION:
case DiagramPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON:
case DiagramPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
Expand Down
Expand Up @@ -64,6 +64,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
this.addWidthComputationExpressionPropertyDescriptor(object);
this.addHeightComputationExpressionPropertyDescriptor(object);
this.addShowIconPropertyDescriptor(object);
this.addLabelIconPropertyDescriptor(object);
this.addShapePropertyDescriptor(object);
}
return this.itemPropertyDescriptors;
Expand Down Expand Up @@ -218,6 +219,18 @@ protected void addShowIconPropertyDescriptor(Object object) {
DiagramPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Label Icon feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addLabelIconPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_NodeStyleDescription_labelIcon_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_NodeStyleDescription_labelIcon_feature", "_UI_NodeStyleDescription_type"),
DiagramPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Shape feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -286,6 +299,7 @@ public void notifyChanged(Notification notification) {
case DiagramPackage.IMAGE_NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION:
case DiagramPackage.IMAGE_NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION:
case DiagramPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON:
case DiagramPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON:
case DiagramPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHAPE:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
Expand Down
Expand Up @@ -65,6 +65,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
this.addWidthComputationExpressionPropertyDescriptor(object);
this.addHeightComputationExpressionPropertyDescriptor(object);
this.addShowIconPropertyDescriptor(object);
this.addLabelIconPropertyDescriptor(object);
this.addWithHeaderPropertyDescriptor(object);
}
return this.itemPropertyDescriptors;
Expand Down Expand Up @@ -219,6 +220,18 @@ protected void addShowIconPropertyDescriptor(Object object) {
DiagramPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Label Icon feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addLabelIconPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_NodeStyleDescription_labelIcon_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_NodeStyleDescription_labelIcon_feature", "_UI_NodeStyleDescription_type"),
DiagramPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the With Header feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -287,6 +300,7 @@ public void notifyChanged(Notification notification) {
case DiagramPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION:
case DiagramPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION:
case DiagramPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON:
case DiagramPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON:
case DiagramPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
Expand Down
Expand Up @@ -880,14 +880,22 @@ public interface DiagramPackage extends EPackage {
*/
int NODE_STYLE_DESCRIPTION__SHOW_ICON = STYLE_FEATURE_COUNT + 12;

/**
* The feature id for the '<em><b>Label Icon</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int NODE_STYLE_DESCRIPTION__LABEL_ICON = STYLE_FEATURE_COUNT + 13;

/**
* The number of structural features of the '<em>Node Style Description</em>' class. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
* @ordered
*/
int NODE_STYLE_DESCRIPTION_FEATURE_COUNT = STYLE_FEATURE_COUNT + 13;
int NODE_STYLE_DESCRIPTION_FEATURE_COUNT = STYLE_FEATURE_COUNT + 14;

/**
* The number of operations of the '<em>Node Style Description</em>' class. <!-- begin-user-doc --> <!--
Expand Down Expand Up @@ -1069,6 +1077,14 @@ public interface DiagramPackage extends EPackage {
*/
int RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON = NODE_STYLE_DESCRIPTION__SHOW_ICON;

/**
* The feature id for the '<em><b>Label Icon</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON = NODE_STYLE_DESCRIPTION__LABEL_ICON;

/**
* The feature id for the '<em><b>With Header</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -1220,6 +1236,14 @@ public interface DiagramPackage extends EPackage {
*/
int IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON = NODE_STYLE_DESCRIPTION__SHOW_ICON;

/**
* The feature id for the '<em><b>Label Icon</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON = NODE_STYLE_DESCRIPTION__LABEL_ICON;

/**
* The feature id for the '<em><b>Shape</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -1372,6 +1396,14 @@ public interface DiagramPackage extends EPackage {
*/
int ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON = NODE_STYLE_DESCRIPTION__SHOW_ICON;

/**
* The feature id for the '<em><b>Label Icon</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON = NODE_STYLE_DESCRIPTION__LABEL_ICON;

/**
* The number of structural features of the '<em>Icon Label Node Style Description</em>' class. <!-- begin-user-doc
* --> <!-- end-user-doc -->
Expand Down Expand Up @@ -1490,14 +1522,22 @@ public interface DiagramPackage extends EPackage {
*/
int EDGE_STYLE__SHOW_ICON = STYLE_FEATURE_COUNT + 9;

/**
* The feature id for the '<em><b>Label Icon</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int EDGE_STYLE__LABEL_ICON = STYLE_FEATURE_COUNT + 10;

/**
* The number of structural features of the '<em>Edge Style</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @generated
* @ordered
*/
int EDGE_STYLE_FEATURE_COUNT = STYLE_FEATURE_COUNT + 10;
int EDGE_STYLE_FEATURE_COUNT = STYLE_FEATURE_COUNT + 11;

/**
* The number of operations of the '<em>Edge Style</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
Expand Down Expand Up @@ -1615,14 +1655,22 @@ public interface DiagramPackage extends EPackage {
*/
int CONDITIONAL_EDGE_STYLE__SHOW_ICON = ViewPackage.CONDITIONAL_FEATURE_COUNT + 10;

/**
* The feature id for the '<em><b>Label Icon</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int CONDITIONAL_EDGE_STYLE__LABEL_ICON = ViewPackage.CONDITIONAL_FEATURE_COUNT + 11;

/**
* The number of structural features of the '<em>Conditional Edge Style</em>' class. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
* @ordered
*/
int CONDITIONAL_EDGE_STYLE_FEATURE_COUNT = ViewPackage.CONDITIONAL_FEATURE_COUNT + 11;
int CONDITIONAL_EDGE_STYLE_FEATURE_COUNT = ViewPackage.CONDITIONAL_FEATURE_COUNT + 12;

/**
* The number of operations of the '<em>Conditional Edge Style</em>' class. <!-- begin-user-doc --> <!--
Expand Down Expand Up @@ -3037,6 +3085,18 @@ public interface DiagramPackage extends EPackage {
*/
EAttribute getNodeStyleDescription_ShowIcon();

/**
* Returns the meta object for the attribute
* '{@link org.eclipse.sirius.components.view.diagram.NodeStyleDescription#getLabelIcon <em>Label Icon</em>}'. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Label Icon</em>'.
* @see org.eclipse.sirius.components.view.diagram.NodeStyleDescription#getLabelIcon()
* @see #getNodeStyleDescription()
* @generated
*/
EAttribute getNodeStyleDescription_LabelIcon();

/**
* Returns the meta object for class '{@link org.eclipse.sirius.components.view.diagram.ConditionalNodeStyle
* <em>Conditional Node Style</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
Expand Down Expand Up @@ -3184,6 +3244,18 @@ public interface DiagramPackage extends EPackage {
*/
EAttribute getEdgeStyle_ShowIcon();

/**
* Returns the meta object for the attribute
* '{@link org.eclipse.sirius.components.view.diagram.EdgeStyle#getLabelIcon <em>Label Icon</em>}'. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Label Icon</em>'.
* @see org.eclipse.sirius.components.view.diagram.EdgeStyle#getLabelIcon()
* @see #getEdgeStyle()
* @generated
*/
EAttribute getEdgeStyle_LabelIcon();

/**
* Returns the meta object for class '{@link org.eclipse.sirius.components.view.diagram.ConditionalEdgeStyle
* <em>Conditional Edge Style</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
Expand Down Expand Up @@ -4133,6 +4205,14 @@ interface Literals {
*/
EAttribute NODE_STYLE_DESCRIPTION__SHOW_ICON = eINSTANCE.getNodeStyleDescription_ShowIcon();

/**
* The meta object literal for the '<em><b>Label Icon</b></em>' attribute feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
*/
EAttribute NODE_STYLE_DESCRIPTION__LABEL_ICON = eINSTANCE.getNodeStyleDescription_LabelIcon();

/**
* The meta object literal for the
* '{@link org.eclipse.sirius.components.view.diagram.impl.ConditionalNodeStyleImpl <em>Conditional Node
Expand Down Expand Up @@ -4251,6 +4331,14 @@ interface Literals {
*/
EAttribute EDGE_STYLE__SHOW_ICON = eINSTANCE.getEdgeStyle_ShowIcon();

/**
* The meta object literal for the '<em><b>Label Icon</b></em>' attribute feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
*/
EAttribute EDGE_STYLE__LABEL_ICON = eINSTANCE.getEdgeStyle_LabelIcon();

/**
* The meta object literal for the
* '{@link org.eclipse.sirius.components.view.diagram.impl.ConditionalEdgeStyleImpl <em>Conditional Edge
Expand Down

0 comments on commit 31bedef

Please sign in to comment.