Add more debug output, UI thread asserts
This commit is contained in:
parent
09d7d80d29
commit
ed7e89d1ab
@ -393,6 +393,12 @@ public class ShareClient extends AbstractUIPlugin implements MessageListener, Di
|
||||
return partListener;
|
||||
}
|
||||
|
||||
public static void assertOnUIThread() {
|
||||
if(!Thread.currentThread().equals(Display.getDefault().getThread())) {
|
||||
MessageDialog.openError(null, "Assertion failed", "Not on UI thread");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void earlyStartup() {
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ public class ShareSession {
|
||||
|
||||
@Override
|
||||
public void onInsert(int index, byte character) {
|
||||
// TODO: assert that we are on the UI thread
|
||||
ShareClient.assertOnUIThread();
|
||||
|
||||
ShareClientDocumentListener documentListener = ShareClient.getDefault().getPartListener().getListener(path);
|
||||
if(documentListener != null) {
|
||||
IDocument document = documentListener.getDocument();
|
||||
@ -108,7 +109,8 @@ public class ShareSession {
|
||||
|
||||
@Override
|
||||
public void onDelete(int index) {
|
||||
// TODO: assert that we are on the UI thread
|
||||
ShareClient.assertOnUIThread();
|
||||
|
||||
ShareClientDocumentListener documentListener = ShareClient.getDefault().getPartListener().getListener(path);
|
||||
if(documentListener != null) {
|
||||
IDocument document = documentListener.getDocument();
|
||||
|
@ -35,6 +35,8 @@ public class ShareClientDocumentListener implements IDocumentListener {
|
||||
|
||||
@Override
|
||||
public void documentAboutToBeChanged(DocumentEvent event) {
|
||||
ShareClient.assertOnUIThread();
|
||||
|
||||
if(ignoreChanges) return;
|
||||
|
||||
System.out.println("UPDATE ON THREAD " + Thread.currentThread());
|
||||
|
@ -178,6 +178,11 @@ public class ShareView extends ViewPart {
|
||||
sb.append("--- Document: ").append(path).append('\n');
|
||||
|
||||
sb.append(document.getContentsAsString());
|
||||
sb.append('\n');
|
||||
|
||||
for(int i = 0; i < document.getCharBag().size(); i++) {
|
||||
sb.append(document.getCharBag().get(i)).append('\n');
|
||||
}
|
||||
|
||||
sb.append('\n');
|
||||
sb.append('\n');
|
||||
|
Loading…
Reference in New Issue
Block a user