Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [CommonNavigator] Handling Global 'Open' to open an Editor
[CommonNavigator] Handling Global 'Open' to open an Editor [message #336150] Tue, 26 May 2009 20:54 Go to next message
Eclipse User
Originally posted by: aczerwonka.3esi.com

I think we have a problem, and I'm not sure how to solve it.

I have a registered ActionProvider that I want kicked in whenever the use
double-clicks on an item in the CommonNavigator. The way I solve the
problem is I set the global action handler for the OPEN action to my action
like this:

actionBars.setGlobalActionHandler(ICommonActionConstants.OPE N, _myAction);



This works just fine, as it does open my editor as expected. The problem is
that the editor gets activated and takes focus away from the navigator, and
subsequent dbl-clicks are ignored until I manually give focus back to the
editor.

Can someone help me solve this problem?


-andy
Re: [CommonNavigator] Handling Global 'Open' to open an Editor [message #336151 is a reply to message #336150] Tue, 26 May 2009 20:57 Go to previous messageGo to next message
Eclipse User
Originally posted by: aczerwonka.3esi.com

BTW, you can see the same behaviour in the IDE's Package Explorer, except
that in this case the Dbl-Click is not being ignored because I'm guessing
(??) that the IDE doesn't override the global OPEN handler?

"Andy Czerwonka" <aczerwonka@3esi.com> wrote in message
news:gvhkum$7fu$1@build.eclipse.org...
>I think we have a problem, and I'm not sure how to solve it.
>
> I have a registered ActionProvider that I want kicked in whenever the use
> double-clicks on an item in the CommonNavigator. The way I solve the
> problem is I set the global action handler for the OPEN action to my
> action like this:
>
> actionBars.setGlobalActionHandler(ICommonActionConstants.OPE N, _myAction);
>
>
>
> This works just fine, as it does open my editor as expected. The problem
> is that the editor gets activated and takes focus away from the navigator,
> and subsequent dbl-clicks are ignored until I manually give focus back to
> the editor.
>
> Can someone help me solve this problem?
>
>
> -andy
>
Re: [CommonNavigator] Handling Global 'Open' to open an Editor [message #336152 is a reply to message #336150] Tue, 26 May 2009 21:36 Go to previous messageGo to next message
Eclipse User
Originally posted by: aczerwonka.3esi.com

When I look at the code in the OpenActionProvider in the resources
navigator, it also uses the setGlobalActionHandler strategy. I'm not sure
what I'm doing wrong if anything...

"Andy Czerwonka" <aczerwonka@3esi.com> wrote in message
news:gvhkum$7fu$1@build.eclipse.org...
>I think we have a problem, and I'm not sure how to solve it.
>
> I have a registered ActionProvider that I want kicked in whenever the use
> double-clicks on an item in the CommonNavigator. The way I solve the
> problem is I set the global action handler for the OPEN action to my
> action like this:
>
> actionBars.setGlobalActionHandler(ICommonActionConstants.OPE N, _myAction);
>
>
>
> This works just fine, as it does open my editor as expected. The problem
> is that the editor gets activated and takes focus away from the navigator,
> and subsequent dbl-clicks are ignored until I manually give focus back to
> the editor.
>
> Can someone help me solve this problem?
>
>
> -andy
>
Re: [CommonNavigator] Handling Global 'Open' to open an Editor [message #336173 is a reply to message #336150] Wed, 27 May 2009 19:49 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse-news.rizzoweb.com

Andy Czerwonka wrote:
> I think we have a problem, and I'm not sure how to solve it.
>
> I have a registered ActionProvider that I want kicked in whenever the use
> double-clicks on an item in the CommonNavigator. The way I solve the
> problem is I set the global action handler for the OPEN action to my action
> like this:
>
> actionBars.setGlobalActionHandler(ICommonActionConstants.OPE N, _myAction);
>
>
>
> This works just fine, as it does open my editor as expected. The problem is
> that the editor gets activated and takes focus away from the navigator, and
> subsequent dbl-clicks are ignored until I manually give focus back to the
> editor.

What does the code look like that is opening the editor?
The IWorkbenchPage.openEditor() method allows you to specify whether or
not the opened editor is activated (as do the methods in the class
org.eclipse.ui.ide.IDE which just delegate to IWorkbenchPage).

Hope this helps,
Eric
Re: [CommonNavigator] Handling Global 'Open' to open an Editor [message #336228 is a reply to message #336173] Mon, 01 June 2009 22:42 Go to previous messageGo to next message
Eclipse User
Originally posted by: aczerwonka.3esi.com

I solved it. There's a setFocus() method you better override on the editor.
Set this to something in your UI or else the activation doesn't actually get
kicked in properly.

"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:gvk5gj$8s4$1@build.eclipse.org...
> Andy Czerwonka wrote:
>> I think we have a problem, and I'm not sure how to solve it.
>>
>> I have a registered ActionProvider that I want kicked in whenever the use
>> double-clicks on an item in the CommonNavigator. The way I solve the
>> problem is I set the global action handler for the OPEN action to my
>> action like this:
>>
>> actionBars.setGlobalActionHandler(ICommonActionConstants.OPE N,
>> _myAction);
>>
>>
>>
>> This works just fine, as it does open my editor as expected. The problem
>> is that the editor gets activated and takes focus away from the
>> navigator, and subsequent dbl-clicks are ignored until I manually give
>> focus back to the editor.
>
> What does the code look like that is opening the editor?
> The IWorkbenchPage.openEditor() method allows you to specify whether or
> not the opened editor is activated (as do the methods in the class
> org.eclipse.ui.ide.IDE which just delegate to IWorkbenchPage).
>
> Hope this helps,
> Eric
Re: [CommonNavigator] Handling Global 'Open' to open an Editor [message #336400 is a reply to message #336228] Wed, 10 June 2009 08:11 Go to previous message
sowmya Mising name is currently offline sowmya Mising name
Messages: 51
Registered: July 2009
Member
Hi
I have used my own actionProvider class to override copy action from
package explorer but my actionProvider(MindmapNavigatorActionProvider)
class does not get invoked at all. I want my action provider to get
invoked whenever i try to perform a copy on the file of the diagram type.
This is how i have added registered the action handler in the extension
point. Can you pleas tell how u cud get your own action provider invoked .

<extension point="org.eclipse.ui.navigator.navigatorContent">
<?gmfgen generated="true"?>
<navigatorContent
id="org.eclipse.gmf.examples.mindmap.diagram.resourceContent "
name="%navigatorContentName"
priority="normal"

contentProvider=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapNa vigatorContentProvider "

labelProvider=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapNa vigatorLabelProvider "
icon="icons/obj16/MindmapDiagramFile.gif"
activeByDefault="true">
<triggerPoints>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.core.resources.extension"
value="mmd"/>
</and>
<instanceof
value=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapAb stractNavigatorItem "/>
<adapt type="org.eclipse.gmf.runtime.notation.View">
<test
property="org.eclipse.gmf.examples.mindmap.diagram.isShortcut "/>
</adapt>
</or>
</triggerPoints>
<possibleChildren>
<or>
<instanceof
value=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapAb stractNavigatorItem "/>
<adapt type="org.eclipse.gmf.runtime.notation.View">
<test
property="org.eclipse.gmf.examples.mindmap.diagram.isShortcut "/>
</adapt>
</or>
</possibleChildren>
<commonSorter

id="org.eclipse.gmf.examples.mindmap.diagram.navigatorSorter "

class=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapNa vigatorSorter ">
<parentExpression>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.core.resources.extension"
value="mmd"/>
</and>
<instanceof
value=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapAb stractNavigatorItem "/>
</or>
</parentExpression>
</commonSorter>
</navigatorContent>
<navigatorContent

id=" org.eclipse.gmf.examples.mindmap.diagram.domainResourceConte nt "
name="%domainNavigatorContentName"
priority="normal"

contentProvider=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapDo mainNavigatorContentProvider "

labelProvider=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapDo mainNavigatorLabelProvider "
icon="icons/obj16/MindmapDiagramFile.gif"
activeByDefault="true">
<triggerPoints>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.core.resources.extension"
value="mindmap"/>
</and>
<and>
<instanceof value="org.eclipse.emf.ecore.EObject"/>
<test
property=" org.eclipse.gmf.examples.mindmap.diagram.isDomainModelElemen t "/>
</and>
</or>
</triggerPoints>
<possibleChildren>
<and>
<instanceof value="org.eclipse.emf.ecore.EObject"/>
<test
property=" org.eclipse.gmf.examples.mindmap.diagram.isDomainModelElemen t "/>
</and>
</possibleChildren>
</navigatorContent>
<actionProvider

id=" org.eclipse.gmf.examples.mindmap.diagram.navigatorActionProv ider "

class=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapNa vigatorActionProvider ">
<enablement>
<or>
<instanceof
value=" org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapAb stractNavigatorItem "/>
<adapt type="org.eclipse.gmf.runtime.notation.View">
<test
property="org.eclipse.gmf.examples.mindmap.diagram.isShortcut "/>
</adapt>
</or>
</enablement>
</actionProvider>
Previous Topic:Avoiding a selection change during a drag
Next Topic:slow multi-user startup of eclipse
Goto Forum:
  


Current Time: Mon Oct 20 08:14:35 GMT 2014

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

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