Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Generic Context Menus for StyledText Control
Generic Context Menus for StyledText Control [message #436849] Tue, 25 May 2004 21:21 Go to next message
Saurabh Bagrodia is currently offline Saurabh BagrodiaFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

I am creating a StyledText control and was wondering is there a generic
context menu for this control like there is for the Text control (Undo,
Cut, Copy, Paste, Delete and SelectAll)??... Currently I am providing my
own context menu but I think I should re-use a generic one if there is one
as all I want to do are the standard operations and so want the StyledText
to behave exactky like the Text control in that respect!

Also I was wondering how the generic context menu for the Text control is
implemented as I was trying to debug and could not find out where the
actions in the generic context menu for the text control are implemented.

Cheers - Saurabh
Re: Generic Context Menus for StyledText Control [message #436852 is a reply to message #436849] Tue, 25 May 2004 21:39 Go to previous messageGo to next message
Henning Rogge is currently offline Henning RoggeFriend
Messages: 148
Registered: July 2009
Senior Member
Saurabh Bagrodia wrote:

> I am creating a StyledText control and was wondering is there a generic
> context menu for this control like there is for the Text control (Undo,
> Cut, Copy, Paste, Delete and SelectAll)??... Currently I am providing my
> own context menu but I think I should re-use a generic one if there is one
> as all I want to do are the standard operations and so want the StyledText
> to behave exactky like the Text control in that respect!

IActionBars bars = getSite().getActionBars();
bars.setGlobalActionHandler(...)

is used to tell eclipse that it should call your action when a certain
retargetable global menu ( cut/copy/paste/ect. ) is activated.

> Also I was wondering how the generic context menu for the Text control is
> implemented as I was trying to debug and could not find out where the
> actions in the generic context menu for the text control are implemented.

look for TextViewer.canDoOperation(int) and TextViewer.doOperation(int)

Henning Rogge.
Re: Generic Context Menus for StyledText Control [message #436951 is a reply to message #436852] Wed, 26 May 2004 15:55 Go to previous message
Saurabh Bagrodia is currently offline Saurabh BagrodiaFriend
Messages: 4
Registered: July 2009
Junior Member
Thanks for the quick response Henning. And your suggestion to look into
TextViewer.canDoOperation(int) and TextViewer.doOperation(int) helped me
re-implement my context menu in a better way :).

But the question that I wanted to ask was why there is no "out-of-the-box"
context menu for StyledText as there is for the Text widget. And if this
was the intended design that what was the reasoning behind not providing
for an "out-of-the-box" context menu for StyledText??

Futhermore I was wondering how is the "out-of-the-box" context menu for
the Text widget implemented??

Cheers - Saurabh


Henning Rogge wrote:

> Saurabh Bagrodia wrote:

> > I am creating a StyledText control and was wondering is there a generic
> > context menu for this control like there is for the Text control (Undo,
> > Cut, Copy, Paste, Delete and SelectAll)??... Currently I am providing my
> > own context menu but I think I should re-use a generic one if there is one
> > as all I want to do are the standard operations and so want the StyledText
> > to behave exactky like the Text control in that respect!

> IActionBars bars = getSite().getActionBars();
> bars.setGlobalActionHandler(...)

> is used to tell eclipse that it should call your action when a certain
> retargetable global menu ( cut/copy/paste/ect. ) is activated.

> > Also I was wondering how the generic context menu for the Text control is
> > implemented as I was trying to debug and could not find out where the
> > actions in the generic context menu for the text control are implemented.

> look for TextViewer.canDoOperation(int) and TextViewer.doOperation(int)

> Henning Rogge.
Previous Topic:Stupid (hopefully easy) drag and drop question
Next Topic:Generic Context Menus for StyledText Control
Goto Forum:
  


Current Time: Tue Apr 23 08:27:34 GMT 2024

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

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

Back to the top