Docker integration - nice deployments list - move comparator to server type

This commit is contained in:
Michael Golubev
2014-12-17 23:55:26 +01:00
parent 5e826343fc
commit ca2d6e2555
3 changed files with 15 additions and 20 deletions
@@ -6,6 +6,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.remoteServer.configuration.RemoteServer;
import com.intellij.remoteServer.configuration.ServerConfiguration;
import com.intellij.remoteServer.configuration.deployment.DeploymentConfigurator;
import com.intellij.remoteServer.runtime.Deployment;
import com.intellij.remoteServer.runtime.ServerConnector;
import com.intellij.remoteServer.runtime.ServerTaskExecutor;
import com.intellij.remoteServer.runtime.deployment.debug.DebugConnector;
@@ -13,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Comparator;
/**
* @author nik
@@ -66,7 +68,18 @@ public abstract class ServerType<C extends ServerConfiguration> {
* @return a non-null instance of {@link DebugConnector} if the server supports deployment in debug mode
*/
@Nullable
public DebugConnector<?,?> createDebugConnector() {
public DebugConnector<?, ?> createDebugConnector() {
return null;
}
@NotNull
public Comparator<Deployment> getDeploymentComparator() {
return new Comparator<Deployment>() {
@Override
public int compare(Deployment o1, Deployment o2) {
return o1.getName().compareTo(o2.getName());
}
};
}
}
@@ -16,8 +16,4 @@ public abstract class DeploymentRuntime {
public interface UndeploymentTaskCallback extends RemoteOperationCallback {
void succeeded();
}
public Integer compareTo(DeploymentRuntime other) {
return null;
}
}
@@ -290,21 +290,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
@NotNull
@Override
public Collection<Deployment> getDeployments() {
Set<Deployment> result = new TreeSet<Deployment>(new Comparator<Deployment>() {
@Override
public int compare(Deployment o1, Deployment o2) {
DeploymentRuntime runtime1 = o1.getRuntime();
DeploymentRuntime runtime2 = o2.getRuntime();
if (runtime1 != null && runtime2 != null) {
Integer runtimeCompareResult = runtime1.compareTo(runtime2);
if (runtimeCompareResult != null) {
return runtimeCompareResult;
}
}
return o1.getName().compareTo(o2.getName());
}
});
Set<Deployment> result = new TreeSet<Deployment>(getServer().getType().getDeploymentComparator());
synchronized (myLocalDeployments) {
result.addAll(myLocalDeployments.values());
}