Tabnine Logo
NSMenu
Code IndexAdd Tabnine to your IDE (free)

How to use
NSMenu
in
ch.cyberduck.binding.application

Best Java code snippets using ch.cyberduck.binding.application.NSMenu (Showing top 20 results out of 315)

origin: iterate-ch/cyberduck

this.timezonePopup.addItemWithTitle(UTC.getID());
this.timezonePopup.lastItem().setRepresentedObject(UTC.getID());
this.timezonePopup.menu().addItem(NSMenuItem.separatorItem());
Collections.sort(timezones, new Comparator<String>() {
  @Override
origin: iterate-ch/cyberduck

public void setColumnMenu(NSMenu columnMenu) {
  this.columnMenu = columnMenu;
  Map<String, String> columns = new HashMap<String, String>();
  columns.put(String.format("browser.column.%s", BrowserColumn.kind.name()), BrowserColumn.kind.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.extension.name()), BrowserColumn.extension.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.size.name()), BrowserColumn.size.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.modified.name()), BrowserColumn.modified.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.owner.name()), BrowserColumn.owner.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.group.name()), BrowserColumn.group.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.permission.name()), BrowserColumn.permission.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.region.name()), BrowserColumn.region.toString());
  columns.put(String.format("browser.column.%s", BrowserColumn.version.name()), BrowserColumn.version.toString());
  for(Map.Entry<String, String> entry : columns.entrySet()) {
    NSMenuItem item = this.columnMenu.addItemWithTitle_action_keyEquivalent(entry.getValue(),
      Foundation.selector("columnMenuClicked:"), StringUtils.EMPTY);
    final String identifier = entry.getKey();
    item.setState(preferences.getBoolean(identifier) ? NSCell.NSOnState : NSCell.NSOffState);
    item.setRepresentedObject(identifier);
  }
}
origin: iterate-ch/cyberduck

public void setFilesPopup(final NSPopUpButton p) {
  this.filesPopup = p;
  this.filesPopup.setTarget(this.id());
  this.filesPopup.removeAllItems();
  final List<TransferItem> items = transfer.getRoots();
  for(int i = 0; i < items.size(); i++) {
    final TransferItem entry = items.get(i);
    this.filesPopup.addItemWithTitle(i == 0 && items.size() > 1 ?
      String.format("%s (%d more)", entry.remote.getName(), items.size() - 1) : entry.remote.getName());
  }
  this.filesPopupMenuDelegate = new TransferMenuDelegate(transfer);
  this.filesPopup.menu().setDelegate(this.filesPopupMenuDelegate.id());
  notificationCenter.addObserver(this.id(),
    Foundation.selector("filesPopupWillShow:"),
    NSPopUpButton.PopUpButtonWillPopUpNotification,
    this.filesPopup.id());
  notificationCenter.addObserver(this.id(),
    Foundation.selector("filesPopupWillHide:"),
    "NSMenuDidEndTrackingNotification",
    this.filesPopup.menu().id());
}
origin: iterate-ch/cyberduck

/**
 * Set name of key in menu item
 */
protected void updateLicenseMenu() {
  final License key = LicenseFactory.find();
  if(key.isReceipt()) {
    this.applicationMenu.removeItemAtIndex(new NSInteger(5));
    this.applicationMenu.removeItemAtIndex(new NSInteger(4));
  }
  else {
    this.applicationMenu.itemAtIndex(new NSInteger(5)).setAttributedTitle(
      NSAttributedString.attributedStringWithAttributes(key.toString(), MENU_HELP_FONT_ATTRIBUTES)
    );
  }
}
origin: iterate-ch/cyberduck

NSMenu bandwidthMenu = NSMenu.menu();
bandwidthMenu.setAutoenablesItems(true);
bandwidthMenu.setDelegate(controller.getBandwidthMenuDelegate().id());
final NSMenuItem unlimited = bandwidthMenu.addItemWithTitle_action_keyEquivalent(LocaleFactory.localizedString("Unlimited Bandwidth", "Transfer"),
    bandwidth.action(), StringUtils.EMPTY);
