@Override public boolean isHostnameConfigurable() { if(StringUtils.isBlank(this.value("Hostname Configurable"))) { return parent.isHostnameConfigurable(); } return this.bool("Hostname Configurable"); }
private static void append(final Protocol protocol, final StringBuilder builder) { final String url; switch(protocol.getType()) { case b2: case s3: case googlestorage: case swift: case azure: url = String.format("%s://<container>/<key>", getScheme(protocol)); break; default: if(protocol.isHostnameConfigurable()) { url = String.format("%s://<hostname>/<folder>/<file>", getScheme(protocol)); } else { // case file: // case googledrive: // case dropbox: // case onedrive: url = String.format("%s://<folder>/<file>", getScheme(protocol)); } break; } builder .append(String.format("%s %s", StringUtils.leftPad(protocol.getDescription(), 50), url)) .append(StringUtils.LF); }
if(!protocol.isHostnameConfigurable()) {
@Override public void awakeFromNib() { super.awakeFromNib(); if(bookmark.getProtocol().isHostnameConfigurable()) { window.makeFirstResponder(hostField); } else { if(options.user) { window.makeFirstResponder(usernameField); } } this.update(); }
@Override public boolean check(final Session<?> session, final Cache<Path> cache, final CancelCallback callback) throws BackgroundException { final Host bookmark = session.getHost(); if(bookmark.getProtocol().isHostnameConfigurable() && StringUtils.isBlank(bookmark.getHostname())) { throw new ConnectionCanceledException(); } if(session.isConnected()) { if(log.isDebugEnabled()) { log.debug(String.format("Skip opening connection for session %s", session)); } // Connection already open return false; } // Obtain password from keychain or prompt synchronized(login) { login.validate(bookmark, MessageFormat.format(LocaleFactory.localizedString( "Login {0} with username and password", "Credentials"), BookmarkNameProvider.toString(bookmark)), prompt, new LoginOptions(bookmark.getProtocol())); } this.connect(session, cache, callback); return true; }
@Override public void change(final Host bookmark) { updateField(hostField, bookmark.getHostname()); hostField.setEnabled(bookmark.getProtocol().isHostnameConfigurable()); hostField.cell().setPlaceholderString(bookmark.getProtocol().getDefaultHostname()); } });
if(!bookmark.getProtocol().isHostnameConfigurable()) { if(!selected.isHostnameConfigurable()) {