Ejemplo n.º 1
0
 public void pkSelectionPanelDidEnd_returnCode_contextInfo(
     NSOpenPanel sheet, int returncode, ID contextInfo) {
   log.debug("pkSelectionPanelDidEnd");
   if (returncode == NSPanel.NSOKButton) {
     NSArray selected = sheet.filenames();
     NSEnumerator enumerator = selected.objectEnumerator();
     NSObject next;
     while (((next = enumerator.nextObject()) != null)) {
       host.getCredentials().setIdentity(LocalFactory.createLocal(next.toString()));
     }
   }
   if (returncode == NSPanel.NSCancelButton) {
     host.getCredentials().setIdentity(null);
   }
   this.init();
   this.itemChanged();
 }
Ejemplo n.º 2
0
 public void downloadPathPanelDidEnd_returnCode_contextInfo(
     NSOpenPanel sheet, int returncode, ID contextInfo) {
   if (returncode == SheetCallback.DEFAULT_OPTION) {
     NSArray selected = sheet.filenames();
     if ((selected.lastObject()) != null) {
       host.setDownloadFolder(LocalFactory.createLocal(selected.lastObject().toString()));
     }
   }
   downloadPathPopup
       .itemAtIndex(new NSInteger(0))
       .setTitle(host.getDownloadFolder().getDisplayName());
   downloadPathPopup
       .itemAtIndex(new NSInteger(0))
       .setRepresentedObject(host.getDownloadFolder().getAbsolute());
   downloadPathPopup
       .itemAtIndex(new NSInteger(0))
       .setImage(IconCache.instance().iconForPath(host.getDownloadFolder(), 16));
   downloadPathPopup.selectItemAtIndex(new NSInteger(0));
   downloadPathPanel = null;
   this.itemChanged();
 }
Ejemplo n.º 3
0
 @Action
 public void pkCheckboxSelectionChanged(final NSButton sender) {
   log.debug("pkCheckboxSelectionChanged");
   if (sender.state() == NSCell.NSOnState) {
     publicKeyPanel = NSOpenPanel.openPanel();
     publicKeyPanel.setCanChooseDirectories(false);
     publicKeyPanel.setCanChooseFiles(true);
     publicKeyPanel.setAllowsMultipleSelection(false);
     publicKeyPanel.setMessage(
         Locale.localizedString("Select the private key in PEM or PuTTY format", "Credentials"));
     publicKeyPanel.setPrompt(Locale.localizedString("Choose"));
     publicKeyPanel.beginSheetForDirectory(
         LocalFactory.createLocal("~/.ssh").getAbsolute(),
         null,
         this.window(),
         this.id(),
         Foundation.selector("pkSelectionPanelDidEnd:returnCode:contextInfo:"),
         null);
   } else {
     this.pkSelectionPanelDidEnd_returnCode_contextInfo(
         publicKeyPanel, NSPanel.NSCancelButton, null);
   }
 }
Ejemplo n.º 4
0
 @Action
 public void downloadPathPopupClicked(final NSMenuItem sender) {
   if (sender.title().equals(CHOOSE)) {
     downloadPathPanel = NSOpenPanel.openPanel();
     downloadPathPanel.setCanChooseFiles(false);
     downloadPathPanel.setCanChooseDirectories(true);
     downloadPathPanel.setAllowsMultipleSelection(false);
     downloadPathPanel.setCanCreateDirectories(true);
     downloadPathPanel.beginSheetForDirectory(
         null,
         null,
         this.window,
         this.id(),
         Foundation.selector("downloadPathPanelDidEnd:returnCode:contextInfo:"),
         null);
   } else {
     host.setDownloadFolder(LocalFactory.createLocal(sender.representedObject()));
     this.itemChanged();
   }
 }