unlimited.setImage(bandwidth.image());
unlimited.setRepresentedObject(String.valueOf(BandwidthThrottle.UNLIMITED));
bandwidthMenu.addItem(NSMenuItem.separatorItem());
final StringTokenizer options = new StringTokenizer(preferences.getProperty("queue.bandwidth.options"), ",");
while(options.hasMoreTokens()) {
  final String bytes = options.nextToken();
  final NSMenuItem m = bandwidthMenu.addItemWithTitle_action_keyEquivalent(SizeFormatterFactory.get().format(Integer.parseInt(bytes)) + "/s",
      bandwidth.action(), StringUtils.EMPTY);
NSMenu connectionsMenu = NSMenu.menu();
connectionsMenu.setAutoenablesItems(true);
final StringTokenizer options = new StringTokenizer(preferences.getProperty("queue.connections.options"), ",");
while(options.hasMoreTokens()) {
  final String n = options.nextToken();
  final NSMenuItem m = connectionsMenu.addItemWithTitle_action_keyEquivalent(
      MessageFormat.format(LocaleFactory.localizedString("{0} Connections", "Transfer"), n),
      TransferToolbarItem.connections.action(), StringUtils.EMPTY);
origin: iterate-ch/cyberduck

button.setAction(browserview.action());
button.setSelectedSegment(preferences.getInteger("browser.view"));
NSMenu menu = NSMenu.menu();
menu.addItemWithTitle_action_keyEquivalent(LocaleFactory.localizedString("List"),
    Foundation.selector("browserSwitchMenuClicked:"), StringUtils.EMPTY);
menu.itemWithTitle(LocaleFactory.localizedString("List")).setTag(BrowserController.BrowserSwitchSegement.list.ordinal());
menu.addItemWithTitle_action_keyEquivalent(LocaleFactory.localizedString("Outline"),
    Foundation.selector("browserSwitchMenuClicked:"), StringUtils.EMPTY);
menu.itemWithTitle(LocaleFactory.localizedString("Outline")).setTag(BrowserController.BrowserSwitchSegement.outline.ordinal());
toolbarMenu.setSubmenu(menu);
item.setView(button);
    encoding.action(), StringUtils.EMPTY);
final String[] charsets = new DefaultCharsetProvider().availableCharsets();
NSMenu charsetMenu = NSMenu.menu();
for(String charset : charsets) {
  final NSMenuItem m = charsetMenu.addItemWithTitle_action_keyEquivalent(charset, encoding.action(), StringUtils.EMPTY);
  m.setRepresentedObject(charset);
NSMenu editMenu = NSMenu.menu();
editMenu.setAutoenablesItems(true);
editMenu.setDelegate(controller.getEditMenuDelegate().id());
toolbarMenu.setSubmenu(editMenu);
final NSButton button = NSButton.buttonWithFrame(new NSRect(0, 0));
origin: iterate-ch/cyberduck

menu.removeItemAtIndex(row);
menu.insertItem_atIndex(this.seperator(), row);
origin: iterate-ch/cyberduck

public void setDefaultDownloadThrottleCombobox(NSPopUpButton b) {
  this.defaultDownloadThrottleCombobox = b;
  this.defaultDownloadThrottleCombobox.setTarget(this.id());
  this.defaultDownloadThrottleCombobox.setAction(Foundation.selector("defaultDownloadThrottleComboboxClicked:"));
  int bandwidth = (int) preferences.getDouble("queue.download.bandwidth.bytes");
  final StringTokenizer options = new StringTokenizer(preferences.getProperty("queue.bandwidth.options"), ",");
  while(options.hasMoreTokens()) {
    final String bytes = options.nextToken();
    this.defaultDownloadThrottleCombobox.addItemWithTitle(SizeFormatterFactory.get().format(Integer.parseInt(bytes)) + "/s");
    this.defaultDownloadThrottleCombobox.lastItem().setRepresentedObject(bytes);
  }
  if(-1 == bandwidth) {
    this.defaultDownloadThrottleCombobox.selectItemWithTag(new NSInteger(-1));
  }
  else {
    this.defaultDownloadThrottleCombobox.selectItemAtIndex(
      this.defaultDownloadThrottleCombobox.menu().indexOfItemWithRepresentedObject(String.valueOf(bandwidth)));
  }
}
origin: iterate-ch/cyberduck

public static NSMenu menu() {
  return CLASS.alloc().init();
}
origin: iterate-ch/cyberduck

public static NSMenu menuWithTitle(String title) {
  return CLASS.alloc().initWithTitle(title);
}
origin: iterate-ch/cyberduck

@Action
public void menuItemClicked(final NSMenuItem item) {
  this.handle(this.getURLs(item.menu().indexOfItem(item), this.getSelected()));
}
origin: iterate-ch/cyberduck

private void addDownloadPath(final Local f) {
  if(downloadPathPopup.menu().itemWithTitle(f.getDisplayName()) == null) {
    downloadPathPopup.addItemWithTitle(f.getDisplayName());
    downloadPathPopup.lastItem().setImage(IconCacheFactory.<NSImage>get().fileIcon(f, 16));
    downloadPathPopup.lastItem().setRepresentedObject(f.getAbsolute());
    if(new DownloadDirectoryFinder().find(bookmark).equals(f)) {
      downloadPathPopup.selectItem(downloadPathPopup.lastItem());
    }
  }
}
origin: iterate-ch/cyberduck

@Override
public boolean menuUpdateItemAtIndex(NSMenu menu, NSMenuItem item, NSInteger row, boolean cancel) {
  if(row.intValue() == index) {
    item.setEnabled(true);
    item.setTitle(LocaleFactory.get().localize("History", "Localizable"));
    item.setImage(IconCacheFactory.<NSImage>get().iconNamed("history.tiff", 16));
    item.setTarget(this.id());
    item.setAction(Foundation.selector("historyMenuClicked:"));
    item.setSubmenu(historyMenu);
  }
  if(row.intValue() == index + 1) {
    item.setEnabled(true);
    item.setTitle(LocaleFactory.get().localize("Bonjour", "Main"));
    item.setImage(IconCacheFactory.<NSImage>get().iconNamed("rendezvous.tiff", 16));
    item.setSubmenu(rendezvousMenu);
  }
  if(row.intValue() == index + 2) {
    menu.removeItemAtIndex(row);
    menu.insertItem_atIndex(this.seperator(), row);
  }
  if(row.intValue() > index + 2) {
    Host h = this.itemForIndex(row);
    item.setTitle(BookmarkNameProvider.toString(h));
    item.setTarget(this.id());
    item.setImage(IconCacheFactory.<NSImage>get().iconNamed(h.getProtocol().icon(), preferences.getInteger("bookmark.menu.icon.size")));
    item.setAction(this.getDefaultAction());
    item.setRepresentedObject(h.getUuid());
  }
  return super.menuUpdateItemAtIndex(menu, item, row, cancel);
}
origin: iterate-ch/cyberduck

public void setDefaultUploadThrottleCombobox(NSPopUpButton b) {
  this.defaultUploadThrottleCombobox = b;
  this.defaultUploadThrottleCombobox.setTarget(this.id());
  this.defaultUploadThrottleCombobox.setAction(Foundation.selector("defaultUploadThrottleComboboxClicked:"));
  int bandwidth = (int) preferences.getDouble("queue.upload.bandwidth.bytes");
  final StringTokenizer options = new StringTokenizer(preferences.getProperty("queue.bandwidth.options"), ",");
  while(options.hasMoreTokens()) {
    final String bytes = options.nextToken();
    this.defaultUploadThrottleCombobox.addItemWithTitle(SizeFormatterFactory.get().format(Integer.parseInt(bytes)) + "/s");
    this.defaultUploadThrottleCombobox.lastItem().setRepresentedObject(bytes);
  }
  if(-1 == bandwidth) {
    this.defaultUploadThrottleCombobox.selectItemWithTag(new NSInteger(-1));
  }
  else {
    this.defaultUploadThrottleCombobox.selectItemAtIndex(
      this.defaultUploadThrottleCombobox.menu().indexOfItemWithRepresentedObject(String.valueOf(bandwidth)));
  }
}
origin: iterate-ch/cyberduck

  this.addProtocol(protocol);
this.protocolCombobox.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new DefaultProtocolPredicate(
  EnumSet.of(Protocol.Type.s3, Protocol.Type.swift, Protocol.Type.azure, Protocol.Type.b2, Protocol.Type.dracoon, Protocol.Type.googlestorage)))) {
  this.addProtocol(protocol);
this.protocolCombobox.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new DefaultProtocolPredicate(
  EnumSet.of(Protocol.Type.dropbox, Protocol.Type.onedrive, Protocol.Type.googledrive)))) {
  this.addProtocol(protocol);
this.protocolCombobox.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new DefaultProtocolPredicate(
  EnumSet.of(Protocol.Type.file)))) {
  this.addProtocol(protocol);
this.protocolCombobox.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new ProfileProtocolPredicate())) {
  this.addProtocol(protocol);
origin: iterate-ch/cyberduck

public void setUpdateFeedPopup(NSPopUpButton b) {
  this.updateFeedPopup = b;
  this.updateFeedPopup.removeAllItems();
  this.updateFeedPopup.setAction(Foundation.selector("updateFeedPopupClicked:"));
  this.updateFeedPopup.addItemWithTitle(LocaleFactory.localizedString("Release"));
  this.updateFeedPopup.lastItem().setRepresentedObject(preferences.getProperty("update.feed.release"));
  this.updateFeedPopup.addItemWithTitle(LocaleFactory.localizedString("Beta"));
  this.updateFeedPopup.lastItem().setRepresentedObject(preferences.getProperty("update.feed.beta"));
  this.updateFeedPopup.addItemWithTitle(LocaleFactory.localizedString("Snapshot Builds"));
  this.updateFeedPopup.lastItem().setRepresentedObject(preferences.getProperty("update.feed.nightly"));
  final String feed = preferences.getProperty(Updater.PROPERTY_FEED_URL);
  NSInteger selected = this.updateFeedPopup.menu().indexOfItemWithRepresentedObject(feed);
  if(-1 == selected.intValue()) {
    log.warn(String.format("Invalid feed setting:%s", feed));
    this.updateFeedPopup.selectItemAtIndex(this.updateFeedPopup.menu().indexOfItemWithRepresentedObject(
      preferences.getProperty("update.feed.release")));
  }
  else {
    this.updateFeedPopup.selectItemAtIndex(selected);
  }
}
origin: iterate-ch/cyberduck

public void setEncodingMenu(NSMenu encodingMenu) {
  this.encodingMenu = encodingMenu;
  for(String charset : new DefaultCharsetProvider().availableCharsets()) {
    final NSMenuItem item = this.encodingMenu.addItemWithTitle_action_keyEquivalent(charset, Foundation.selector("encodingMenuClicked:"), StringUtils.EMPTY);
    item.setRepresentedObject(charset);
  }
}
origin: iterate-ch/cyberduck

  this.addProtocol(protocol);
this.protocolPopup.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new DefaultProtocolPredicate(
  EnumSet.of(Protocol.Type.s3, Protocol.Type.swift, Protocol.Type.azure, Protocol.Type.b2, Protocol.Type.dracoon, Protocol.Type.googlestorage)))) {
  this.addProtocol(protocol);
this.protocolPopup.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new DefaultProtocolPredicate(
  EnumSet.of(Protocol.Type.dropbox, Protocol.Type.onedrive, Protocol.Type.googledrive)))) {
  this.addProtocol(protocol);
this.protocolPopup.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new DefaultProtocolPredicate(
  EnumSet.of(Protocol.Type.file)))) {
  this.addProtocol(protocol);
this.protocolPopup.menu().addItem(NSMenuItem.separatorItem());
for(Protocol protocol : protocols.find(new ProfileProtocolPredicate())) {
  this.addProtocol(protocol);
origin: iterate-ch/cyberduck

public void setDownloadPathPopup(NSPopUpButton b) {
  this.downloadPathPopup = b;
  this.downloadPathPopup.setTarget(this.id());
  this.downloadPathPopup.setAction(Foundation.selector("downloadPathPopupClicked:"));
  this.downloadPathPopup.removeAllItems();
  // Default download folder
  this.addDownloadPath(DEFAULT_DOWNLOAD_FOLDER);
  this.downloadPathPopup.menu().addItem(NSMenuItem.separatorItem());
  // Shortcut to the Desktop
  this.addDownloadPath(LocalFactory.get("~/Desktop"));
  // Shortcut to user home
  this.addDownloadPath(LocalFactory.get("~"));
  // Shortcut to user downloads for 10.5
  this.addDownloadPath(LocalFactory.get("~/Downloads"));
  // Choose another folder
  this.downloadPathPopup.menu().addItem(NSMenuItem.separatorItem());
  this.downloadPathPopup.addItemWithTitle(String.format("%s…", LocaleFactory.localizedString("Choose")));
}
origin: iterate-ch/cyberduck

public void setDownloadPathPopup(final NSPopUpButton button) {
  this.downloadPathPopup = button;
  this.downloadPathPopup.setTarget(this.id());
  this.downloadPathPopup.setAction(Foundation.selector("downloadPathPopupClicked:"));
  this.downloadPathPopup.removeAllItems();
  // Default download folder
  this.addDownloadPath(new DownloadDirectoryFinder().find(bookmark));
  this.downloadPathPopup.menu().addItem(NSMenuItem.separatorItem());
  this.addDownloadPath(LocalFactory.get(preferences.getProperty("queue.download.folder")));
  // Shortcut to the Desktop
  this.addDownloadPath(LocalFactory.get("~/Desktop"));
  // Shortcut to user home
  this.addDownloadPath(LocalFactory.get("~"));
  // Shortcut to user downloads for 10.5
  this.addDownloadPath(LocalFactory.get("~/Downloads"));
  // Choose another folder
  // Choose another folder
  this.downloadPathPopup.menu().addItem(NSMenuItem.separatorItem());
  this.downloadPathPopup.addItemWithTitle(String.format("%s…", LocaleFactory.localizedString("Choose")));
}
ch.cyberduck.binding.applicationNSMenu

Most used methods

  • addItem
    Original signature : void addItem(NSMenuItem*) native declaration : :64
  • addItemWithTitle_action_keyEquivalent
    native declaration : :66 Conversion Error : /// Original signature : NSMenuItem* addItemWithTitle(NS
  • id
  • indexOfItem
    Original signature : NSInteger indexOfItem(NSMenuItem*) native declaration : :74
  • indexOfItemWithRepresentedObject
    Original signature : NSInteger indexOfItemWithRepresentedObject(id) native declaration : :77
  • init
  • initWithTitle
    Original signature : id initWithTitle(NSString*) native declaration : :54
  • insertItem_atIndex
    Original signature : void insertItem(NSMenuItem*, NSInteger) native declaration : :63
  • itemAtIndex
    Original signature : NSMenuItem* itemAtIndex(NSInteger) native declaration : :81
  • itemWithTitle
    Original signature : NSMenuItem* itemWithTitle(NSString*) native declaration : :82
  • menu
  • removeItemAtIndex
    Original signature : void removeItemAtIndex(NSInteger) native declaration : :67
  • menu,
  • removeItemAtIndex,
  • setAutoenablesItems,
  • setDelegate

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now