1 package ch
.cyberduck
.ui
.cocoa
.delegate
;
4 * Copyright (c) 2012 David Kocher. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * Bug fixes, suggestions and comments should be sent to:
18 * dkocher@cyberduck.ch
21 import ch
.cyberduck
.core
.DescriptiveUrl
;
22 import ch
.cyberduck
.core
.Path
;
23 import ch
.cyberduck
.core
.UrlProvider
;
24 import ch
.cyberduck
.core
.cdn
.DistributionConfiguration
;
25 import ch
.cyberduck
.core
.local
.BrowserLauncherFactory
;
26 import ch
.cyberduck
.binding
.application
.NSEvent
;
28 import java
.util
.ArrayList
;
29 import java
.util
.List
;
34 public abstract class OpenURLMenuDelegate
extends URLMenuDelegate
{
37 protected String
getKeyEquivalent() {
42 protected int getModifierMask() {
43 return NSEvent
.NSCommandKeyMask
| NSEvent
.NSShiftKeyMask
;
47 protected List
<DescriptiveUrl
> getURLs(Path selected
) {
48 final ArrayList
<DescriptiveUrl
> list
= new ArrayList
<DescriptiveUrl
>();
49 final UrlProvider provider
= this.getSession().getFeature(UrlProvider
.class);
50 if(provider
!= null) {
51 list
.addAll(provider
.toUrl(selected
).filter(
52 DescriptiveUrl
.Type
.http
, DescriptiveUrl
.Type
.cname
, DescriptiveUrl
.Type
.cdn
,
53 DescriptiveUrl
.Type
.signed
, DescriptiveUrl
.Type
.authenticated
, DescriptiveUrl
.Type
.torrent
));
55 final DistributionConfiguration feature
= this.getSession().getFeature(DistributionConfiguration
.class);
57 list
.addAll(feature
.toUrl(selected
));
63 public void handle(final List
<DescriptiveUrl
> selected
) {
64 for(DescriptiveUrl url
: selected
) {
65 BrowserLauncherFactory
.get().open(url
.getUrl());