mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move ssh connection provider to remote-run.
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
package com.intellij.remote;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author lene
|
||||
* Date: 05.07.13
|
||||
*/
|
||||
public interface SshConnectionProvider {
|
||||
ExtensionPointName<SshConnectionProvider> EP_NAME = ExtensionPointName.create("RemoteRun.sshConnectionProvider");
|
||||
|
||||
@NotNull
|
||||
Collection<? extends RemoteConnector> collectRemoteConnectors();
|
||||
|
||||
@Nullable
|
||||
RemoteConnector getRemoteConnector(RemoteConnectionType type, @Nullable String id, Project project, Module module);
|
||||
|
||||
@Nullable
|
||||
String getSettingCreationDescription();
|
||||
|
||||
@NotNull
|
||||
@Nls
|
||||
String getRadioButtonDescription();
|
||||
|
||||
@NotNull
|
||||
RemoteConnectionType getTypeForConfigurable();
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.intellij.remote;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.remote.RemoteConnectionType;
|
||||
import com.intellij.remote.RemoteConnector;
|
||||
import com.intellij.remote.SshConnectionProvider;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public class VagrantSshConnectionProvider implements SshConnectionProvider {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends RemoteConnector> collectRemoteConnectors() {
|
||||
return collectVagrantConnections();
|
||||
}
|
||||
|
||||
private static List<RemoteConnector> collectVagrantConnections() {
|
||||
List<RemoteConnector> result = Lists.newArrayList();
|
||||
VagrantSupport vs = VagrantSupport.getInstance();
|
||||
if (vs != null) {
|
||||
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
|
||||
result.addAll(vs.getVagrantInstancesConnectors(project));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public RemoteConnector getRemoteConnector(RemoteConnectionType type, @Nullable String id, Project project, Module module) {
|
||||
for (RemoteConnector connector : collectRemoteConnectors()) {
|
||||
if (connector.getType() == type && (connector.getId() != null && connector.getId().equals(id))) {
|
||||
return connector;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getSettingCreationDescription() {
|
||||
return "add Vagrant";
|
||||
}
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getRadioButtonDescription() {
|
||||
return "Current Vagrant";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RemoteConnectionType getTypeForConfigurable() {
|
||||
return RemoteConnectionType.CURRENT_VAGRANT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user