Search in sources :

Example 1 with MountSettings

use of org.knime.workbench.explorer.view.preferences.MountSettings in project knime-core by knime.

the class IntroPage method mountServer.

private void mountServer() {
    String s = ExplorerActivator.getDefault().getPreferenceStore().getString(PreferenceConstants.P_EXPLORER_MOUNT_POINT_XML);
    List<MountSettings> mountSettingsList = MountSettings.parseSettings(s, true);
    Set<String> idSet = new LinkedHashSet<>();
    for (MountSettings settings : mountSettingsList) {
        idSet.add(settings.getFactoryID());
    }
    List<String> contentProviderIDs = new ArrayList<String>(idSet);
    List<String> mountIDs = new ArrayList<String>(mountSettingsList.size());
    for (MountSettings settings : mountSettingsList) {
        mountIDs.add(settings.getMountID());
    }
    EditMountPointDialog dlg = new EditMountPointDialog(Display.getDefault().getActiveShell(), ExplorerMountTable.getAddableContentProviders(contentProviderIDs), mountIDs);
    if (dlg.open() != Window.OK) {
        return;
    }
    AbstractContentProvider newCP = dlg.getContentProvider();
    if (newCP != null) {
        MountSettings mountSettings = new MountSettings(newCP);
        if (mountSettings.getDefaultMountID() == null) {
            mountSettings.setDefaultMountID(dlg.getDefaultMountID());
        }
        mountSettingsList.add(mountSettings);
        // store new mount point settings
        String settingsString = MountSettings.getSettingsString(mountSettingsList);
        ExplorerActivator.getDefault().getPreferenceStore().setValue(PreferenceConstants.P_EXPLORER_MOUNT_POINT_XML, settingsString);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) EditMountPointDialog(org.knime.workbench.explorer.view.preferences.EditMountPointDialog) ArrayList(java.util.ArrayList) AbstractContentProvider(org.knime.workbench.explorer.view.AbstractContentProvider) MountSettings(org.knime.workbench.explorer.view.preferences.MountSettings)

Aggregations

ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 AbstractContentProvider (org.knime.workbench.explorer.view.AbstractContentProvider)1 EditMountPointDialog (org.knime.workbench.explorer.view.preferences.EditMountPointDialog)1 MountSettings (org.knime.workbench.explorer.view.preferences.MountSettings)1