示例#1
0
  // Requires user to select a text file somewhere downtree from ~
  @Test
  @Ignore
  public void testShow() {
    new JFrame().setVisible(true); // otherwise no panel
    NSOpenPanel panel = NSOpenPanel.CLASS.openPanel();

    // Keep this reference!
    ObjCObject ocProxy =
        Rococoa.proxy(
            new Object() {
              @SuppressWarnings("unused")
              public boolean panel_shouldShowFilename(ID panel, String filename) {
                char initialChar = new File(filename).getName().toLowerCase().charAt(0);
                return initialChar % 2 == 0;
              }
            });

    panel.setDelegate(ocProxy.id());
    int button = panel.runModalForTypes(null);
    //              or, eg
    //                NSArray.CLASS.arrayWithObjects(
    //                    NSString.stringWithString("txt"), null));
    NSString filenameAsNSString = panel.filename();
    if (button == NSOpenPanel.NSOKButton) {
      assertTrue(filenameAsNSString.toString().startsWith("/Users"));
    } else {
      assertEquals(NSOpenPanel.NSCancelButton, button);
      assertNull(filenameAsNSString);
    }
  }
示例#2
0
 public void mountFailed(NSNotification notification) {
   log.warn("mountFailed");
   NSDictionary userInfo = notification.userInfo();
   NSError error =
       Rococoa.cast(
           userInfo.objectForKey(GMUserFileSystem.kGMUserFileSystemErrorKey), NSError.class);
   session.error(Locale.localizedString("Mount failed", "Error"), null);
 }
示例#3
0
/// <i>native declaration : /Users/dkocher/null:10</i>
public abstract class NSValue extends NSObject {
  private static final _Class CLASS = org.rococoa.Rococoa.createClass("NSValue", _Class.class);

  public static NSValue valueWithSize(NSSize size) {
    return CLASS.valueWithSize(size);
  }

  public interface _Class extends ObjCClass {
    NSValue valueWithSize(NSSize size);
  }

  /**
   * Original signature : <code>BOOL isEqualToValue(NSValue*)</code><br>
   * <i>from NSValueExtensionMethods native declaration : /Users/dkocher/null:33</i>
   */
  public abstract byte isEqualToValue(NSValue value);
}