Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » methods in IDocument stop the program(Getting content from IDocument does not response.)
methods in IDocument stop the program [message #667673] Sun, 01 May 2011 06:19 Go to next message
sto  is currently offline sto Friend
Messages: 7
Registered: March 2011
Junior Member
Hi,

i am trying to get the content of an opened without saving it.
So, first i get the IEditorPart, and then get IDocument from IEditorPart.
After that, by calling get() method from IDocument object to get the Editor content, the program then does not work or throw any Exception after calling the method get() or any other methods in the object.
ps: reference to Editors work fines and IDocument the object is not null as well and my sample codes are below
Thanks in advance

//get the editor
IEditorPart[] editors = window.getActivePage().getEditors();
for(IEditorPart editor : editors){
if(editor.isDirty()){
AbstractTextEditor tEditor = (AbstractTextEditor)editor.getAdapter(AbstractTextEditor.cla ss);
IDocument doc = tEditor.getDocumentProvider().getDocument(editor.getEditorIn put());
System.out.println(doc.get());
System.out.println("here");
//more codes .....
}

}
Re: methods in IDocument stop the program [message #667674 is a reply to message #667673] Sun, 01 May 2011 06:38 Go to previous message
sto  is currently offline sto Friend
Messages: 7
Registered: March 2011
Junior Member
I forgot to set the dependency in plugin.xml :")
Previous Topic:Eclipse using absolute path's for imported jar's
Next Topic:replacement for WEB-INF/lib
Goto Forum:
  


Current Time: Tue Sep 24 07:05:49 GMT 2024

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

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

Back to the top