Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Activities] how to use activityPatternBinding's with one's own newly-defined extension-point?
[Activities] how to use activityPatternBinding's with one's own newly-defined extension-point? [message #309785] Wed, 08 November 2006 18:09 Go to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
R3.2.1, WinXP

So, I define a whole new extension-point (write the EXSD file, etc.), plug into it, all cool. Here's
an example of my plugging into it (the EXSD says the "class" must implement ISomeStrategy):

<extension
point="com.mun.ist.app.theStrategy">
<strategy
class="com.mun.ist.app.strategies.MySimpleStrategy"
id="simpleStrategyId"
label="Strategy to do what I like"/>
</extension>

Now I want to place my new extension-point under the activities framework, so I write an
activityPatternBinding for it, like this (the extending class and XML are indeed in plugin
com.mun.ist.app; there is a working activity called com.mun.ist.app.expertUserActivity):

<activityPatternBinding
activityId="com.mun.ist.app.expertUserActivity"
pattern="com\.mun\.ist\.app/simpleStrategyId"/>

Now, how will my id become known to the activities framework? The clue is at the very full
discussion here:
http://eclipse.pookzilla.net/2006/10/context-capability-and- perspective.php
So I create from my IConfigurationElement a factory-class which itself extends IPluginContribution,
and ensure that the correct plugin and local ids are being returned. (Read the code at
ActionSetDescriptor as aguide to how to work.)

Fails: the stragey is just as available as if the activityPatternBinding were commented out. So --
there must be another step needed in order to get activityPatternBinding's to play nicely with
home-grown extension-points. What is that step? (Guess: I need to "register" each
IPluginContribution with the FooManager?)

thanks
Paul
Re: [Activities] how to use activityPatternBinding's with one's own newly-defined extension-point? [message #309808 is a reply to message #309785] Thu, 09 November 2006 15:29 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Paul Keyser wrote:

>
> Fails: the stragey is just as available as if the activityPatternBinding
> were commented out. So -- there must be another step needed in order to
> get activityPatternBinding's to play nicely with home-grown
> extension-points. What is that step? (Guess: I need to "register" each
> IPluginContribution with the FooManager?)
>
> thanks
> Paul
>

When you call WorkbenchActivityHelper.filterItem(pc) before you show one
of your filtered items, does it return true or false?

Later,
PW


Re: [Activities] how to use activityPatternBinding's with one's own newly-defined extension-point? [message #309829 is a reply to message #309808] Thu, 09 November 2006 23:09 Go to previous messageGo to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
Paul Webster wrote:
> Paul Keyser wrote:
>
....
> When you call WorkbenchActivityHelper.filterItem(pc) before you show one
> of your filtered items, does it return true or false?
>

false (whether or not I have the relevant activity enabled or not)

I checked the IIdentifier's state in the debugger, and it is indeed being passed the relevant
activity, as well as the apparently-correct "unified" id, i.e., "com.mun.ist.app/simpleStrategyId".
If I understand the contract of filterItem(), its return-value is to be read as:

<pseudocode>filterItem() ? hideItem() : showItem()</pseudocode>

Correct? Anyway, if it *always* returns *one* value, I must be doing something else wrong, eh?

thanks,
Paul
Re: [Activities] how to use activityPatternBinding's with one's own newly-define [message #309862 is a reply to message #309829] Fri, 10 November 2006 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kim_horne.ca.ibm.com

Paul Keyser wrote:

That pseudocode looks okay. Without seeing your code in action I don't
know why it's not working - there's no special trick to getting activities
to work with third party extension points. You define your activities,
you define your bindings, and you ensure that the code you use to show
your extensions passes appropriate IPluginContribtion objects to
WorkbenchActivityHelper.filterItem(). You might want to set a
breakpoint in MutableActivityManager.updateIdentifier and see what happens
when your activity.isMatch() is called.

> Paul Webster wrote:

> false (whether or not I have the relevant activity enabled or not)

> I checked the IIdentifier's state in the debugger, and it is indeed being
passed the relevant
> activity, as well as the apparently-correct "unified" id, i.e.,
"com.mun.ist.app/simpleStrategyId".
> If I understand the contract of filterItem(), its return-value is to be read
as:

> <pseudocode>filterItem() ? hideItem() : showItem()</pseudocode>

> Correct? Anyway, if it *always* returns *one* value, I must be doing
something else wrong, eh?

> thanks,
> Paul
Re: [Activities] how to use activityPatternBinding's with one's own newly-define [message #309886 is a reply to message #309862] Fri, 10 November 2006 19:41 Go to previous messageGo to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
Kimberly Horne wrote:

> Paul Keyser wrote:
>
> That pseudocode looks okay. Without seeing your code in action I don't
> know why it's not working - there's no special trick to getting
> activities to work with third party extension points. You define your
> activities, you define your bindings, and you ensure that the code you
> use to show your extensions passes appropriate IPluginContribtion
> objects to WorkbenchActivityHelper.filterItem(). You might want to
> set a breakpoint in MutableActivityManager.updateIdentifier and see what
> happens when your activity.isMatch() is called.
>

Well, I don't exactly know what I was doing wrong before, but this time when I uncommented the two
lines of Java and the extension to plug my Foo in, it all worked. It *may* be that formerly I did
not clear out the cache in
....\eclipse\runtime-MyRCP.product\.metadata\.plugins\org.ec lipse.core.runtime\.settings\org.eclipse.ui.wrokbench.prefs
-- this time I did (I may have the filename wrong -- it's gone now).

Very nice system!

BTW, what determines the order in which the categories are listed in GUI of the activities
pref-page? (Seems like it's alphabetical by id of first activity added to the category, which seems
a bit random.)

thanks,
Paul
Re: [Activities] how to use activityPatternBinding's with one's own newly-define [message #309972 is a reply to message #309886] Mon, 13 November 2006 20:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kim_horne.ca.ibm.com

Paul Keyser wrote:


> Very nice system!

Thanks!



> BTW, what determines the order in which the categories are listed in GUI of
the activities
> pref-page? (Seems like it's alphabetical by id of first activity added to
the category, which seems
> a bit random.)

In 3.2 this is the behaviour. We addressed this in 3.3 and it's now
displaying the items alphabetically according to their user-friendly name.

> thanks,
> Paul
Re: [Activities] how to use activityPatternBinding's with one's own newly-define [message #309992 is a reply to message #309972] Tue, 14 November 2006 20:00 Go to previous message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
>> BTW, what determines the order in which the categories are listed in
>> GUI of the activities pref-page? (Seems like it's alphabetical by id
>> of first activity added to the category, which seems a bit random.)
>
> In 3.2 this is the behaviour. We addressed this in 3.3 and it's now
> displaying the items alphabetically according to their user-friendly name.
>
Good, when my group gets up to 3.3 I can stop alphabetizing my activity-id's :)

Meanwhile, I'm still needing help with a post from a while back, "binding
activities to help?" -- is it indeed the case that actvityPatternBinding's
can be used to enable/diable *only* TOC files in the help system (and not
individual HTML files)?

If so, any suggestions on where to go to learn more about setting up TOC
files? (i.e., in that case, I'd want to have a full TOC-hierarchy to match
my activities, right?)

thanks,
Paul
Previous Topic:setSelection on virtual Tree VERY slow
Next Topic:Create a file in the workspace
Goto Forum:
  


Current Time: Fri Apr 19 11:17:09 GMT 2024

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

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

Back to the top