question-circle Enumerations Generalization

3 months 1 week ago #6552 by bit
Hi,
I need to apply a relationship of "Generalization" between two "Enumerations". I see that Modelio does not allow it, so I tried to create a custom "CreateGeneralization" tool in module.xml by applying an Enumeration as Scope-Source and Scope-Target.
<Tool id="CreateGeneralization" label="Generalization" tooltip="%CreateGeneralizationTooltip" image="res/icons/generalization.png">
                <Scope-source metaclass="Standard.Enumeration"/>
                <Scope-target metaclass="Standard.Enumeration"/>
                <Handler class="Link">
                    <HParameter name="metaclass" value="Standard.Generalization"/>
                </Handler>
            </Tool>

In this way the Enumeration when it is selected has the color red and I cannot select it as the first element.

I also tried to force it by creating my own ALGeneralizationLinkTool class and, while always returning true to the acceptFirstElement function, the class diagram does not allow me to create a Generalization relation.
<Tool id="CreateGeneralization" label="Generalization" tooltip="%CreateGeneralizationTooltip" image="res/icons/generalization.png">
                <Handler class="pikbit.aldesigner.command.ALGeneralizationLinkTool">
                    <HParameter name="metaclass" value="Standard.Generalization"/>
                </Handler>
            </Tool>
public class ALGeneralizationLinkTool extends GenericLinkTool {

    @Override
    protected void postConfigure(IDiagramHandle diagramHandle, IDiagramGraphic originNode, IDiagramGraphic targetNode, ModelElement source, ModelElement target, MObject newElement, IDiagramLink newLink, List<IDiagramGraphic> newGraphics, LinkRouterKind routerType, ILinkPath path) {
        super.postConfigure(diagramHandle, originNode, targetNode, source, target, newElement, newLink, newGraphics, routerType, path);
    }

	@Override
	public boolean acceptFirstElement(IDiagramHandle diagramHandle, IDiagramGraphic targetNode) {
		return true;
	}

	@Override
	public boolean acceptSecondElement(IDiagramHandle diagramHandle, IDiagramGraphic originNode,
			IDiagramGraphic targetNode) {
		return true;
	}

	@Override
	public void actionPerformed(IDiagramHandle diagramHandle, IDiagramGraphic originNode, IDiagramGraphic targetNode,
			LinkRouterKind routerType, ILinkPath path) {
		super.actionPerformed(diagramHandle, originNode, targetNode, routerType, path);
	}  

}

I would like to understand if I am doing something wrong or is it a Modelio block that I cannot get around.

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.030 seconds
^ Back to Top