Lines 60-112
Link Here
|
60 |
|
60 |
|
61 |
Point location= getHoverEventLocation(); |
61 |
Point location= getHoverEventLocation(); |
62 |
int offset= computeOffsetAtLocation(location.x, location.y); |
62 |
int offset= computeOffsetAtLocation(location.x, location.y); |
63 |
if (offset == -1) |
63 |
if (offset == -1) { |
|
|
64 |
setInformation(null, null); |
64 |
return; |
65 |
return; |
|
|
66 |
} |
65 |
|
67 |
|
66 |
final ITextHover hover= fTextViewer.getTextHover(offset); |
68 |
final ITextHover hover= fTextViewer.getTextHover(offset); |
67 |
if (hover == null) |
69 |
if (hover == null) { |
|
|
70 |
setInformation(null, null); |
68 |
return; |
71 |
return; |
|
|
72 |
} |
69 |
|
73 |
|
70 |
final IRegion region= hover.getHoverRegion(fTextViewer, offset); |
74 |
final IRegion region= hover.getHoverRegion(fTextViewer, offset); |
71 |
if (region == null) |
75 |
if (region == null) { |
|
|
76 |
setInformation(null, null); |
72 |
return; |
77 |
return; |
|
|
78 |
} |
73 |
|
79 |
|
74 |
final Rectangle area= computeArea(region); |
80 |
final Rectangle area= computeArea(region); |
75 |
if (area == null || area.isEmpty()) |
81 |
if (area == null || area.isEmpty()) { |
|
|
82 |
setInformation(null, null); |
76 |
return; |
83 |
return; |
|
|
84 |
} |
77 |
|
85 |
|
78 |
if (fThread == null) { |
86 |
if (fThread != null) { |
79 |
|
87 |
setInformation(null, null); |
80 |
fThread= new Thread() { |
88 |
return; |
81 |
public void run() { |
89 |
} |
|
|
90 |
|
91 |
fThread= new Thread() { |
92 |
public void run() { |
93 |
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=17693 |
94 |
try { |
82 |
|
95 |
|
83 |
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=17693 |
96 |
if (fThread != null) { |
|
|
97 |
String information= hover.getHoverInfo(fTextViewer, region); |
98 |
setInformation(information, area); |
99 |
} else { |
100 |
setInformation(null, null); |
101 |
} |
84 |
|
102 |
|
85 |
try { |
103 |
} finally { |
86 |
|
104 |
synchronized (fMutex) { |
87 |
if (fThread != null) { |
105 |
if (fTextViewer != null) |
88 |
String information= hover.getHoverInfo(fTextViewer, region); |
106 |
fTextViewer.removeTextListener(fStopper); |
89 |
setInformation(information, area); |
107 |
fThread= null; |
90 |
} else { |
|
|
91 |
setInformation(null, null); |
92 |
} |
93 |
|
94 |
} finally { |
95 |
synchronized (fMutex) { |
96 |
if (fTextViewer != null) |
97 |
fTextViewer.removeTextListener(fStopper); |
98 |
fThread= null; |
99 |
} |
100 |
} |
108 |
} |
101 |
} |
109 |
} |
102 |
}; |
|
|
103 |
|
104 |
fThread.setDaemon(true); |
105 |
fThread.setPriority(Thread.MIN_PRIORITY); |
106 |
synchronized (fMutex) { |
107 |
fTextViewer.addTextListener(fStopper); |
108 |
fThread.start(); |
109 |
} |
110 |
} |
|
|
111 |
}; |
112 |
|
113 |
fThread.setDaemon(true); |
114 |
fThread.setPriority(Thread.MIN_PRIORITY); |
115 |
synchronized (fMutex) { |
116 |
fTextViewer.addTextListener(fStopper); |
117 |
fThread.start(); |
110 |
} |
118 |
} |
111 |
} |
119 |
} |
112 |
|
120 |
|