Extension Guide : Add New UCM Element

Overview

  • The purpose of this guide is to give pointers on what tasks need to be accomplished when a new model element is to be added.
  • For simplification purposes, lets consider adding a new PathNode subclass.
  • This guide should be verified by the person actually following the guide.

Initial Steps

  • Read JUCMNavDevDoc articles if you have the time smile
  • You'll need to add your model element to the palette so that it can be added.
    • Create an icon; maybe we've already created it for you; check the icons folder (See DevDocIcons)
    • Make sure ModelCreationFactory can generate instances of your new object (See DevDocModelCreationFactory)
    • Add entry in UcmPaletteRoot.buildPalette() (See DevDocPalette)
  • Create a figure for your new model element (See DevDocFigures)
  • Create an editpart for your new element (See DevDocEditPartCreation)
    • Register your figure in PathNodeEditPart.createFigure()
    • If you have lots of new behaviour, extend PathNodeEditPart and Register yourself in GraphicalEditPartFactory
    • Do same for outline (See DevDocOutline):
      • Simply add icon image in PathNodeTreeEditPart
      • Hopefully won't need to access TreeEditPartFactory

Optional Steps

  • You'll probably have some special "do something or other" that you'll want to add to the contextual menu.
  • Create a command that does your work (See DevDocCommands). Look at many command examples before attempting this; it is critical.
  • Create an action that maps a user selection to your command. (See DevDocActions)
    • Don't forget to register your action in the action registry and context menu provider.

Testing

  • Any command you created implements JUCMNavCommand and must therefore implement testPreConditions()/testPostConditions(). (See DevDocCommands)
  • Create a simple test case in JUCMNavCommandTests; simply add a method and a few lines that execute your command. Find other examples.
  • You might want to create tests for your action (elsewhere) as well, if it is complicated.
  • See DevDocCheckoutCode for running the tests.

-- JasonKealey - 14 Jul 2005
Topic revision: r1 - 13 Jul 2005, JasonKealey
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback