summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 07:46:00 (EDT)
committerEike Stepper2007-10-11 07:46:00 (EDT)
commitc6517f0fccb9802dec214eda778ec30811387bb2 (patch)
treeb3c58f1907a1f23fa6e4c99b8148a5a03bacae15
parent4dac56083358f73743433bb51f51712ad2a8bd21 (diff)
downloadcdo-c6517f0fccb9802dec214eda778ec30811387bb2.zip
cdo-c6517f0fccb9802dec214eda778ec30811387bb2.tar.gz
cdo-c6517f0fccb9802dec214eda778ec30811387bb2.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java31
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java1
2 files changed, 32 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
index 6e09307..cddf40f 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.buddies.internal.ui.views;
+import org.eclipse.net4j.buddies.BuddiesUtil;
import org.eclipse.net4j.buddies.IBuddyCollaboration;
import org.eclipse.net4j.buddies.IBuddySession;
import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
@@ -22,18 +23,23 @@ import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.container.IContainerEventVisitor;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.widgets.Composite;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -60,6 +66,8 @@ public class CollaborationsPane extends Composite implements IListener
private Map<IFacility, FacilityPane> facilityPanes = new HashMap<IFacility, FacilityPane>();
+ private List<IAction> activateFacilityActions = new ArrayList<IAction>();
+
private StackLayout paneStack;
public CollaborationsPane(Composite parent, CollaborationsView collaborationsView)
@@ -145,6 +153,29 @@ public class CollaborationsPane extends Composite implements IListener
}
}
+ public void fillLocalToolBar(IToolBarManager manager)
+ {
+ for (String type : BuddiesUtil.getFacilityTypes())
+ {
+ final String facilityType = type;
+ IAction action = new SafeAction()
+ {
+ @Override
+ protected void safeRun() throws Exception
+ {
+ if (activeCollaboration != null)
+ {
+ IFacility facility = activeCollaboration.getFacility(facilityType);
+ setActiveFacility(activeCollaboration, facility);
+ }
+ }
+ };
+
+ activateFacilityActions.add(action);
+ manager.add(action);
+ }
+ }
+
public void notifyEvent(IEvent event)
{
if (session != null && event.getSource() == session.getSelf() && event instanceof IContainerEvent)
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
index d607820..2fcd5b3 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
@@ -56,6 +56,7 @@ public class CollaborationsView extends SessionManagerView
@Override
protected void fillLocalToolBar(IToolBarManager manager)
{
+ getCollaborationsPane().fillLocalToolBar(manager);
manager.add(new Separator());
super.fillLocalToolBar(manager);
}