IDocument cannot be resolved for type

I am very new to eclipse devalopment plugin and I want to get content from editor using eclipse plugin so I found this answer .

But the problem is I am getting compilation error IDocument cannot be resolved to a type

. No quick import imports. My Eclipse version is 3.8.2.

How can I fix this problem?

The code I used (from the linked answer) is the following:

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();
}

      

enter image description here

I cannot find it org.eclipse.jface.text

among my dependencies. Here's a snapshot:

enter image description here

+3


source to share


1 answer


IDocument

is in the plugin org.eclipse.text

, so you have to add it to the plugin dependencies list.



Note. You can also add the plugin org.eclipse.jface.text

to the dependency list as it will include the plugin org.eclipse.text

.

+8


source







All Articles