I'm very new to eclipse plugin devalopment and i want to get content from editor using eclipse plugin so i found this answer.
But problem is: I get the compile error IDocument cannot be resolved to a type. No quick fix imports available. My Eclipse version is 3.8.2.
How can I fix this problem?
The code I used (from the linked answer) is this:
public String getCurrentEditorContent() {
final IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
if (activeEditor == null)
return null;
final IDocument doc = (IDocument) activeEditor.getAdapter(IDocument.class);
if (doc == null) return null;
return doc.get();
}

I can't find org.eclipse.jface.text among my dependencies. Here is a snapshot:

IDocument is in the org.eclipse.text plugin so you must add this to your plugin's dependencies list.
Note: You can also add the org.eclipse.jface.text plugin to the dependencies list as that will include the org.eclipse.text plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With