Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2005-02-16 06:34:50 +0000
committerslewis2005-02-16 06:34:50 +0000
commit67381d642155defa5ed87968c112afb24c2c8b2a (patch)
treed856395fad01917b61742252975234a16c6024b1
parent2a929fec5d976c918f2e86f79bd481b74ce8dbaf (diff)
downloadorg.eclipse.ecf-67381d642155defa5ed87968c112afb24c2c8b2a.tar.gz
org.eclipse.ecf-67381d642155defa5ed87968c112afb24c2c8b2a.tar.xz
org.eclipse.ecf-67381d642155defa5ed87968c112afb24c2c8b2a.zip
Updated join collaboration wizard page to display different contents based upon which combo box entry is selected. Added IMessageViewer interface to org.eclipse.ecf.ui. Added to xmpp provider plugin so that Presence objects are reported to IPresenceViewer.
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/JoinGroupWizardPage.java94
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatView.java18
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/plugin.xml11
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/IMessageViewer.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java6
-rw-r--r--framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresenceViewer.java2
7 files changed, 112 insertions, 29 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/JoinGroupWizardPage.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/JoinGroupWizardPage.java
index d6ac7c7bb..5bae16fd8 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/JoinGroupWizardPage.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/JoinGroupWizardPage.java
@@ -10,12 +10,16 @@
*****************************************************************************/
package org.eclipse.ecf.example.collab.ui;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.eclipse.ecf.core.SharedObjectContainerDescription;
import org.eclipse.ecf.core.SharedObjectContainerFactory;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
@@ -31,33 +35,83 @@ public class JoinGroupWizardPage extends WizardPage {
protected static final String ECF_TEMPLATE_URL = "ecftcp://<machinename>:<port>/<name>";
protected static final String PAGE_TITLE = "Join ECF Group";
+ protected static final String DEFAULT_CLIENT = "org.eclipse.ecf.provider.generic.Client";
+
public JoinGroupWizardPage() {
super("wizardPage");
setTitle(PAGE_TITLE);
setDescription(PAGE_DESCRIPTION);
}
+ protected String template_url = ECF_TEMPLATE_URL;
+ protected String default_url = ECF_DEFAULT_URL;
+ protected boolean showPassword = true;
+
+ protected Label password_label;
protected Text nickname_text;
protected Text joingroup_text;
+ protected Label example_label;
protected Combo combo;
protected Text password_text;
- protected List containerDescriptions;
+ protected List containerDescriptions = new ArrayList();
+ protected void modifyUI(Map props) {
+ if (props != null) {
+ String usePassword = (String) props.get("usepassword");
+ String examplegroupid = (String) props.get("examplegroupid");
+ String defaultgroupid = (String) props.get("defaultgroupid");
+ // turn off password unless used
+ if (usePassword != null){
+ password_label.setVisible(true);
+ password_text.setVisible(true);
+ } else {
+ password_label.setVisible(false);
+ password_text.setVisible(false);
+ }
+ // set examplegroupid text
+ example_label.setText((examplegroupid != null)?examplegroupid:"");
+ joingroup_text.setText((defaultgroupid != null)?defaultgroupid:"");
+ }
+ }
protected void fillCombo() {
- combo.add("Default");
- containerDescriptions = SharedObjectContainerFactory.getDescriptions();
- for(Iterator i=containerDescriptions.iterator(); i.hasNext(); ) {
- SharedObjectContainerDescription desc = (SharedObjectContainerDescription) i.next();
+ List rawDescriptions = SharedObjectContainerFactory.getDescriptions();
+ int index = 0;
+ int def = 0;
+ Map defProps = null;
+ for(Iterator i=rawDescriptions.iterator(); i.hasNext(); ) {
+ final SharedObjectContainerDescription desc = (SharedObjectContainerDescription) i.next();
String name = desc.getName();
String description = desc.getDescription();
- if (description != null && !description.equals("")) {
- name = name + " - " + description;
+ Map props = desc.getProperties();
+ String isClient = (String) props.get("isClient");
+ if (isClient != null) {
+ if (DEFAULT_CLIENT.equals(name)) {
+ def = index;
+ defProps = props;
+ }
+ combo.add(description+" - "+name,index);
+ combo.setData(""+index,desc);
+ containerDescriptions.add(desc);
+ index++;
}
- combo.add(name);
}
+ combo.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ SharedObjectContainerDescription desc = (SharedObjectContainerDescription) combo.getData(combo.getSelectionIndex()+"");
+ Map props = desc.getProperties();
+ modifyUI(props);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
// Set to default
- combo.select(0);
+ if (combo.getItemCount() > 0) combo.select(def);
+ if (defProps != null) modifyUI(defProps);
}
+
+ //protected
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
final GridLayout gridLayout = new GridLayout();
@@ -67,23 +121,22 @@ public class JoinGroupWizardPage extends WizardPage {
setControl(container);
final Label label_4 = new Label(container, SWT.NONE);
- label_4.setText("ECF Provider:");
+ label_4.setText("Provider:");
combo = new Combo(container, SWT.NONE);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
combo.setLayoutData(gridData_1);
- fillCombo();
final Label label_2 = new Label(container, SWT.NONE);
- final Label label_3 = new Label(container, SWT.NONE);
- label_3.setText(ECF_TEMPLATE_URL);
+ example_label = new Label(container, SWT.NONE);
+ example_label.setText(template_url);
final Label label = new Label(container, SWT.NONE);
label.setText(JOINGROUP_FIELDNAME);
joingroup_text = new Text(container, SWT.BORDER);
- joingroup_text.setText(ECF_DEFAULT_URL);
+ joingroup_text.setText(default_url);
final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.widthHint = 140;
joingroup_text.setLayoutData(gridData);
@@ -97,12 +150,17 @@ public class JoinGroupWizardPage extends WizardPage {
nickname_text.setLayoutData(nickname);
nickname_text.setText(System.getProperty("user.name"));
- final Label label_5 = new Label(container, SWT.NONE);
- label_5.setText("Password:");
+ password_label = new Label(container, SWT.NONE);
+ password_label.setText("Password:");
password_text = new Text(container, SWT.BORDER);
password_text.setEchoChar('*');
password_text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ if (!showPassword) {
+ password_text.setVisible(false);
+ password_label.setVisible(false);
+ }
+ fillCombo();
}
public String getJoinGroupText() {
@@ -119,9 +177,9 @@ public class JoinGroupWizardPage extends WizardPage {
public String getContainerType() {
int index = combo.getSelectionIndex();
- if (index == 0) return null;
+ if (index == -1) return null;
else {
- SharedObjectContainerDescription desc = (SharedObjectContainerDescription) containerDescriptions.get(index-1);
+ SharedObjectContainerDescription desc = (SharedObjectContainerDescription) containerDescriptions.get(index);
return desc.getName();
}
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatView.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatView.java
index e777457cd..a61db5fa4 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatView.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatView.java
@@ -99,14 +99,18 @@ public class LineChatView extends ViewPart {
if (ti != null) ti.dispose();
if (clientViews.isEmpty()) {
- singleton.tabFolder.dispose();
- singleton.tabFolder = null;
+ if (singleton != null) {
+ if (singleton.tabFolder != null) {
+ singleton.tabFolder.dispose();
+ singleton.tabFolder = null;
+ }
- createInactiveComposite(singleton.parentComposite);
- actionBars.getToolBarManager().removeAll();
- actionBars.getMenuManager().removeAll();
- actionBars.updateActionBars();
- singleton.parentComposite.layout();
+ createInactiveComposite(singleton.parentComposite);
+ actionBars.getToolBarManager().removeAll();
+ actionBars.getMenuManager().removeAll();
+ actionBars.updateActionBars();
+ singleton.parentComposite.layout();
+ }
}
}
});
diff --git a/framework/bundles/org.eclipse.ecf.provider/plugin.xml b/framework/bundles/org.eclipse.ecf.provider/plugin.xml
index d2128a315..d69cd5498 100644
--- a/framework/bundles/org.eclipse.ecf.provider/plugin.xml
+++ b/framework/bundles/org.eclipse.ecf.provider/plugin.xml
@@ -5,7 +5,7 @@
point="org.eclipse.ecf.containerFactory">
<containerFactory
class="org.eclipse.ecf.provider.generic.ContainerInstantiator"
- description="Generic Client Container Instantiator"
+ description="Generic ECF Provider"
name="org.eclipse.ecf.provider.generic.Client">
<defaultargument
type="org.eclipse.ecf.core.identity.ID"
@@ -14,6 +14,15 @@
value="10000"
type="java.lang.Integer"
name="keepAlive"/>
+ <property
+ value="ecftcp://&lt;server&gt;:&lt;port&gt;/&lt;servicename&gt;"
+ name="examplegroupid"/>
+ <property
+ value="ecftcp://localhost:3282/server"
+ name="defaultgroupid"/>
+ <property
+ value="true"
+ name="isClient"/>
</containerFactory>
</extension>
<extension
diff --git a/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF
index 4e2793b90..619b41bda 100644
--- a/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF
@@ -10,5 +10,5 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ecf,
org.eclipse.core.runtime
Eclipse-AutoStart: true
-Provide-Package: org.eclipse.ecf.ui.presence
+Provide-Package: org.eclipse.ecf.ui.presence, org.eclipse.ecf.ui
diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/IMessageViewer.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/IMessageViewer.java
new file mode 100644
index 000000000..e5945c931
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/IMessageViewer.java
@@ -0,0 +1,8 @@
+package org.eclipse.ecf.ui;
+
+import org.eclipse.ecf.core.identity.ID;
+
+public interface IMessageViewer {
+
+ public void showMessage(ID fromID, ID toID, String message);
+}
diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java
index 687ce9009..8caa0c8a0 100644
--- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java
+++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java
@@ -26,6 +26,7 @@ public interface IPresence extends IAdaptable, Serializable {
private static final String AVAILABLE_NAME = "available";
private static final String ERROR_NAME = "error";
private static final String SUBSCRIBE_NAME = "subscribe";
+ private static final String SUBSCRIBED_NAME = "subscribed";
private static final String UNAVAILABLE_NAME = "unavailable";
private static final String UNSUBSCRIBE_NAME = "unsubscribe";
private static final String UNSUBSCRIBED_NAME = "unsubscribed";
@@ -44,6 +45,8 @@ public interface IPresence extends IAdaptable, Serializable {
return ERROR;
} else if (presenceType.equals(SUBSCRIBE_NAME)) {
return SUBSCRIBE;
+ } else if (presenceType.equals(SUBSCRIBED_NAME)) {
+ return SUBSCRIBED;
} else if (presenceType.equals(UNAVAILABLE_NAME)) {
return UNAVAILABLE;
} else if (presenceType.equals(UNSUBSCRIBE_NAME)) {
@@ -58,6 +61,7 @@ public interface IPresence extends IAdaptable, Serializable {
public static final Type AVAILABLE = new Type(AVAILABLE_NAME);
public static final Type ERROR = new Type(ERROR_NAME);
public static final Type SUBSCRIBE = new Type(SUBSCRIBE_NAME);
+ public static final Type SUBSCRIBED = new Type(SUBSCRIBED_NAME);
public static final Type UNAVAILABLE = new Type(UNAVAILABLE_NAME);
public static final Type UNSUBSCRIBE = new Type(UNSUBSCRIBE_NAME);
public static final Type UNSUBSCRIBED = new Type(UNSUBSCRIBED_NAME);
@@ -74,7 +78,7 @@ public interface IPresence extends IAdaptable, Serializable {
// For serialization
private static int nextOrdinal = 0;
private final int ordinal = nextOrdinal++;
- private static final Type [] VALUES = { AVAILABLE, ERROR, SUBSCRIBE, UNAVAILABLE, UNSUBSCRIBE, UNSUBSCRIBED, UNKNOWN };
+ private static final Type [] VALUES = { AVAILABLE, ERROR, SUBSCRIBE, SUBSCRIBED, UNAVAILABLE, UNSUBSCRIBE, UNSUBSCRIBED, UNKNOWN };
Object readResolve() throws ObjectStreamException {
return VALUES[ordinal];
}
diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresenceViewer.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresenceViewer.java
index cc4f61e43..56a937e2f 100644
--- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresenceViewer.java
+++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresenceViewer.java
@@ -6,7 +6,7 @@ package org.eclipse.ecf.ui.presence;
import org.eclipse.ecf.core.identity.ID;
-public interface IPresenceViewer extends IRosterViewer {
+public interface IPresenceViewer {
public void receivePresence(ID userID, IPresence presence);
}

Back to the top