Problem with getDiagramToolbarConfigurator()

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Problem with getDiagramToolbarConfigurator()

Postby Petar Blagoev » Mon Jun 25, 2007 4:38 am

Hello,
I'm trying to add a custom Diagram Toolbar (see my previous posting)
like the following:
public class NavigationDiagram extends BaseUWEDiagram{
...
@Override
public AMConfigurator getDiagramToolbarConfigurator() {
return new ClassDiagramToolbarConfigurator(new
ClassDiagramToolbarAction(), NAVIGATION_DIAGRAM);
}
...

}
#############################
public class ClassDiagramToolbarConfigurator extends
BaseDiagramToolbarConfigurator{
private DefaultDiagramAction action;
private Logger logger = Logger.
getLogger(ClassDiagramToolbarConfigurator.class);
private String type;
public ClassDiagramToolbarConfigurator(DefaultDiagramAction action,
String type){
this.action = action;
this.type = type;
if(type !=null){
BaseToolbarActions.setType(type);
}
}


/**
* Configuring toolbar and shortcuts.
*/
public void configure(ActionsManager mngr){
logger.debug("mngr: " + mngr);
// MDActionsManager actions = BaseToolbarActions.ACTIONS;
action.addAction(BaseToolbarActions.ACTIONS.
getActionFor(DrawClassAction.DRAW_CLASS_ACTION));
DiagramInnerToolbarConfiguration category= new
DiagramInnerToolbarConfiguration("ELEMENTS", null, "Elements Diagram",
true);
BaseToolbarActions.ACTIONS.addActionNearTheGiven(ActionsID.
CLASS_DIAGRAM_ELEMENTS, false, new ClassDiagramToolbarAction());
category.addAction(action);
mngr.addCategory(category);

}
...
}
#############
actualy its a little modification of the "Simpleconfigurators"
example from OpenAPI. The problem is, that after successful opening
of the Diagram there is no such Diagram Toolbar item "Elements
Diagram". What I'm doing wrong? When is acctually the overriten
method getDiagramToolbarConfigurator() from BaseUWEDiagram called? I
thought at the creating of the Diagram all of the inherited methods
are executed, so this will add also my custom Item into the Diagram
Toolbar.

thanks in advance!
regards,
petar
--
Composed with Newz Crawler 1.8 http://www.newzcrawler.com/
Petar Blagoev
 
Posts Rating:

Re: Problem with getDiagramToolbarConfigurator()

Postby Martynas Lelevicius » Mon Jul 09, 2007 5:41 am

Hello,

Please check md.log in MD install dir for exceptions.
It is possible that the line:
action.addAction(BaseToolbarActions.ACTIONS.getActionFor(DrawClassAction.DRAW_CLASS_ACTION));throws UnsupportedOperationException.Regards,--Martynas LeleviciusProgrammerNo Magic Lithuanian Development CenterSavanoriu pr. 363, LT-49425, KaunasP.O. box 2166, LT-44011, KaunasPhone: +370 37 324032 Fax: +370 37 320670E-mail : marte: http://www.magicdraw.com

Martynas Lelevicius
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests