Home » Eclipse Projects » Eclipse Platform » setActiveEditor not called when editor is selected.
setActiveEditor not called when editor is selected. [message #148927] |
Fri, 24 October 2003 01:00  |
Eclipse User |
|
|
|
I need to set the status of an action based every time an editor is
selected.
My thought was to create a viewer contribution in ui.popupMenus where that
contribution is an IEditorActionDelegate.
I guessed that setActiveEditor would be called every time an editor is
selected. It is called when an editor is first opened up ... but not when
switching between two editors that are already opened.
Was wondering ... anyone know how can I hook into an editor being selected?
Brett
|
|
| |
Re: setActiveEditor not called when editor is selected. [message #149005 is a reply to message #148982] |
Fri, 24 October 2003 07:57   |
Eclipse User |
|
|
|
Hmmm ... apologize for being ambigious.
By selected I mean ... if there were two editors tabs currently in eclipse,
seleting here means clicking on a tab. So for example, if there were two
editors, Editor1 and Editor2, if I clicked on the Editor1 tab, I am
selecting it. (Is that the same as activating?)
So, now, if I were to repeateadly click the Editor1 tab followed by the
Editor2 tab, I am interested in having my any of my IEditorActionDelegate's
methods to be called (either selectionChanged or activeEditor.)
According to your note, it seems that my some of my Action's methods should
be called since it is a subclass of ActionDelegate ... but I just verified
that they aren't ;-(
To veify, in my Action, I put a breakpoint in selectionChanged and
setActiveEditor methods. They are called initially, but at some point in
time, I can switch between the two editors, and no breakpoints are hit ...
or did I totally screw this up?
Brett
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:bnam5n$1s5$1@eclipse.org...
> Brett Kotch wrote:
>
> >I need to set the status of an action based every time an editor is
> >selected.
> >
> >My thought was to create a viewer contribution in ui.popupMenus where
that
> >contribution is an IEditorActionDelegate.
> >
> >I guessed that setActiveEditor would be called every time an editor is
> >selected. It is called when an editor is first opened up ... but not when
> >switching between two editors that are already opened.
> >
> >Was wondering ... anyone know how can I hook into an editor being
selected?
> >
> >
> By selected you mean activated I guess. There are two ways to do this:
>
> 1. add a part listener (see IPartListener and IPartListener2) to the
> workbench page
> 2. add a selection listener
>
> Note: if your action is an action delegate then it will be informed
> automatically about selection changes.
>
> Dani
>
> >
> >
> >Brett
> >
> >
> >
> >
> >
> >
>
|
|
|
Re: setActiveEditor not called when editor is selected. [message #149611 is a reply to message #149005] |
Mon, 27 October 2003 04:37   |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
Brett Kotch wrote:
>Hmmm ... apologize for being ambigious.
>
>By selected I mean ... if there were two editors tabs currently in eclipse,
>seleting here means clicking on a tab. So for example, if there were two
>editors, Editor1 and Editor2, if I clicked on the Editor1 tab, I am
>selecting it. (Is that the same as activating?)
>
>
Yes. The active part (view or editor) is the one with the blue tite bar/tab.
>So, now, if I were to repeateadly click the Editor1 tab followed by the
>Editor2 tab, I am interested in having my any of my IEditorActionDelegate's
>methods to be called (either selectionChanged or activeEditor.)
>
>According to your note, it seems that my some of my Action's methods should
>be called since it is a subclass of ActionDelegate ... but I just verified
>that they aren't ;-(
>
>To veify, in my Action, I put a breakpoint in selectionChanged and
>setActiveEditor methods. They are called initially, but at some point in
>time, I can switch between the two editors, and no breakpoints are hit ...
>or did I totally screw this up?
>
>
It depends how you registered the delegate: if you did this via XML then
selectionChagend(...) should be called (if not it's a bug). If you
created the action in code then it is your responsibility to register
them as selection dependent actions. The following links might help:
- TextEditorAction
- RetargetTextEditorAction
- AbstractTextEditor.markAsSelectionDependentAction()
Dani
>Brett
>
>"Daniel Megert" <daniel.megert@gmx.net> wrote in message
>news:bnam5n$1s5$1@eclipse.org...
>
>
>>Brett Kotch wrote:
>>
>>
>>
>>>I need to set the status of an action based every time an editor is
>>>selected.
>>>
>>>My thought was to create a viewer contribution in ui.popupMenus where
>>>
>>>
>that
>
>
>>>contribution is an IEditorActionDelegate.
>>>
>>>I guessed that setActiveEditor would be called every time an editor is
>>>selected. It is called when an editor is first opened up ... but not when
>>>switching between two editors that are already opened.
>>>
>>>Was wondering ... anyone know how can I hook into an editor being
>>>
>>>
>selected?
>
>
>>>
>>>
>>By selected you mean activated I guess. There are two ways to do this:
>>
>>1. add a part listener (see IPartListener and IPartListener2) to the
>>workbench page
>>2. add a selection listener
>>
>>Note: if your action is an action delegate then it will be informed
>>automatically about selection changes.
>>
>>Dani
>>
>>
>>
>>>Brett
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
>
>
>
|
|
|
Re: setActiveEditor not called when editor is selected. [message #149744 is a reply to message #149611] |
Mon, 27 October 2003 09:27   |
Eclipse User |
|
|
|
The action was registered via XML ...
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:bniouh$md5$1@eclipse.org...
> Brett Kotch wrote:
>
> >Hmmm ... apologize for being ambigious.
> >
> >By selected I mean ... if there were two editors tabs currently in
eclipse,
> >seleting here means clicking on a tab. So for example, if there were two
> >editors, Editor1 and Editor2, if I clicked on the Editor1 tab, I am
> >selecting it. (Is that the same as activating?)
> >
> >
> Yes. The active part (view or editor) is the one with the blue tite
bar/tab.
>
> >So, now, if I were to repeateadly click the Editor1 tab followed by the
> >Editor2 tab, I am interested in having my any of my
IEditorActionDelegate's
> >methods to be called (either selectionChanged or activeEditor.)
> >
> >According to your note, it seems that my some of my Action's methods
should
> >be called since it is a subclass of ActionDelegate ... but I just
verified
> >that they aren't ;-(
> >
> >To veify, in my Action, I put a breakpoint in selectionChanged and
> >setActiveEditor methods. They are called initially, but at some point in
> >time, I can switch between the two editors, and no breakpoints are hit
....
> >or did I totally screw this up?
> >
> >
> It depends how you registered the delegate: if you did this via XML then
> selectionChagend(...) should be called (if not it's a bug). If you
> created the action in code then it is your responsibility to register
> them as selection dependent actions. The following links might help:
>
> - TextEditorAction
> - RetargetTextEditorAction
> - AbstractTextEditor.markAsSelectionDependentAction()
>
> Dani
>
> >Brett
> >
> >"Daniel Megert" <daniel.megert@gmx.net> wrote in message
> >news:bnam5n$1s5$1@eclipse.org...
> >
> >
> >>Brett Kotch wrote:
> >>
> >>
> >>
> >>>I need to set the status of an action based every time an editor is
> >>>selected.
> >>>
> >>>My thought was to create a viewer contribution in ui.popupMenus where
> >>>
> >>>
> >that
> >
> >
> >>>contribution is an IEditorActionDelegate.
> >>>
> >>>I guessed that setActiveEditor would be called every time an editor is
> >>>selected. It is called when an editor is first opened up ... but not
when
> >>>switching between two editors that are already opened.
> >>>
> >>>Was wondering ... anyone know how can I hook into an editor being
> >>>
> >>>
> >selected?
> >
> >
> >>>
> >>>
> >>By selected you mean activated I guess. There are two ways to do this:
> >>
> >>1. add a part listener (see IPartListener and IPartListener2) to the
> >>workbench page
> >>2. add a selection listener
> >>
> >>Note: if your action is an action delegate then it will be informed
> >>automatically about selection changes.
> >>
> >>Dani
> >>
> >>
> >>
> >>>Brett
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
|
|
|
Re: setActiveEditor not called when editor is selected. [message #150105 is a reply to message #149744] |
Tue, 28 October 2003 06:36   |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
Brett Kotch wrote:
>The action was registered via XML ...
>
>
How did you do it?
>
>"Daniel Megert" <daniel.megert@gmx.net> wrote in message
>news:bniouh$md5$1@eclipse.org...
>
>
>>Brett Kotch wrote:
>>
>>
>>
>>>Hmmm ... apologize for being ambigious.
>>>
>>>By selected I mean ... if there were two editors tabs currently in
>>>
>>>
>eclipse,
>
>
>>>seleting here means clicking on a tab. So for example, if there were two
>>>editors, Editor1 and Editor2, if I clicked on the Editor1 tab, I am
>>>selecting it. (Is that the same as activating?)
>>>
>>>
>>>
>>>
>>Yes. The active part (view or editor) is the one with the blue tite
>>
>>
>bar/tab.
>
>
>>>So, now, if I were to repeateadly click the Editor1 tab followed by the
>>>Editor2 tab, I am interested in having my any of my
>>>
>>>
>IEditorActionDelegate's
>
>
>>>methods to be called (either selectionChanged or activeEditor.)
>>>
>>>According to your note, it seems that my some of my Action's methods
>>>
>>>
>should
>
>
>>>be called since it is a subclass of ActionDelegate ... but I just
>>>
>>>
>verified
>
>
>>>that they aren't ;-(
>>>
>>>To veify, in my Action, I put a breakpoint in selectionChanged and
>>>setActiveEditor methods. They are called initially, but at some point in
>>>time, I can switch between the two editors, and no breakpoints are hit
>>>
>>>
>...
>
>
>>>or did I totally screw this up?
>>>
>>>
>>>
>>>
>>It depends how you registered the delegate: if you did this via XML then
>>selectionChagend(...) should be called (if not it's a bug). If you
>>created the action in code then it is your responsibility to register
>>them as selection dependent actions. The following links might help:
>>
>>- TextEditorAction
>>- RetargetTextEditorAction
>>- AbstractTextEditor.markAsSelectionDependentAction()
>>
>>Dani
>>
>>
>>
>>>Brett
>>>
>>>"Daniel Megert" <daniel.megert@gmx.net> wrote in message
>>>news:bnam5n$1s5$1@eclipse.org...
>>>
>>>
>>>
>>>
>>>>Brett Kotch wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>I need to set the status of an action based every time an editor is
>>>>>selected.
>>>>>
>>>>>My thought was to create a viewer contribution in ui.popupMenus where
>>>>>
>>>>>
>>>>>
>>>>>
>>>that
>>>
>>>
>>>
>>>
>>>>>contribution is an IEditorActionDelegate.
>>>>>
>>>>>I guessed that setActiveEditor would be called every time an editor is
>>>>>selected. It is called when an editor is first opened up ... but not
>>>>>
>>>>>
>when
>
>
>>>>>switching between two editors that are already opened.
>>>>>
>>>>>Was wondering ... anyone know how can I hook into an editor being
>>>>>
>>>>>
>>>>>
>>>>>
>>>selected?
>>>
>>>
>>>
>>>
>>>>>
>>>>>
>>>>By selected you mean activated I guess. There are two ways to do this:
>>>>
>>>>1. add a part listener (see IPartListener and IPartListener2) to the
>>>>workbench page
>>>>2. add a selection listener
>>>>
>>>>Note: if your action is an action delegate then it will be informed
>>>>automatically about selection changes.
>>>>
>>>>Dani
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Brett
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>
>
>
>
|
|
|
Re: setActiveEditor not called when editor is selected. [message #150508 is a reply to message #150105] |
Wed, 29 October 2003 00:22  |
Eclipse User |
|
|
|
Viewer contribution listed below ... via <extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
targetID="#TextEditorContext"
id="net.sourceforge.perforce.ui.EditorViewSubmitContribution ">
<action
label="%submit.label"
class="net.sourceforge.perforce.ui.action.SubmitIResourceAction "
menubarPath="additions"
enablesFor="+"
id="net.sourceforge.perforce.ui.action.submitIResourceAction ">
</action>
</viewerContribution>
This was posted earlier
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:bnlk9p$knm$1@eclipse.org...
> Brett Kotch wrote:
>
> >The action was registered via XML ...
> >
> >
> How did you do it?
>
> >
> >"Daniel Megert" <daniel.megert@gmx.net> wrote in message
> >news:bniouh$md5$1@eclipse.org...
> >
> >
> >>Brett Kotch wrote:
> >>
> >>
> >>
> >>>Hmmm ... apologize for being ambigious.
> >>>
> >>>By selected I mean ... if there were two editors tabs currently in
> >>>
> >>>
> >eclipse,
> >
> >
> >>>seleting here means clicking on a tab. So for example, if there were
two
> >>>editors, Editor1 and Editor2, if I clicked on the Editor1 tab, I am
> >>>selecting it. (Is that the same as activating?)
> >>>
> >>>
> >>>
> >>>
> >>Yes. The active part (view or editor) is the one with the blue tite
> >>
> >>
> >bar/tab.
> >
> >
> >>>So, now, if I were to repeateadly click the Editor1 tab followed by
the
> >>>Editor2 tab, I am interested in having my any of my
> >>>
> >>>
> >IEditorActionDelegate's
> >
> >
> >>>methods to be called (either selectionChanged or activeEditor.)
> >>>
> >>>According to your note, it seems that my some of my Action's methods
> >>>
> >>>
> >should
> >
> >
> >>>be called since it is a subclass of ActionDelegate ... but I just
> >>>
> >>>
> >verified
> >
> >
> >>>that they aren't ;-(
> >>>
> >>>To veify, in my Action, I put a breakpoint in selectionChanged and
> >>>setActiveEditor methods. They are called initially, but at some point
in
> >>>time, I can switch between the two editors, and no breakpoints are hit
> >>>
> >>>
> >...
> >
> >
> >>>or did I totally screw this up?
> >>>
> >>>
> >>>
> >>>
> >>It depends how you registered the delegate: if you did this via XML then
> >>selectionChagend(...) should be called (if not it's a bug). If you
> >>created the action in code then it is your responsibility to register
> >>them as selection dependent actions. The following links might help:
> >>
> >>- TextEditorAction
> >>- RetargetTextEditorAction
> >>- AbstractTextEditor.markAsSelectionDependentAction()
> >>
> >>Dani
> >>
> >>
> >>
> >>>Brett
> >>>
> >>>"Daniel Megert" <daniel.megert@gmx.net> wrote in message
> >>>news:bnam5n$1s5$1@eclipse.org...
> >>>
> >>>
> >>>
> >>>
> >>>>Brett Kotch wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>I need to set the status of an action based every time an editor is
> >>>>>selected.
> >>>>>
> >>>>>My thought was to create a viewer contribution in ui.popupMenus where
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>that
> >>>
> >>>
> >>>
> >>>
> >>>>>contribution is an IEditorActionDelegate.
> >>>>>
> >>>>>I guessed that setActiveEditor would be called every time an editor
is
> >>>>>selected. It is called when an editor is first opened up ... but not
> >>>>>
> >>>>>
> >when
> >
> >
> >>>>>switching between two editors that are already opened.
> >>>>>
> >>>>>Was wondering ... anyone know how can I hook into an editor being
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>selected?
> >>>
> >>>
> >>>
> >>>
> >>>>>
> >>>>>
> >>>>By selected you mean activated I guess. There are two ways to do this:
> >>>>
> >>>>1. add a part listener (see IPartListener and IPartListener2) to the
> >>>>workbench page
> >>>>2. add a selection listener
> >>>>
> >>>>Note: if your action is an action delegate then it will be informed
> >>>>automatically about selection changes.
> >>>>
> >>>>Dani
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Brett
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
|
|
|
Goto Forum:
Current Time: Sat May 03 17:36:54 EDT 2025
Powered by FUDForum. Page generated in 0.03207 seconds
|