Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » org.eclipse.ui.texteditor is gone?
org.eclipse.ui.texteditor is gone? [message #231874] Wed, 21 June 2006 23:46 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:Possible to put my own tree in the "Variables" view of the debug perspective?
Next Topic:How to implement Blank Line rules for Sun's Code Convention code formatter XML?
Goto Forum:
  


Current Time: Tue May 13 12:54:52 EDT 2025

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

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

Back to the top