Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Command Handler + KeyBinding = Freezing
Command Handler + KeyBinding = Freezing [message #668035] Tue, 03 May 2011 09:42 Go to next message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

Hi, I am trying to catch a key combination and execute some code. In plugin.xml I define the command, the binding and the handler:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.commands">
      <command
            id="it.polito.softeng.momaapp.customgmfcode.InsertPortion"
            name="InsertPortion">
       
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.bindings">
      <key
            commandId="it.polito.softeng.momaapp.customgmfcode.InsertPortion"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M1+I">
      </key>
   </extension>
   <extension
         point="org.eclipse.ui.handlers">
      <handler
            class="MyHandler"
            commandId="it.polito.softeng.momaapp.customgmfcode.InsertPortion">
      </handler>
   </extension>

</plugin>


The binding appears under the Key Binding list in my RCP application but when I press ctrl+I the rcp application freezes (no error messages are shown in the console of the Eclipse IDE where I am developing the plugins). Any ideas?


Re: Command Handler + KeyBinding = Freezing [message #668054 is a reply to message #668035] Tue, 03 May 2011 10:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

On 05/03/2011 09:42 AM, Federico Tomassetti wrote:
>
> The binding appears under the Key Binding list in my RCP application but
> when I press ctrl+I the rcp application freezes (no error messages are
> shown in the console of the Eclipse IDE where I am developing the
> plugins). Any ideas?
>

Is your handler being called? Place a breakpoint in your handler execute(*)

If it is truly frozen you can also follow steps from
http://wiki.eclipse.org/index.php/How_to_report_a_deadlock to find out
what your RCP/java is doing.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Command Handler + KeyBinding = Freezing [message #668055 is a reply to message #668054] Tue, 03 May 2011 10:40 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

I tried using a JOptionPane.showMessage(...) and throwing an exception: it is not called.

Thank you for the link (http://wiki.eclipse.org/index.php/How_to_report_a_deadlock) I did not know it.


Re: Command Handler + KeyBinding = Freezing [message #668124 is a reply to message #668035] Tue, 03 May 2011 16:40 Go to previous messageGo to next message
Carlo Salinari is currently offline Carlo Salinari
Messages: 66
Registered: October 2010
Member
On 5/3/2011 3:42 PM, Federico Tomassetti wrote:
> The binding appears under the Key Binding list in my RCP application but when I press ctrl+I the rcp application freezes (no error messages are shown in the console of the Eclipse IDE where I am developing the plugins). Any ideas?

This may sound a bit silly, but did you try changing the key sequence?

Ctrl+I is already defined in
org.eclipse.ui.defaultAcceleratorConfiguration for "Correct
Indentation", and unless you declare a custom scheme, I think that
setting is overriding yours.
Re: Command Handler + KeyBinding = Freezing [message #668237 is a reply to message #668055] Wed, 04 May 2011 11:33 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

On 05/03/2011 10:40 AM, Federico Tomassetti wrote:
> I tried using a JOptionPane.showMessage(...) and throwing an exception:
> it is not called.

JOptionPane is a Swing method, and has to run in the EDT. Your handler
would be run in the SWT UI thread (which is different), and if you just
call JOptionPane from the SWT UI Thread that guarantees bad behaviour.

1) actually debug your code or
2) put a sysout to print to the console.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Command Handler + KeyBinding = Freezing [message #668310 is a reply to message #668124] Thu, 05 May 2011 03:17 Go to previous message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

I don't think it overrides my binding because from the menu I can see that combination is associated with my command.

Maybe Swing doesn't work there but the exception is fired anyway... so I think I should get some reaction.


Previous Topic:CNF: Remove SOME popup options from the ones that are platform contributions
Next Topic:Implements my own search
Goto Forum:
  


Current Time: Thu Apr 17 08:38:58 EDT 2014

Powered by FUDForum. Page generated in 0.03367 seconds