Domain models, XMLModel and Undo [message #77193] |
Fri, 25 February 2005 23:42  |
Eclipse User |
|
|
|
Hi everyone
I need to implement my own derived data model at a level above the DOM,
and provide undoable changes to the model. Pretty common use case, I
assume.
Picture something like the plug-in manifest editor, with an XML source
page and some form pages which perform undoable actions. At this time, I
don't think I want to go the EMF route, but I'm open to persuasion.
In M2, I notice that if I use the context menu in the outline view of the
XML editor to add a child element, the action is not undoable. Is that
true in M3? I believe there's some new command framework in M5a, but when
will it be used in WTP?
Any advice on how to get started? The cleanest way to keep my model and
the DOM and the source in sync? Any Undo support outside of EMF, or will I
have to manipulate the text model and let the XML parser do its thing?
Any examples of this kind of thing in M5a/WTP M3 that I can look at?
Thanks!
- Richard
|
|
|
|
Re: Domain models, XMLModel and Undo [message #77356 is a reply to message #77243] |
Sat, 26 February 2005 11:20  |
Eclipse User |
|
|
|
Thanks for the pointer to a simple undoable action. Add child is not
undoable in M3, so I wrote up:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=86752
I'd still love to see a good example of a higher-level model sync'ed to
the XMLModel.
Should I be looking at node adapters? I haven't figured out how node
adapters are installed, and whether they are used in editing scenarios or
just for read-only views like the outline.
Again, using my example of the plugin manifest editor, where the user is
adding dependencies, say.
Without really understanding the details yet, I could imagine using a node
adapter to provide a domain-specific view of the model eg. build a list of
dependencies so I can check does dependency X exist before I insert it.
Presumably the adapter can hang on to a node reference so it can be used
to supply the appropriate parent node to construct an AddDependency action
which would operate directly on the DOM in the same way that the XML
editor actions do. Or perhaps the node adapter itself can alter the node
and be called from the action?
- Richard
Nitin Dahyabhai wrote:
> Richard Rodseth wrote:
>> In M2, I notice that if I use the context menu in the outline view of
>> the XML editor to add a child element, the action is not undoable. Is
>> that true in M3? I believe there's some new command framework in M5a,
>> but when will it be used in WTP?
> The outline views haven't seen many changes in M3 so it's likely
> still true. If you are seeing the same problems with M3 please open
> a bug on the SSE component. SSE will attempt to migrate to the new
> undo framework in M4--we didn't expect to see it in Eclipse 3.1M5.
>> Any advice on how to get started? The cleanest way to keep my model and
>> the DOM and the source in sync? Any Undo support outside of EMF, or will
>> I have to manipulate the text model and let the XML parser do its thing?
>>
>> Any examples of this kind of thing in M5a/WTP M3 that I can look at?
> org.eclipse.wst.xml.ui.actions.ToggleCommentActionXML is the
> simplest example of how to use IStructuredModel's Undo facilities.
> The methods called on IStructuredModel are just a convenience layer
> around an IStructuredTextUndoManager, which itself can be retrieved
> from the model. How undo is implemented may change in incompatible
> ways for M4, but this interface is the center of it all for M3. If
> the changes for M4 are incompatible, notes will be provided in the
> M4 migration guide.
|
|
|
Powered by
FUDForum. Page generated in 0.04090 seconds