geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r797343 - in /geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core: GeronimoLaunchConfigurationDelegate.java GeronimoServerBehaviourDelegate.java
Date Fri, 24 Jul 2009 07:01:02 GMT
Author: mcconne
Date: Fri Jul 24 07:01:02 2009
New Revision: 797343

URL: http://svn.apache.org/viewvc?rev=797343&view=rev
Log:
GERONIMODEVTOOLS-575 Handle scenario where there is a failure on the GEP side during setup
of the Launch Configuration -- Thanks to Delos Dai for the patch !!

Modified:
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java?rev=797343&r1=797342&r2=797343&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
Fri Jul 24 07:01:02 2009
@@ -42,15 +42,22 @@
  */
 public class GeronimoLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate
{
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration,
-	 *      java.lang.String, org.eclipse.debug.core.ILaunch,
-	 *      org.eclipse.core.runtime.IProgressMonitor)
-	 */
-	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor
monitor) throws CoreException {
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration,
+     *      java.lang.String, org.eclipse.debug.core.ILaunch,
+     *      org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor
monitor) throws CoreException {
+
+        if (configuration.hasAttribute(GeronimoServerBehaviourDelegate.ERROR_SETUP_LAUNCH_CONFIGURATION)){
+            //get error flag from configuration if it's set in setLaunchConfiguration
+            String errorMessage = configuration.getAttribute(GeronimoServerBehaviourDelegate.ERROR_SETUP_LAUNCH_CONFIGURATION,"");
+            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR,
errorMessage, null));
+        }
+        
 		IServer server = ServerUtil.getServer(configuration);
 		if (server == null) {
 			throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR,
Messages.missingServer, null));

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?rev=797343&r1=797342&r2=797343&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
Fri Jul 24 07:01:02 2009
@@ -95,8 +95,11 @@
 
     protected transient IDebugEventSetListener processListener;
 
+    public static final String ERROR_SETUP_LAUNCH_CONFIGURATION = "errorInSetupLaunchConfiguration";
+
     abstract protected ClassLoader getContextClassLoader();
 
+
     /*
      * (non-Javadoc)
      * 
@@ -115,9 +118,21 @@
         if (vmInstall != null)
             wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
 
-        setupLaunchClasspath(wc, vmInstall);
-
-        String existingProgArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
(String) null);
+        String existingProgArgs = null;
+        wc.setAttribute(ERROR_SETUP_LAUNCH_CONFIGURATION, (String)null);
+        
+        try{
+            setupLaunchClasspath(wc, vmInstall);
+            existingProgArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
(String) null);
+        }catch (CoreException e){
+            // Throwing a CoreException at this time will not accomplish anything useful
as WTP will 
+            // will essentially ignore it. Instead set a flag in the configuration that can

+            // subsequently be checked when an attempt is made to launch the server in 
+            // GeronimoLaunchConfigurationDelegate.launch(). At that point a CoreException
will be
+            // thrown that WTP will handle properly and will display an error dialog which
is 
+            // exactly what we want the GEP user to see.
+            wc.setAttribute(ERROR_SETUP_LAUNCH_CONFIGURATION, e.getMessage());
+        }
         String serverProgArgs = getServerDelegate().getConsoleLogLevel();
         if (existingProgArgs == null || existingProgArgs.indexOf(serverProgArgs) < 0)
{
             wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverProgArgs);
@@ -126,6 +141,7 @@
         wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, getServerDelegate().getVMArgs());
     }
 
+
     /**
      * @param launch
      * @param launchMode



Mime
View raw message