Exemplo n.º 1
0
 @Action
 public void anonymousCheckboxClicked(final NSButton sender) {
   if (sender.state() == NSCell.NSOnState) {
     host.getCredentials()
         .setUsername(Preferences.instance().getProperty("connection.login.anon.name"));
   }
   if (sender.state() == NSCell.NSOffState) {
     if (Preferences.instance()
         .getProperty("connection.login.name")
         .equals(Preferences.instance().getProperty("connection.login.anon.name"))) {
       host.getCredentials().setUsername(StringUtils.EMPTY);
     } else {
       host.getCredentials()
           .setUsername(Preferences.instance().getProperty("connection.login.name"));
     }
   }
   this.itemChanged();
   this.init();
 }
Exemplo n.º 2
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);
   }
 }