mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-140441 - Clouds: find clouds panel in settings
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
displayName="Clouds"
|
||||
id="RemoteServers"
|
||||
provider="com.intellij.remoteServer.impl.configuration.RemoteServerListConfigurableProvider"/>
|
||||
<search.optionContributor implementation="com.intellij.remoteServer.impl.configuration.RemoteServerSearchableOptionContributor"/>
|
||||
<programRunner implementation="com.intellij.remoteServer.impl.runtime.DeployToServerRunner"/>
|
||||
<projectService serviceInterface="com.intellij.remoteServer.runtime.ui.RemoteServersView"
|
||||
serviceImplementation="com.intellij.remoteServer.impl.runtime.ui.RemoteServersViewImpl"/>
|
||||
|
||||
+28
-3
@@ -13,14 +13,19 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.remoteServer.ServerType;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.RemoteServersManager;
|
||||
import com.intellij.ui.TreeSpeedSearch;
|
||||
import com.intellij.ui.speedSearch.SpeedSearchSupply;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.text.UniqueNameGenerator;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -30,6 +35,10 @@ import java.util.Set;
|
||||
* @author nik
|
||||
*/
|
||||
public class RemoteServerListConfigurable extends MasterDetailsComponent implements SearchableConfigurable {
|
||||
|
||||
@NonNls
|
||||
public static final String ID = "RemoteServers";
|
||||
|
||||
private final RemoteServersManager myServersManager;
|
||||
@Nullable private final ServerType<?> myServerType;
|
||||
private RemoteServer<?> myLastSelectedServer;
|
||||
@@ -83,13 +92,29 @@ public class RemoteServerListConfigurable extends MasterDetailsComponent impleme
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
return "RemoteServers";
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Runnable enableSearch(String option) {
|
||||
return null;
|
||||
public Runnable enableSearch(final String option) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ObjectUtils.assertNotNull(SpeedSearchSupply.getSupply(myTree, true)).findAndSelectElement(option);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initTree() {
|
||||
super.initTree();
|
||||
new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
|
||||
@Override
|
||||
public String convert(final TreePath treePath) {
|
||||
return ((MyNode)treePath.getLastPathComponent()).getDisplayName();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.remoteServer.impl.configuration;
|
||||
|
||||
import com.intellij.ide.ui.search.SearchableOptionContributor;
|
||||
import com.intellij.ide.ui.search.SearchableOptionProcessor;
|
||||
import com.intellij.remoteServer.ServerType;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.RemoteServersManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RemoteServerSearchableOptionContributor extends SearchableOptionContributor {
|
||||
|
||||
@Override
|
||||
public void processOptions(@NotNull SearchableOptionProcessor processor) {
|
||||
for (ServerType<?> serverType : ServerType.EP_NAME.getExtensions()) {
|
||||
String typeName = serverType.getPresentableName();
|
||||
processor.addOptions(typeName, null, typeName + " cloud type", RemoteServerListConfigurable.ID, null, false);
|
||||
for (RemoteServer<?> server : RemoteServersManager.getInstance().getServers(serverType)) {
|
||||
String serverName = server.getName();
|
||||
processor.addOptions(serverName, null, serverName + " cloud instance", RemoteServerListConfigurable.ID, null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user