anything like org.eclipse.ui.actions.TextActionHandler for FormText? [message #299904] |
Mon, 27 February 2006 18:54  |
Eclipse User |
|
|
|
R3.1.1; WinXP
The following (slightly pseudo-)code works fine for Text:
/**
* @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse .swt.events.FocusEvent)
*/
public void focusGained(FocusEvent e) {
final IActionBars bars = _editor.getEditorSite().getActionBars();
// this turns off the Ctrl-C/V/X during editing:
bars.clearGlobalActionHandlers();
bars.updateActionBars();
// now create the TextActionHandler for this Text
_textActionHandler = new TextActionHandler(bars);
_textActionHandler.addText(_text);
}
/**
* @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.s wt.events.FocusEvent)
*/
public void focusLost(FocusEvent e) {
if (_textActionHandler != null) {
_textActionHandler.removeText(_text);
}
// this restores the normal Ctrl-A/C/V/X function:
_editor.createMyEditorActionBarContributor().setActiveEditor (_editor);
}
protected final IEditorPart _editor;
protected final Text _text;
protected TextActionHandler _textActionHandler;
I'd like to do the same thing for FormText (where, I understand, I can only expect to get CTRL-C) --
is there a way?
thanks,
Paul
|
|
|
|
Re: anything like org.eclipse.ui.actions.TextActionHandler for FormText? [message #301294 is a reply to message #299979] |
Mon, 27 March 2006 10:16  |
Eclipse User |
|
|
|
Doug(las) --
(not sure whether you prefer Doug or Douglas)
I took your first suggestion, slightly modified (hoisted an abstract class out of TextActionHandler,
and then created two concrete subclasses, one for Text and the other for FormText), and although it
is clear that my basic structure is ok (my concrete "BasicTextActionHandler", for Text, works fine),
the FormText stubbornly ignores CTRL-C.
I tried setting breakpoints, but I cannot even get a breakpoint at Text.copy() to work (despite that
CTRL-C is working for Text -- some myestrious trick allows Text to copy on CTRL-C when I attach a
TextActionHandler, without calling copy(), but prevents copying on CTRL-C without the
TextActionHandler), let alone any breakpoints in FormText. Any further clues, or shall I report a bug?
thanks,
Paul
|
|
|
Powered by
FUDForum. Page generated in 0.03127 seconds