diff options
author | Guy Perron | 2014-08-29 16:10:32 +0000 |
---|---|---|
committer | Jacques Bouthillier | 2014-09-02 17:09:03 +0000 |
commit | a66d319e326fbc81302c4dd7fa47abb6295ccda8 (patch) | |
tree | 99fdf813846850b7a5d93b5524504f0d4669ae64 | |
parent | 62220a5aa3c4101fb0eda1e97ae494f54efb5006 (diff) | |
download | org.eclipse.mylyn.reviews-a66d319e326fbc81302c4dd7fa47abb6295ccda8.tar.gz org.eclipse.mylyn.reviews-a66d319e326fbc81302c4dd7fa47abb6295ccda8.tar.xz org.eclipse.mylyn.reviews-a66d319e326fbc81302c4dd7fa47abb6295ccda8.zip |
442629: remove watchdog threadorigin/e_4_4_m_3_13_x
Change-Id: Iff011a976a68907bad4b9014aaf6e7bb785a63a2
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=442629
Signed-off-by: Guy Perron <guy.perron@ericsson.com>
-rw-r--r-- | org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewCompareAnnotationSupport.java | 66 |
1 files changed, 9 insertions, 57 deletions
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewCompareAnnotationSupport.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewCompareAnnotationSupport.java index 0b876cc92..9947f589f 100644 --- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewCompareAnnotationSupport.java +++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewCompareAnnotationSupport.java @@ -56,7 +56,7 @@ import org.eclipse.ui.texteditor.AbstractTextEditor; /** * Manages annotation models for compare viewers. - * + * * @author Thomas Ehrnhoefer * @author Steffen Pingel * @author Guy Perron @@ -67,10 +67,6 @@ public class ReviewCompareAnnotationSupport { LEFT_SIDE, RIGHT_SIDE } - private static final int INTERRUPT_INTERVAL = 16; - - private static final int PAUSE_DELAY = 250; - private static String KEY_ANNOTAION_SUPPORT = ReviewItemSetCompareEditorInput.class.getName(); private CommentPopupDialog commentPopupDialog = null; @@ -84,10 +80,6 @@ public class ReviewCompareAnnotationSupport { return support; } - private Thread watchDog = null; - - private boolean sentinel = false; - public class MonitorObject { }; @@ -186,7 +178,7 @@ public class ReviewCompareAnnotationSupport { /** * Jumps to the next annotation according to the given direction. - * + * * @param direction * the search direction * @return the selected annotation or <code>null</code> if none @@ -334,17 +326,8 @@ public class ReviewCompareAnnotationSupport { LineRange range = new LineRange(p.x + 1, p.y); if (commentPopupDialog != null) { - if (watchDog != null) { - try { - synchronized (myMonitorObject) { - sentinel = true; - commentPopupDialog.dispose(); - myMonitorObject.wait(); - } - } catch (InterruptedException e) { - StatusHandler.log(new Status(IStatus.ERROR, ReviewsUiPlugin.PLUGIN_ID, "Error destroying dialog", e)); //$NON-NLS-1$ - } - } + commentPopupDialog.dispose(); + commentPopupDialog = null; } commentPopupDialog = new CommentPopupDialog(ReviewsUiPlugin.getDefault() @@ -362,39 +345,8 @@ public class ReviewCompareAnnotationSupport { location.y = location.y + (sourceViewer.getViewportHeight() / 2); commentPopupDialog.setLocation(location); commentPopupDialog.open(); + commentPopupDialog.setFocus(); - watchDog = new Thread(new Runnable() { - public void run() { - try { - for (int x = 0; x < INTERRUPT_INTERVAL; x++) { - if (sentinel) { - Thread.currentThread().interrupt(); - break; - } - Thread.sleep(PAUSE_DELAY); - } - } catch (Exception e) { - StatusHandler.log(new Status(IStatus.ERROR, ReviewsUiPlugin.PLUGIN_ID, - "Error interrupting thread", e)); //$NON-NLS-1$ - } - if (!sentinel) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - if (commentPopupDialog != null) { - commentPopupDialog.dispose(); - commentPopupDialog = null; - } - } - }); - } - synchronized (myMonitorObject) { - myMonitorObject.notify(); - } - } - }); - sentinel = false; - - watchDog.start(); widget.setRedraw(true); } @@ -454,7 +406,7 @@ public class ReviewCompareAnnotationSupport { return false; } - // adapted from {@link AbstractTextEditor#selectAndReveal(int, int)} +// adapted from {@link AbstractTextEditor#selectAndReveal(int, int)} protected void adjustHighlightRange(SourceViewer sourceViewer, int offset, int length) { if (sourceViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer; @@ -464,7 +416,7 @@ public class ReviewCompareAnnotationSupport { } } - // adapted from {@link AbstractTextEditor#selectAndReveal(int, int)} +// adapted from {@link AbstractTextEditor#selectAndReveal(int, int)} private boolean isVisible(SourceViewer viewer, int offset, int length) { if (viewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension = (ITextViewerExtension5) viewer; @@ -509,7 +461,7 @@ public class ReviewCompareAnnotationSupport { /** * Returns the annotation closest to the given range respecting the given direction. If an annotation is found, the * annotations current position is copied into the provided annotation position. - * + * * @param viewer * the viewer * @param direction @@ -558,7 +510,7 @@ public class ReviewCompareAnnotationSupport { && p.offset + p.getLength() == offset + length) {// || p.includes(offset)) { if (containingAnnotation == null || (direction == Direction.FORWARDS && p.length >= containingAnnotationPosition.length || direction == Direction.BACKWARDS - && p.length >= containingAnnotationPosition.length)) { + && p.length >= containingAnnotationPosition.length)) { containingAnnotation = a; containingAnnotationPosition = p; currentAnnotation = p.length == length; |