Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Eclipse Integration (pop-menu enablement)

2 views
Skip to first unread message

Dave Couture

unread,
Feb 26, 2007, 11:19:44 PM2/26/07
to
Hi,

This may not be the right place to put this question, but I'm doing a
plug-in using Together 2006 R2, so I'm taking the chance. :-)

I have add options on the pop-menu of any modeling element
(com.tssap.selena.model.ui.IElementWrapper). I want to disable some of the
options based on conditions that cannot be extracted from the selected
element. Eclipse offers enablement option (<enablement>) on menu option
(<action>) (see
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_popupMenus.html).
My problem is that enablement options can ask only the selected class who is
a Together pluging class, not mine. And all the events offered by the
IObjectActionDelegate interface are called only when the user select the
menu option which is too late.

Basically, I need to check the metaclass and the stereotypes of the selected
element, scan a configuration file and then enable or not the menu options.

I think of one scenario that may works but I don't know how to make it
happen. I may add an Eclipse extension on the selection change where I can
look the metaclass and the stereotypes and set some system property. The
enablement of the pop-menu option will then use system property.

I've posted the same question on Eclipse Plugin Central
(http://www.eclipseplugincentral.com/index.php?name=PNphpBB2&file=viewtopic&p=11628#11628).

Any ideas?

Regards,

Dave


Dave Couture

unread,
Mar 5, 2007, 10:43:04 PM3/5/07
to
Hi,

I've found my answer. Part of my problem is that I'm a better .Net designer
and programmer than a Java one :wink: (sorry guys).

I'm using the setActivePart(IAction action, IWorkbenchPart targetPart)
method of my org.eclipse.ui.popupMenus extension to check which object is
selected and set the value of a system variable using
System.setProperty(java.lang.String arg0, java.lang.String arg1) based on
the selected object properties and my configuration file.

Then I'm my plugin.xml I'm using:

<enablement>
<systemProperty
name="variableName"
value="value"/>
</enablement>

Simple as that.

Regards,

Dave

See posted answer on Eclipse Plugin Central
(http://www.eclipseplugincentral.com/index.php?name=PNphpBB2&file=viewtopic&p=11645#11645)


"Dave Couture" <dave_c...@dmr.ca> a écrit dans le message de news:
45e3b126$1...@newsgroups.borland.com...

0 new messages