Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » easier way to display emf objects?
easier way to display emf objects? [message #88649] Sun, 31 December 2006 13:06
Eclipse UserFriend
Hi,

My application currently uses emf and I'd like to display some
of the objects graphically via gmf. At this point, I'm not
interested in saving modifications to the views and would like
to build the diagram from in memory objects (rather than from
a file). From reading suggestions on this newsgroup, I currently
can read in and display objects by creating my own
IStorageEditorInput and IDiagramDocumentProvider (to circumvent
having to use a file as input).

However, it's quite a hack (I'm sure I don't have them implemented
correctly) and I can't help wondering if there's a simpler way to
visualize my emf objects?

My code looks like:

// invoke the editor
MyStorageEditorInput input = new MyStorageEditorInput(domainObjectRoot);
readonlyEditor = page.openEditor( input, MyDiagramEditor.ID);


MyDiagramEditor.setInput(IEditorInput input)
{
// create diagram with input containing root object
TransactionalEditingDomain editingDomain = createEditingDomain();
ResourceSet resourceSet = editingDomain.getResourceSet();
final EObject myRootObj =
((MyStorageEditorInput)input).getDomainObject();
final Resource diagramResource = resourceSet.createResource(

URI.createPlatformResourceURI(dummyFile.getFullPath().toStri ng()));
List dummyFiles = new LinkedList();
AbstractTransactionalCommand command = new AbstractTransactionalCommand(
editingDomain, "Create new diagram", dummyFiles)
{
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info)
throws ExecutionException
{
Diagram diagram = ViewService.createDiagram(myRootObj
MyRootEditPart.MODEL_ID,
MyDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
}
};
OperationHistoryFactory.getOperationHistory().execute(comman d,
new NullProgressMonitor(), null);

super.setInput(input);
}

Is there a way to invoke this editor without needing to
implement my own IStorageEditorInput and IDiagramDocumentProvider?

thanks,
Keith
Previous Topic:Adding to figures when Diagram comes up
Next Topic:Different icons for different Attributes
Goto Forum:
  


Current Time: Sun Jun 01 04:03:16 EDT 2025

Powered by FUDForum. Page generated in 0.02726 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top