[351899] action properties passed to RunOnServerAction can be ignored
diff --git a/features/org.eclipse.wst.server_ui.feature.patch/buildnotes_org.eclipse.wst.server_ui.feature.patch.html b/features/org.eclipse.wst.server_ui.feature.patch/buildnotes_org.eclipse.wst.server_ui.feature.patch.html
index 1054fea..a38dbd8 100644
--- a/features/org.eclipse.wst.server_ui.feature.patch/buildnotes_org.eclipse.wst.server_ui.feature.patch.html
+++ b/features/org.eclipse.wst.server_ui.feature.patch/buildnotes_org.eclipse.wst.server_ui.feature.patch.html
@@ -16,5 +16,7 @@
 <ul><li>org.eclipse.wst.server.ui</li></ul>
 <p>Bug <a href='https://bugs.eclipse.org/368778'>368778</a>. Empty Servers View Default Message (Patch included)</p>
 <p>Bug <a href='https://bugs.eclipse.org/369708'>369708</a>. ModifyModulesComposite cannot block removal of modules</p>
+<p>Bug <a href='https://bugs.eclipse.org/351899'>351899</a>. action properties passed to RunOnServerAction can be ignored</p>
+<p>Bug <a href='https://bugs.eclipse.org/370894'>370894</a>. Context menu not available if server is empty</p>
 
 </body></html>
\ No newline at end of file
diff --git a/features/org.eclipse.wst.server_ui.feature.patch/feature.properties b/features/org.eclipse.wst.server_ui.feature.patch/feature.properties
index 57338b4..d800008 100644
--- a/features/org.eclipse.wst.server_ui.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.server_ui.feature.patch/feature.properties
@@ -29,6 +29,8 @@
 \n\
 Bug https://bugs.eclipse.org/368778 Empty Servers View Default Message (Patch included)\n\
 Bug https://bugs.eclipse.org/369708 ModifyModulesComposite cannot block removal of modules\n\
+Bug https://bugs.eclipse.org/351899 action properties passed to RunOnServerAction can be ignored\n\
+Bug https://bugs.eclipse.org/370894 Context menu not available if server is empty\n\
 \n\
 # "copyright" property - text of the "Feature Update Copyright"
 copyright=\
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
index db388b4..f757449 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -280,6 +280,12 @@
 		client = (IClient)getOverwriteValue(ROS_CLIENT);
 		launchableAdapter = (ILaunchableAdapter) getOverwriteValue(ROS_LAUNCHABLE);
 		
+		if (Trace.FINEST) {
+			Trace.trace(Trace.STRING_FINEST, 
+					"Client and launchableAdapter after setting predefined values: launchableAdapter="
+					+ launchableAdapter + " client=" + client);
+		}		
+		
 		try {
 			IProgressMonitor monitor = new NullProgressMonitor();
 			server2 = getServer(module, moduleArtifact, monitor);
@@ -323,8 +329,18 @@
 					return;
 			} else
 				wizard.performFinish();
-			client = wizard.getSelectedClient();
-			launchableAdapter = wizard.getLaunchableAdapter();
+
+			// Do not overwrite the client or launchableAdapter value, as it may
+			// have been set by getOverwriteValue, which will add predefined values 
+			// if provided. There is no guarantee that getting the values (client and 
+			// launchableAadapter) from the wizard will be valid, since the values from
+			// the wizard are used only if the client and launchableAdapter are null
+			if (client == null){
+				client = wizard.getSelectedClient();
+			}
+			if (launchableAdapter == null){
+				launchableAdapter = wizard.getLaunchableAdapter();
+			}
 		}
 		
 		// if there is no client, use a dummy
@@ -352,6 +368,11 @@
 			};
 		}
 		
+		if (Trace.FINEST) {
+			Trace.trace(Trace.STRING_FINEST, 
+					"Prior to creating launch client jobs: launchableAdapter="+ launchableAdapter + " client=" + client);
+		}
+		
 		if (moduleArtifact instanceof ModuleArtifactDelegate) {
 			boolean canLoad = false;
 			try {
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/cnf/ServersView2.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/cnf/ServersView2.java
index 9d3460f..fcf5337 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/cnf/ServersView2.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/cnf/ServersView2.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008,2011 IBM Corporation and others.
+ * Copyright (c) 2008,2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -19,6 +19,10 @@
 import org.eclipse.core.runtime.jobs.IJobChangeEvent;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.WizardDialog;
@@ -29,11 +33,11 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.actions.ActionContext;
 import org.eclipse.ui.contexts.IContextService;
 import org.eclipse.ui.forms.widgets.Form;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.navigator.CommonNavigator;
-import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.*;
 import org.eclipse.ui.part.PageBook;
 import org.eclipse.wst.server.core.*;
 import org.eclipse.wst.server.core.internal.Server;
@@ -115,6 +119,48 @@
 			}
 		});
 		
+
+		// Create the context menu for the default page
+		final CommonViewer commonViewer = this.getCommonViewer();
+		if (commonViewer != null){
+			ICommonViewerSite commonViewerSite = CommonViewerSiteFactory
+					.createCommonViewerSite(this.getViewSite());
+			
+			if (commonViewerSite != null){
+				// Note: actionService cannot be null
+				final NavigatorActionService actionService = new NavigatorActionService(commonViewerSite,
+						commonViewer, commonViewer.getNavigatorContentService());
+				
+				MenuManager menuManager = new MenuManager("#PopupMenu");
+				menuManager.addMenuListener(new IMenuListener() {
+					public void menuAboutToShow(IMenuManager mgr) {
+						ISelection selection = commonViewer.getSelection();
+						actionService.setContext(new ActionContext(selection));
+						actionService.fillContextMenu(mgr);
+					}
+				});
+				Menu menu = menuManager.createContextMenu(body);
+
+				// It is necessary to set the menu in two places:
+				// 1. The white space in the server view
+				// 2. The text and link in the server view. If this menu is not set, if the
+				// user right clicks on the text or uses shortcut keys to open the context menu,
+				// the context menu will not come up
+				body.setMenu(menu);	
+				hlink.setMenu(menu);
+			}
+			else {
+				if (Trace.FINEST) {
+					Trace.trace(Trace.STRING_FINEST, "The commonViewerSite is null");
+				}
+			}
+		}
+		else {
+			if (Trace.FINEST) {
+				Trace.trace(Trace.STRING_FINEST, "The commonViewer is null");
+			}
+		}
+		
 		return form;
 	}
 	
@@ -180,11 +226,18 @@
 			public void done(IJobChangeEvent event) {
 				Display.getDefault().asyncExec(new Runnable() {
 					public void run() {
-						if (tableViewer.getTree().getItemCount() > 0) {
-							Object obj = tableViewer.getTree().getItem(0).getData();
-							tableViewer.setSelection(new StructuredSelection(obj));
-						} else{
-							toggleDefultPage();
+						try {
+							if (tableViewer.getTree().getItemCount() > 0) {
+								Object obj = tableViewer.getTree().getItem(0).getData();
+								tableViewer.setSelection(new StructuredSelection(obj));
+							} else{
+								toggleDefultPage();
+							}
+						}
+						catch (Exception e){
+							if (Trace.WARNING) {
+								Trace.trace(Trace.STRING_WARNING, "Failed to update the server view.", e);
+							}
 						}
 					}
 				});