org.eclipse.ui.texteditor is gone? [message #231874] |
Wed, 21 June 2006 23:46  |
Eclipse User |
|
|
|
Originally posted by: unusedusername.gmail.com
Hello,
This is probably a bit of a newbie question (and maybe in the wrong
forum), but here we go.
I'm trying to devolop a Java plugin for Eclipse that needs to have access
to the text in the currently active editor.
I've worked up the following code to do this:
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
IEditorPart part = page.getActiveEditor();
ITextEditor editor = (ITextEditor)part;
IDocumentProvider dp = part.getDocumentProvider();
IDocument doc = dp.getDocument(editor.getEditorInput());
From the IDocument it is trivial to get at the text...
The trouble is that eclipse can not find ITextEditor, or IDocumentProvider.
The Api(ver 3.1, same as my eclipse) says it sould be located in
org.eclipse.ui.texteditor, however that is not listed as a possible
dependant package nor will Eclipse allow me to import that package. I get
a package not found error. I have tried this on a fresh install of the
current stable, under both Mac and Win XP.
Any thoughts on this?
-Jeff Hagen
unusedusername@gmail.com
|
|
|
Re: org.eclipse.ui.texteditor is gone? [message #231891 is a reply to message #231874] |
Thu, 22 June 2006 04:26  |
Eclipse User |
|
|
|
Originally posted by: tom_eicher.ch.ibm.com
Add a dependency on org.eclipse.ui.workbench.texteditor
-tom
Jeff Hagen wrote:
> Hello,
>
> This is probably a bit of a newbie question (and maybe in the wrong
> forum), but here we go.
>
> I'm trying to devolop a Java plugin for Eclipse that needs to have
> access to the text in the currently active editor.
>
> I've worked up the following code to do this:
> IWorkbench wb = PlatformUI.getWorkbench();
> IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
> IWorkbenchPage page = win.getActivePage();
> IEditorPart part = page.getActiveEditor();
> ITextEditor editor = (ITextEditor)part;
> IDocumentProvider dp = part.getDocumentProvider();
> IDocument doc = dp.getDocument(editor.getEditorInput());
>
> From the IDocument it is trivial to get at the text...
>
> The trouble is that eclipse can not find ITextEditor, or IDocumentProvider.
>
> The Api(ver 3.1, same as my eclipse) says it sould be located in
> org.eclipse.ui.texteditor, however that is not listed as a possible
> dependant package nor will Eclipse allow me to import that package. I
> get a package not found error. I have tried this on a fresh install of
> the current stable, under both Mac and Win XP.
>
> Any thoughts on this?
>
> -Jeff Hagen
> unusedusername@gmail.com
>
|
|
|
Powered by
FUDForum. Page generated in 0.03533 seconds