| [news.eclipse.tools.emf] Re: Limit Copy, Paste, Cut keyboard shortcuts to EMF tree only (not the entire editor) |
|
Hi Paul an Tom, With some extra inspiration, I found the solution to my problem. Here it is: textName.addFocusListener(new FocusListener() { IAction emfcutaction = detailsPage.getActionBars().getGlobalActionHandler(ActionFactory.CUT.getId()); IAction emfcopyaction = detailsPage.getActionBars().getGlobalActionHandler(ActionFactory.COPY.getId()); IAction emfpasteaction = detailsPage.getActionBars().getGlobalActionHandler(ActionFactory.PASTE.getId()); IAction standardCut = new Action() { public void run() { textName.cut(); } }; IAction standardCopy = new Action() { public void run() { textName.copy(); } }; IAction standardPaste = new Action() { public void run() { textName.paste(); } }; public void focusLost(FocusEvent e) { detailsPage.getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), emfcutaction); detailsPage.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), emfcopyaction); detailsPage.getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), emfpasteaction); detailsPage.getActionBars().updateActionBars(); } public void focusGained(FocusEvent e) { detailsPage.getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), standardCut); detailsPage.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), standardCopy); detailsPage.getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), standardPaste); detailsPage.getActionBars().updateActionBars(); } }); Thanks for your help. Mircea Paul Webster wrote: Mircea Luchian wrote: |