Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Listening to Tab Activations in Java Editor
Listening to Tab Activations in Java Editor [message #152192] Sat, 03 April 2004 23:39 Go to next message
Eclipse UserFriend
My code needs to get notifications when user selects new Java File to edit
(including switches between tabs). I did the following:

private void addEditorListener() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
final IEditorPart editor = page.getActiveEditor();
editor.addPropertyListener( new IPropertyListener() {
public void propertyChanged(Object source, int propId) {
if ( IEditorPart.PROP_INPUT == propId ) {
System.out.println( "ACTIVE FILE CHANGED." );
}
}

} );
}

But that does not work. Any help is appreciated!

Alex
Re: Listening to Tab Activations in Java Editor [message #152680 is a reply to message #152192] Tue, 06 April 2004 08:24 Go to previous message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Alex Iskold wrote:

>My code needs to get notifications when user selects new Java File to edit
>(including switches between tabs). I did the following:
>
>private void addEditorListener() {
> IWorkbench workbench = PlatformUI.getWorkbench();
> IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
> IWorkbenchPage page = window.getActivePage();
> final IEditorPart editor = page.getActiveEditor();
> editor.addPropertyListener( new IPropertyListener() {
> public void propertyChanged(Object source, int propId) {
> if ( IEditorPart.PROP_INPUT == propId ) {
> System.out.println( "ACTIVE FILE CHANGED." );
> }
> }
>
> } );
>}
>
>But that does not work.
>
Well, this code only checks whether the input of the active editor
changed. If you open a new one or switch between different editors then
this stays the same. Take a look at IPartListener2.

Dani

>Any help is appreciated!
>
>Alex
>
>
>
Previous Topic:comparing MethodInvocation with a Statement
Next Topic:Debug
Goto Forum:
  


Current Time: Mon Jun 02 01:53:55 EDT 2025

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

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

Back to the top