Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » how to display a PropertyDialog from context menu?
how to display a PropertyDialog from context menu? [message #179490] Thu, 28 April 2005 02:52 Go to next message
Eclipse UserFriend
Originally posted by: Angel.Roman.prismtech.com

Hi Everyone,

I would like to add an action (Properties) to my editor that would
launch a PropertyDialog whenever the user clicks on the action via the
context menu in my editor. How should I approach this?

I understand that I need to add the action to the action registry by
overriding createActions in my GraphicalEditor. Which action should I
add? I encountered the PropertyDialogAction action, however,
PopertyDialogAction requires a shell. Which shell? Is there more than
one shell? should I call getControl().getShell()? or should I call
PlatformUI....getShell()?


Regards,
Angel
Re: how to display a PropertyDialog from context menu? [message #179498 is a reply to message #179490] Thu, 28 April 2005 03:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Angel.Roman.prismtech.com

Angel Roman wrote:
> Hi Everyone,
>
> I would like to add an action (Properties) to my editor that would
> launch a PropertyDialog whenever the user clicks on the action via the
> context menu in my editor. How should I approach this?
>
> I understand that I need to add the action to the action registry by
> overriding createActions in my GraphicalEditor. Which action should I
> add? I encountered the PropertyDialogAction action, however,
> PopertyDialogAction requires a shell. Which shell? Is there more than
> one shell? should I call getControl().getShell()? or should I call
> PlatformUI....getShell()?
>
>
> Regards,
> Angel

I am launching a propertydialog by creating a PropertyDialogAction
during configureGraphicalViewer() and adding it to the ActionRegistry in
the mean time. It seems that I should be able to register the action
during createActions() therefore, I believe that a better method would
be for me to create my own IAction (or extend from an existing one) that
is not dependent on obtaining a graphical viewer and somehow display the
property dialog during the run() method or have my action be an
adapter for PropertyDialogAction. If there's a simpler way to display
the property dialog on an editpart (via the context menu) any help would
be greatly appreciated. To throw a curve ball into this, only some
editparts should enable the property action. How do I go about this?

Thansk in advance,
Angel
Re: how to display a PropertyDialog from context menu? [message #179657 is a reply to message #179498] Fri, 29 April 2005 07:21 Go to previous message
Eclipse UserFriend
Originally posted by: nathanoj.gmail.com

What i did is i implemented SelectionAction and then added my action in the
createActions() method of my EditorPart using the following code:

action = new MySelectionAction((IWorkbenchPart)this);
registry.registerAction(action);
getSelectionActions().add(action.getId());

Then just override the calculateEnabled method of the SelectionAction to
target only those editparts that this action would be enabled and the run
method to open your PropertyDialogAction...

Hope this helps....

Jon

"Angel Roman" <Angel.Roman@prismtech.com> wrote in message
news:d4pmhs$sfv$1@news.eclipse.org...
> Angel Roman wrote:
>> Hi Everyone,
>>
>> I would like to add an action (Properties) to my editor that would launch
>> a PropertyDialog whenever the user clicks on the action via the context
>> menu in my editor. How should I approach this?
>>
>> I understand that I need to add the action to the action registry by
>> overriding createActions in my GraphicalEditor. Which action should I
>> add? I encountered the PropertyDialogAction action, however,
>> PopertyDialogAction requires a shell. Which shell? Is there more than one
>> shell? should I call getControl().getShell()? or should I call
>> PlatformUI....getShell()?
>>
>>
>> Regards,
>> Angel
>
> I am launching a propertydialog by creating a PropertyDialogAction during
> configureGraphicalViewer() and adding it to the ActionRegistry in the mean
> time. It seems that I should be able to register the action during
> createActions() therefore, I believe that a better method would be for me
> to create my own IAction (or extend from an existing one) that is not
> dependent on obtaining a graphical viewer and somehow display the property
> dialog during the run() method or have my action be an adapter for
> PropertyDialogAction. If there's a simpler way to display the property
> dialog on an editpart (via the context menu) any help would be greatly
> appreciated. To throw a curve ball into this, only some editparts should
> enable the property action. How do I go about this?
>
> Thansk in advance,
> Angel
Previous Topic:Problem with GEF/EMF Workflow example under Linux
Next Topic:Prevent certain connections
Goto Forum:
  


Current Time: Tue Apr 23 15:27:44 GMT 2024

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

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

Back to the top