Author: max.andersen(a)jboss.com
Date: 2008-04-17 06:24:21 -0400 (Thu, 17 Apr 2008)
New Revision: 7569
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
Log:
JBIDE-2076
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-04-17
09:39:04 UTC (rev 7568)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-04-17
10:24:21 UTC (rev 7569)
@@ -29,6 +29,7 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
@@ -65,14 +66,26 @@
public class DeployAction implements IObjectActionDelegate {
protected ISelection selection;
+ private Shell shell;
+
public DeployAction() {
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ if(targetPart!=null && targetPart.getSite()!=null) {
+ shell = targetPart.getSite().getShell();
+ }
}
public void run(IAction action) {
- IServer server = getServer();
+ IServer[] deployableServersAsIServers =
ServerConverter.getDeployableServersAsIServers();
+ if(deployableServersAsIServers.length==0) {
+ MessageDialog.openInformation(shell, "No deployable servers found",
"There are no servers that support deploying single files.");
+ }
+ IServer server = getServer(shell,deployableServersAsIServers);
+ if(server==null) { // User pressed cancel.
+ return;
+ }
IStatus errorStatus = null;
String errorTitle, errorMessage;
errorTitle = errorMessage = null;
@@ -121,14 +134,13 @@
}
- protected IServer getServer() {
+ protected IServer getServer(Shell shell, IServer[] servers) {
- IServer[] servers = ServerConverter.getDeployableServersAsIServers();
if( servers.length == 0 ) return null;
if( servers.length == 1 ) return servers[0];
// Throw up a dialog
- SelectServerDialog d = new SelectServerDialog(null);
+ SelectServerDialog d = new SelectServerDialog(shell);
int result = d.open();
if( result == Dialog.OK ) {
return d.getSelectedServer();
Show replies by date