Skip to main content


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 13:38 Go to next message
Slawek L is currently offline Slawek LFriend
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 09:20 Go to previous message
Slawek L is currently offline Slawek LFriend
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:please delete this
Next Topic:FieldEditorPreferencePage/Fieldeditor usage.
Goto Forum:
  


Current Time: Fri Apr 26 18:00:59 GMT 2024

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

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

Back to the top