You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ob...@apache.org on 2004/01/26 12:27:18 UTC

cvs commit: avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/ui MerlinServerTabGroup.java

oberhack    2004/01/26 03:27:18

  Modified:    ide/org.apache.avalon.ide.eclipse.launch .project
  Added:       ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch
                        MerlinLaunchShortcut.java
                        MerlinDeveloperLaunch.java
                        MerlinContainerConfigNature.java
                        MerlinLaunchConfigurationDelegate.java
               ide/org.apache.avalon.ide.eclipse.launch .classpath
                        deploy_local.jardesc MerlinDeveloperLaunch.jar
                        plugin.xml build.properties
               ide/org.apache.avalon.ide.eclipse.launch/lib
                        merlin-bootstrap-1.0.jar
               ide/org.apache.avalon.ide.eclipse.launch/icons merlin.gif
                        plugin.xml merlin_light.gif
               ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/nature
                        MerlinContainerConfigNature.java
                        MerlinProjectNature.java
               ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/container
                        MerlinEmbeddedContainer.java IAvalonContainer.java
                        AvalonContainer.java MerlinExternalContainer.java
               ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/ui
                        MerlinServerTabGroup.java
  Log:
  initialize commit
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/MerlinLaunchShortcut.java
  
  Index: MerlinLaunchShortcut.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met: 1.
   * Redistributions of source code must retain the above copyright notice, this
   * list of conditions and the following disclaimer. 2. Redistributions in
   * binary form must reproduce the above copyright notice, this list of
   * conditions and the following disclaimer in the documentation and/or other
   * materials provided with the distribution. 3. The end-user documentation
   * included with the redistribution, if any, must include the following
   * acknowledgment: "This product includes software developed by the Apache
   * Software Foundation (http://www.apache.org/)." Alternately, this
   * acknowledgment may appear in the software itself, if and wherever such
   * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
   * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
   * used to endorse or promote products derived from this software without prior
   * written permission. For written permission, please contact
   * apache@apache.org. 5. Products derived from this software may not be called
   * "Apache", nor may "Apache" appear in their name, without prior written
   * permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch;
  
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.List;
  import java.util.Vector;
  
  import org.apache.avalon.ide.eclipse.merlin.launch.container.IAvalonContainer;
  import org.apache.avalon.ide.eclipse.merlin.launch.container.MerlinExternalContainer;
  import org.apache.avalon.ide.eclipse.merlin.nature.MerlinProjectNature;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.debug.core.DebugPlugin;
  import org.eclipse.debug.core.ILaunchConfiguration;
  import org.eclipse.debug.core.ILaunchConfigurationType;
  import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
  import org.eclipse.debug.core.ILaunchManager;
  import org.eclipse.debug.ui.DebugUITools;
  import org.eclipse.debug.ui.ILaunchShortcut;
  import org.eclipse.jdt.core.IJavaProject;
  import org.eclipse.jface.viewers.ISelection;
  import org.eclipse.jface.viewers.IStructuredSelection;
  import org.eclipse.ui.IEditorInput;
  import org.eclipse.ui.IEditorPart;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public class MerlinLaunchShortcut implements ILaunchShortcut
  {
  
      private IAvalonContainer container;
  
      protected void searchAndLaunch(Object[] search, String mode)
      {
          MerlinProjectNature[] merlinProjectCreators = null;
          if (search != null)
          {
              merlinProjectCreators = findTargets(search);
              launch(merlinProjectCreators, mode);
          }
      }
  
      private MerlinProjectNature[] findTargets(Object[] elements)
      {
          Vector result = new Vector();
          try
          {
              for (int i = 0; i < elements.length; i++)
              {
                  if (elements[i] instanceof IProject)
                  {
                      IProject project = (IProject) elements[i];
                      if (project.getNature(MerlinDeveloperLaunch.MERLIN_PROJECT_NATURE_ID) != null)
                      {
                          result.add(MerlinProjectNature.create(project));
                      }
                  }
                  if (elements[i] instanceof IJavaProject)
                  {
                      IJavaProject javaProject = (IJavaProject) elements[i];
                      if (javaProject
                          .getProject()
                          .getNature(MerlinDeveloperLaunch.MERLIN_PROJECT_NATURE_ID)
                          != null)
                      {
                          result.add(MerlinProjectNature.create(javaProject));
                      }
                  }
              }
          } catch (CoreException e)
          {
              MerlinDeveloperLaunch.log(e, "findTargets(Object[] elements) handling CoreException"); //$NON-NLS-1$
          }
          return (MerlinProjectNature[]) result.toArray(new MerlinProjectNature[result.size()]);
      }
  
      protected void launch(MerlinProjectNature[] merlinProjectCreators, String mode)
      {
          //this.container = containerManager.getInstance().createServer();
          try
          {
              ILaunchConfiguration config = findLaunchConfiguration(mode, merlinProjectCreators[0]);
              if (config != null)
              {
                  if (merlinProjectCreators.length != 0)
                  {
                      this.container = new MerlinExternalContainer();
                      for (int i = 0; i < merlinProjectCreators.length; i++)
                      {
                          // move to launch delegate tab
                          ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
                          workingCopy.setAttribute("project", merlinProjectCreators[i].getProject().getName());
                          config = workingCopy.doSave();
                      }
                  }
                  DebugUITools.saveAndBuildBeforeLaunch();
                  config.launch(mode, null);
              }
          } catch (CoreException e)
          {
              MerlinDeveloperLaunch.log(e, "erorr(1) while launching"); //$NON-NLS-1$
          }
      }
  
      protected ILaunchConfiguration findLaunchConfiguration(
          String mode,
          MerlinProjectNature project)
      {
  
          ILaunchConfigurationType configType = getMerlinContainerLaunchConfigType();
          List candidateConfigs = Collections.EMPTY_LIST;
          try
          {
              ILaunchConfiguration[] configs =
                  DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
              candidateConfigs = new ArrayList(configs.length);
              for (int i = 0; i < configs.length; i++)
              {
                  ILaunchConfiguration config = configs[i];
                  if (config
                      .getAttribute(MerlinDeveloperLaunch.ATTR_MERLIN_CONTAINER_ID, "")
                      .equals(MerlinExternalContainer.getServerLabel()))
                  { //$NON-NLS-1$
                      candidateConfigs.add(config);
                  }
              }
          } catch (CoreException e)
          {
              MerlinDeveloperLaunch.log(e, "findLaunchConfiguration(String mode) handling CoreException"); //$NON-NLS-1$
          }
  
          int candidateCount = candidateConfigs.size();
          if (candidateCount < 1)
          {
              return createConfiguration(project);
          } else if (candidateCount == 1)
          {
              return (ILaunchConfiguration) candidateConfigs.get(0);
          } 
  
          return null;
      }
  
      protected ILaunchConfiguration createConfiguration(MerlinProjectNature project)
      {
          ILaunchConfiguration config = null;
          try
          {
              ILaunchConfigurationType type = getMerlinContainerLaunchConfigType();
              String instanceName;
              if (project.getProject() != null)
              {
                  instanceName = project.getProject().getName();
              } else
              {
                  instanceName = MerlinExternalContainer.getServerLabel();
              }
              ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, instanceName);
              workingCopy.setAttribute(
                  MerlinDeveloperLaunch.ATTR_MERLIN_CONTAINER_ID,
                  MerlinExternalContainer.getServerLabel());
              workingCopy.setAttribute("project", instanceName);
              config = workingCopy.doSave();
          } catch (CoreException e)
          {
              MerlinDeveloperLaunch.log(e, "createConfiguration() handling CoreException"); //$NON-NLS-1$
          }
          return config;
      }
  
      protected ILaunchConfigurationType getMerlinContainerLaunchConfigType()
      {
  
          return getLaunchManager().getLaunchConfigurationType(
              MerlinDeveloperLaunch.ID_MERLIN_CONTAINER);
      }
  
      protected ILaunchManager getLaunchManager()
      {
          return DebugPlugin.getDefault().getLaunchManager();
      }
  
       protected void launch(MerlinProjectNature merlinProjectCreator, String mode)
      {
          launch(new MerlinProjectNature[] { merlinProjectCreator }, mode);
      }
  
      public void launch(IEditorPart editor, String mode)
      {
          IEditorInput input = editor.getEditorInput();
          IProject project = (IProject) input.getAdapter(IProject.class);
          if (project != null)
          {
              searchAndLaunch(new Object[] { project }, mode);
          } else
          {
              // error
          }
      }
  
      public void launch(ISelection selection, String mode)
      {
          if (selection instanceof IStructuredSelection)
          {
              searchAndLaunch(((IStructuredSelection) selection).toArray(), mode);
          } else
          {
              // error
          }
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/MerlinDeveloperLaunch.java
  
  Index: MerlinDeveloperLaunch.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met: 1.
   * Redistributions of source code must retain the above copyright notice, this
   * list of conditions and the following disclaimer. 2. Redistributions in
   * binary form must reproduce the above copyright notice, this list of
   * conditions and the following disclaimer in the documentation and/or other
   * materials provided with the distribution. 3. The end-user documentation
   * included with the redistribution, if any, must include the following
   * acknowledgment: "This product includes software developed by the Apache
   * Software Foundation (http://www.apache.org/)." Alternately, this
   * acknowledgment may appear in the software itself, if and wherever such
   * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
   * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
   * used to endorse or promote products derived from this software without prior
   * written permission. For written permission, please contact
   * apache@apache.org. 5. Products derived from this software may not be called
   * "Apache", nor may "Apache" appear in their name, without prior written
   * permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  
  package org.apache.avalon.ide.eclipse.merlin.launch;
  
  import java.net.URL;
  import java.util.MissingResourceException;
  import java.util.ResourceBundle;
  
  import org.eclipse.core.resources.IWorkspace;
  import org.eclipse.core.resources.ResourcesPlugin;
  import org.eclipse.core.runtime.IPath;
  import org.eclipse.core.runtime.IPluginDescriptor;
  import org.eclipse.core.runtime.IStatus;
  import org.eclipse.core.runtime.Path;
  import org.eclipse.core.runtime.Platform;
  import org.eclipse.core.runtime.Status;
  import org.eclipse.ui.plugin.AbstractUIPlugin;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>*
   *         The main plugin class to be used in the desktop.
   */
  public class MerlinDeveloperLaunch extends AbstractUIPlugin
  {
      //The shared instance.
      private static MerlinDeveloperLaunch plugin;
      //Resource bundle.
      private ResourceBundle resourceBundle;
  
      public static final String PLUGIN_ID = "org.apache.avalon.MerlinDeveloperLaunch";
      public static final String MERLIN_PROJECT_NATURE_ID =
          PLUGIN_ID + ".merlinProjectNature";
      public static final String MERLIN_PROJECT_CONFIG_NATURE_ID =
          PLUGIN_ID + ".merlinConfigNature";
      public static final String ID_MERLIN_CONTAINER = 
          MerlinDeveloperLaunch.PLUGIN_ID + ".merlinLaunchConfigurationDelegate"; //$NON-NLS-1$
      public static final String ATTR_MERLIN_CONTAINER_ID = "merlinContainerID"; //$NON-NLS-1$
      /**
  	 * The constructor.
  	 */
      public MerlinDeveloperLaunch(IPluginDescriptor descriptor)
      {
          super(descriptor);
          plugin = this;
          try
          {
              resourceBundle =
                  ResourceBundle.getBundle(
                      "org.apache.avalon.ide.eclipse.merlin.launch.MerlinDeveloperLaunchResources");
          } catch (MissingResourceException x)
          {
              resourceBundle = null;
          }
      }
  
      /**
  	 * Returns the shared instance.
  	 */
      public static MerlinDeveloperLaunch getDefault()
      {
          return plugin;
      }
  
      /**
  	 * Returns the workspace instance.
  	 */
      public static IWorkspace getWorkspace()
      {
          return ResourcesPlugin.getWorkspace();
      }
  
      /**
  	 * Returns the string from the plugin's resource bundle, or 'key' if not
  	 * found.
  	 */
      public static String getResourceString(String key)
      {
          ResourceBundle bundle = MerlinDeveloperLaunch.getDefault().getResourceBundle();
          try
          {
              return (bundle != null ? bundle.getString(key) : key);
          } catch (MissingResourceException e)
          {
              return key;
          }
      }
  
      /**
  	 * Returns the plugin's resource bundle,
  	 */
      public ResourceBundle getResourceBundle()
      {
          return resourceBundle;
      }
  
      public static void log(IStatus status)
      {
          getDefault().getLog().log(status);
      }
  
      public static void log(Throwable e, String message)
      {
          boolean isDebugging = true; // change to false for production
          IStatus status =
              new Status(
                  IStatus.ERROR,
                  getDefault().getDescriptor().getUniqueIdentifier(),
                  IStatus.ERROR,
                  message,
                  e);
  
          log(status);
          if (isDebugging)
          {
              System.out.println(message + ": " + e.getMessage()); //$NON-NLS-1$
          }
      }
  
      public IPath getPluginLocation()
      {
          return getPluginLocation(MerlinDeveloperLaunch.PLUGIN_ID);
      }
  
      public IPath getPluginLocation(String pluginId)
      {
          try
          {
              URL installURL =
                  Platform.getPluginRegistry().getPluginDescriptor(pluginId).getInstallURL();
              return new Path(Platform.resolve(installURL).getFile());
          } catch (Exception e)
          {
              log(e, "getPluginLocation() handling Exception"); //$NON-NLS-1$
              return null;
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/MerlinContainerConfigNature.java
  
  Index: MerlinContainerConfigNature.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *  1. Redistributions of source code must retain the above copyright notice,
   * this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in the
   * documentation and/or other materials provided with the distribution.
   *  3. The end-user documentation included with the redistribution, if any,
   * must include the following acknowledgment: "This product includes software
   * developed by the Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself, if and
   * wherever such third-party acknowledgments normally appear.
   *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
   * Software Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written permission,
   * please contact apache@apache.org.
   *  5. Products derived from this software may not be called "Apache", nor may
   * "Apache" appear in their name, without prior written permission of the
   * Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch;
  
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.resources.IProjectNature;
  import org.eclipse.core.runtime.CoreException;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public class MerlinContainerConfigNature implements IProjectNature {
  
  	private IProject project;
  
  	public void configure() throws CoreException {
  		// add build spec here
  	}
  	public void deconfigure() throws CoreException {
  		// Remove the nature-specific information here.
  	}
  	public IProject getProject() {
  		return project;
  	}
  	public void setProject(IProject project) {
  		this.project = project;
  	}
  	
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/MerlinLaunchConfigurationDelegate.java
  
  Index: MerlinLaunchConfigurationDelegate.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *  1. Redistributions of source code must retain the above copyright notice,
   * this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in the
   * documentation and/or other materials provided with the distribution.
   *  3. The end-user documentation included with the redistribution, if any,
   * must include the following acknowledgment: "This product includes software
   * developed by the Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself, if and
   * wherever such third-party acknowledgments normally appear.
   *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
   * Software Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written permission,
   * please contact apache@apache.org.
   *  5. Products derived from this software may not be called "Apache", nor may
   * "Apache" appear in their name, without prior written permission of the
   * Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch;
  
  import org.apache.avalon.ide.eclipse.merlin.launch.container.MerlinExternalContainer;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.core.runtime.IProgressMonitor;
  import org.eclipse.core.runtime.IStatus;
  import org.eclipse.core.runtime.NullProgressMonitor;
  import org.eclipse.core.runtime.Status;
  import org.eclipse.debug.core.ILaunch;
  import org.eclipse.debug.core.ILaunchConfiguration;
  import org.eclipse.debug.core.ILaunchManager;
  import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
  
  
  /**
   * This class is always called, if an Merlin Container is launched.
   * If the Merlin Container is launched through 'run as / Merlin Container'
   * the class MerlinLaunchShortcut is launched prior to MerlinLaunchConfigurationDelegate
   * 
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public class MerlinLaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
  
  	public void launch(ILaunchConfiguration launchConfig, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
  				
  		if (monitor == null) {
  			monitor = new NullProgressMonitor();
  		}
  
          MerlinExternalContainer container = new MerlinExternalContainer();      
          //container.init();
          
          if (mode.equals(ILaunchManager.RUN_MODE)) {
              container.start(launch);
          } else if (mode.equals(ILaunchManager.DEBUG_MODE)) {
              container.debug(launch);
          }
  		// check for cancellation
  		if (monitor.isCanceled()) {
  			return;
  		}
  
  		monitor.done();
  	}
  	
  	protected void abort(String message, Throwable exception, int code) throws CoreException {
  		throw new CoreException(new Status(IStatus.ERROR, MerlinDeveloperLaunch.getDefault().getDescriptor().getUniqueIdentifier(), code, message, exception));
  	}
  	
  }	
  
  
  
  
  
  1.2       +18 -0     avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/.project
  
  Index: .project
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/.project,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .project	26 Jan 2004 11:00:02 -0000	1.1
  +++ .project	26 Jan 2004 11:27:12 -0000	1.2
  @@ -3,9 +3,27 @@
   	<name>org.apache.avalon.ide.eclipse.launch</name>
   	<comment></comment>
   	<projects>
  +		<project>org.apache.avalon.ide.eclipse.core</project>
   	</projects>
   	<buildSpec>
  +		<buildCommand>
  +			<name>org.eclipse.jdt.core.javabuilder</name>
  +			<arguments>
  +			</arguments>
  +		</buildCommand>
  +		<buildCommand>
  +			<name>org.eclipse.pde.ManifestBuilder</name>
  +			<arguments>
  +			</arguments>
  +		</buildCommand>
  +		<buildCommand>
  +			<name>org.eclipse.pde.SchemaBuilder</name>
  +			<arguments>
  +			</arguments>
  +		</buildCommand>
   	</buildSpec>
   	<natures>
  +		<nature>org.eclipse.pde.PluginNature</nature>
  +		<nature>org.eclipse.jdt.core.javanature</nature>
   	</natures>
   </projectDescription>
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/.classpath
  
  Index: .classpath
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <classpath>
  	<classpathentry kind="src" path="src"/>
  	<classpathentry kind="lib" path="lib/merlin-bootstrap-1.0.jar"/>
  	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
  	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  	<classpathentry kind="output" path="bin"/>
  </classpath>
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/deploy_local.jardesc
  
  Index: deploy_local.jardesc
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <jardesc>
      <jar path="C:/develop/eclipse/workspace/MerlinDeveloper Launch/MerlinDeveloperLaunch.jar"/>
      <options overwrite="false" compress="true" exportErrors="true" exportWarnings="true" saveDescription="true" descriptionLocation="/MerlinDeveloper Launch/deploy_local.jardesc" useSourceFolders="false" buildIfNeeded="true"/>
      <manifest manifestVersion="1.0" usesManifest="true" reuseManifest="false" saveManifest="false" generateManifest="true" manifestLocation="">
          <sealing sealJar="false">
              <packagesToSeal/>
              <packagesToUnSeal/>
          </sealing>
      </manifest>
      <selectedElements exportClassFiles="true" exportJavaFiles="false">
          <javaElement handleIdentifier="=MerlinDeveloper Launch/src"/>
      </selectedElements>
  </jardesc>
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/MerlinDeveloperLaunch.jar
  
  	<<Binary file>>
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/plugin.xml
  
  Index: plugin.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <plugin
     id="org.apache.avalon.MerlinDeveloperLaunch"
     name="MerlinDeveloper Launch"
     version="0.0.1"
     provider-name="Apache Software Foundation"
     class="org.apache.avalon.ide.eclipse.merlin.launch.MerlinDeveloperLaunch">
  
     <runtime>
        <library name="MerlinDeveloperLaunch.jar">
           <export name="*"/>
        </library>
        <library name="lib/merlin-bootstrap-1.0.jar"/>
     </runtime>
     <requires>
        <import plugin="org.eclipse.core.resources"/>
        <import plugin="org.eclipse.ui"/>
        <import plugin="org.eclipse.core.runtime"/>
        <import plugin="org.eclipse.debug.ui"/>
        <import plugin="org.eclipse.debug.core"/>
        <import plugin="org.eclipse.jdt.core"/>
        <import plugin="org.eclipse.jdt.launching"/>
        <import plugin="org.eclipse.jdt.debug.ui"/>
        <import plugin="org.apache.avalon.MerlinDeveloperCore"/>
     </requires>
  
  
     <extension
           id="merlinProjectNature"
           name="MerlinDeveloperProjectNature"
           point="org.eclipse.core.resources.natures">
        <runtime>
           <run
                 class="org.apache.avalon.ide.eclipse.merlin.nature.MerlinProjectNature">
           </run>
        </runtime>
     </extension>
     <extension
           id="merlinConfigNature"
           name="MerlinConfigNature"
           point="org.eclipse.core.resources.natures">
        <runtime>
           <run
                 class="org.apache.avalon.ide.eclipse.merlin.nature.MerlinContainerConfigNature">
           </run>
        </runtime>
     </extension>
     <extension
           point="org.eclipse.debug.core.launchConfigurationTypes">
        <launchConfigurationType
              name="MerlinContainerConfiguration"
              delegate="org.apache.avalon.ide.eclipse.merlin.launch.MerlinLaunchConfigurationDelegate"
              modes="run, debug"
              id="org.apache.avalon.MerlinDeveloperLaunch.merlinLaunchConfigurationDelegate">
        </launchConfigurationType>
     </extension>
     <extension
           point="org.eclipse.debug.ui.launchConfigurationTabGroups">
        <launchConfigurationTabGroup
              type="org.apache.avalon.MerlinDeveloperLaunch.merlinLaunchConfigurationDelegate"
              class="org.apache.avalon.ide.eclipse.merlin.launch.ui.MerlinServerTabGroup"
              id="org.apache.avalon.MerlinDeveloper.merlinServerTabGroup">
        </launchConfigurationTabGroup>
     </extension>
     <extension
           point="org.eclipse.debug.ui.launchConfigurationTypeImages">
        <launchConfigurationTypeImage
              icon="icons/merlin_light.gif"
              configTypeID="org.apache.avalon.MerlinDeveloperLaunch.merlinLaunchConfigurationDelegate"
              id="org.apache.avalon.launch.merlinLaunchConfigurationTypeImage">
        </launchConfigurationTypeImage>
     </extension>
     <extension
           point="org.eclipse.debug.ui.launchShortcuts">
        <shortcut
              label="Merlin Container"
              icon="icons/merlin_light.gif"
              class="org.apache.avalon.ide.eclipse.merlin.launch.MerlinLaunchShortcut"
              modes="run, debug"
              id="org.apache.avalon.ide.eclipse.merlin.launch.merlinLaunchShortcut">
           <perspective
                 id="org.eclipse.jdt.ui.JavaPerspective">
           </perspective>
           <perspective
                 id="org.eclipse.jdt.ui.JavaHierarchyPerspective">
           </perspective>
           <perspective
                 id="org.eclipse.jdt.ui.JavaBrowsingPerspective">
           </perspective>
           <perspective
                 id="org.eclipse.debug.ui.DebugPerspective">
           </perspective>
        </shortcut>
     </extension>
  
  </plugin>
  
  
  
  1.3       +4 -1      avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/build.properties
  
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/lib/merlin-bootstrap-1.0.jar
  
  	<<Binary file>>
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/icons/merlin.gif
  
  	<<Binary file>>
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/icons/plugin.xml
  
  Index: plugin.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <plugin
     id="biz.softwarefabrik.MerlinDeveloper"
     name="%pluginName"
     version="0.0.3"
     provider-name="%providerName"
     class="biz.softwarefabrik.eclipse.merlin.MerlinContainerPlugin">
  
     <runtime>
        <library name="MerlinDeveloper.jar"/>
        <library name="lib/avalon-activation/merlin-bootstrap-1.0.jar"/>
        <library name="properties/"/>
     </runtime>
     <requires>
        <import plugin="org.apache.xerces"/>
        <import plugin="org.eclipse.core.resources"/>
        <import plugin="org.eclipse.core.runtime"/>
        <import plugin="org.eclipse.debug.core"/>
        <import plugin="org.eclipse.debug.ui"/>
        <import plugin="org.eclipse.help"/>
        <import plugin="org.eclipse.help.ui"/>
        <import plugin="org.eclipse.jdt.core"/>
        <import plugin="org.eclipse.jdt.launching"/>
        <import plugin="org.eclipse.jdt.ui"/>
        <import plugin="org.eclipse.ui"/>
        <import plugin="org.eclipse.jdt.debug.ui"/>
        <import plugin="org.eclipse.pde.ui"/>
     </requires>
  
  
     <extension-point id="server" name="%serverExtensionPointName"/>
  
     <extension
           point="org.eclipse.ui.newWizards">
        <category
              name="%new.category.name"
              id="org.eclipse.ui.Merlin">
        </category>
        <wizard
              name="%new.blockDevelopment.name"
              icon="icons/full/ctool16/newjprj_wiz.gif"
              category="org.eclipse.ui.Merlin"
              class="biz.softwarefabrik.eclipse.merlin.wizards.NewBlockDevelopmentWizard"
              project="true"
              id="biz.softwarefabrik.eclipse.wizards.newMerlinBlockWizard1">
        </wizard>
        <wizard
              name="%new.frameworkDevelopment.name"
              icon="icons/full/ctool16/newjprj_wiz.gif"
              category="org.eclipse.ui.Merlin"
              class="biz.softwarefabrik.eclipse.merlin.wizards.NewFrameworkDevelopmentWizard"
              project="true"
              id="biz.softwarefabrik.eclipse.wizards.newMerlinBlockWizard">
        </wizard>
        <wizard
              name="%new.architectureDriven.name"
              icon="icons/full/ctool16/newjprj_wiz.gif"
              category="org.eclipse.ui.Merlin"
              class="biz.softwarefabrik.eclipse.merlin.wizards.NewArchitectureDrivenWizard"
              project="true"
              id="biz.softwarefabrik.eclipse.wizards.newMerlinBlockWizard2">
        </wizard>
        <wizard
              name="%new.convertProject.name"
              icon="icons/full/ctool16/newjprj_wiz.gif"
              category="org.eclipse.ui.Merlin"
              class="biz.softwarefabrik.eclipse.merlin.wizards.NewConvertNatureWizard"
              id="biz.softwarefabrik.eclipse.wizards.newMerlinBlockWizard2">
        </wizard>
     </extension>
     <extension
           point="org.eclipse.ui.preferencePages">
        <page
              name="%webAppPreferencePageName"
              class="biz.softwarefabrik.eclipse.merlin.preferences.WebAppPreferencePage"
              id="biz.softwarefabrik.eclipse.webapp.preferences.webAppPreferencePage">
        </page>
     </extension>
     <extension
           id="merlinProjectNature"
           name="%webAppProjectNatureName"
           point="org.eclipse.core.resources.natures">
        <runtime>
           <run
                 class="biz.softwarefabrik.eclipse.merlin.tools.MerlinProjectNature">
           </run>
        </runtime>
     </extension>
     <extension
           id="merlinConfigNature"
           name="%webAppServerConfigNatureName"
           point="org.eclipse.core.resources.natures">
        <runtime>
           <run
                 class="biz.softwarefabrik.eclipse.merlin.MerlinContainerConfigNature">
           </run>
        </runtime>
     </extension>
     <extension
           point="com.blueskytime.eclipse.webapp.server">
        <server
              factoryclass="biz.softwarefabrik.eclipse.merlin.container.MerlinServerFactory"
              name="%serverAdapterName"
              id="biz.softwarefabrik.eclipse.merlin.container.MerlinServerAdapter">
        </server>
     </extension>
     <extension
           point="org.eclipse.debug.core.launchConfigurationTypes">
        <launchConfigurationType
              name="%launchConfigurationTypeName"
              delegate="biz.softwarefabrik.eclipse.merlin.launching.WebAppLaunchConfigurationDelegate"
              modes="run, debug"
              id="biz.softwarefabrik.MerlinDeveloper.launching.webAppLaunchConfigurationDelegate">
        </launchConfigurationType>
     </extension>
     <extension
           point="org.eclipse.debug.ui.launchConfigurationTypeImages">
        <launchConfigurationTypeImage
              icon="icons/full/ctool16/java_app.gif"
              configTypeID="biz.softwarefabrik.merlin.MerlinDeveloper.launching.webAppLaunchConfigurationDelegate"
              id="biz.softwarefabrik.MerlinDeveloper.launching.webAppLaunchConfigurationTypeImage">
        </launchConfigurationTypeImage>
     </extension>
     <extension
           point="org.eclipse.debug.ui.launchConfigurationTabGroups">
        <launchConfigurationTabGroup
              type="biz.softwarefabrik.MerlinDeveloper.launching.webAppLaunchConfigurationDelegate"
              class="biz.softwarefabrik.eclipse.merlin.launching.WebAppServerTabGroup"
              id="biz.softwarefabrik.MerlinDeveloper.webAppServerTabGroup">
        </launchConfigurationTabGroup>
     </extension>
     <extension
           point="org.eclipse.debug.ui.launchShortcuts">
        <shortcut
              label="%webAppLaunchShortcutLabel"
              icon="icons/full/ctool16/java_app.gif"
              modes="run, debug"
              class="biz.softwarefabrik.eclipse.merlin.launching.WebAppLaunchShortcut"
              id="biz.softwarefabrik.eclipse.merlin.container.launching.webAppLaunchShortcut">
           <perspective
                 id="org.eclipse.jdt.ui.JavaPerspective">
           </perspective>
           <perspective
                 id="org.eclipse.jdt.ui.JavaHierarchyPerspective">
           </perspective>
           <perspective
                 id="org.eclipse.jdt.ui.JavaBrowsingPerspective">
           </perspective>
           <perspective
                 id="org.eclipse.debug.ui.DebugPerspective">
           </perspective>
        </shortcut>
     </extension>
  
  </plugin>
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/icons/merlin_light.gif
  
  	<<Binary file>>
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/nature/MerlinContainerConfigNature.java
  
  Index: MerlinContainerConfigNature.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *  1. Redistributions of source code must retain the above copyright notice,
   * this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in the
   * documentation and/or other materials provided with the distribution.
   *  3. The end-user documentation included with the redistribution, if any,
   * must include the following acknowledgment: "This product includes software
   * developed by the Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself, if and
   * wherever such third-party acknowledgments normally appear.
   *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
   * Software Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written permission,
   * please contact apache@apache.org.
   *  5. Products derived from this software may not be called "Apache", nor may
   * "Apache" appear in their name, without prior written permission of the
   * Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.nature;
  
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.resources.IProjectNature;
  import org.eclipse.core.runtime.CoreException;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public class MerlinContainerConfigNature implements IProjectNature {
  
  	private IProject project;
  
  	public void configure() throws CoreException {
  		// add build spec here
  	}
  	public void deconfigure() throws CoreException {
  		// Remove the nature-specific information here.
  	}
  	public IProject getProject() {
  		return project;
  	}
  	public void setProject(IProject project) {
  		this.project = project;
  	}
  	
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/nature/MerlinProjectNature.java
  
  Index: MerlinProjectNature.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *  1. Redistributions of source code must retain the above copyright notice,
   * this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in the
   * documentation and/or other materials provided with the distribution.
   *  3. The end-user documentation included with the redistribution, if any,
   * must include the following acknowledgment: "This product includes software
   * developed by the Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself, if and
   * wherever such third-party acknowledgments normally appear.
   *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
   * Software Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written permission,
   * please contact apache@apache.org.
   *  5. Products derived from this software may not be called "Apache", nor may
   * "Apache" appear in their name, without prior written permission of the
   * Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.nature;
  
  import org.apache.avalon.ide.eclipse.merlin.launch.MerlinDeveloperLaunch;
  import org.eclipse.core.resources.ICommand;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.resources.IProjectDescription;
  import org.eclipse.core.resources.IProjectNature;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.jdt.core.IJavaProject;
  import org.eclipse.jdt.core.JavaCore;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public class MerlinProjectNature implements IProjectNature
  {
  
      private IProject project;
      private IJavaProject javaProject;
  
      static public MerlinProjectNature create(IJavaProject javaProject) {
          MerlinProjectNature result = null;
          try {
              result =
              (MerlinProjectNature) javaProject.getProject().getNature(
                      MerlinDeveloperLaunch.MERLIN_PROJECT_NATURE_ID);
              if (result != null)
                  result.setJavaProject(javaProject);
          } catch (CoreException e) {
              MerlinDeveloperLaunch.log(e, "create(IJavaProject javaProject) handling CoreException"); //$NON-NLS-1$
          }
          return result;
      }
  
      /**
       * This is the entry method, called by NewMerlinBlockOperation
       * 
       * @param project
       * @return
       */
      static public MerlinProjectNature create(IProject project) {
  
          IJavaProject javaProject = JavaCore.create(project);
          if (javaProject != null) {
              return MerlinProjectNature.create(javaProject);
          } else {
              return null;
          }
      }
      
      /**
  	 * Normaly, the whole initialization stuff (creating directory structure,
  	 * initial files etc. ) is done here. But because we need greater
  	 * flexibility, this is done in the wizards operastions classes.
  	 * 
  	 * @see org.eclipse.core.resources.IProjectNature#configure()
  	 */
      public void configure() throws CoreException
      {}
  
      public void deconfigure() throws CoreException
      {
          // Remove the nature-specific information here.
      }
  
      public String getDocumentBase()
      {
          return this.getProject().getLocation().toString();
      }
  
      // not used yet
      protected void addToBuildSpec(String builderID) throws CoreException
      {
  
          IProjectDescription description = getProject().getDescription();
          ICommand[] commands = description.getBuildSpec();
          boolean found = false;
  
          for (int i = 0; i < commands.length; ++i)
          {
              if (commands[i].getBuilderName().equals(builderID))
              {
                  found = true;
                  break;
              }
          }
  
          if (!found)
          {
              //add builder to project
              ICommand command = description.newCommand();
              command.setBuilderName(builderID);
              ICommand[] newCommands = new ICommand[commands.length + 1];
  
              // Add it before other builders.
              System.arraycopy(commands, 0, newCommands, 1, commands.length);
              newCommands[0] = command;
              description.setBuildSpec(newCommands);
              getProject().setDescription(description, null);
          }
  
      }
  
      /*
  	 * (non-Javadoc)
  	 * 
  	 * @see org.eclipse.core.resources.IProjectNature#getProject()
  	 */
      public IProject getProject()
      {
          return project;
      }
  
      /**
  	 * This method is automatically called by eclipse during project creation
  	 * before the configure() method is called
  	 * 
  	 * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
  	 */
      public void setProject(IProject project)
      {
          this.project = project;
      }
  
      /**
       * @param pJavaProject
       */
      private void setJavaProject(IJavaProject pJavaProject)
      {
          javaProject = pJavaProject;
          
      }
      
      /**
       * @return Returns the javaProject.
       */
      public IJavaProject getJavaProject()
      {
          return javaProject;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/container/MerlinEmbeddedContainer.java
  
  Index: MerlinEmbeddedContainer.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *  1. Redistributions of source code must retain the above copyright notice,
   * this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in the
   * documentation and/or other materials provided with the distribution.
   *  3. The end-user documentation included with the redistribution, if any,
   * must include the following acknowledgment: "This product includes software
   * developed by the Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself, if and
   * wherever such third-party acknowledgments normally appear.
   *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
   * Software Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written permission,
   * please contact apache@apache.org.
   *  5. Products derived from this software may not be called "Apache", nor may
   * "Apache" appear in their name, without prior written permission of the
   * Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch.container;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public class MerlinEmbeddedContainer
  {}
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/container/IAvalonContainer.java
  
  Index: IAvalonContainer.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *  1. Redistributions of source code must retain the above copyright notice,
   * this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in the
   * documentation and/or other materials provided with the distribution.
   *  3. The end-user documentation included with the redistribution, if any,
   * must include the following acknowledgment: "This product includes software
   * developed by the Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself, if and
   * wherever such third-party acknowledgments normally appear.
   *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
   * Software Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written permission,
   * please contact apache@apache.org.
   *  5. Products derived from this software may not be called "Apache", nor may
   * "Apache" appear in their name, without prior written permission of the
   * Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch.container;
  
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.debug.core.ILaunch;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *
   */
  public interface IAvalonContainer {
  
  	public void setProjectName(String projectName);
  	public String getProjectName();
  	public void debug(ILaunch launch) throws CoreException;
  	public boolean isStarted();
  	public boolean isStopped();
  	public void start(ILaunch launch) throws CoreException;
  	public void stop() throws CoreException;
  	public void terminate();
  
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/container/AvalonContainer.java
  
  Index: AvalonContainer.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met: 1.
   * Redistributions of source code must retain the above copyright notice, this
   * list of conditions and the following disclaimer. 2. Redistributions in
   * binary form must reproduce the above copyright notice, this list of
   * conditions and the following disclaimer in the documentation and/or other
   * materials provided with the distribution. 3. The end-user documentation
   * included with the redistribution, if any, must include the following
   * acknowledgment: "This product includes software developed by the Apache
   * Software Foundation (http://www.apache.org/)." Alternately, this
   * acknowledgment may appear in the software itself, if and wherever such
   * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
   * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
   * used to endorse or promote products derived from this software without prior
   * written permission. For written permission, please contact
   * apache@apache.org. 5. Products derived from this software may not be called
   * "Apache", nor may "Apache" appear in their name, without prior written
   * permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch.container;
  
  import java.text.MessageFormat;
  import java.util.ArrayList;
  
  import org.apache.avalon.ide.eclipse.merlin.launch.MerlinDeveloperLaunch;
  import org.apache.avalon.ide.eclipse.merlin.nature.MerlinProjectNature;
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.core.runtime.IPath;
  import org.eclipse.core.runtime.IProgressMonitor;
  import org.eclipse.core.runtime.IStatus;
  import org.eclipse.core.runtime.NullProgressMonitor;
  import org.eclipse.core.runtime.Path;
  import org.eclipse.core.runtime.Status;
  import org.eclipse.debug.core.DebugException;
  import org.eclipse.debug.core.DebugPlugin;
  import org.eclipse.debug.core.ILaunch;
  import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
  import org.eclipse.debug.core.ILaunchManager;
  import org.eclipse.debug.core.model.ISourceLocator;
  import org.eclipse.debug.ui.IDebugUIConstants;
  import org.eclipse.jdt.core.IJavaProject;
  import org.eclipse.jdt.launching.ExecutionArguments;
  import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
  import org.eclipse.jdt.launching.IVMInstall;
  import org.eclipse.jdt.launching.IVMInstallType;
  import org.eclipse.jdt.launching.IVMRunner;
  import org.eclipse.jdt.launching.JavaRuntime;
  import org.eclipse.jdt.launching.LibraryLocation;
  import org.eclipse.jdt.launching.VMRunnerConfiguration;
  import org.eclipse.jdt.launching.sourcelookup.JavaSourceLocator;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *  
   */
  public abstract class AvalonContainer implements IAvalonContainer
  {
  
      protected static ILaunch merlinLaunch = null;
      protected static MerlinProjectNature merlinProjectNature;
      private static final String XML_PLUGIN_ID = "org.apache.xerces"; //$NON-NLS-1$
  
      protected AvalonContainer()
      {}
  
      protected abstract LibraryLocation[] getLibraryLocations();
      protected abstract String getMainClass();
      protected abstract String getProgramArguments();
      protected abstract String getVMArguments();
  
      public void debug(ILaunch launch) throws CoreException
      {
  
          merlinLaunch = run(ILaunchManager.DEBUG_MODE, launch);
          DebugPlugin.getDefault().getLaunchManager().addLaunch(merlinLaunch);
      }
  
      public void start(ILaunch launch) throws CoreException
      {
  
          merlinLaunch = run(ILaunchManager.RUN_MODE, launch);
          ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
          lm.addLaunch(merlinLaunch);
      }
  
      protected ILaunch run(String mode, ILaunch launch) throws CoreException
      {
  
          ILaunchConfigurationWorkingCopy working = launch.getLaunchConfiguration().getWorkingCopy();
          setProjectName(working.getAttribute("project", ""));
          launch.setAttribute(
              IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE,
              IDebugUIConstants.PERSPECTIVE_DEFAULT);
          launch.setAttribute(
              IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE,
              IDebugUIConstants.PERSPECTIVE_DEFAULT);
          launch.setAttribute("project", getProjectName());
  
          // Check Tools classpath
          if (getToolsLibraryLocation() == null)
          {
              abort("ToolsLibrary location not found", null, 1); //$NON-NLS-1$
          }
  
          // Class to launch
          String classToLaunch = this.getMainClass();
          if (classToLaunch == null || "".equals(classToLaunch))
          { //$NON-NLS-1$
              abort("Main class not defined", null, 2); //$NON-NLS-1$
          }
  
          // Virtual machine
          IVMInstall vmInstall = getVMInstall(null);
          IVMRunner vmRunner = vmInstall.getVMRunner(mode);
          if (vmRunner == null)
          {
              if (mode == ILaunchManager.DEBUG_MODE)
              {
                  abort(MessageFormat.format("JRE {0} does not support debug mode.", new String[] { vmInstall.getName()}), null, 3); //$NON-NLS-1$
              } else
              {
                  abort(MessageFormat.format("JRE {0} does not support run mode.", new String[] { vmInstall.getName()}), null, 4); //$NON-NLS-1$
              }
          }
  
          // Program & VM args
          String programArguments = this.getProgramArguments();
          String vmArguments = this.getVMArguments();
          ExecutionArguments executionArguments =
              new ExecutionArguments(vmArguments, programArguments);
  
          // Classpath
          String[] classpath = getClasspath();
  
          // Bootpath
          String[] bootClasspath = getBootClasspath(vmInstall);
          String[] vmArgs = new String[1];
          vmArgs[0] = executionArguments.getVMArguments();
          if (bootClasspath == null)
          {
              abort("Boot classpath not resolved", null, 5); //$NON-NLS-1$
          }
  
          VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(classToLaunch, classpath);
          runnerConfig.setVMArguments(vmArgs);
          runnerConfig.setProgramArguments(executionArguments.getProgramArgumentsArray());
          runnerConfig.setBootClassPath(bootClasspath);
  
          IProgressMonitor monitor = new NullProgressMonitor();
          vmRunner.run(runnerConfig, launch, monitor);
  
          if (mode.equals(ILaunchManager.DEBUG_MODE))
          {
              launch.setSourceLocator(getSourceLocator());
          }
  
          return launch;
  
      }
  
      public void stop() throws CoreException
      {
          terminate();
      }
  
      public boolean isStarted()
      {
          return true;
      }
  
      public boolean isStopped()
      {
          return false;
      }
  
      public void terminate()
      {
          if (!(merlinLaunch == null))
          {
              try
              {
                  merlinLaunch.terminate();
              } catch (DebugException e)
              {
                  MerlinDeveloperLaunch.log(e, "terminate() handling DebugException" + " " + e.getStatus().getMessage() + +e.getStatus().getCode()); //$NON-NLS-1$
              }
          }
      }
      
      protected LibraryLocation getToolsLibraryLocation() {
          IPath toolsJarPath = new Path(JavaRuntime.getDefaultVMInstall().getInstallLocation().getPath()).append("lib").append("tools.jar"); //$NON-NLS-1$ //$NON-NLS-2$
          if (toolsJarPath.toFile().exists()) {
              return new LibraryLocation(toolsJarPath, Path.EMPTY, Path.EMPTY);
          } else {
              return null;
          }
      }
      
      private IVMInstall getVMInstall(String vmInstallName)
      {
          if (vmInstallName != null)
          {
              IVMInstall[] vmInstalls = getVMInstalls();
              for (int i = 0; i < vmInstalls.length; i++)
              {
                  if (vmInstallName.equals(vmInstalls[i].getName()))
                  {
                      return vmInstalls[i];
                  }
              }
          }
          // if vmInstallName not found just return default
          return JavaRuntime.getDefaultVMInstall();
      }
  
      private static IVMInstall[] getVMInstalls()
      {
          ArrayList vmInstalls = new ArrayList();
          IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
          for (int i = 0; i < vmInstallTypes.length; i++)
          {
              IVMInstall[] installs = vmInstallTypes[i].getVMInstalls();
              for (int k = 0; k < installs.length; k++)
              {
                  vmInstalls.add(installs[k]);
              }
          }
          return (IVMInstall[]) vmInstalls.toArray(new IVMInstall[vmInstalls.size()]);
      }
  
      private String[] getClasspath()
      {
          ArrayList runtimeClasspaths = new ArrayList();
          LibraryLocation[] serverLibs = this.getLibraryLocations();
          for (int i = 0; i < serverLibs.length; i++)
          {
              IRuntimeClasspathEntry runtimeEntry =
                  JavaRuntime.newArchiveRuntimeClasspathEntry(
                      ((LibraryLocation) (serverLibs[i])).getSystemLibraryPath());
              runtimeEntry.setSourceAttachmentPath(
                  ((LibraryLocation) (serverLibs[i])).getSystemLibrarySourcePath());
              runtimeEntry.setSourceAttachmentRootPath(
                  ((LibraryLocation) (serverLibs[i])).getPackageRootPath());
              runtimeEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
              runtimeClasspaths.add(runtimeEntry.getLocation());
          }
  
          if (runtimeClasspaths.size() == 0)
          {
              return null;
          } else
          {
              return (String[]) runtimeClasspaths.toArray(new String[runtimeClasspaths.size()]);
          }
      }
  
      private String[] getBootClasspath(IVMInstall vm)
      {
          ArrayList runtimeClasspaths = new ArrayList();
          LibraryLocation[] vmLibs = JavaRuntime.getLibraryLocations(vm);
          for (int i = 0; i < vmLibs.length; i++)
          {
              IRuntimeClasspathEntry runtimeEntry =
                  JavaRuntime.newArchiveRuntimeClasspathEntry(
                      ((LibraryLocation) (vmLibs[i])).getSystemLibraryPath());
              runtimeEntry.setSourceAttachmentPath(
                  ((LibraryLocation) (vmLibs[i])).getSystemLibrarySourcePath());
              runtimeEntry.setSourceAttachmentRootPath(
                  ((LibraryLocation) (vmLibs[i])).getPackageRootPath());
              runtimeEntry.setClasspathProperty(IRuntimeClasspathEntry.STANDARD_CLASSES);
              runtimeClasspaths.add(runtimeEntry.getLocation());
          }
  
          if (runtimeClasspaths.size() == 0)
          {
              return null;
          } else
          {
              return (String[]) runtimeClasspaths.toArray(new String[runtimeClasspaths.size()]);
          }
      }
  
      protected void abort(String message, Throwable exception, int code) throws CoreException
      {
          throw new CoreException(
              new Status(
                  IStatus.ERROR,
                  MerlinDeveloperLaunch.getDefault().getDescriptor().getUniqueIdentifier(),
                  code,
                  message,
                  exception));
      }
  
      private ISourceLocator getSourceLocator() throws CoreException
      {
  
          MerlinProjectNature[] addedMerlinProjectCreators = getMerlinProjectCreators();
          IJavaProject[] javaProjects = new IJavaProject[addedMerlinProjectCreators.length];
  
          for (int i = 0; i < addedMerlinProjectCreators.length; i++)
          {
              if (addedMerlinProjectCreators[i].getJavaProject().isOpen())
              {
                  javaProjects[i] = addedMerlinProjectCreators[i].getJavaProject();
              }
          }
  
          return new JavaSourceLocator(javaProjects, true);
  
      }
  
      protected MerlinProjectNature[] getMerlinProjectCreators() throws CoreException
      {
  
          IProject[] projects = MerlinDeveloperLaunch.getWorkspace().getRoot().getProjects();
          ArrayList merlinProjectCreators = new ArrayList();
  
          for (int i = 0; i < projects.length; i++)
          {
              if (projects[i].isOpen())
              {
                  if (projects[i].hasNature(MerlinDeveloperLaunch.MERLIN_PROJECT_NATURE_ID))
                  {
                      MerlinProjectNature merlinProjectCreator =
                          MerlinProjectNature.create(projects[i]);
                      merlinProjectCreators.add(merlinProjectCreator);
                  }
              }
          }
  
          return (MerlinProjectNature[]) merlinProjectCreators.toArray(
              new MerlinProjectNature[merlinProjectCreators.size()]);
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/container/MerlinExternalContainer.java
  
  Index: MerlinExternalContainer.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met: 1.
   * Redistributions of source code must retain the above copyright notice, this
   * list of conditions and the following disclaimer. 2. Redistributions in
   * binary form must reproduce the above copyright notice, this list of
   * conditions and the following disclaimer in the documentation and/or other
   * materials provided with the distribution. 3. The end-user documentation
   * included with the redistribution, if any, must include the following
   * acknowledgment: "This product includes software developed by the Apache
   * Software Foundation (http://www.apache.org/)." Alternately, this
   * acknowledgment may appear in the software itself, if and wherever such
   * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
   * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
   * used to endorse or promote products derived from this software without prior
   * written permission. For written permission, please contact
   * apache@apache.org. 5. Products derived from this software may not be called
   * "Apache", nor may "Apache" appear in their name, without prior written
   * permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch.container;
  
  import java.util.Vector;
  
  import org.apache.avalon.ide.eclipse.merlin.launch.MerlinDeveloperLaunch;
  import org.apache.avalon.ide.eclipse.merlin.nature.MerlinProjectNature;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.core.runtime.ILibrary;
  import org.eclipse.core.runtime.IPath;
  import org.eclipse.core.runtime.Path;
  import org.eclipse.debug.core.model.ISourceLocator;
  import org.eclipse.jdt.core.IJavaProject;
  import org.eclipse.jdt.core.JavaCore;
  import org.eclipse.jdt.core.JavaModelException;
  import org.eclipse.jdt.launching.LibraryLocation;
  import org.eclipse.jdt.launching.sourcelookup.JavaSourceLocator;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *  
   */
  public class MerlinExternalContainer extends AvalonContainer
  {
  
      private static final String MAIN_CLASS = "Merlin"; //$NON-NLS-1$
      private static final String MERLIN_HOME_KEY = "merlin.home";
      private String projectName;
      /**
  	 *  
  	 */
      public MerlinExternalContainer()
      {
          super();
      }
  
      /*
  	 * (non-Javadoc)
  	 *  
  	 */
      protected LibraryLocation[] getLibraryLocations()
      {
          IPath pluginPath = MerlinDeveloperLaunch.getDefault().getPluginLocation();
          ILibrary[] libraries =
              MerlinDeveloperLaunch.getDefault().getDescriptor().getRuntimeLibraries();
          Vector libraryLocations = new Vector();
  
          for (int i = 0; i < libraries.length; i++)
          {
              libraryLocations.add(
                  new LibraryLocation(
                      pluginPath.append(libraries[i].getPath()),
                      Path.EMPTY,
                      Path.EMPTY));
          }
  
          pluginPath = pluginPath.append("/lib/hibernate");
          String[] path = pluginPath.toFile().list();
          if (path != null)
          {
              for (int i = 0; i < path.length; i++)
              {
                  if (path[i].endsWith(".jar"))
                  { //$NON-NLS-1$
                      libraryLocations.add(
                          new LibraryLocation(pluginPath.append(path[i]), Path.EMPTY, Path.EMPTY));
                  }
              }
          }
          return (LibraryLocation[]) libraryLocations.toArray(
              new LibraryLocation[libraryLocations.size()]);
      }
  
      /*
  	 * (non-Javadoc)
  	 *  
  	 */
      protected String getMainClass()
      {
  
          return "Merlin";
      }
  
      /*
  	 * (non-Javadoc)
  	 *  
  	 */
      protected String getProgramArguments()
      {
  
          String param = "";
          try
          {
              IProject project =
                  MerlinDeveloperLaunch.getWorkspace().getRoot().getProject(projectName);
              IJavaProject proj = JavaCore.create(project);
              param = project.getLocation().append(proj.getOutputLocation().lastSegment()).toString();
          } catch (JavaModelException e)
          {
              e.printStackTrace();
          }
          return param + " -execute -debug";
      }
  
      /*
  	 * (non-Javadoc)
  	 *  
  	 */
      protected String getVMArguments()
      {
          String fallback = System.getProperty("user.home") + "/.merlin";
          String home = System.getProperty(MERLIN_HOME_KEY, fallback);
  
          return "-Djava.security.policy=" + home + "/bin/security.policy -Dmerlin.home=" + home;
      }
  
      private ISourceLocator getSourceLocator() throws CoreException
      {
  
          MerlinProjectNature[] addedMerlinProjectCreators = getMerlinProjectCreators();
          IJavaProject[] javaProjects = new IJavaProject[addedMerlinProjectCreators.length];
  
          for (int i = 0; i < addedMerlinProjectCreators.length; i++)
          {
              if (addedMerlinProjectCreators[i].getJavaProject().isOpen())
              {
                  javaProjects[i] = addedMerlinProjectCreators[i].getJavaProject();
              }
          }
  
          return new JavaSourceLocator(javaProjects, true);
  
      }
  
      /**
  	 * Set the projects name for which the container is started
  	 *  
  	 */
      public void setProjectName(String projectName)
      {
  
          this.projectName = projectName;
  
      }
  
      /**
  	 * Get the projects name for which the container is started
  	 */
      public String getProjectName()
      {
  
          return projectName;
      }
  
      /**
  	 * @return String server label
  	 */
      public static String getServerLabel()
      {
          return "merlinContainerID";
      }
  }
  
  
  
  1.1                  avalon-sandbox/ide/org.apache.avalon.ide.eclipse.launch/src/org/apache/avalon/ide/eclipse/merlin/launch/ui/MerlinServerTabGroup.java
  
  Index: MerlinServerTabGroup.java
  ===================================================================
  /*
   * ============================================================================
   * The Apache Software License, Version 1.1
   * ============================================================================
   * 
   * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met: 1.
   * Redistributions of source code must retain the above copyright notice, this
   * list of conditions and the following disclaimer. 2. Redistributions in
   * binary form must reproduce the above copyright notice, this list of
   * conditions and the following disclaimer in the documentation and/or other
   * materials provided with the distribution. 3. The end-user documentation
   * included with the redistribution, if any, must include the following
   * acknowledgment: "This product includes software developed by the Apache
   * Software Foundation (http://www.apache.org/)." Alternately, this
   * acknowledgment may appear in the software itself, if and wherever such
   * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
   * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
   * used to endorse or promote products derived from this software without prior
   * written permission. For written permission, please contact
   * apache@apache.org. 5. Products derived from this software may not be called
   * "Apache", nor may "Apache" appear in their name, without prior written
   * permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation. For more information on the
   * Apache Software Foundation, please see <http://www.apache.org/> .
   */
  package org.apache.avalon.ide.eclipse.merlin.launch.ui;
  
  import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
  import org.eclipse.debug.ui.CommonTab;
  import org.eclipse.debug.ui.EnvironmentTab;
  import org.eclipse.debug.ui.ILaunchConfigurationDialog;
  import org.eclipse.debug.ui.ILaunchConfigurationTab;
  import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
  import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
  import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
  import org.eclipse.jdt.debug.ui.launchConfigurations.JavaMainTab;
  import org.eclipse.jdt.debug.ui.launchConfigurations.JavaSourceLookupTab;
  
  /**
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   *  
   */
  
  public class MerlinServerTabGroup extends AbstractLaunchConfigurationTabGroup
  {
  
      public void createTabs(ILaunchConfigurationDialog dialog, String mode)
      {
          ILaunchConfigurationTab[] tabs =
              new ILaunchConfigurationTab[] {
                  new JavaMainTab(),
                  new JavaArgumentsTab(),
                  new JavaJRETab(),
                  new JavaClasspathTab(),
                  new JavaSourceLookupTab(),
                  new EnvironmentTab(),
                  new CommonTab()};
          setTabs(tabs);
      }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org