Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-09-03 00:57:17 -0400
committerslewis2008-09-03 00:57:17 -0400
commitccfdfe779bbf12f3c103854bb3e713edb1479b0d (patch)
tree331e64853460e5f338dd95b76a2e917a25d03f84
parent0837d0aad62622f667d0d5d3d2dd100fa8fb09ef (diff)
downloadorg.eclipse.ecf-ccfdfe779bbf12f3c103854bb3e713edb1479b0d.tar.gz
org.eclipse.ecf-ccfdfe779bbf12f3c103854bb3e713edb1479b0d.tar.xz
org.eclipse.ecf-ccfdfe779bbf12f3c103854bb3e713edb1479b0d.zip
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/Messages.java1
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/messages.properties5
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java37
3 files changed, 40 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/Messages.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/Messages.java
index ea67a066e..6b22b0d93 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/Messages.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/Messages.java
@@ -27,6 +27,7 @@ public class Messages extends NLS {
public static String DocShare_EXCEPTION_RECEIVING_MESSAGE_MESSAGE;
public static String DocShare_EXCEPTION_RECEIVING_MESSAGE_TITLE;
public static String DocShare_EXCEPTION_SEND_MESSAGE;
+ public static String DocShare_REMOTE_USER_STOPPED;
public static String DocShare_STOP_SHARED_EDITOR_REMOTE;
public static String DocShare_STOP_SHARED_EDITOR_TITLE;
public static String DocShare_STOP_SHARED_EDITOR_US;
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/messages.properties b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/messages.properties
index ef8639fb8..e69a2162a 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/messages.properties
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/docshare/messages.properties
@@ -17,9 +17,10 @@ DocShare_EXCEPTION_INVALID_MESSAGE=message is invalid type {0}
DocShare_EXCEPTION_RECEIVING_MESSAGE_MESSAGE=Exception handling start message {0}
DocShare_EXCEPTION_RECEIVING_MESSAGE_TITLE=Exception receiving message
DocShare_EXCEPTION_SEND_MESSAGE=send message error
-DocShare_STOP_SHARED_EDITOR_REMOTE=The remote user was disconnected, and shared editing stopped
+DocShare_REMOTE_USER_STOPPED=Remote user stopped shared editing
+DocShare_STOP_SHARED_EDITOR_REMOTE=Remote user disconnected, and shared editing stopped
DocShare_STOP_SHARED_EDITOR_TITLE=Shared Editor Stopped
-DocShare_STOP_SHARED_EDITOR_US=Our account was disconnected, and shared editing stopped
+DocShare_STOP_SHARED_EDITOR_US=Local account was disconnected, and shared editing stopped
DocShareRosterMenuContributionItem_SHARE_EDITOR_MENU_TEXT=Share Editor With
DocShareRosterMenuContributionItem_STOP_SHARE_EDITOR_MENU_TEXT=Stop Sharing Editor with {0}
DocShareRosterMenuHandler_DOCSHARE_START_ERROR_TITLE=Error Starting Docshare
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java
index 282d1cce4..2a45427f1 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java
@@ -12,6 +12,8 @@
package org.eclipse.ecf.internal.provisional.docshare;
+import org.eclipse.ecf.internal.docshare.Messages;
+
import java.io.*;
import java.util.Iterator;
import java.util.List;
@@ -67,6 +69,32 @@ public class DocShare extends AbstractShare {
*/
ITextEditor editor;
+ IPartListener partListener = new IPartListener() {
+
+ public void partActivated(IWorkbenchPart part) {
+ // nothing to do
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ // nothing to do
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ if (editor != null && part.equals(editor.getSite().getPart())) {
+ stopShare();
+ }
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+ // nothing to do
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+ // nothing to do
+ }
+
+ };
+
IRosterManager rosterManager;
IRosterListener rosterListener = new IRosterListener() {
@@ -87,7 +115,8 @@ public class DocShare extends AbstractShare {
synchronized (stateLock) {
oID = getOurID();
otherID = getOtherID();
- shell = editor.getSite().getShell();
+ IWorkbenchPartSite wps = editor.getSite();
+ shell = wps.getShell();
}
if (oID != null && changedID.equals(oID)) {
localStopShare();
@@ -436,7 +465,9 @@ public class DocShare extends AbstractShare {
*/
protected void handleStopMessage(StopMessage message) {
if (isSharing()) {
+ Shell s = editor.getSite().getShell();
localStopShare();
+ showStopShareMessage(s, Messages.DocShare_REMOTE_USER_STOPPED);
}
}
@@ -572,6 +603,7 @@ public class DocShare extends AbstractShare {
this.initiatorID = initiator;
this.receiverID = receiver;
this.editor = edt;
+ this.editor.getSite().getPage().addPartListener(partListener);
final IDocument doc = getDocumentFromEditor();
if (doc != null)
doc.addDocumentListener(documentListener);
@@ -595,6 +627,9 @@ public class DocShare extends AbstractShare {
final IDocument doc = getDocumentFromEditor();
if (doc != null)
doc.removeDocumentListener(documentListener);
+ if (editor != null) {
+ editor.getSite().getPage().removePartListener(partListener);
+ }
this.editor = null;
}
// clean up if necessary

Back to the top