Non-Emf Diagram Loading [message #990626] |
Thu, 13 December 2012 13:53 |
Tim E. Messages: 56 Registered: November 2012 |
Member |
|
|
Hi,
at the moment I'm stuck and hope that you can help me.
The project is to build a visualization for a non-emf model.
I had a look at the tutorial, at the FAQ and several topics in this forum, especially the Non-Emf example.
But somehow I'm stuck and do not really know what to do.
Business model: can be edited by a separate (text) editor
Want I want to achieve:
Load:
-- load model (use my own loading mechanism)
-- load view information (use Graphiti)
if there is none, create one.
-- hook these things together
Save:
-- save model (use my own loading mechanism)
-- save view information (use Graphiti)
But I'm failing to implement the basic framework.
What I implemented:
according to eclipse help:
* DomainModelChangeListener
* DiagramEditor (registered it as extension point, extension *.tim)
* NotificationService (without overriding any method)
according to forum:
* IndependenceSolver
But then I had a closer look at DiagramEditor and discovered the "Behavior" mechanism.
So in order to load my business model I should probably extend the DefaultPersistencyBehavior.
I'm trying to do that at the moment but as I said, I'm stuck. I want to load my business model, but I don't really know how to create a Diagram using the provided AddFeatures.
Can somebody perhaps help me and explain what I have to do.
Thanks a lot!
Cheers,
Tim
[Updated on: Tue, 18 December 2012 08:34] Report message to a moderator
|
|
|
Re: Non-Emf Diagram Loading [message #991178 is a reply to message #990626] |
Mon, 17 December 2012 15:43 |
Tim E. Messages: 56 Registered: November 2012 |
Member |
|
|
Hi again,
made a bit of progress for one of the mentioned points: Load a model. At least I hope that
For testing purposes I just try to load one single object, created at the beginning
of the loadDiagram method.
public class CDPersistencyBehavior extends DefaultPersistencyBehavior {
public CDPersistencyBehavior(DiagramEditor diagramEditor) {
super(diagramEditor);
}
@Override
public Diagram loadDiagram(URI uri) {
ClassObject textObject = new ClassObject("TestAdd");
if (uri != null) {
// final TransactionalEditingDomain editingDomain = diagramEditor
// .getEditingDomain();
// Create the diagram and its file
Diagram diagram = Graphiti.getPeCreateService().createDiagram(
"CDDiagramType", "Testing", true); //$NON-NLS-1$
IDiagramTypeProvider dtp = GraphitiUi.getExtensionManager()
.createDiagramTypeProvider(diagram,
"demo.cd.diagram.CDDiagramTypeProvider"); //$NON-NLS-1$
IFeatureProvider fp = dtp.getFeatureProvider();
AddContext ac = new AddContext();
ac.setTargetContainer(diagram);
ac.setNewObject(textObject);
ac.setLocation(10, 10);
ac.setSize(50, 50);
PictogramElement pe = fp.addIfPossible(ac);
CDPatternFeatureProvider cpfp = (CDPatternFeatureProvider) fp;
CDIndependenceSolver cdis = cpfp.getCDIndependenceSolver();
cdis.printMap();
cdis.printClasses();
return diagram;
}
return null;
// return super.loadDiagram(uri);
}
@Override
public void saveDiagram(IProgressMonitor monitor) {
super.saveDiagram(monitor);
}
}
It seems to add the class correctly to the Independence Solver.
Unfortunately, it is not shown in the diagram.
Even adding a object from the palette does not work any longer.
I guess, I made a mistake Any help is appreciated.
Another topic related question:
How would I manage to load (and save, see other topic) the "view" information,
load the model separately and hook these together?
Is it even possible to do that? How can I (conceptually) achieve this?
Thanks a lot!
[Updated on: Tue, 18 December 2012 08:36] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02811 seconds