コード例 #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());
 }
コード例 #2
0
 protected List<String> getContainers() {
   // List S3 containers
   final Session session =
       SessionFactory.createSession(
           new Host(Protocol.S3_SSL, Protocol.S3_SSL.getDefaultHostname(), host.getCredentials()));
   if (session.getHost().getCredentials().validate(session.getHost().getProtocol())) {
     List<String> buckets = new ArrayList<String>();
     for (Path bucket : session.mount().children()) {
       buckets.add(bucket.getName());
     }
     Collections.sort(buckets);
     return buckets;
   }
   return Collections.emptyList();
 }