Lines 10-17
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.compare.internal; |
11 |
package org.eclipse.compare.internal; |
12 |
|
12 |
|
|
|
13 |
import org.eclipse.compare.CompareConfiguration; |
13 |
import org.eclipse.core.runtime.Assert; |
14 |
import org.eclipse.core.runtime.Assert; |
14 |
import org.eclipse.core.runtime.ListenerList; |
15 |
import org.eclipse.core.runtime.ListenerList; |
|
|
16 |
import org.eclipse.jface.text.IRegion; |
17 |
import org.eclipse.jface.text.ITextSelection; |
15 |
import org.eclipse.jface.text.TextSelection; |
18 |
import org.eclipse.jface.text.TextSelection; |
16 |
import org.eclipse.jface.text.TextViewer; |
19 |
import org.eclipse.jface.text.TextViewer; |
17 |
import org.eclipse.jface.viewers.IPostSelectionProvider; |
20 |
import org.eclipse.jface.viewers.IPostSelectionProvider; |
Lines 66-77
Link Here
|
66 |
} |
69 |
} |
67 |
|
70 |
|
68 |
private TextViewer[] fViewers; |
71 |
private TextViewer[] fViewers; |
69 |
|
|
|
70 |
private TextViewer fViewerInFocus; |
72 |
private TextViewer fViewerInFocus; |
71 |
private ListenerList fSelectionChangedListeners; |
73 |
private ListenerList fSelectionChangedListeners; |
72 |
private ListenerList fPostSelectionChangedListeners; |
74 |
private ListenerList fPostSelectionChangedListeners; |
|
|
75 |
private CompareConfiguration fCompareConfiguration; |
73 |
|
76 |
|
74 |
public CompareEditorSelectionProvider() { |
77 |
public CompareEditorSelectionProvider(CompareConfiguration cc) { |
|
|
78 |
fCompareConfiguration = cc; |
75 |
fSelectionChangedListeners = new ListenerList(); |
79 |
fSelectionChangedListeners = new ListenerList(); |
76 |
fPostSelectionChangedListeners = new ListenerList(); |
80 |
fPostSelectionChangedListeners = new ListenerList(); |
77 |
// nothing more to do here, Compare Editor is initializing |
81 |
// nothing more to do here, Compare Editor is initializing |
Lines 199-204
Link Here
|
199 |
|
203 |
|
200 |
public void setSelection(ISelection selection, boolean reveal) { |
204 |
public void setSelection(ISelection selection, boolean reveal) { |
201 |
if (fViewerInFocus != null) { |
205 |
if (fViewerInFocus != null) { |
|
|
206 |
if (reveal) { |
207 |
IRegion visible = fViewerInFocus.getVisibleRegion(); |
208 |
if (selection instanceof ITextSelection) { |
209 |
ITextSelection s= (ITextSelection) selection; |
210 |
if (s.getOffset() < visible.getOffset() |
211 |
|| s.getOffset() + s.getLength() > visible.getOffset() + visible.getLength()) { |
212 |
fCompareConfiguration.setProperty("RESET_DIFF_TREE_VIEWER_SELECTION", null); |
213 |
} |
214 |
} |
215 |
} |
202 |
fViewerInFocus.setSelection(selection, reveal); |
216 |
fViewerInFocus.setSelection(selection, reveal); |
203 |
} |
217 |
} |
204 |
} |
218 |
} |