Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » how to change the DOM of a StructuredTextEditor
how to change the DOM of a StructuredTextEditor [message #644572] Mon, 13 December 2010 10:29 Go to next message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
I created a graphical editor with a StructuredTextEditor.
the thing is that i want to change the SSE model managed by the StructuredTextEditor

I can acess the model via :
...
IDocument doc = sourcePage.getDocumentProvider().getDocument(
getEditorInput());
if (doc instanceof IStructuredDocument) {
IStructuredModel model = StructuredModelManager.getModelManager()
.getExistingModelForEdit(doc);
if (model == null) {
model = StructuredModelManager.getModelManager()
.getModelForEdit((IStructuredDocument) doc);
...

My question is how to change this SSE model in order to be able to edit the DOM of another IFILE. so my StructuredTextEditor will not edit the DOM related to the graphical editor. it will edit a new IDOMModel of another IFILE.

I hope my question is clear.
Thanks
Re: how to change the DOM of a StructuredTextEditor [message #644686 is a reply to message #644572] Mon, 13 December 2010 18:58 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick Sandonato
Messages: 126
Registered: July 2009
Senior Member
I'm not sure if I fully understand your question.

The way I'm interpreting it is that you have file A open in your editor, but you want modifications done to the editor to affect file B and not file A. Is that correct?

We don't have any API available to accomplish this, as the model is bound to the editor via doSetInput(). I could see possibly using INodeAdapters to accomplish editing a different DOM, but even then it would require manipulating the file A backing your graphical editor in order to affect file B's DOM.

[Updated on: Mon, 13 December 2010 19:10]

Report message to a moderator

Re: how to change the DOM of a StructuredTextEditor [message #644877 is a reply to message #644686] Tue, 14 December 2010 15:17 Go to previous messageGo to next message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
Thank you for responding me.
what I really want to do is to open and edit the XML editor on a String (and not on a file)

for this I tried setting the IEditorInput of the StructuredTextEditor
...
IStorage storage = new StringStorage(string);
IStorageEditorInput input = new StringInput(storage);
int index = addPage(sourcePage, input);
...

then I discovered by using IStorageEditorInput, the downside is it's a read-only input type. (according to this FAQ: http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_somet hing_that_is_not_a_file%3F )

do you have ideas about how to deal with this?
Thank you.
Re: how to change the DOM of a StructuredTextEditor [message #646619 is a reply to message #644877] Wed, 29 December 2010 11:55 Go to previous message
Agustin  is currently offline Agustin
Messages: 26
Registered: November 2010
Location: Uruguay
Junior Member

Hello!
I need help with html editor (WebPageEditor), implement this takes as input a String (which is what happens in a IStorageEditorinput), "StringEditorInput"

The editor takes input without problems, but the problem is to stop working context, ctrl'space shows nothing and the palette also

Alguein could help me with this with some example of how the model setear HTML editor, my goal is that the editor WebPageEditor take as input any string that I pass

If you open the XML editor to the input string then is not going to work the context, something similar to what happened to me
Previous Topic:StringEditorInput implements IStorageEditorInput Input WebPageEditor
Next Topic:Web Page Editor Input on memory
Goto Forum:
  


Current Time: Sat Sep 20 12:09:11 GMT 2014

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

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