Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkgilmer2006-04-26 15:29:21 +0000
committerkgilmer2006-04-26 15:29:21 +0000
commit8d6c25cffa73bc917c46e3fc56efa97c786344db (patch)
tree67dbc38acfcff2e1f204105d788eefab42ab5a1f
parentcbee9d96aed818840f5179d86d207f0cda46d8f9 (diff)
downloadorg.eclipse.ecf-8d6c25cffa73bc917c46e3fc56efa97c786344db.tar.gz
org.eclipse.ecf-8d6c25cffa73bc917c46e3fc56efa97c786344db.tar.xz
org.eclipse.ecf-8d6c25cffa73bc917c46e3fc56efa97c786344db.zip
Fixed initial state refresh bug and code cleanup.
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java5
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java13
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/EditChannelListener.java (renamed from examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java)31
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/EditorListener.java (renamed from examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java)43
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/PresenceChannelListener.java (renamed from examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java)16
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/AbstractMessage.java19
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorUpdateRequest.java12
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java3
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java3
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/preferences/ClientPreferencePage.java2
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java7
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java14
12 files changed, 100 insertions, 68 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java
index 0e67107e0..88964f9d4 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/Activator.java
@@ -12,7 +12,6 @@ package org.eclipse.ecf.example.collab.editor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -104,7 +103,7 @@ public class Activator extends AbstractUIPlugin {
return listenerActive;
}
- synchronized void setListenerActive(boolean active) {
+ synchronized public void setListenerActive(boolean active) {
listenerActive = active;
}
@@ -119,7 +118,7 @@ public class Activator extends AbstractUIPlugin {
if (presenceChannel != null) {
// Tell everyone there is a new shared editor.
try {
- presenceChannel.sendMessage(PresenceChannelListener.createMessage(new SharedEditorSessionList(sessionNames)));
+ presenceChannel.sendMessage((new SharedEditorSessionList(sessionNames)).toByteArray());
} catch (ECFException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java
index c706d99de..09a6d2dc5 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/actions/InitiateSharedSessionAction.java
@@ -13,13 +13,12 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.example.collab.editor.Activator;
-import org.eclipse.ecf.example.collab.editor.EditorListener;
+import org.eclipse.ecf.example.collab.editor.listeners.EditorListener;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -61,8 +60,6 @@ public class InitiateSharedSessionAction extends Action implements IObjectAction
final IWorkbenchPage page = workbench.getWorkbenchWindows()[0].getActivePage();
workbench.getDisplay().asyncExec(new Runnable() {
- IEditorPart part;
-
public void run() {
try {
//Open the default editor for the selected file.
@@ -77,7 +74,7 @@ public class InitiateSharedSessionAction extends Action implements IObjectAction
IDocument document = dp.getDocument(editorPart.getEditorInput());
if (document != null) {
- EditorListener listener = new EditorListener(document, textEditor);
+ EditorListener listener = new EditorListener(document, textEditor, true);
document.addDocumentListener(listener);
} else {
if (dp instanceof TextFileDocumentProvider) {
@@ -85,7 +82,7 @@ public class InitiateSharedSessionAction extends Action implements IObjectAction
document = ((TextFileDocumentProvider) dp).getDocument(editorPart.getEditorInput());
if (document != null) {
- EditorListener listener = new EditorListener(document, textEditor);
+ EditorListener listener = new EditorListener(document, textEditor, true);
document.addDocumentListener(listener);
return;
} else {
@@ -100,9 +97,7 @@ public class InitiateSharedSessionAction extends Action implements IObjectAction
} catch (PartInitException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getLocalizedMessage(), e));
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getLocalizedMessage(), e)); }
}
});
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/EditChannelListener.java
index a16b7b659..5a6b9ee3c 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditChannelListener.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/EditChannelListener.java
@@ -6,7 +6,7 @@
*
* Contributors: Ken Gilmer - initial API and implementation
******************************************************************************/
-package org.eclipse.ecf.example.collab.editor;
+package org.eclipse.ecf.example.collab.editor.listeners;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -17,7 +17,10 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.datashare.IChannelListener;
import org.eclipse.ecf.datashare.events.IChannelEvent;
import org.eclipse.ecf.datashare.events.IChannelMessageEvent;
+import org.eclipse.ecf.example.collab.editor.Activator;
import org.eclipse.ecf.example.collab.editor.message.EditorChangeMessage;
+import org.eclipse.ecf.example.collab.editor.message.EditorUpdateRequest;
+import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
@@ -33,18 +36,23 @@ public class EditChannelListener implements IChannelListener {
private AbstractTextEditor editor;
private StyledText textControl;
+
+ private boolean documentOwner;
+
+ private EditorListener editorListener;
- public EditChannelListener(IDocument document, AbstractTextEditor editor) {
+ public EditChannelListener(IDocument document, AbstractTextEditor editor, boolean owner, EditorListener editorListener) {
this.document = document;
this.editor = editor;
+ this.editorListener = editorListener;
textControl = (StyledText) editor.getAdapter(Control.class);
+ documentOwner = owner;
+
- System.out.println(textControl.getAlignment());
}
public void handleChannelEvent(IChannelEvent event) {
if (event instanceof IChannelMessageEvent) {
- System.out.println("Receiving");
setEditorEditable(false);
Activator.getDefault().setListenerActive(false);
@@ -54,11 +62,16 @@ public class EditChannelListener implements IChannelListener {
ObjectInputStream ois;
try {
ois = new ObjectInputStream(bins);
- EditorChangeMessage message = (EditorChangeMessage) ois
- .readObject();
-
- // Append text from remote to end of document
- appendLocallyFromRemote(message);
+
+ Object message = ois.readObject();
+
+ if (message instanceof EditorChangeMessage) {
+ // Append text from remote to end of document
+ appendLocallyFromRemote((EditorChangeMessage) message);
+ } else if (message instanceof EditorUpdateRequest && documentOwner) {
+ //Respond since I'm the document owner;
+ editorListener.sendDocumentUpdateMessage();
+ }
} catch (IOException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getLocalizedMessage(), e));
} catch (ClassNotFoundException e) {
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/EditorListener.java
index 3880c81bc..f71da022f 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/EditorListener.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/EditorListener.java
@@ -6,7 +6,7 @@
*
* Contributors: Ken Gilmer - initial API and implementation
******************************************************************************/
-package org.eclipse.ecf.example.collab.editor;
+package org.eclipse.ecf.example.collab.editor.listeners;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -23,7 +23,9 @@ import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.datashare.IChannel;
import org.eclipse.ecf.datashare.IChannelContainer;
import org.eclipse.ecf.datashare.IChannelListener;
+import org.eclipse.ecf.example.collab.editor.Activator;
import org.eclipse.ecf.example.collab.editor.message.EditorChangeMessage;
+import org.eclipse.ecf.example.collab.editor.message.EditorUpdateRequest;
import org.eclipse.ecf.example.collab.editor.preferences.ClientPreferencePage;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
@@ -44,11 +46,14 @@ public class EditorListener implements IDocumentListener {
private IChannelListener channelListener;
private String sessionID;
+
+ private boolean documentOwner;
- public EditorListener(IDocument document, AbstractTextEditor textEditor) {
+ public EditorListener(IDocument document, AbstractTextEditor textEditor, boolean owner) {
this.document = document;
this.editor = textEditor;
-
+ this.documentOwner = owner;
+
try {
intializeEditorSession();
@@ -57,7 +62,8 @@ public class EditorListener implements IDocumentListener {
}
} catch (ECFException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getLocalizedMessage(), e));
- }
+ } catch (IOException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getLocalizedMessage(), e)); }
}
public void documentAboutToBeChanged(DocumentEvent event) {
@@ -78,12 +84,14 @@ public class EditorListener implements IDocumentListener {
return;
}
+ sendDocumentUpdateMessage();
+ }
+
+ public void sendDocumentUpdateMessage() {
try {
- System.out.println("sending");
- IDocument newDocument = event.getDocument();
- channel.sendMessage(createMessageFromEvent(event));
- this.document = newDocument;
+ channel.sendMessage(createMessageFromEvent(document));
+
} catch (ECFException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getLocalizedMessage(), e));
} catch (IOException e) {
@@ -91,14 +99,14 @@ public class EditorListener implements IDocumentListener {
}
}
- private byte[] createMessageFromEvent(DocumentEvent event) throws IOException, ECFException {
+ private byte[] createMessageFromEvent(IDocument document) throws IOException, ECFException {
ByteArrayOutputStream bouts = new ByteArrayOutputStream();
ObjectOutputStream douts = new ObjectOutputStream(bouts);
- douts.writeObject(new EditorChangeMessage(event.getDocument().get()));
+ douts.writeObject(new EditorChangeMessage(document.get()));
return bouts.toByteArray();
}
- public void intializeEditorSession() throws ECFException {
+ public void intializeEditorSession() throws ECFException, IOException {
container = ContainerFactory.getDefault().createContainer(
Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.CONTAINER_TYPE));
@@ -110,16 +118,27 @@ public class EditorListener implements IDocumentListener {
final ID channelID = IDFactory.getDefault().createID(channelContainer.getChannelNamespace(), sessionID);
- channelListener = new EditChannelListener(document, editor);
+ channelListener = new EditChannelListener(document, editor, documentOwner, this);
channel = channelContainer.createChannel(channelID, channelListener, new HashMap());
container.connect(IDFactory.getDefault().createID(container.getConnectNamespace(),
Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.TARGET_SERVER)), null);
+
+ //If we don't own the document, request a fresh copy from the owner.
+ if (!documentOwner) {
+ sendEditorUpdateRequest();
+ }
}
+ private void sendEditorUpdateRequest() throws ECFException, IOException {
+ if (channel != null) {
+ channel.sendMessage((new EditorUpdateRequest()).toByteArray());
+ }
+ }
+
public String getSessionID() {
return sessionID;
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/PresenceChannelListener.java
index c572f0d55..39beb7de0 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/PresenceChannelListener.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/listeners/PresenceChannelListener.java
@@ -6,13 +6,11 @@
*
* Contributors: Ken Gilmer - initial API and implementation
******************************************************************************/
-package org.eclipse.ecf.example.collab.editor;
+package org.eclipse.ecf.example.collab.editor.listeners;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -21,6 +19,7 @@ import org.eclipse.ecf.datashare.IChannel;
import org.eclipse.ecf.datashare.IChannelListener;
import org.eclipse.ecf.datashare.events.IChannelEvent;
import org.eclipse.ecf.datashare.events.IChannelMessageEvent;
+import org.eclipse.ecf.example.collab.editor.Activator;
import org.eclipse.ecf.example.collab.editor.message.SharedEditorSessionList;
import org.eclipse.ecf.example.collab.editor.message.SharedEditorSessionListRequest;
@@ -54,7 +53,7 @@ public class PresenceChannelListener implements IChannelListener {
Object o = ois.readObject();
if (o instanceof SharedEditorSessionListRequest) {
- channel.sendMessage(createMessage(new SharedEditorSessionList(Activator.getDefault().getSessionNames())));
+ channel.sendMessage((new SharedEditorSessionList(Activator.getDefault().getSessionNames())).toByteArray());
}
} catch (IOException e) {
@@ -69,13 +68,4 @@ public class PresenceChannelListener implements IChannelListener {
}
}
}
-
- public static byte[] createMessage(Object obj) throws IOException, ECFException {
- ByteArrayOutputStream bouts = new ByteArrayOutputStream();
-
- ObjectOutputStream douts = new ObjectOutputStream(bouts);
- douts.writeObject(obj);
-
- return bouts.toByteArray();
- }
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/AbstractMessage.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/AbstractMessage.java
new file mode 100644
index 000000000..6354f3bfd
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/AbstractMessage.java
@@ -0,0 +1,19 @@
+package org.eclipse.ecf.example.collab.editor.message;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.eclipse.ecf.core.util.ECFException;
+
+public abstract class AbstractMessage implements Serializable {
+
+
+ public byte[] toByteArray() throws IOException, ECFException {
+ ByteArrayOutputStream bouts = new ByteArrayOutputStream();
+ ObjectOutputStream douts = new ObjectOutputStream(bouts);
+ douts.writeObject(this);
+ return bouts.toByteArray();
+ }
+}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorUpdateRequest.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorUpdateRequest.java
new file mode 100644
index 000000000..ee7d7a947
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/EditorUpdateRequest.java
@@ -0,0 +1,12 @@
+package org.eclipse.ecf.example.collab.editor.message;
+
+/**
+ * A message sent from a joining peer, needing the current editor model.
+ * This message should be caught by the creator, and respond with a EditorChangeMessage.
+ * @author kg11212
+ *
+ */
+public class EditorUpdateRequest extends AbstractMessage {
+ private static final long serialVersionUID = 7307387852689460016L;
+
+}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java
index 6373d4f54..a6e422b24 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionList.java
@@ -9,7 +9,6 @@
package org.eclipse.ecf.example.collab.editor.message;
-import java.io.Serializable;
import java.util.List;
/**
@@ -19,7 +18,7 @@ import java.util.List;
* @author kgilmer
*
*/
-public class SharedEditorSessionList implements Serializable {
+public class SharedEditorSessionList extends AbstractMessage {
private static final long serialVersionUID = 4337027955521207775L;
private List sessionNames;
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java
index 2940fbc6c..c62f969b2 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/message/SharedEditorSessionListRequest.java
@@ -9,7 +9,6 @@
package org.eclipse.ecf.example.collab.editor.message;
-import java.io.Serializable;
/**
* This message is passed when a peer wishes to "discover" all available
@@ -20,7 +19,7 @@ import java.io.Serializable;
* @author kgilmer
*
*/
-public class SharedEditorSessionListRequest implements Serializable {
+public class SharedEditorSessionListRequest extends AbstractMessage {
private static final long serialVersionUID = 2096909220585200273L;
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/preferences/ClientPreferencePage.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/preferences/ClientPreferencePage.java
index 6b786bd33..1e63ee219 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/preferences/ClientPreferencePage.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/preferences/ClientPreferencePage.java
@@ -17,10 +17,8 @@ import java.net.UnknownHostException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.example.collab.editor.Activator;
-import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java
index 685da3dc7..63a8dcc31 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizard.java
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.example.collab.editor.Activator;
-import org.eclipse.ecf.example.collab.editor.EditorListener;
+import org.eclipse.ecf.example.collab.editor.listeners.EditorListener;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.IDocument;
@@ -124,7 +124,7 @@ public class NewSharedSessionWizard extends Wizard implements INewWizard {
IDocument document = dp.getDocument(editorPart.getEditorInput());
if (document != null) {
- EditorListener listener = new EditorListener(document, textEditor);
+ EditorListener listener = new EditorListener(document, textEditor, false);
document.addDocumentListener(listener);
} else {
if (dp instanceof TextFileDocumentProvider) {
@@ -132,8 +132,9 @@ public class NewSharedSessionWizard extends Wizard implements INewWizard {
document = ((TextFileDocumentProvider) dp).getDocument(editorPart.getEditorInput());
if (document != null) {
- EditorListener listener = new EditorListener(document, textEditor);
+ EditorListener listener = new EditorListener(document, textEditor, false);
document.addDocumentListener(listener);
+
return;
} else {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Unable to get reference to editor's document. Shared session not created.", null));
diff --git a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java
index 20e886136..14d162261 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab.editor/src/org/eclipse/ecf/example/collab/editor/wizards/NewSharedSessionWizardPage.java
@@ -10,10 +10,8 @@
package org.eclipse.ecf.example.collab.editor.wizards;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +25,6 @@ import org.eclipse.ecf.datashare.IChannelListener;
import org.eclipse.ecf.datashare.events.IChannelEvent;
import org.eclipse.ecf.datashare.events.IChannelMessageEvent;
import org.eclipse.ecf.example.collab.editor.Activator;
-import org.eclipse.ecf.example.collab.editor.EditorListener;
import org.eclipse.ecf.example.collab.editor.message.SharedEditorSessionList;
import org.eclipse.ecf.example.collab.editor.message.SharedEditorSessionListRequest;
import org.eclipse.ecf.example.collab.editor.model.SessionInstance;
@@ -222,7 +219,7 @@ public class NewSharedSessionWizardPage extends WizardPage {
try {
IChannel channel = Activator.getDefault().intializePresenceSession(new SessionResponseListener());
- channel.sendMessage(createMessage(new SharedEditorSessionListRequest()));
+ channel.sendMessage((new SharedEditorSessionListRequest()).toByteArray());
} catch (ECFException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -272,15 +269,6 @@ public class NewSharedSessionWizardPage extends WizardPage {
}
}
- private byte[] createMessage(Object obj) throws IOException, ECFException {
- ByteArrayOutputStream bouts = new ByteArrayOutputStream();
-
- ObjectOutputStream douts = new ObjectOutputStream(bouts);
- douts.writeObject(obj);
-
- return bouts.toByteArray();
- }
-
private void handleBrowse() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
"Select new file container");

Back to the top