Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Context menu and Print
Context menu and Print [message #185149] Thu, 23 June 2005 07:44 Go to next message
Eclipse UserFriend
Originally posted by: ngocdannytn.sbcglobal.net

Hi,

I tried to add Print action into my context menu as below
GEFActionConstants.addStandardActionGroups(menu);

IAction action;



action = getActionRegistry().getAction(ActionFactory.PRINT.getId());

menu.appendToGroup(GEFActionConstants.GROUP_PRINT, action);

However, the popup menu shows the item with no text/label eventhough
clicking on the menu item still executes the PRINT action. Please help.

Thank you.

Danny
Re: Context menu and Print [message #185192 is a reply to message #185149] Thu, 23 June 2005 13:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Replace the following line

action = getActionRegistry().getAction(ActionFactory.PRINT.getId());

with this.

action = getActionRegistry().getAction(GEFActionConstants.PRINT);

Harsh
Re: Context menu and Print [message #185239 is a reply to message #185192] Thu, 23 June 2005 18:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ngocdannytn.sbcglobal.net

I used that originally but it was deprecated and it told me to use
ActionFactory.PRINT.getId();

Regards,
Danny
The field IWorkbenchActionConstants.PRINT is deprecated

"Harsh Sabikhi" <harsh@ti.com> wrote in message
news:76aa2faac86317a630e7fa8a7c51c069$1@www.eclipse.org...
> Replace the following line
>
> action = getActionRegistry().getAction(ActionFactory.PRINT.getId());
>
> with this.
>
> action = getActionRegistry().getAction(GEFActionConstants.PRINT);
>
> Harsh
>
Re: Context menu and Print [message #192163 is a reply to message #185149] Mon, 15 August 2005 16:40 Go to previous messageGo to next message
Nick Allen is currently offline Nick AllenFriend
Messages: 23
Registered: July 2009
Junior Member
On Thu, 23 Jun 2005 00:44:12 -0700, Danny Nguyen wrote:

> However, the popup menu shows the item with no text/label eventhough
> clicking on the menu item still executes the PRINT action. Please help.

Danny, did you ever find a solution to your problem?

I am having the same problem with Cut, Copy, and Paste actions that I am
trying to contribute to the context menu. When I add the same actions
to the toolbar or a menu, the cut, copy, paste images appear as normal.
Re: Context menu and Print [message #192170 is a reply to message #192163] Mon, 15 August 2005 17:13 Go to previous messageGo to next message
Nick Allen is currently offline Nick AllenFriend
Messages: 23
Registered: July 2009
Junior Member
On Mon, 15 Aug 2005 12:40:15 -0400, Nick Allen wrote:
> I am having the same problem with Cut, Copy, and Paste actions that I am
> trying to contribute to the context menu. When I add the same actions
> to the toolbar or a menu, the cut, copy, paste images appear as normal.

The problems seem to only appear with actions which are not
always enabled. For instance, my cut and copy actions are only enabled
when a copy-able/cut-able element is selected.

I would like the behavior of the provided Delete action. If the
action is not enabled, the action appears shaded in the context menu, but
still visible.
Re: Context menu and Print [message #192178 is a reply to message #192170] Mon, 15 August 2005 17:32 Go to previous message
Nick Allen is currently offline Nick AllenFriend
Messages: 23
Registered: July 2009
Junior Member
On Mon, 15 Aug 2005 13:13:42 -0400, Nick Allen wrote:
> I would like the behavior of the provided Delete action. If the
> action is not enabled, the action appears shaded in the context menu, but
> still visible.

After looking at the provided DeleteAction I found the problem. I needed
to provide the proper images, tooltip text, etc for the CopyAction,
CutAction, and PasteActions that I created.

I simply followed the lead of DeleteAction.init()...

/**
* Initializes this action's text and images.
*/
protected void init() {
super.init();
setText(GEFMessages.DeleteAction_Label);
setToolTipText(GEFMessages.DeleteAction_Tooltip);
setId(ActionFactory.DELETE.getId());
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
setImageDescriptor(sharedImages.getImageDescriptor(ISharedIm ages.IMG_TOOL_DELETE));
setDisabledImageDescriptor(sharedImages.getImageDescriptor(
ISharedImages.IMG_TOOL_DELETE_DISABLED));
setEnabled(false);
}
Previous Topic:Rules used to decorate a polyline
Next Topic:Adding children editparts with zoom does not scale the text
Goto Forum:
  


Current Time: Thu Sep 19 02:30:54 GMT 2024

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

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

Back to the top