Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Plugin Development getContent from editor
Plugin Development getContent from editor [message #917928] Thu, 20 September 2012 15:14 Go to next message
Luca Mising name is currently offline Luca Mising name
Messages: 5
Registered: November 2011
Junior Member
Hi all,

I'm developing my simple plugin but I don't know how can I get Text Content. Can you help me?

I search on internet but I don't found solution.

IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
TextEditor textEditor = (TextEditor) editor;

and then???

Thanks in advance

Luca
Re: Plugin Development getContent from editor [message #917952 is a reply to message #917928] Thu, 20 September 2012 15:36 Go to previous messageGo to next message
Luca Mising name is currently offline Luca Mising name
Messages: 5
Registered: November 2011
Junior Member
I found solution, sorry

final IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
ITextEditor editor = (ITextEditor) activeEditor;
IDocumentProvider dp = editor.getDocumentProvider();
IDocument doc = dp.getDocument(editor.getEditorInput());

doc.get(); //this is text

Thanks

L
Re: Plugin Development getContent from editor [message #920839 is a reply to message #917952] Sun, 23 September 2012 14:05 Go to previous message
Stephan Herrmann is currently offline Stephan Herrmann
Messages: 1007
Registered: July 2009
Senior Member
looks good, thanks for sharing your solution Smile
Previous Topic:Trying to convert from IMethod to MethodDeclaration: findDeclaringNode always returns null
Next Topic:Debug Perspective - Variables Detail Pane - "@xxxxxxx" string after type
Goto Forum:
  


Current Time: Sat Sep 20 06:13:25 GMT 2014

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

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