Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Editor loses focus - disable save as
Editor loses focus - disable save as [message #462780] Thu, 01 February 2007 00:27 Go to next message
Eclipse UserFriend
How can you detect if an EditorPart is in focus? When a user switches
between an editor and a view I would like to disable the Save As option for
the editor. I tried adding the editor as a part listener to detects it's
corresponding IPartListener2.partDeactivated(..) method, but the problem is
that the EditorPart.isSaveAsAllowed() method is invoked before the
IPartListener2.partDeactivated(..) is invoked, so it's not possible to use
the deactivate event to change the Save As allowed status. Is there
something else I could try?



Thanks.

Stefan
Re: Editor loses focus - disable save as [message #462880 is a reply to message #462780] Thu, 01 February 2007 16:03 Go to previous messageGo to next message
Eclipse UserFriend
You can add a focus listener to some control of your editor.
For instance, if you use a text editor, you can catch focus using:
textEditor.getTextViewer().getTextWidget().addFocusListener( new
FocusListener(){
....
});

Snjeza

Stefan Beskow wrote:
> How can you detect if an EditorPart is in focus? When a user switches
> between an editor and a view I would like to disable the Save As option for
> the editor. I tried adding the editor as a part listener to detects it's
> corresponding IPartListener2.partDeactivated(..) method, but the problem is
> that the EditorPart.isSaveAsAllowed() method is invoked before the
> IPartListener2.partDeactivated(..) is invoked, so it's not possible to use
> the deactivate event to change the Save As allowed status. Is there
> something else I could try?
>
>
>
> Thanks.
>
> Stefan
>
>
Re: Editor loses focus - disable save as [message #462887 is a reply to message #462880] Thu, 01 February 2007 21:06 Go to previous message
Eclipse UserFriend
Great that works.

Thanks for your help.
Stefan

"Snjezana Peco" <snjeza.peco@gmail.com> wrote in message
news:eptkjj$avd$1@utils.eclipse.org...
> You can add a focus listener to some control of your editor.
> For instance, if you use a text editor, you can catch focus using:
> textEditor.getTextViewer().getTextWidget().addFocusListener( new
> FocusListener(){
> ...
> });
>
> Snjeza
>
> Stefan Beskow wrote:
>> How can you detect if an EditorPart is in focus? When a user switches
>> between an editor and a view I would like to disable the Save As option
>> for the editor. I tried adding the editor as a part listener to detects
>> it's corresponding IPartListener2.partDeactivated(..) method, but the
>> problem is that the EditorPart.isSaveAsAllowed() method is invoked before
>> the IPartListener2.partDeactivated(..) is invoked, so it's not possible
>> to use the deactivate event to change the Save As allowed status. Is
>> there something else I could try?
>>
>>
>>
>> Thanks.
>>
>> Stefan
>>
Previous Topic:RCP, JDT, and WTP
Next Topic:How can we get a notification when the workbench window is about to close
Goto Forum:
  


Current Time: Sun Apr 27 04:00:28 EDT 2025

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

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

Back to the top