mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remote servers view: supported 'edit configuration' action for deployments
This commit is contained in:
@@ -2,6 +2,7 @@ package com.intellij.remoteServer.runtime;
|
||||
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentRuntime;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentStatus;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentTask;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -20,4 +21,7 @@ public interface Deployment {
|
||||
|
||||
@Nullable
|
||||
DeploymentRuntime getRuntime();
|
||||
|
||||
@Nullable
|
||||
DeploymentTask<?> getDeploymentTask();
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public abstract class ServerRuntimeInstance<D extends DeploymentConfiguration> {
|
||||
public abstract void disconnect();
|
||||
|
||||
public interface DeploymentOperationCallback extends RemoteOperationCallback {
|
||||
void succeeded(@NotNull DeploymentRuntime deployment);
|
||||
void succeeded(@NotNull DeploymentRuntime deploymentRuntime);
|
||||
}
|
||||
|
||||
public interface ComputeDeploymentsCallback extends RemoteOperationCallback {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<action id="RemoteServers.RunServer" class="com.intellij.remoteServer.impl.runtime.ui.tree.actions.RunServerAction"/>
|
||||
<action id="RemoteServers.DebugServer" class="com.intellij.remoteServer.impl.runtime.ui.tree.actions.DebugServerAction"/>
|
||||
<action id="RemoteServers.StopServer" class="com.intellij.remoteServer.impl.runtime.ui.tree.actions.StopServerAction"/>
|
||||
<action id="RemoteServers.EditServer" class="com.intellij.remoteServer.impl.runtime.ui.tree.actions.EditServerConfigAction"/>
|
||||
<action id="RemoteServers.EditServer" class="com.intellij.remoteServer.impl.runtime.ui.tree.actions.EditConfigurationAction"/>
|
||||
<separator/>
|
||||
<action id="RemoteServers.DeployAll" class="com.intellij.remoteServer.impl.runtime.ui.tree.actions.DeployAllAction"/>
|
||||
</group>
|
||||
|
||||
+1
-2
@@ -45,8 +45,7 @@ public class DeployToServerState<S extends ServerConfiguration, D extends Deploy
|
||||
@NotNull private final D myConfiguration;
|
||||
@NotNull private final ExecutionEnvironment myEnvironment;
|
||||
|
||||
public DeployToServerState(@NotNull RemoteServer<S> server,
|
||||
@NotNull DeploymentSource deploymentSource,
|
||||
public DeployToServerState(@NotNull RemoteServer<S> server, @NotNull DeploymentSource deploymentSource,
|
||||
@NotNull D deploymentConfiguration, @NotNull ExecutionEnvironment environment) {
|
||||
myServer = server;
|
||||
mySource = deploymentSource;
|
||||
|
||||
+39
-12
@@ -38,7 +38,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
private volatile String myStatusText;
|
||||
private volatile ServerRuntimeInstance<D> myRuntimeInstance;
|
||||
private final Map<String, Deployment> myRemoteDeployments = new HashMap<String, Deployment>();
|
||||
private final Map<String, Deployment> myLocalDeployments = Collections.synchronizedMap(new HashMap<String, Deployment>());
|
||||
private final Map<String, DeploymentImpl> myLocalDeployments = new HashMap<String, DeploymentImpl>();
|
||||
private final Map<String, DeploymentLogManagerImpl> myLogManagers = new ConcurrentHashMap<String, DeploymentLogManagerImpl>();
|
||||
|
||||
public ServerConnectionImpl(RemoteServer<?> server, ServerConnector connector, ServerConnectionManagerImpl connectionManager) {
|
||||
@@ -105,7 +105,11 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
public void connected(@NotNull ServerRuntimeInstance<D> instance) {
|
||||
DeploymentSource source = task.getSource();
|
||||
String deploymentName = instance.getDeploymentName(source);
|
||||
myLocalDeployments.put(deploymentName, new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYING, null, null));
|
||||
DeploymentImpl deployment;
|
||||
synchronized (myLocalDeployments) {
|
||||
deployment = new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYING, null, null, task);
|
||||
myLocalDeployments.put(deploymentName, deployment);
|
||||
}
|
||||
DeploymentLogManagerImpl logManager = new DeploymentLogManagerImpl(task.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -116,7 +120,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
myLogManagers.put(deploymentName, logManager);
|
||||
handler.printlnSystemMessage("Deploying '" + deploymentName + "'...");
|
||||
onDeploymentStarted.run(deploymentName);
|
||||
instance.deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl<D>)task, handler));
|
||||
instance.deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl<D>)task, handler, deployment));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -137,7 +141,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
|
||||
@Override
|
||||
public void addDeployment(@NotNull String deploymentName) {
|
||||
myDeployments.add(new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYED, null, null));
|
||||
myDeployments.add(new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYED, null, null, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,7 +173,14 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
@Override
|
||||
public void undeploy(@NotNull Deployment deployment, @NotNull final DeploymentRuntime runtime) {
|
||||
final String deploymentName = deployment.getName();
|
||||
myLocalDeployments.put(deploymentName, new DeploymentImpl(deploymentName, DeploymentStatus.UNDEPLOYING, null, null));
|
||||
final DeploymentImpl localDeployment;
|
||||
synchronized (myLocalDeployments) {
|
||||
localDeployment = myLocalDeployments.get(deploymentName);
|
||||
if (localDeployment != null) {
|
||||
localDeployment.changeState(DeploymentStatus.DEPLOYED, DeploymentStatus.UNDEPLOYING, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
myEventDispatcher.queueDeploymentsChanged(this);
|
||||
final LoggingHandlerImpl loggingHandler = myLogManagers.get(deploymentName).getMainLoggingHandler();
|
||||
loggingHandler.printlnSystemMessage("Undeploying '" + deploymentName + "'...");
|
||||
@@ -177,7 +188,12 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
@Override
|
||||
public void succeeded() {
|
||||
loggingHandler.printlnSystemMessage("'" + deploymentName + "' has been undeployed successfully.");
|
||||
myLocalDeployments.remove(deploymentName);
|
||||
synchronized (myLocalDeployments) {
|
||||
if (localDeployment != null &&
|
||||
localDeployment.changeState(DeploymentStatus.UNDEPLOYING, DeploymentStatus.NOT_DEPLOYED, null, null)) {
|
||||
myLocalDeployments.remove(deploymentName);
|
||||
}
|
||||
}
|
||||
myLogManagers.remove(deploymentName);
|
||||
myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
|
||||
}
|
||||
@@ -185,7 +201,11 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
@Override
|
||||
public void errorOccurred(@NotNull String errorMessage) {
|
||||
loggingHandler.printlnSystemMessage("Failed to undeploy '" + deploymentName + "': " + errorMessage);
|
||||
myLocalDeployments.put(deploymentName, new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYED, errorMessage, runtime));
|
||||
synchronized (myLocalDeployments) {
|
||||
if (localDeployment != null) {
|
||||
localDeployment.changeState(DeploymentStatus.UNDEPLOYING, DeploymentStatus.DEPLOYED, errorMessage, runtime);
|
||||
}
|
||||
}
|
||||
myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
|
||||
}
|
||||
});
|
||||
@@ -248,21 +268,26 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
private final String myDeploymentName;
|
||||
private final DeploymentTaskImpl<D> myDeploymentTask;
|
||||
private final LoggingHandlerImpl myLoggingHandler;
|
||||
private final DeploymentImpl myDeployment;
|
||||
|
||||
public DeploymentOperationCallbackImpl(String deploymentName, DeploymentTaskImpl<D> deploymentTask, LoggingHandlerImpl handler) {
|
||||
public DeploymentOperationCallbackImpl(String deploymentName,
|
||||
DeploymentTaskImpl<D> deploymentTask,
|
||||
LoggingHandlerImpl handler,
|
||||
DeploymentImpl deployment) {
|
||||
myDeploymentName = deploymentName;
|
||||
myDeploymentTask = deploymentTask;
|
||||
myLoggingHandler = handler;
|
||||
myDeployment = deployment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void succeeded(@NotNull DeploymentRuntime deployment) {
|
||||
public void succeeded(@NotNull DeploymentRuntime deploymentRuntime) {
|
||||
myLoggingHandler.printlnSystemMessage("'" + myDeploymentName + "' has been deployed successfully.");
|
||||
myLocalDeployments.put(myDeploymentName, new DeploymentImpl(myDeploymentName, DeploymentStatus.DEPLOYED, null, deployment));
|
||||
myDeployment.changeState(DeploymentStatus.DEPLOYING, DeploymentStatus.DEPLOYED, null, deploymentRuntime);
|
||||
myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
|
||||
DebugConnector<?,?> debugConnector = myDeploymentTask.getDebugConnector();
|
||||
if (debugConnector != null) {
|
||||
launchDebugger(debugConnector, deployment);
|
||||
launchDebugger(debugConnector, deploymentRuntime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +316,9 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
@Override
|
||||
public void errorOccurred(@NotNull String errorMessage) {
|
||||
myLoggingHandler.printlnSystemMessage("Failed to deploy '" + myDeploymentName + "': " + errorMessage);
|
||||
myLocalDeployments.put(myDeploymentName, new DeploymentImpl(myDeploymentName, DeploymentStatus.NOT_DEPLOYED, errorMessage, null));
|
||||
synchronized (myLocalDeployments) {
|
||||
myDeployment.changeState(DeploymentStatus.DEPLOYING, DeploymentStatus.NOT_DEPLOYED, errorMessage, null);
|
||||
}
|
||||
myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
|
||||
}
|
||||
}
|
||||
|
||||
+53
-10
@@ -3,6 +3,7 @@ package com.intellij.remoteServer.impl.runtime.deployment;
|
||||
import com.intellij.remoteServer.runtime.Deployment;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentRuntime;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentStatus;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentTask;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -11,15 +12,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class DeploymentImpl implements Deployment {
|
||||
private final String myName;
|
||||
private final DeploymentStatus myStatus;
|
||||
private final String myStatusText;
|
||||
private final DeploymentRuntime myRuntime;
|
||||
private final DeploymentTask<?> myDeploymentTask;
|
||||
private volatile DeploymentState myState;
|
||||
|
||||
public DeploymentImpl(@NotNull String name, @NotNull DeploymentStatus status, @Nullable String statusText, @Nullable DeploymentRuntime runtime) {
|
||||
public DeploymentImpl(@NotNull String name, @NotNull DeploymentStatus status, @Nullable String statusText,
|
||||
@Nullable DeploymentRuntime runtime, @Nullable DeploymentTask<?> deploymentTask) {
|
||||
myName = name;
|
||||
myStatus = status;
|
||||
myStatusText = statusText;
|
||||
myRuntime = runtime;
|
||||
myDeploymentTask = deploymentTask;
|
||||
myState = new DeploymentState(status, statusText, runtime);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -30,15 +30,58 @@ public class DeploymentImpl implements Deployment {
|
||||
@Override
|
||||
@NotNull
|
||||
public DeploymentStatus getStatus() {
|
||||
return myStatus;
|
||||
return myState.getStatus();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getStatusText() {
|
||||
return myStatusText != null ? myStatusText : myStatus.getPresentableText();
|
||||
String statusText = myState.getStatusText();
|
||||
return statusText != null ? statusText : getStatus().getPresentableText();
|
||||
}
|
||||
|
||||
public DeploymentRuntime getRuntime() {
|
||||
return myRuntime;
|
||||
return myState.getRuntime();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DeploymentTask<?> getDeploymentTask() {
|
||||
return myDeploymentTask;
|
||||
}
|
||||
|
||||
public boolean changeState(@NotNull DeploymentStatus oldStatus, @NotNull DeploymentStatus newStatus, @Nullable String statusText,
|
||||
@Nullable DeploymentRuntime runtime) {
|
||||
if (myState.getStatus() == oldStatus) {
|
||||
myState = new DeploymentState(newStatus, statusText, runtime);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class DeploymentState {
|
||||
private final DeploymentStatus myStatus;
|
||||
private final String myStatusText;
|
||||
private final DeploymentRuntime myRuntime;
|
||||
|
||||
private DeploymentState(@NotNull DeploymentStatus status, @Nullable String statusText, @Nullable DeploymentRuntime runtime) {
|
||||
myStatus = status;
|
||||
myStatusText = statusText;
|
||||
myRuntime = runtime;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DeploymentStatus getStatus() {
|
||||
return myStatus;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getStatusText() {
|
||||
return myStatusText;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DeploymentRuntime getRuntime() {
|
||||
return myRuntime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -11,4 +11,7 @@ public interface DeploymentNode {
|
||||
|
||||
boolean isUndeployActionEnabled();
|
||||
void undeploy();
|
||||
|
||||
boolean isEditConfigurationActionEnabled();
|
||||
void editConfiguration();
|
||||
}
|
||||
|
||||
+20
@@ -1,7 +1,9 @@
|
||||
package com.intellij.remoteServer.impl.runtime.ui.tree;
|
||||
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.RunnerAndConfigurationSettings;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
import com.intellij.execution.impl.RunDialog;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
import com.intellij.ide.projectView.TreeStructureProvider;
|
||||
@@ -14,6 +16,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.configuration.RemoteServersManager;
|
||||
import com.intellij.remoteServer.impl.configuration.RemoteServerConfigurable;
|
||||
import com.intellij.remoteServer.impl.runtime.deployment.DeploymentTaskImpl;
|
||||
import com.intellij.remoteServer.impl.runtime.log.DeploymentLogManagerImpl;
|
||||
import com.intellij.remoteServer.impl.runtime.log.LoggingHandlerImpl;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.RemoteServersViewContributor;
|
||||
@@ -23,6 +26,7 @@ import com.intellij.remoteServer.runtime.ServerConnection;
|
||||
import com.intellij.remoteServer.runtime.ServerConnectionManager;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentRuntime;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentStatus;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentTask;
|
||||
import com.intellij.ui.LayeredIcon;
|
||||
import icons.RemoteServersIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -244,6 +248,22 @@ public class ServersTreeStructure extends AbstractTreeStructureBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditConfigurationActionEnabled() {
|
||||
return getValue().getDeploymentTask() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editConfiguration() {
|
||||
DeploymentTask<?> task = getValue().getDeploymentTask();
|
||||
if (task != null) {
|
||||
RunnerAndConfigurationSettings settings = ((DeploymentTaskImpl)task).getExecutionEnvironment().getRunnerAndConfigurationSettings();
|
||||
if (settings != null) {
|
||||
RunDialog.editConfiguration(doGetProject(), settings, "Edit Deployment Configuration");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ServerConnection<?> getConnection() {
|
||||
return myConnection;
|
||||
}
|
||||
|
||||
-34
@@ -3,20 +3,12 @@ package com.intellij.remoteServer.impl.runtime.ui.tree.actions;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.ServersToolWindowContent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.ServerNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public class DebugServerAction extends RunServerActionBase {
|
||||
|
||||
public DebugServerAction() {
|
||||
super("Debug", "Start the selected server in debug mode", AllIcons.Actions.StartDebugger);
|
||||
}
|
||||
@@ -25,30 +17,4 @@ public class DebugServerAction extends RunServerActionBase {
|
||||
protected Executor getExecutor() {
|
||||
return DefaultDebugExecutor.getDebugExecutorInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public abstract static class SingleServerActionBase extends ServersTreeActionBase {
|
||||
protected SingleServerActionBase(String text, String description, Icon icon) {
|
||||
super(text, description, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doActionPerformed(@NotNull ServersToolWindowContent content) {
|
||||
doActionPerformed(content, content.getSelectedServerNodes().iterator().next());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabled(@NotNull ServersToolWindowContent content, AnActionEvent e) {
|
||||
Set<ServerNode> serverNodes = content.getSelectedServerNodes();
|
||||
return content.getBuilder().getSelectedElements().size() == serverNodes.size() && serverNodes.size() == 1 &&
|
||||
isEnabledForServer(serverNodes.iterator().next());
|
||||
}
|
||||
|
||||
protected abstract boolean isEnabledForServer(ServerNode serverNode);
|
||||
|
||||
protected abstract void doActionPerformed(@NotNull ServersToolWindowContent content, @NotNull ServerNode server);
|
||||
}
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.intellij.remoteServer.impl.runtime.ui.tree.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.ServersToolWindowContent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.DeploymentNode;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.ServerNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public class EditConfigurationAction extends ServersTreeActionBase {
|
||||
public EditConfigurationAction() {
|
||||
super("Edit Configuration", "Edit configuration of the selected server", AllIcons.Actions.EditSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doActionPerformed(@NotNull ServersToolWindowContent content) {
|
||||
Set<DeploymentNode> deploymentNodes = content.getSelectedDeploymentNodes();
|
||||
Set<ServerNode> serverNodes = content.getSelectedServerNodes();
|
||||
if (deploymentNodes.size() == 1) {
|
||||
deploymentNodes.iterator().next().editConfiguration();
|
||||
}
|
||||
else {
|
||||
serverNodes.iterator().next().editConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabled(@NotNull ServersToolWindowContent content, AnActionEvent e) {
|
||||
Set<DeploymentNode> deploymentNodes = content.getSelectedDeploymentNodes();
|
||||
Set<ServerNode> serverNodes = content.getSelectedServerNodes();
|
||||
if (deploymentNodes.size() + serverNodes.size() != 1) return false;
|
||||
if (deploymentNodes.size() == 1) {
|
||||
return deploymentNodes.iterator().next().isEditConfigurationActionEnabled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.intellij.remoteServer.impl.runtime.ui.tree.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.ServersToolWindowContent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.ServerNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public class EditServerConfigAction extends DebugServerAction.SingleServerActionBase {
|
||||
public EditServerConfigAction() {
|
||||
super("Edit Configuration", "Edit configuration of the selected server",
|
||||
AllIcons.Actions.EditSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doActionPerformed(@NotNull ServersToolWindowContent content, @NotNull ServerNode server) {
|
||||
server.editConfiguration();
|
||||
}
|
||||
|
||||
protected boolean isEnabledForServer(ServerNode serverNode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.runtime.ui.tree.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.ServersToolWindowContent;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.ServerNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public abstract class SingleServerActionBase extends ServersTreeActionBase {
|
||||
protected SingleServerActionBase(String text, String description, Icon icon) {
|
||||
super(text, description, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doActionPerformed(@NotNull ServersToolWindowContent content) {
|
||||
doActionPerformed(content, content.getSelectedServerNodes().iterator().next());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabled(@NotNull ServersToolWindowContent content, AnActionEvent e) {
|
||||
Set<ServerNode> serverNodes = content.getSelectedServerNodes();
|
||||
return content.getBuilder().getSelectedElements().size() == serverNodes.size() && serverNodes.size() == 1 &&
|
||||
isEnabledForServer(serverNodes.iterator().next());
|
||||
}
|
||||
|
||||
protected abstract boolean isEnabledForServer(ServerNode serverNode);
|
||||
|
||||
protected abstract void doActionPerformed(@NotNull ServersToolWindowContent content, @NotNull ServerNode server);
|
||||
}
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class UploadApplicationAction extends AnAction {
|
||||
}
|
||||
final AppEngineUploader uploader = AppEngineUploader.createUploader(project, artifact, null, new ServerRuntimeInstance.DeploymentOperationCallback() {
|
||||
@Override
|
||||
public void succeeded(@NotNull DeploymentRuntime deployment) {
|
||||
public void succeeded(@NotNull DeploymentRuntime deploymentRuntime) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user