summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 06:03:01 (EDT)
committerEike Stepper2007-10-11 06:03:01 (EDT)
commitd4efae0b5518fcdd92afed8832e2bd237214f1d9 (patch)
tree8a669781f12dfbd3b0da30ea71c7c57c1993f168
parent073c022f883397b315664de66e4afd16a59e2442 (diff)
downloadcdo-d4efae0b5518fcdd92afed8832e2bd237214f1d9.zip
cdo-d4efae0b5518fcdd92afed8832e2bd237214f1d9.tar.gz
cdo-d4efae0b5518fcdd92afed8832e2bd237214f1d9.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/build.properties6
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/build.properties6
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/plugin.xml1
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/schema/facilityPaneCreators.exsd112
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java51
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java25
6 files changed, 196 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/build.properties b/plugins/org.eclipse.emf.cdo.ui/build.properties
index 93fed57..334259d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/build.properties
+++ b/plugins/org.eclipse.emf.cdo.ui/build.properties
@@ -17,4 +17,8 @@ bin.includes = META-INF/,\
plugin.properties,\
model/,\
icons/,\
- .options
+ .options,\
+ about.html,\
+ copyright.txt,\
+ epl-v10.html,\
+ license.html
diff --git a/plugins/org.eclipse.net4j.buddies.ui/build.properties b/plugins/org.eclipse.net4j.buddies.ui/build.properties
index 26b3bec..eb222fb 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/build.properties
+++ b/plugins/org.eclipse.net4j.buddies.ui/build.properties
@@ -16,4 +16,8 @@ bin.includes = META-INF/,\
plugin.xml,\
plugin.properties,\
icons/,\
- .options
+ .options,\
+ epl-v10.html,\
+ copyright.txt,\
+ about.html,\
+ schema/
diff --git a/plugins/org.eclipse.net4j.buddies.ui/plugin.xml b/plugins/org.eclipse.net4j.buddies.ui/plugin.xml
index 8c8c133..a38dfb8 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/plugin.xml
+++ b/plugins/org.eclipse.net4j.buddies.ui/plugin.xml
@@ -16,6 +16,7 @@
-->
<plugin>
+ <extension-point id="facilityPaneCreators" name="Facility Pane Creators" schema="schema/facilityPaneCreators.exsd"/>
<extension
point="org.eclipse.ui.preferencePages">
diff --git a/plugins/org.eclipse.net4j.buddies.ui/schema/facilityPaneCreators.exsd b/plugins/org.eclipse.net4j.buddies.ui/schema/facilityPaneCreators.exsd
new file mode 100644
index 0000000..9be9ac3
--- /dev/null
+++ b/plugins/org.eclipse.net4j.buddies.ui/schema/facilityPaneCreators.exsd
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.net4j.buddies.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.net4j.buddies.ui" id="facilityPaneCreators" name="Facility Pane Creators"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="facilityPaneCreator" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="facilityPaneCreator">
+ <complexType>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.net4j.buddies.ui.IFacilityPaneCreator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
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 0e0292e..4ee8e86 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
@@ -12,14 +12,17 @@ package org.eclipse.net4j.buddies.internal.ui.views;
import org.eclipse.net4j.buddies.IBuddyCollaboration;
import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.buddies.protocol.ICollaboration;
import org.eclipse.net4j.buddies.protocol.IFacility;
+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.UIUtil;
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.HashMap;
@@ -41,14 +44,16 @@ public class CollaborationsPane extends Composite implements IListener
private IBuddySession session;
+ private Map<IBuddyCollaboration, IFacility> activeFacilities = new HashMap<IBuddyCollaboration, IFacility>();
+
private Map<IFacility, FacilityPane> facilityPanes = new HashMap<IFacility, FacilityPane>();
- private Map<IBuddyCollaboration, IFacility> activeFacilities = new HashMap<IBuddyCollaboration, IFacility>();
+ private StackLayout paneStack;
public CollaborationsPane(Composite parent, CollaborationsView collaborationsView)
{
super(parent, SWT.NONE);
- setLayout(UIUtil.createGridLayout(1));
+ setLayout(paneStack = new StackLayout());
this.collaborationsView = collaborationsView;
collaborationsView.getViewer().addSelectionChangedListener(collaborationsViewerListener);
@@ -78,5 +83,45 @@ public class CollaborationsPane extends Composite implements IListener
public void notifyEvent(IEvent event)
{
+ if (session != null && event.getSource() == session.getSelf() && event instanceof IContainerEvent)
+ {
+ IContainerEvent<ICollaboration> e = (IContainerEvent<ICollaboration>)event;
+ e.accept(new IContainerEventVisitor<ICollaboration>()
+ {
+ public void added(ICollaboration collaboration)
+ {
+ collaborationAdded(collaboration);
+ }
+
+ public void removed(ICollaboration collaboration)
+ {
+ collaborationRemoved(collaboration);
+ }
+ });
+ }
+ }
+
+ protected void collaborationAdded(ICollaboration collaboration)
+ {
+ for (IFacility facility : collaboration.getFacilities())
+ {
+ addFacilityPane(facility);
+ }
+ }
+
+ protected void collaborationRemoved(ICollaboration collaboration)
+ {
+ }
+
+ protected FacilityPane addFacilityPane(IFacility facility)
+ {
+ FacilityPane pane = createFacilityPane(facility.getType());
+ facilityPanes.put(facility, pane);
+ return pane;
+ }
+
+ protected FacilityPane createFacilityPane(String type)
+ {
+ return null;
}
}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java
new file mode 100644
index 0000000..67892ac
--- /dev/null
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.buddies.ui;
+
+import org.eclipse.net4j.buddies.internal.ui.views.FacilityPane;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IFacilityPaneCreator
+{
+ public String getFacilityType();
+
+ public FacilityPane createFacilityPane(Composite parent, int style);
+}