Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Perron2014-08-29 12:10:32 -0400
committerJacques Bouthillier2014-09-02 13:09:03 -0400
commita66d319e326fbc81302c4dd7fa47abb6295ccda8 (patch)
tree99fdf813846850b7a5d93b5524504f0d4669ae64 /org.eclipse.mylyn.reviews.ui/src
parent62220a5aa3c4101fb0eda1e97ae494f54efb5006 (diff)
downloadorg.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>
Diffstat (limited to 'org.eclipse.mylyn.reviews.ui/src')
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewCompareAnnotationSupport.java66
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 0b876cc9..9947f589 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;

Back to the top