| using shortcuts wile in text widgets run Eclipse command instead of text behavior [message #332522] | 
Fri, 24 October 2008 16:16   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: james.towers.siemens.com 
 
Hi, 
 
When we are in text widgets and use shortcut keys the bound Eclipse commands  
run instead of expected text behavior.  In text widgets we would like  
copy/cut/paste/delete to work in a text like manner.  If we are not in a  
text widget we would like the commands run. 
 
Currently if we select a model object in a Tree, position into a text field,  
select some text, and use M1+C, we copy the model object instead of the  
text.  The outcome is worse if we do the same except use the delete key as  
we delete the model object.  We noticed that if no model objects are seleted  
we get expected text behavior while in text fields. 
 
We are using Eclipse 3.3 menus/commands/handlers.  We have defined our own  
context for key bindings. 
 
We found the org.eclipse.ui.textEditorScope context and tried to use it in  
our activeWhen clauses....make the handler active when we are not in a text  
widget.  We discovered that o.e.u.contexts.dialogAndWindow/window were  
active even while in a text widget and o.e.u.textEditorScope was not. 
 
I'm hoping there is good way for us to get text behavior while in text  
widgets and command behavior while elsewhere.  Below I show some snippets of  
our handlers/contexts/keys using copy as an example...they are similar for  
cut/paste/delete. 
 
Thanks, 
Jim 
 
Handler: 
 
            <handler 
 
                  class="HandlerClass" 
 
                  commandId="org.eclipse.ui.edit.copy"> 
 
               <activeWhen> 
 
                   <iterate 
 
                         ifEmpty="false"> 
 
                      <adapt 
 
                            type="modelType"> 
 
                      </adapt> 
 
                   </iterate> 
 
               </activeWhen> 
 
            </handler> 
 
 
 
Context: 
 
 
 
   <extension point="org.eclipse.ui.contexts"> 
 
      <context 
 
            id="myContext" 
 
            name="myContext" 
 
            parentId="org.eclipse.ui.contexts.window"> 
 
      </context> 
 
 
 
 
 
bindings: 
 
 
 
   <extension point="org.eclipse.ui.contexts"> 
 
      <context 
 
            id="myContext" 
 
            name="myContext" 
 
            parentId="org.eclipse.ui.contexts.window"> 
 
      </context>
 |  
 |  
  | 
 | 
Powered by 
FUDForum. Page generated in 0.03657 seconds