Skip to content

Commit

Permalink
Review usages.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 15, 2025
1 parent 7410892 commit e9921e6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
import ch.cyberduck.ui.cocoa.toolbar.BrowserToolbarValidator;
import ch.cyberduck.ui.cocoa.view.BookmarkCell;
import ch.cyberduck.ui.cocoa.view.OutlineCell;
import ch.cyberduck.ui.pasteboard.PasteboardService;
import ch.cyberduck.ui.pasteboard.PasteboardServiceFactory;
import ch.cyberduck.ui.quicklook.QuickLook;
import ch.cyberduck.ui.quicklook.QuickLookFactory;

Expand Down Expand Up @@ -2609,11 +2611,7 @@ public void cleanup(final DescriptiveUrl url) {
public void callback(final int returncode) {
switch(returncode) {
case SheetCallback.CANCEL_OPTION:
final NSPasteboard pboard = NSPasteboard.generalPasteboard();
pboard.declareTypes(NSArray.arrayWithObject(NSString.stringWithString(NSPasteboard.StringPboardType)), null);
if(!pboard.setStringForType(url.getUrl(), NSPasteboard.StringPboardType)) {
log.error("Error writing URL to {}", NSPasteboard.StringPboardType);
}
PasteboardServiceFactory.get().add(PasteboardService.Type.url, url.getUrl());
}
}

Expand Down Expand Up @@ -2655,11 +2653,7 @@ public void cleanup(final DescriptiveUrl url) {
public void callback(final int returncode) {
switch(returncode) {
case SheetCallback.CANCEL_OPTION:
final NSPasteboard pboard = NSPasteboard.generalPasteboard();
pboard.declareTypes(NSArray.arrayWithObject(NSString.stringWithString(NSPasteboard.StringPboardType)), null);
if(!pboard.setStringForType(url.getUrl(), NSPasteboard.StringPboardType)) {
log.error("Error writing URL to {}", NSPasteboard.StringPboardType);
}
PasteboardServiceFactory.get().add(PasteboardService.Type.url, url.getUrl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
*/

import ch.cyberduck.binding.application.NSEvent;
import ch.cyberduck.binding.application.NSPasteboard;
import ch.cyberduck.binding.foundation.NSArray;
import ch.cyberduck.binding.foundation.NSString;
import ch.cyberduck.core.DescriptiveUrl;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.UrlProvider;
import ch.cyberduck.core.pool.SessionPool;
import ch.cyberduck.ui.pasteboard.PasteboardService;
import ch.cyberduck.ui.pasteboard.PasteboardServiceFactory;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -68,10 +67,6 @@ public void handle(final List<DescriptiveUrl> selected) {
url.append("\n");
}
}
final NSPasteboard pboard = NSPasteboard.generalPasteboard();
pboard.declareTypes(NSArray.arrayWithObject(NSString.stringWithString(NSPasteboard.StringPboardType)), null);
if(!pboard.setStringForType(url.toString(), NSPasteboard.StringPboardType)) {
log.error("Error writing URL to {}", NSPasteboard.StringPboardType);
}
PasteboardServiceFactory.get().add(PasteboardService.Type.string, url.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
using ch.cyberduck.core.worker;
using ch.cyberduck.ui.browser;
using ch.cyberduck.ui.comparator;
using ch.cyberduck.ui.pasteboard;
using ch.cyberduck.ui.Views;
using Ch.Cyberduck.Core;
using Ch.Cyberduck.Core.Local;
Expand Down Expand Up @@ -3705,7 +3706,7 @@ public override void cleanup(object result)
switch (option)
{
case 1:
Clipboard.SetText(url.getUrl());
PasteboardServiceFactory.get().add(PasteboardService.Type.url, url.getUrl());
break;
}
});
Expand Down Expand Up @@ -3750,7 +3751,7 @@ public override void cleanup(object result)
switch (option)
{
case 1:
Clipboard.SetText(url.getUrl());
PasteboardServiceFactory.get().add(PasteboardService.Type.url, url.getUrl());
break;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System.Windows.Forms;
using Ch.Cyberduck.Core;
using ch.cyberduck.core;
using ch.cyberduck.ui.pasteboard;
using ch.cyberduck.core.local;

namespace Ch.Cyberduck.Ui.Winforms.Controls
Expand All @@ -33,7 +34,7 @@ public ClickLinkLabel()
{
ContextMenuStrip contextMenu = new ContextMenuStrip();
ToolStripItem addItem = contextMenu.Items.Add(LocaleFactory.localizedString("Copy URL", "Browser"));
addItem.Click += (sender, args) => Clipboard.SetText(Text);
addItem.Click += (sender, args) => PasteboardServiceFactory.get().add(PasteboardService.Type.url, Text);
ContextMenuStrip = contextMenu;
}
}
Expand Down

0 comments on commit e9921e6

Please sign in to comment.