summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 06:50:08 (EDT)
committerEike Stepper2007-10-11 06:50:08 (EDT)
commite663ffce53a663908a2e5c344b0bee78392006e7 (patch)
tree2f85db03a687eaa745b8c64cef446f2c29d0f66a
parentc6a5b042dfd501c05662ea690aa01a58723529b0 (diff)
downloadcdo-e663ffce53a663908a2e5c344b0bee78392006e7.zip
cdo-e663ffce53a663908a2e5c344b0bee78392006e7.tar.gz
cdo-e663ffce53a663908a2e5c344b0bee78392006e7.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.java58
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java8
2 files changed, 60 insertions, 6 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 8f0a54d..3934f4f 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
@@ -93,14 +93,45 @@ public class CollaborationsPane extends Composite implements IListener
this.session = session;
}
+ public void setActiveCollaboration(IBuddyCollaboration collaboration)
+ {
+ if (activeCollaboration != collaboration)
+ {
+ activeCollaboration = collaboration;
+ IFacility facility = activeFacilities.get(collaboration);
+ if (facility != null)
+ {
+ setActiveFacility(collaboration, facility);
+ }
+ }
+ }
+
public void setActiveFacility(IBuddyCollaboration collaboration, IFacility facility)
{
activeFacilities.put(collaboration, facility);
if (collaboration == activeCollaboration)
{
FacilityPane facilityPane = facilityPanes.get(facility);
- paneStack.topControl = facilityPane;
+ setActiveFacilityPane(facilityPane);
+ }
+ }
+
+ protected void setActiveFacilityPane(FacilityPane newPane)
+ {
+ if (paneStack.topControl != newPane)
+ {
+ FacilityPane oldPane = (FacilityPane)paneStack.topControl;
+ if (oldPane != null)
+ {
+ oldPane.hidden(newPane);
+ }
+
+ paneStack.topControl = newPane;
layout();
+ if (newPane != null)
+ {
+ newPane.showed(oldPane);
+ }
}
}
@@ -113,26 +144,41 @@ public class CollaborationsPane extends Composite implements IListener
{
public void added(ICollaboration collaboration)
{
- collaborationAdded(collaboration);
+ collaborationAdded((IBuddyCollaboration)collaboration);
}
public void removed(ICollaboration collaboration)
{
- collaborationRemoved(collaboration);
+ collaborationRemoved((IBuddyCollaboration)collaboration);
}
});
}
+ else
+ {
+ System.out.println("EVENT: " + event);
+ }
}
- protected void collaborationAdded(ICollaboration collaboration)
+ protected void collaborationAdded(IBuddyCollaboration collaboration)
{
- for (IFacility facility : collaboration.getFacilities())
+ IFacility[] facilities = collaboration.getFacilities();
+ for (IFacility facility : facilities)
{
addFacilityPane(facility);
}
+
+ if (activeCollaboration == null)
+ {
+ setActiveCollaboration(collaboration);
+ }
+
+ if (facilities.length != 0)
+ {
+ setActiveFacility(collaboration, facilities[0]);
+ }
}
- protected void collaborationRemoved(ICollaboration collaboration)
+ protected void collaborationRemoved(IBuddyCollaboration collaboration)
{
}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java
index 2db0dec..feede5e 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java
@@ -21,4 +21,12 @@ public class FacilityPane extends Composite
{
super(parent, style);
}
+
+ public void hidden(FacilityPane newPane)
+ {
+ }
+
+ public void showed(FacilityPane oldPane)
+ {
+ }
}