void copyToClipboard (char [] buffer) { if (buffer.length == 0) return; NSPasteboard pasteboard = NSPasteboard.generalPasteboard (); if (pasteboard == null) return; pasteboard.declareTypes (NSArray.arrayWithObject (OS.NSStringPboardType), null); pasteboard.setString (NSString.stringWithCharacters (buffer, buffer.length), OS.NSStringPboardType); }
void addRelation (Control control) { if (!control.isDescribedByLabel ()) return; if (textView != null) { NSObject accessibleElement = control.focusView(); if (accessibleElement instanceof NSControl) { NSControl viewAsControl = (NSControl)accessibleElement; if (viewAsControl.cell() != null) accessibleElement = viewAsControl.cell(); } accessibleElement.accessibilitySetOverrideValue(textView.cell(), OS.NSAccessibilityTitleUIElementAttribute); NSArray controlArray = NSArray.arrayWithObject(accessibleElement); textView.cell().accessibilitySetOverrideValue(controlArray, OS.NSAccessibilityServesAsTitleForUIElementsAttribute); } }
/** * Executes the program with the file as the single argument * in the operating system. It is the responsibility of the * programmer to ensure that the file contains valid data for * this program. * * @param fileName the file or program name * @return <code>true</code> if the file is launched, otherwise <code>false</code> * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when fileName is null</li> * </ul> */ public boolean execute (String fileName) { if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); NSAutoreleasePool pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { NSWorkspace workspace = NSWorkspace.sharedWorkspace(); NSURL url = getURL(fileName); NSArray urls = NSArray.arrayWithObject(url); return workspace.openURLs(urls, NSString.stringWith(identifier), 0, null, 0); } finally { pool.release(); } }
void keyDown (long /*int*/ id, long /*int*/ sel, long /*int*/ theEvent) { if (hasFocus()) { if ((state & CANVAS) != 0) { Shell s = this.getShell(); s.deferFlushing(); NSArray array = NSArray.arrayWithObject (new NSEvent (theEvent)); s.keyInputHappened = false; view.interpretKeyEvents (array); if (imeInComposition ()) return; if (!s.keyInputHappened) { NSEvent nsEvent = new NSEvent (theEvent); boolean [] consume = new boolean [1]; if (translateTraversal (nsEvent.keyCode (), nsEvent, consume)) return; if (isDisposed ()) return; if (!sendKeyEvent (nsEvent, SWT.KeyDown)) return; if (consume [0]) return; } return; } } super.keyDown (id, sel, theEvent); }
return NSArray.arrayWithObject(nextView.view).id; else return NSArray.array().id; return NSArray.arrayWithObject(nextView.view).id; else return NSArray.array().id;
NSObject tdata = transferData.data; NSString dataType = NSString.stringWith(typeNames[j]); pasteboard.addTypes(NSArray.arrayWithObject(dataType), null); if (dataType.isEqual(OS.NSStringPboardType) || dataType.isEqual(OS.NSRTFPboardType) ||