Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » anything like org.eclipse.ui.actions.TextActionHandler for FormText?
anything like org.eclipse.ui.actions.TextActionHandler for FormText? [message #299904] Mon, 27 February 2006 18:54 Go to next message
Eclipse UserFriend
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 #299979 is a reply to message #299904] Tue, 28 February 2006 10:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Paul Keyser wrote:
> 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?

Copy the TextActionHandler class, and change activeTextControl to be a
FormText. Alternatively, you can adopt a technique similar to that used in
WidgetMethodHandler (i.e., reflection).



cheers,
d.
Re: anything like org.eclipse.ui.actions.TextActionHandler for FormText? [message #301294 is a reply to message #299979] Mon, 27 March 2006 10:16 Go to previous message
Eclipse UserFriend
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
Previous Topic:Debug template extension
Next Topic:FormEditor Does Not Close When Project Deleted
Goto Forum:
  


Current Time: Wed Jul 23 11:20:46 EDT 2025

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

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

Back to the top