public void setEncodingPopup(NSPopUpButton encodingPopup) { this.encodingPopup = encodingPopup; this.encodingPopup.setEnabled(true); this.encodingPopup.removeAllItems(); this.encodingPopup.addItemWithTitle(DEFAULT); this.encodingPopup.menu().addItem(NSMenuItem.separatorItem()); this.encodingPopup.addItemsWithTitles( NSArray.arrayWithObjects(MainController.availableCharsets())); if (null == host.getEncoding()) { this.encodingPopup.selectItemWithTitle(DEFAULT); } else { this.encodingPopup.selectItemWithTitle(host.getEncoding()); } this.encodingPopup.setTarget(this.id()); final Selector action = Foundation.selector("encodingSelectionChanged:"); this.encodingPopup.setAction(action); }