Get grouped items

Hi,

I would like to know if it’s possible (with plugin api) to get all grouped items (grouped with right click->grouping->group) grouped with an item (IShapeUIModel).
I would like to know where i can get this kind of relation like for classical relationships (which are present in relationship tab of the specification).

I hope it’s clear…

Thanks a lot!

Sorry for late reply.
I am sorry that, it was not supported in OpenAPI.

But we just support it in latest patch. 2 new classes are supported in OpenAPI IShapeGroupable, and IShapeGroup

  • Any IDiagramElement is sub-class of IShapeGroupable, which can be grouped in a IShapeGroup.

  • IShapeGroup groups the IShapeGroupable(s). And IShapeGroup is also sub-class of IShapeGroupable, that can be grouped by another IShapeGroup.

  • IDiagramUIModel#group(IShapeGroupable[]) : IShapeGroup
    create a IShapeGroup to group the IShapeGroupable.

  • IShapeGroupable#getShapeGroup() : IShapeGroup
    returns the parent group

  • IShapeGroup#add(IShapeGroupable)
    append a groupable into this group

Simple sample:

IDiagramUIModel lDiagram = ApplicationManager.instance().getDiagramManager().getActiveDiagram();

// get the Use Case shape(s)
IDiagramElement[] lUseCases = lDiagram.toDiagramElementArray(IUseCaseDiagramUIModel.SHAPETYPE_USE_CASE);
// groups the Use Case(s)
IShapeGroup lUseCaseGroup = lDiagram.group(lUseCases);

// collect Actor shape(s) + UseCaseGroup
Collection<IShapeGroupable> lElements = new ArrayList<IShapeGroupable>();
IDiagramElement[] lActors = lDiagram.toDiagramElementArray(IUseCaseDiagramUIModel.SHAPETYPE_ACTOR);
for (IDiagramElement lActor : lActors) {
	lElements.add(lActor);
}
lElements.add(lUseCaseGroup);
// groups the Actors + UseCaseGroup
IShapeGroup lGroup = lDiagram.group(lElements.toArray(new IShapeGroupable[lElements.size()]));

On the above sample, finally, the shapes will be grouped in following hierarchy:

lGroup
   Actor 1
   Actor 2
   Actor 3 ...
   lUseCaseGroup
      UseCase 1
      UseCase 2 ...

Please update the software to latest patch build (20200230af or later) to get the problem fixed.
Details about update to latest patch can be found at