diff options
| author | Nikita Nemkin | 2020-01-20 19:12:18 +0000 |
|---|---|---|
| committer | Nikita Nemkin | 2020-01-21 10:22:29 +0000 |
| commit | f3234fc41f7fc4036b9d74df1b149b7844944890 (patch) | |
| tree | 1bc3342312a879e223121fdbf503617876e7ada0 | |
| parent | 4fc6abead6cb168d90051ae9ce7e1d1f506e725f (diff) | |
| download | eclipse.platform.swt-f3234fc41f7fc4036b9d74df1b149b7844944890.tar.gz eclipse.platform.swt-f3234fc41f7fc4036b9d74df1b149b7844944890.tar.xz eclipse.platform.swt-f3234fc41f7fc4036b9d74df1b149b7844944890.zip | |
Bug 559362 - [Cocoa] Small fixes to string constant usage
* Use wrapped object constants instead of raw long constants.
* Use isEqual instead of isEqualTo.
Change-Id: Ic81c561ca295b9ab5ad4e33ce956543eb6676280
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
6 files changed, 15 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras index fbfb01690e..19b2f55c59 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras @@ -767,10 +767,6 @@ <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> - <method selector="isEqualTo:" swt_gen="true"> - <arg swt_gen="true"></arg> - <retval swt_gen="true"></retval> - </method> <method selector="isKindOfClass:" swt_gen="true"> <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java index 464a62d3dc..954075c26c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -138,10 +138,6 @@ public boolean isEqual(id object) { return OS.objc_msgSend_bool(this.id, OS.sel_isEqual_, object != null ? object.id : 0); } -public boolean isEqualTo(id object) { - return OS.objc_msgSend_bool(this.id, OS.sel_isEqualTo_, object != null ? object.id : 0); -} - public boolean isKindOfClass(long aClass) { return OS.objc_msgSend_bool(this.id, OS.sel_isKindOfClass_, aClass); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index ac8ddaac8c..03db43eca7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1522,7 +1522,6 @@ public static final long sel_isDrawingToScreen = Selector.sel_isDrawingToScreen. public static final long sel_isEmpty = Selector.sel_isEmpty.value; public static final long sel_isEnabled = Selector.sel_isEnabled.value; public static final long sel_isEqual_ = Selector.sel_isEqual_.value; -public static final long sel_isEqualTo_ = Selector.sel_isEqualTo_.value; public static final long sel_isEqualToString_ = Selector.sel_isEqualToString_.value; public static final long sel_isExecutableFileAtPath_ = Selector.sel_isExecutableFileAtPath_.value; public static final long sel_isFieldEditor = Selector.sel_isFieldEditor.value; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java index 9e93b7106f..22c37b7732 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java @@ -634,7 +634,6 @@ public enum Selector { , sel_isEmpty("isEmpty") , sel_isEnabled("isEnabled") , sel_isEqual_("isEqual:") - , sel_isEqualTo_("isEqualTo:") , sel_isEqualToString_("isEqualToString:") , sel_isExecutableFileAtPath_("isExecutableFileAtPath:") , sel_isFieldEditor("isFieldEditor") diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java index 7780f26e9f..d7436e36fd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/Printer.java @@ -237,7 +237,7 @@ protected void create(DeviceData deviceData) { * the user chooses the preview button. The fix is to reset the job disposition. */ NSString job = printInfo.jobDisposition(); - if (job.isEqual(new NSString(OS.NSPrintPreviewJob()))) { + if (job.isEqual(OS.NSPrintPreviewJob)) { printInfo.setJobDisposition(job); } NSRect rect = new NSRect(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java index ae0f3d32fb..9db5dfbc27 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java @@ -269,16 +269,16 @@ TextStyle getStyle (NSDictionary attribs) { TextStyle style = new TextStyle (); for (int j = 0; j < count; j++) { NSString key = new NSString (keys.objectAtIndex (j)); - if (key.isEqualTo (OS.NSBackgroundColorAttributeName)) { + if (key.isEqual (OS.NSBackgroundColorAttributeName)) { NSColor color = new NSColor (attribs.objectForKey (key)); style.background = Color.cocoa_new (display, display.getNSColorRGB(color)); - } else if (key.isEqualTo (OS.NSForegroundColorAttributeName)) { + } else if (key.isEqual (OS.NSForegroundColorAttributeName)) { NSColor color = new NSColor (attribs.objectForKey (key)); style.foreground = Color.cocoa_new (display, display.getNSColorRGB(color)); - } else if (key.isEqualTo (OS.NSUnderlineColorAttributeName)) { + } else if (key.isEqual (OS.NSUnderlineColorAttributeName)) { NSColor color = new NSColor (attribs.objectForKey (key)); style.underlineColor = Color.cocoa_new (display, display.getNSColorRGB(color)); - } else if (key.isEqualTo (OS.NSUnderlineStyleAttributeName)) { + } else if (key.isEqual (OS.NSUnderlineStyleAttributeName)) { NSNumber value = new NSNumber (attribs.objectForKey (key)); switch (value.intValue ()) { case OS.NSUnderlineStyleSingle: style.underlineStyle = SWT.UNDERLINE_SINGLE; break; @@ -286,13 +286,13 @@ TextStyle getStyle (NSDictionary attribs) { case OS.NSUnderlineStyleThick: style.underlineStyle = UNDERLINE_THICK; break; } style.underline = value.intValue () != OS.NSUnderlineStyleNone; - } else if (key.isEqualTo (OS.NSStrikethroughColorAttributeName)) { + } else if (key.isEqual (OS.NSStrikethroughColorAttributeName)) { NSColor color = new NSColor (attribs.objectForKey (key)); style.strikeoutColor = Color.cocoa_new (display, display.getNSColorRGB(color)); - } else if (key.isEqualTo (OS.NSStrikethroughStyleAttributeName)) { + } else if (key.isEqual (OS.NSStrikethroughStyleAttributeName)) { NSNumber value = new NSNumber (attribs.objectForKey (key)); style.strikeout = value.intValue () != OS.NSUnderlineStyleNone; - } else if (key.isEqualTo (OS.NSFontAttributeName)) { + } else if (key.isEqual (OS.NSFontAttributeName)) { NSFont font = new NSFont (attribs.objectForKey (key)); font.retain(); style.font = Font.cocoa_new (display, font); @@ -513,12 +513,12 @@ boolean setMarkedText_selectedRange (long id, long sel, long string, long selRan @Override long validAttributesForMarkedText (long id, long sel) { NSMutableArray attribs = NSMutableArray.arrayWithCapacity (6); - attribs.addObject (new NSString (OS.NSForegroundColorAttributeName ())); - attribs.addObject (new NSString (OS.NSBackgroundColorAttributeName ())); - attribs.addObject (new NSString (OS.NSUnderlineStyleAttributeName ())); - attribs.addObject (new NSString (OS.NSUnderlineColorAttributeName ())); - attribs.addObject (new NSString (OS.NSStrikethroughStyleAttributeName ())); - attribs.addObject (new NSString (OS.NSStrikethroughColorAttributeName ())); + attribs.addObject (OS.NSForegroundColorAttributeName); + attribs.addObject (OS.NSBackgroundColorAttributeName); + attribs.addObject (OS.NSUnderlineStyleAttributeName); + attribs.addObject (OS.NSUnderlineColorAttributeName); + attribs.addObject (OS.NSStrikethroughStyleAttributeName); + attribs.addObject (OS.NSStrikethroughColorAttributeName); return attribs.id; } |
