Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 87269 - [ActivityMgmt] improve activity set manipulation
Summary: [ActivityMgmt] improve activity set manipulation
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Kim Horne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 80130
  Show dependency tree
 
Reported: 2005-03-07 10:04 EST by Kim Horne CLA
Modified: 2005-03-30 11:08 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Horne CLA 2005-03-07 10:04:46 EST
Workbench needs to provide utility mechanisms that can help clients determine
dependencies between sets of activities and categories.
Comment 1 Kim Horne CLA 2005-03-07 10:06:34 EST
From 80130:

2) apis that allow the following: given a category, give me all categories 
that will be enabled/disabled if this category is enabled/disabled.  
For Atlantic, we needed to prompt the user with a list of categories (aka 
roles) that will be enabled if he enabled a certain category. This was a bit 
difficult with the current apis because I had to do the logic of taking the 
current category, looking at all its activities (and all there dependant 
activities) and figuring out given this set of newly enabled activities, what 
categories will be enabled. an api would be great.

3)  apis that allow the following: given a activity, tell me whether or not I 
can disable this activity. 
Again, we needed to know this because if a user disabled a category we did NOT 
want to disable other categories under the hood. We did not even want to 
prompt the user. He does not need to know. So, we had to, given a list of 
activities from the category we wanted to disable, we had to figure out if 
there is any enabled category that had any of these activities enabled. if 
yes, then we did not disable this activity when disabling the category, 
because disabling this activity disabled another category and we did not want 
that. Again, an api would have made sense here. 
Comment 2 Kim Horne CLA 2005-03-07 10:08:43 EST
Some initial code in head in WorkbenchActivityHelper.

You can ask the helper what categories will be enabled/disabled if a given
category is enabled.  I went with the assumption (correct me if I'm wrong) that
you would only be interested in categories that would actually change if the
given category is changed.  Ie: if the given category is already disabled then
don't return it in the list of those that would be disabled.  Hope that makes sense.
Comment 3 Kim Horne CLA 2005-03-07 10:47:26 EST
Mazen: For point 3 above, would a method such as Set
getEnabledCategoriesForActivity(String activityId) be sufficient?  It would
return the set of all fully enabled categories that this activity belongs to and
you could use that to drive your logic?  I'm hesitant to add any highly
specialized logic to the activity framework such as "can i disable this
activity" because that's a policy decision and we don't want to code any more of
that into the engine.
Comment 4 Kim Horne CLA 2005-03-23 11:47:23 EST
Mazen, do you think it's wise to offer this as API at this point?  We havnt had
time to review it properly and the only client at this point is a Workbench
page.  I would be much more comfortable pulling it out of
WorkbenchActivityHelper and into an internal class for the time being.
Comment 5 Mazen Faraj CLA 2005-03-23 11:51:22 EST
when you say "this", which api in the class are you specifically refereing to? 
or are you talking about making the whole helper class internal? (Apologies 
Kim for not being quicker to use these apis). 

Im already using one of the apis and (will use more soon):
 WorkbenchActivityHelper.isEnabled(
                activityManager, category.getId());

Comment 6 Kim Horne CLA 2005-03-23 12:02:29 EST
I was only referring to the new methods I've added for 3.1 relating to category
managment.  I can never get rid of this class - API sticks around forever here.
 Which is exactly why I'm so concerned with keeping it when I've had 0 feedback
regarding its usefullness and correctness.
Comment 7 Mazen Faraj CLA 2005-03-23 12:34:38 EST
Kim,
I was in the middle of using 
getEnabledCategories(IActivityManager activityManager,
                                       String categoryId)
and 
getDisabledCategories(IActivityManager activityManager,
                                        String categoryId)

in the platform SDK. Intro happens to be a client that needs to poke around in 
the activity support, and this is why I agve you the feedback. Other clients 
will need them too. 

So to give you feedback about usefeullness, yes they are usefull. To give you 
the facts straight, I have used only the apis that I have mentioned so far. 
They seem to cover cases I can think off, because they are powerfull. They do 
all the logic that I gave you feedback on. You can make a decision about the 
other apis (eg: the apis manipulating activities).

To give you feedback about correctness (eg: bugs), give me until tomorrow.  

First bug, in docs: 
for the  
getDisabledCategories(IActivityManager activityManager,
                                        String categoryId)
the docs say: 
Return a list of category ids that will become implicity disabled if the given 
category becomes disabled. Note that the set returned by this set represents 
the delta of categories that would be enabled - if the category is already 
enabled then it is omitted.  

it should say: 
Note that the set returned by this set represents the delta of categories that 
would be disabled - if the category is already disabled then it is omitted.  

Comment 8 Mazen Faraj CLA 2005-03-23 12:35:29 EST
and btw, 
what do you mean in the docs:
Parameters:
activityManager - the activity manager to test against *

do I have to clone an activityManager before I use it? 
Comment 9 Kim Horne CLA 2005-03-23 14:05:20 EST
My main concern is that the utility methods I've added are only useful for our
(the SDKs) particular model for activities and categories.  You could make the
argument that a category is never enabled or disabled, but rather can be fully
enabled, partially disabled, or totally disabled.  You could also argue that our
currently criteria for "enabled" is wrong.  You could argue that if ANY
contained activity is enabled then it too is enabled.  That's the root of my
apprehension.  If you're already making use of them, however, I'll leave them be. 

To answer your question regarding cloning, no.  You don't need to work on a
clone of the activity manager.  That parameter was added so that you COULD work
on a clone.  This was very useful for the preference page, for instance.
Comment 10 Mazen Faraj CLA 2005-03-23 14:18:09 EST
The new helper apis are good to clear any confusion. A category is enabled if 
all its activities are enabled. simple fact. Now, if you want to figure out 
the dependancies between categories, go to the wokbench helper class. 
I think this is a simple story.  
Comment 11 Kim Horne CLA 2005-03-28 15:51:11 EST
Marking as fixed.
Comment 12 Kim Horne CLA 2005-03-30 11:08:45 EST
Verified that the API is in place in I20050330-0500