mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Remove workaround for platform bug 151197
This commit is contained in:
parent
285d224021
commit
b58ed032fb
1 changed files with 1 additions and 25 deletions
|
@ -20,15 +20,12 @@ import org.eclipse.jface.text.ITextViewer;
|
|||
import org.eclipse.jface.text.ITextViewerExtension;
|
||||
import org.eclipse.jface.text.ITextViewerExtension5;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.custom.StyledTextContent;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.DragSourceAdapter;
|
||||
import org.eclipse.swt.dnd.DragSourceEvent;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.ui.texteditor.ITextEditorExtension;
|
||||
|
||||
/**
|
||||
|
@ -48,8 +45,6 @@ public class TextViewerDragAdapter extends DragSourceAdapter {
|
|||
private ITextViewer fViewer;
|
||||
/** The editor of the viewer (may be null) */
|
||||
private ITextEditorExtension fEditor;
|
||||
/** Location of last mouse down event (as a workaround for bug 151197) */
|
||||
private Point fDragStartLocation;
|
||||
/** Flag whether this drag source listener allows to drag */
|
||||
private boolean fIsEnabled= true;
|
||||
|
||||
|
@ -68,20 +63,6 @@ public class TextViewerDragAdapter extends DragSourceAdapter {
|
|||
public TextViewerDragAdapter(ITextViewer viewer, ITextEditorExtension editor) {
|
||||
fViewer= viewer;
|
||||
fEditor= editor;
|
||||
fViewer.getTextWidget().addListener(SWT.MouseDown, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
// workaround for bug 151197
|
||||
Point selection= fViewer.getTextWidget().getSelection();
|
||||
if (selection.x != selection.y) {
|
||||
// remember last mouse down location
|
||||
// to check if drag started inside selection
|
||||
fDragStartLocation= new Point(event.x,event.y);
|
||||
} else {
|
||||
// no active selection - this is no valid drag start
|
||||
fDragStartLocation= null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -128,13 +109,8 @@ public class TextViewerDragAdapter extends DragSourceAdapter {
|
|||
event.doit= false;
|
||||
return;
|
||||
}
|
||||
// workaround for bug 151197
|
||||
if (fDragStartLocation == null) {
|
||||
event.doit= false;
|
||||
return;
|
||||
}
|
||||
// convert screen coordinates to widget offest
|
||||
int offset= getOffsetAtLocation(fDragStartLocation.x, fDragStartLocation.y, false);
|
||||
int offset= getOffsetAtLocation(event.x, event.y, false);
|
||||
// convert further to a document offset
|
||||
offset= getDocumentOffset(offset);
|
||||
Point selection= fViewer.getSelectedRange();
|
||||
|
|
Loading…
Add table
Reference in a new issue