Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 05:27 Go to next message
Stefan Beskow is currently offline Stefan BeskowFriend
Messages: 7
Registered: July 2009
Junior Member
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 21:03 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
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] Fri, 02 February 2007 02:06 Go to previous message
Stefan Beskow is currently offline Stefan BeskowFriend
Messages: 7
Registered: July 2009
Junior Member
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: Sat Oct 12 16:11:10 GMT 2024

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

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

Back to the top