diff options
author | Felipe Heidrich <Felipe_Heidrich@ca.ibm.com> | 2011-10-07 16:03:36 -0400 |
---|---|---|
committer | Felipe Heidrich <Felipe_Heidrich@ca.ibm.com> | 2011-10-07 16:03:36 -0400 |
commit | b2a0367307501ef9a704be790fed4a41e6f15f7a (patch) | |
tree | f257cc6c7adaedf5eb7db6bebec03db6783d57bc | |
parent | 2dbaee48900e62b5a503a411f575892e3b0d10fc (diff) | |
download | eclipse.platform.swt-b2a0367307501ef9a704be790fed4a41e6f15f7a.tar.gz eclipse.platform.swt-b2a0367307501ef9a704be790fed4a41e6f15f7a.tar.xz eclipse.platform.swt-b2a0367307501ef9a704be790fed4a41e6f15f7a.zip |
review for bug 44072, cocoa
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java | 16 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java | 9 |
2 files changed, 7 insertions, 18 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java index 0c16849208..406bc49794 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java @@ -597,22 +597,16 @@ boolean dragDetect(int x, int y, boolean filter, boolean[] consume) { } public int getCaretPosition() { checkWidget(); - if(this.isFocusControl()) { - return selectionRange != null ? (int)/*64*/selectionRange.location : 0; - } - else { - return 0; - } + return selectionRange != null ? (int)/*64*/selectionRange.location : 0; } public Point getCaretLocation() { - NSTextView widget; - if(this.isFocusControl()) { + checkWidget(); + NSTextView widget = null; + if (this.hasFocus()) { widget = new NSTextView(view.window().fieldEditor(true, view)); } - else { - return new Point(0, 0); - } + if (widget == null) return new Point (0, 0); NSLayoutManager layoutManager = widget.layoutManager(); NSTextContainer container = widget.textContainer(); NSRange range = widget.selectedRange(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java index 5fdb5f6262..82c66ce803 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java @@ -704,18 +704,13 @@ public Point getCaretLocation () { checkWidget (); NSTextView widget = null; if ((style & SWT.SINGLE) != 0) { - if(this.isFocusControl()) { + if (this.hasFocus()) { widget = new NSTextView(view.window().fieldEditor(true, view)); } - else { - return new Point (0, 0); - } - //TODO - caret location for single text - //return new Point (0, 0); } else { widget = (NSTextView) view; } - //NSTextView widget = (NSTextView)view; + if (widget == null) return new Point (0, 0); NSLayoutManager layoutManager = widget.layoutManager(); NSTextContainer container = widget.textContainer(); NSRange range = widget.selectedRange(); |