Hello,

I'm using Topcased 3.2.0 in a graphical editor generated from a metamodel. With this editor, I'm able to create a diagram from an EMF model, with a graphical wizard. I'd like to create this diagram programmatically from the EMF model, in the sources of the editor.

I tried to use the code from the wizard, stored in a class that herits from the org.eclipse.jface.wizard.Wizard class : in this class, there is a performFinish() method that executes a code when the user clicks on the 'Finish' button of the graphical wizard. In this method, an other method called createDiagramFromExistingModel() is called. It uses classes from Topcased, org.modeler.topcased.tools.DiagramFileInitializer and org.topcased.modeler.wizards.DiagramsPage. Here is the code of this method :

private boolean createDiagramFromExistingModel()
   {
       WorkspaceModifyOperation op = new WorkspaceModifyOperation()
       {
           /**
* @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
            */
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException,
                   InterruptedException
           {
DiagramFileInitializer initializer = new DiagramFileInitializer();
               try
{ initializer.createDiagram(diagPage.getRootEObject(), diagPage.getDiagramId(), diagPage.isInitialized(), monitor);
               }
               catch (IOException ioe)
               {
                   throw new InvocationTargetException(ioe);
               }
           }
       };

       try
       {
           getContainer().run(false, true, op);
           return true;
       }
       catch (InvocationTargetException ite)
       {
           SmePlugin.log(ite);
       }
       catch (InterruptedException ie)
       {
           // Wizard stopped
       }
       return false;
   }

This method calls a Topcased method called createDiagram : it seems to be the method that really creates the diagram from the model. I've tried to use a part of the code of the method, and to create a redefinition of this method (to use the root object of my emf model instead of diagPage.getRootEObject()) but the diagram isn't created. How can I create this diagram from the model?

Regards,

François.


_______________________________________________
Topcased-users mailing list
[email protected]
http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users

Reply via email to