Creating DiagramStateAction into toolbar

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Creating DiagramStateAction into toolbar

Postby Petar Blagoev » Mon Sep 03, 2007 4:45 am

Hi,

I'd like to put all my new createt DefaultDiagramStateActions under two
submenus of DiagramToolbar-Item.
For example, like all Class-Elements are under the diagramToolbar-menu
'Class Diagram'/Class. I can manage
to create a DiagramInnerToolbarConfiguration and than to put all
DiagramStateActions into this configuration,
but they are not nested and I can't put them into two groups (submenus).
How can I achieve this? Here is a code
snippet:

public class MyDiagramToolbarConfigurator extends
BaseDiagramToolbarConfigurator {

public void configure(ActionsManager mngr){
DiagramInnerToolbarConfiguration toolbarCategory = new
DiagramInnerToolbarConfiguration("test", null, "test");
mngr.addCategory(toolbarCategory);
toolbarCategory.setNested(true);
DefaultDiagramStateAction a1 = new DefaultDiagramStateAction("ff",
"ff", null, null);
DefaultDiagramStateAction a2 = new DefaultDiagramStateAction("gg",
"gg", null, null);
toolbarCategory.addAction(a1);
toolbarCategory.addAction(a2); //wrong I'd like to put a2 in the
same place where a1 is, so
I can select one of them and the selected becomes on the top
(see "Class" under "Class Diagram")
}

}

Thanks a lot in advance!

Regards,
Petar


Petar Blagoev
 
Posts Rating:

Re: Creating DiagramStateAction into toolbar

Postby Martynas Lelevicius » Mon Sep 03, 2007 5:31 am

Hi,

You should use additional ActionsCategory - add your actions here, and add
the category to toolbar category:

public static class MyDiagramToolbarConfigurator extends
BaseDiagramToolbarConfigurator
{
public void configure(ActionsManager mngr)
{
DiagramInnerToolbarConfiguration toolbarCategory = new
DiagramInnerToolbarConfiguration("test", null, "test");
mngr.addCategory(toolbarCategory);
toolbarCategory.setNested(true);
ActionsCategory category = new ActionsCategory("", "");
category.setNested(true);
toolbarCategory.addAction(category);
DefaultDiagramStateAction a1 = new DefaultDiagramStateAction("ff",
"ff", null, null);
DefaultDiagramStateAction a2 = new DefaultDiagramStateAction("gg",
"gg", null, null);
category.addAction(a1);
category.addAction(a2); //wrong I'd like to put a2 in the
}
}

Regards,
--
Martynas Lelevicius
Senior Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
E-mail : marte
WWW: http://www.magicdraw.com

Martynas Lelevicius
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 1 guest