diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/Deployment.java b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/Deployment.java index fe0f09a866fb..740c7ca294fa 100644 --- a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/Deployment.java +++ b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/Deployment.java @@ -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(); } diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java index 97815f5b2d3e..b057fb30a7fa 100644 --- a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java +++ b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java @@ -23,7 +23,7 @@ public abstract class ServerRuntimeInstance { public abstract void disconnect(); public interface DeploymentOperationCallback extends RemoteOperationCallback { - void succeeded(@NotNull DeploymentRuntime deployment); + void succeeded(@NotNull DeploymentRuntime deploymentRuntime); } public interface ComputeDeploymentsCallback extends RemoteOperationCallback { diff --git a/platform/remote-servers/impl/src/META-INF/RemoteServers.xml b/platform/remote-servers/impl/src/META-INF/RemoteServers.xml index edb1533f4ebb..cabac1dba935 100644 --- a/platform/remote-servers/impl/src/META-INF/RemoteServers.xml +++ b/platform/remote-servers/impl/src/META-INF/RemoteServers.xml @@ -36,7 +36,7 @@ - + diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java index 62beadcd50dd..c633976df2be 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java @@ -45,8 +45,7 @@ public class DeployToServerState server, - @NotNull DeploymentSource deploymentSource, + public DeployToServerState(@NotNull RemoteServer server, @NotNull DeploymentSource deploymentSource, @NotNull D deploymentConfiguration, @NotNull ExecutionEnvironment environment) { myServer = server; mySource = deploymentSource; diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java index 9ccd10434082..e93cc37cc6a4 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java @@ -38,7 +38,7 @@ public class ServerConnectionImpl implements private volatile String myStatusText; private volatile ServerRuntimeInstance myRuntimeInstance; private final Map myRemoteDeployments = new HashMap(); - private final Map myLocalDeployments = Collections.synchronizedMap(new HashMap()); + private final Map myLocalDeployments = new HashMap(); private final Map myLogManagers = new ConcurrentHashMap(); public ServerConnectionImpl(RemoteServer server, ServerConnector connector, ServerConnectionManagerImpl connectionManager) { @@ -105,7 +105,11 @@ public class ServerConnectionImpl implements public void connected(@NotNull ServerRuntimeInstance 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 implements myLogManagers.put(deploymentName, logManager); handler.printlnSystemMessage("Deploying '" + deploymentName + "'..."); onDeploymentStarted.run(deploymentName); - instance.deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl)task, handler)); + instance.deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl)task, handler, deployment)); } }); } @@ -137,7 +141,7 @@ public class ServerConnectionImpl 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 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 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 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 implements private final String myDeploymentName; private final DeploymentTaskImpl myDeploymentTask; private final LoggingHandlerImpl myLoggingHandler; + private final DeploymentImpl myDeployment; - public DeploymentOperationCallbackImpl(String deploymentName, DeploymentTaskImpl deploymentTask, LoggingHandlerImpl handler) { + public DeploymentOperationCallbackImpl(String deploymentName, + DeploymentTaskImpl 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 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); } } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/DeploymentImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/DeploymentImpl.java index 9d4154560f66..4705e520433e 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/DeploymentImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/DeploymentImpl.java @@ -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; + } } } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/DeploymentNode.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/DeploymentNode.java index d217ff2f63bb..d83553cb147c 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/DeploymentNode.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/DeploymentNode.java @@ -11,4 +11,7 @@ public interface DeploymentNode { boolean isUndeployActionEnabled(); void undeploy(); + + boolean isEditConfigurationActionEnabled(); + void editConfiguration(); } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java index 2f901d26b8d8..4b459fc7f7c3 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java @@ -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; } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/DebugServerAction.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/DebugServerAction.java index b37dac1e5b3c..7c7b8ea59e8a 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/DebugServerAction.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/DebugServerAction.java @@ -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 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); - } } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/EditConfigurationAction.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/EditConfigurationAction.java new file mode 100644 index 000000000000..babdee2c59dc --- /dev/null +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/EditConfigurationAction.java @@ -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 deploymentNodes = content.getSelectedDeploymentNodes(); + Set 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 deploymentNodes = content.getSelectedDeploymentNodes(); + Set serverNodes = content.getSelectedServerNodes(); + if (deploymentNodes.size() + serverNodes.size() != 1) return false; + if (deploymentNodes.size() == 1) { + return deploymentNodes.iterator().next().isEditConfigurationActionEnabled(); + } + return true; + } +} diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/EditServerConfigAction.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/EditServerConfigAction.java deleted file mode 100644 index e9195e45e197..000000000000 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/EditServerConfigAction.java +++ /dev/null @@ -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; - } -} diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/SingleServerActionBase.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/SingleServerActionBase.java new file mode 100644 index 000000000000..d6755e0c9643 --- /dev/null +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/SingleServerActionBase.java @@ -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 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); +} diff --git a/plugins/google-app-engine/source/com/intellij/appengine/actions/UploadApplicationAction.java b/plugins/google-app-engine/source/com/intellij/appengine/actions/UploadApplicationAction.java index f243a799b9a8..afe24f134587 100644 --- a/plugins/google-app-engine/source/com/intellij/appengine/actions/UploadApplicationAction.java +++ b/plugins/google-app-engine/source/com/intellij/appengine/actions/UploadApplicationAction.java @@ -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) { }