use of com.mucommander.protocol.ui.ProtocolPanelProvider in project mucommander by mucommander.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
FileProtocolService service = new FileProtocolService() {
@Override
public String getSchema() {
return "vsphere";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new VSphereProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(true), 443, "/", AuthenticationType.AUTHENTICATION_REQUIRED, null);
}
};
ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {
@Override
public String getSchema() {
return "vsphere";
}
@Override
public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
return new VSpherePanel(listener, mainFrame);
}
@Override
public int priority() {
return 9000;
}
};
serviceRegistration = context.registerService(FileProtocolService.class, service, null);
uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
use of com.mucommander.protocol.ui.ProtocolPanelProvider in project mucommander by mucommander.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
FileProtocolService service = new FileProtocolService() {
@Override
public String getSchema() {
return "http";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new HTTPProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(true), 80, "/", AuthenticationType.AUTHENTICATION_OPTIONAL, null);
}
};
FileProtocolService service2 = new FileProtocolService() {
@Override
public String getSchema() {
return "https";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new HTTPProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(true), 443, "/", AuthenticationType.AUTHENTICATION_OPTIONAL, null);
}
};
ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {
@Override
public String getSchema() {
return "http";
}
@Override
public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
return new HTTPPanel(listener, mainFrame);
}
@Override
public int priority() {
return 6000;
}
@Override
public Class<? extends ServerPanel> getPanelClass() {
return HTTPPanel.class;
}
};
serviceRegistration = context.registerService(FileProtocolService.class, service, null);
service2Registration = context.registerService(FileProtocolService.class, service2, null);
uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
use of com.mucommander.protocol.ui.ProtocolPanelProvider in project mucommander by mucommander.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
FileProtocolService service = new FileProtocolService() {
@Override
public String getSchema() {
return "ovirt";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new OvirtProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(true), 443, "/", AuthenticationType.AUTHENTICATION_REQUIRED, null);
}
};
ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {
@Override
public String getSchema() {
return "ovirt";
}
@Override
public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
return new OvirtPanel(listener, mainFrame);
}
@Override
public int priority() {
return 7000;
}
};
serviceRegistration = context.registerService(FileProtocolService.class, service, null);
uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
use of com.mucommander.protocol.ui.ProtocolPanelProvider in project mucommander by mucommander.
the class DrivePopupButton method getPopupMenu.
// //////////////////////////////
// PopupButton implementation //
// //////////////////////////////
@Override
public JPopupMenu getPopupMenu() {
JPopupMenu popupMenu = new JPopupMenu();
// Update the list of volumes in case new ones were mounted
volumes = getDisplayableVolumes();
// Add volumes
int nbVolumes = volumes.length;
final MainFrame mainFrame = folderPanel.getMainFrame();
// Provides mnemonics and ensures uniqueness
MnemonicHelper mnemonicHelper = new MnemonicHelper();
JMenuItem item;
MuAction action;
String volumeName;
boolean useExtendedDriveNames = fileSystemView != null;
ArrayList<JMenuItem> itemsV = new ArrayList<JMenuItem>();
for (int i = 0; i < nbVolumes; i++) {
action = new CustomOpenLocationAction(mainFrame, new Hashtable<String, Object>(), volumes[i]);
volumeName = volumes[i].getName();
// volume's path, to disambiguate
for (int j = 0; j < nbVolumes; j++) {
if (j != i && volumes[j].getName().equalsIgnoreCase(volumeName)) {
action.setLabel(volumes[i].getAbsolutePath());
break;
}
}
item = popupMenu.add(action);
setMnemonic(item, mnemonicHelper);
// Set icon from cache
Icon icon = iconCache.get(volumes[i]);
if (icon != null) {
item.setIcon(icon);
}
if (useExtendedDriveNames) {
// Use the last known value (if any) while we update it in a separate thread
String previousExtendedName = extendedNameCache.get(volumes[i]);
if (previousExtendedName != null)
item.setText(previousExtendedName);
}
// JMenu offers no way to retrieve a particular JMenuItem, so we have to keep them
itemsV.add(item);
}
new RefreshDriveNamesAndIcons(popupMenu, itemsV).start();
popupMenu.add(new JSeparator());
// Add boookmarks
java.util.List<Bookmark> bookmarks = BookmarkManager.getBookmarks();
if (!bookmarks.isEmpty()) {
for (Bookmark bookmark : bookmarks) {
item = popupMenu.add(new CustomOpenLocationAction(mainFrame, new Hashtable<String, Object>(), bookmark));
setMnemonic(item, mnemonicHelper);
}
} else {
// No bookmark : add a disabled menu item saying there is no bookmark
popupMenu.add(Translator.get("bookmarks_menu.no_bookmark")).setEnabled(false);
}
popupMenu.add(new JSeparator());
// Add 'Network shares' shortcut
if (FileFactory.isRegisteredProtocol(FileProtocols.SMB)) {
action = new CustomOpenLocationAction(mainFrame, new Hashtable<String, Object>(), new Bookmark(Translator.get("drive_popup.network_shares"), "smb:///"));
action.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.NETWORK_ICON_NAME));
setMnemonic(popupMenu.add(action), mnemonicHelper);
}
// Add Bonjour services menu
setMnemonic(popupMenu.add(new BonjourMenu() {
@Override
public MuAction getMenuItemAction(BonjourService bs) {
return new CustomOpenLocationAction(mainFrame, new Hashtable<String, Object>(), bs);
}
}), mnemonicHelper);
popupMenu.add(new JSeparator());
// Add 'connect to server' shortcuts
schemaToPanelProvider.values().stream().sorted(Comparator.comparing(ProtocolPanelProvider::priority)).map(this::toServerConnectAction).map(popupMenu::add).forEach(menuItem -> setMnemonic(menuItem, mnemonicHelper));
return popupMenu;
}
use of com.mucommander.protocol.ui.ProtocolPanelProvider in project mucommander by mucommander.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
FileProtocolService service = new FileProtocolService() {
@Override
public String getSchema() {
return "gdrive";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new GoogleDriveProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(), 21, "/", AuthenticationType.NO_AUTHENTICATION, new Credentials("anonymous", "anonymous_coward@mucommander.com"));
}
};
ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {
@Override
public String getSchema() {
return "gdrive";
}
@Override
public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
return new GoogleDrivePanel(listener, mainFrame);
}
@Override
public int priority() {
return 5000;
}
@Override
public Class<? extends ServerPanel> getPanelClass() {
return GoogleDrivePanel.class;
}
};
serviceRegistration = context.registerService(FileProtocolService.class, service, null);
uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
Aggregations