Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Activities have no effect
Activities have no effect [message #467301] Wed, 02 May 2007 15:40 Go to next message
Christoph is currently offline ChristophFriend
Messages: 55
Registered: July 2009
Member
Hello,
i have defined two activities in my rcp-application. I use these to show
respectively hide certain views and editors from the user depending on the
type of user logged in. But when i switch the activity by code it has no
effect, meaning that views, matched to activity A are shown when i switch
to activity B.

Here is how i have declared the activities in my core-plugin:

<extension point="org.eclipse.ui.activities">
<category
description="%geplan.category.activity.description"
id="de.gebitms.geplan.core.category.activity"
name="%geplan.category.activity.name"/>
<activity
description="%geplan.category.activity.admin.description"
id="de.gebitms.geplan.core.activity.admin"
name="%geplan.category.activity.admin.name"/>
<activity
description="%geplan.category.activity.user.description"
id="de.gebitms.geplan.core.activity.user"
name="%geplan.category.activity.user.name"/>
<categoryActivityBinding
activityId="de.gebitms.geplan.core.activity.admin"
categoryId="de.gebitms.geplan.core.category.activity"/>
<categoryActivityBinding
activityId="de.gebitms.geplan.core.activity.user"
categoryId="de.gebitms.geplan.core.category.activity"/>
</extension>

Here is how i match the view to the activities (within another plugin):

<extension point="org.eclipse.ui.activities">
<activityPatternBinding
activityId="de.gebitms.geplan.core.activity.admin"
pattern=" de\.gebitms\.geplan\.ui/de\.gebitms\.geplan\.ui\.editors\.Ba sislookuptabellenEditor "/>
</extension>

And here is how i switch between activities:

HashSet actSet = new HashSet();
// Puts the activity-id in the set, depending on the type of the user
being logged in.
if (UIPlugin.getUser().getArt()==1){
actSet.add("de.gebitms.geplan.core.activity.admin");
}else{
actSet.add("de.gebitms.geplan.core.activity.user");
}
PlatformUI.getWorkbench().getActivitySupport().setEnabledAct ivityIds(actSet);
// Reset the Perspective
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().resetPerspective();

As i said, this has no effect, when i switch to the user-activity, the
view is shown, although i have explicitly matched it only to the
admin-activity.

What am i doing wrong?

Thanks in advance for your time.
Christoph
Re: Activities have no effect [message #467432 is a reply to message #467301] Thu, 03 May 2007 20:36 Go to previous messageGo to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
I have successfully used actvities to hide Editors -- I assume that Views would be equivalent. I did
not check your XML-code. But I did notice that you did not mention any use of "trigger points", or
the IActivityManagerListener -- you would need to have one of those (in an RCP, I'd put it in my
WorkbenchWindowAdvisor, either as a field or have the WorkbenchWindowAdvisor implement that
interface), and its method activityManagerChanged() would need to call
Display.getDefault().asyncExec(someRunnable) [to get onto the GUI thread], where the Runnable would
then close any editors/views not compatible with the current list of enabled activities. Works for
editors. (Also for toolbar items.)

HTH,
Paul
Re: Activities have no effect [message #467459 is a reply to message #467432] Fri, 04 May 2007 06:27 Go to previous message
Christoph is currently offline ChristophFriend
Messages: 55
Registered: July 2009
Member
Thanks very much Paul. I will check that out. Sorry for posting that
often, but i was posting in another newsgroup, not noticing that it was
connected to this one.
Previous Topic:[RCP] Laying out a view in the plugin
Next Topic:Java 6 and Linux GTK errors (swt_awt)
Goto Forum:
  


Current Time: Fri Apr 26 03:45:53 GMT 2024

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

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

Back to the top