Esempio n. 1
0
 public void setFilesPopup(final NSPopUpButton p) {
   this.filesPopup = p;
   this.filesPopup.setTarget(this.id());
   this.filesPopup.removeAllItems();
   for (Path path : transfer.getRoots()) {
     NSMenuItem item =
         this.filesPopup
             .menu()
             .addItemWithTitle_action_keyEquivalent(
                 path.getName(), Foundation.selector("reveal:"), StringUtils.EMPTY);
     item.setRepresentedObject(path.getAbsolute());
     item.setImage(IconCache.instance().iconForPath(path, 16, false));
   }
   this.filesPopupMenuDelegate = new TransferMenuDelegate(transfer);
   this.filesPopup.menu().setDelegate(this.filesPopupMenuDelegate.id());
   NSNotificationCenter.defaultCenter()
       .addObserver(
           this.id(),
           Foundation.selector("filesPopupWillShow:"),
           NSPopUpButton.PopUpButtonWillPopUpNotification,
           this.filesPopup);
   NSNotificationCenter.defaultCenter()
       .addObserver(
           this.id(),
           Foundation.selector("filesPopupWillHide:"),
           "NSMenuDidEndTrackingNotification",
           this.filesPopup.menu());
 }
Esempio n. 2
0
 public void setProtocolPopup(NSPopUpButton protocolPopup) {
   this.protocolPopup = protocolPopup;
   this.protocolPopup.setEnabled(true);
   this.protocolPopup.setTarget(this.id());
   this.protocolPopup.setAction(Foundation.selector("protocolSelectionChanged:"));
   this.protocolPopup.removeAllItems();
   for (Protocol protocol : ProtocolFactory.getKnownProtocols()) {
     final String title = protocol.getDescription();
     this.protocolPopup.addItemWithTitle(title);
     final NSMenuItem item = this.protocolPopup.itemWithTitle(title);
     item.setRepresentedObject(String.valueOf(protocol.hashCode()));
     item.setImage(IconCache.iconNamed(protocol.icon(), 16));
   }
 }