Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » how does org.eclipse.jface.text.idocument modify content?
how does org.eclipse.jface.text.idocument modify content? [message #902238] Thu, 16 August 2012 09:38 Go to next message
Slawek L is currently offline Slawek L
Messages: 21
Registered: May 2012
Junior Member
I would like to modify some content of IDocument. For example: find tag
<body>
and insert some text after it. I checked out IDocument api and i have no idea how do it, method get() returns this document's complete text but is there exist a more efficient solution ?
Re: how does org.eclipse.jface.text.idocument modify content? [message #902353 is a reply to message #902238] Fri, 17 August 2012 05:20 Go to previous message
Slawek L is currently offline Slawek L
Messages: 21
Registered: May 2012
Junior Member
If someone is interested:
FindReplaceDocumentAdapter adapter=new FindReplaceDocumentAdapter(iDoc);
try {
	IRegion iRegion = adapter.find(0, "<body>", true, false, true, false);
	String textInsert= "xxxxxxxxxxxxxxx";
	iDoc.replace(iRegion.getOffset(), 0, textInsert);
	} catch (BadLocationException e) {
	e.printStackTrace();
	}
}
Previous Topic:FieldEditorPreferencePage/Fieldeditor usage.
Next Topic:How can I update status message in JFace ApplicationWindow?
Goto Forum:
  


Current Time: Wed Jul 23 05:59:41 EDT 2014

Powered by FUDForum. Page generated in 0.01490 seconds