Author: rombert
Date: Fri Jul 19 15:02:22 2013
New Revision: 1504893

URL: http://svn.apache.org/r1504893
Log:
SLING-2793 - [Tooling] Align Eclipse tooling to proposed structure

WST server definition complete, now working on getting modules to deploy
on the Sling server.

Added:
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetInstallDelegate.java
      - copied, changed from r1504892, 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java
   (with props)
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java
   (with props)
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java
   (with props)
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchableAdapterDelegate.java
      - copied, changed from r1504892, 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
Modified:
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/plugin.xml
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadRuntime.java
    
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadServer.java

Modified: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF?rev=1504893&r1=1504892&r2=1504893&view=diff
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF 
(original)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF 
Fri Jul 19 15:02:22 2013
@@ -5,8 +5,18 @@ Bundle-SymbolicName: org.apache.sling.sl
 Bundle-Version: 0.0.1.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ClassPath: .
-Import-Package: org.eclipse.core.runtime;version="3.4.0",
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.core.runtime;version="3.4.0",
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
  org.eclipse.jface.viewers,
+ org.eclipse.jst.common.project.facet.core,
+ org.eclipse.jst.server.core,
  org.eclipse.swt,
  org.eclipse.swt.events,
  org.eclipse.swt.layout,
@@ -14,8 +24,8 @@ Import-Package: org.eclipse.core.runtime
  org.eclipse.ui,
  org.eclipse.ui.forms,
  org.eclipse.ui.forms.widgets,
+ org.eclipse.wst.common.project.facet.core,
  org.eclipse.wst.server.core,
  org.eclipse.wst.server.core.model,
- org.eclipse.wst.server.ui.editor,
- org.eclipse.core.resources,
- org.eclipse.core.runtime.jobs
+ org.eclipse.wst.server.ui,
+ org.eclipse.wst.server.ui.editor

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/plugin.xml
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/plugin.xml?rev=1504893&r1=1504892&r2=1504893&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/plugin.xml 
(original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/plugin.xml Fri Jul 
19 15:02:22 2013
@@ -2,63 +2,167 @@
 <?eclipse version="3.0"?>
 <plugin>
 
-  <extension point="org.eclipse.wst.server.core.runtimeTypes">
+       <!-- Define the sling module type. TODO needed ? -->
+  <extension point="org.eclipse.wst.server.core.moduleTypes">
+    <moduleType
+       id="sling.content"
+       name="Sling module type"/>
+  </extension>
   
+       <!-- Define the sling facet we support -->
+       <extension point="org.eclipse.wst.common.project.facet.core.facets">
+               <project-facet id="sling.content">
+                       <label>Sling content module</label>
+                       <description>Sling content modules contain content 
which is installed into the repository as-is. Good examples are static files ( 
HTML, CSS, JS ), scripts ( JSP, ESP ) and any other form of 
content.</description>
+               </project-facet>
+               
+               <project-facet-version facet="sling.content" version="1.0"/>
+               <!-- TODO add image -->
+               
+               <action facet="sling.content" version="1.0" type="INSTALL">
+                       <delegate 
class="org.apache.sling.ide.eclipse.wst.internal.SlingContentFacetInstallDelegate"/>
+               </action>
+
+               <action facet="sling.content" version="1.0" type="UNINSTALL">
+                       <delegate 
class="org.apache.sling.ide.eclipse.wst.internal.SlingContentFacetUninstallDelegate"/>
+               </action>
+       </extension>  
+
+       <!-- Define the Sling launchpad runtime type -->
+  <extension point="org.eclipse.wst.server.core.runtimeTypes">
     <runtimeType
-       id="org.apache.sling.ide.eclipse.wst.slingLaunchpad"
-       name="Sling Launchpad"
-       description="Sling Launchpad"
+       id="org.apache.sling.launchpad.runtime"
+       name="Sling Launchpad (runtime name)"
+       description="Sling Launchpad (runtime description)"
        vendor="Sling"
-       version="2.4"
+       version="1.0"
        class="org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadRuntime">
-       
-       <!-- TODO do we need a Sling module type ? -->
-       
-       <!--
-       <moduleType
-         types="jst.web"
-         versions="2.2, 2.3, 2.4, 2.5"/>
-       <moduleType
-         types="jst.utility"
-         versions="1.0"/>
-         -->
+       <moduleType types="sling.content" versions="1.0"/> 
     </runtimeType>
   </extension>
   
-  <!-- TODO remove launchConfigId for now ? -->
+  <!-- Define the Sling launchpad server type -->
   <extension point="org.eclipse.wst.server.core.serverTypes">
      <serverType
-       id="org.apache.sling.ide.eclipse.wst.slingLaunchpad"
-       name="Sling Launchpad"
-       description="Sling Launchpad"
+       id="org.apache.sling.launchpad.server"
+       name="Sling Launchpad (server name)"
+       description="Sling Launchpad (server description)"
        supportsRemoteHosts="true"
        runtime="true"
        startTimeout="30000"
        stopTimeout="15000"
        initialState="stopped"
        hasConfiguration="true"
-       
launchConfigId="org.apache.sling.ide.eclipse.wst.slingLaunchpadConfigurationType"
-       runtimeTypeId="org.apache.sling.ide.eclipse.wst.slingLaunchpad"
+       
launchConfigId="org.apache.sling.ide.eclipse.launchpad.launchConfigurationType" 
      
+       runtimeTypeId="org.apache.sling.launchpad.runtime"
        class="org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadServer"
        
behaviourClass="org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadBehaviour">
      </serverType>
   </extension>
 
-<!-- TODO move to wst.ui bundle -->  
+  <extension point="org.eclipse.wst.server.core.launchableAdapters">
+     <launchableAdapter
+        
class="org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadLaunchableAdapterDelegate"
+        id="org.sling.slingclipse.web"/>
+  </extension>
+
+       <!-- Define the launch configuration type for the launchpad TODO do we 
need a sourcePathComputer ? -->
+  <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+     <launchConfigurationType
+        id="org.apache.sling.ide.eclipse.launchpad.launchConfigurationType"
+        name="Sling Launchpad"
+        
delegate="org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadLaunchConfigurationDelegate"
+        modes="run"
+        
sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
+  </extension>
+    
+       <!-- Declare that the launchpad runtime type, supporting content 
modules -->
+       <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+               <runtime-component-type id="org.apache.sling.launchpad"/>
+               <runtime-component-version type="org.apache.sling.launchpad" 
version="1.0"/>
+               
+           <adapter>
+             <runtime-component
+                id="org.apache.sling.launchpad"/>
+             <factory
+                
class="org.eclipse.jst.server.core.internal.RuntimeClasspathProvider$Factory"/>
+             <type
+                
class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+           </adapter>          
+               
+               <supported>
+                       <runtime-component id="org.apache.sling.launchpad" 
version="1.0"/>
+                       <facet id="sling.content" version="1.0"/>
+               </supported>    
+       </extension>
+
+
+       <!-- Define default facets ( needed ? ) -->
+  <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
+    <default-facets>
+      <runtime-component id="org.apache.sling.launchpad"/>
+      <facet id="sling.content" version="1.0"/>
+    </default-facets>
+  </extension>
+       
+       <!-- Map from the launchpad runtime type to our runtime components -->
+         <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+       <runtimeFacetMapping
+      runtimeTypeId="org.apache.sling.launchpad.runtime"
+      runtime-component="org.apache.sling.launchpad"
+      version="1.0"/>
+     </extension>
+  
+  <!-- Define the launch configuration's tab group -->
+    <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+    <launchConfigurationTabGroup
+      id="org.apache.sling.ide.eclipse.launchpad.launchConfigurationTabGroup"
+      type="org.apache.sling.ide.eclipse.launchpad.launchConfigurationType"
+      
class="org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadLaunchConfigurationTabGroup">
+    </launchConfigurationTabGroup>
+  </extension>
+  
+
+       <!-- Define images -->
+       <!-- TODO move to ui bundle -->  
        <extension point="org.eclipse.wst.server.ui.serverImages">      
              <image
-                id="org.apache.sling.ide.eclipse.wst.launchpad"
                 icon="icons/obj16/sling.gif"
-                typeIds="org.apache.sling.ide.eclipse.wst.slingLaunchpad"/>
+                typeIds="org.apache.sling.launchpad.server"/>
        </extension>  
        
+       <!-- Define the editor section(s) we contribute to the WST UI -->
    <extension point="org.eclipse.wst.server.ui.editorPageSections">      
       <section
          id="org.apache.sling.ide.eclipse.configuration.editor.port"
          order="10"
          insertionId="org.eclipse.wst.server.editor.overview.right"
-         typeIds="org.apache.sling.ide.eclipse.wst.*"
+         typeIds="org.apache.sling.launchpad.server"
          
class="org.apache.sling.ide.eclipse.wst.ui.internal.ConnectionEditorSection">
       </section>
-   </extension>        
+   </extension>   
+  
+  <!-- Runtime images -->
+    <extension point="org.eclipse.wst.common.project.facet.ui.images">
+    <image runtime-component-type="org.apache.sling.launchpad"
+       path="icons/obj16/sling.gif"/>
+  </extension>
+   
+<!--
+  <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+    <launchConfigurationTypeImage
+      id="org.eclipse.wst.server.preview.launchConfigurationTypeImage"
+      configTypeID="org.eclipse.wst.server.preview.launchConfigurationType"
+      icon="icons/obj16/preview.gif">
+    </launchConfigurationTypeImage>
+  </extension>
+
+  <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+    <launchConfigurationTabGroup
+      id="org.eclipse.wst.server.preview.launchConfigurationTabGroup"
+      type="org.eclipse.wst.server.preview.launchConfigurationType"
+      
class="org.eclipse.wst.server.preview.adapter.internal.ui.PreviewLaunchConfigurationTabGroup">
+    </launchConfigurationTabGroup>
+  </extension>
+ -->
 </plugin>    

Copied: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetInstallDelegate.java
 (from r1504892, 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java)
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetInstallDelegate.java?p2=sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetInstallDelegate.java&p1=sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java&r1=1504892&r2=1504893&rev=1504893&view=diff
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
 (original)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetInstallDelegate.java
 Fri Jul 19 15:02:22 2013
@@ -16,12 +16,19 @@
  */
 package org.apache.sling.ide.eclipse.wst.internal;
 
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
 
-public class SlingLaunchpadBehaviour extends ServerBehaviourDelegate {
+public class SlingContentFacetInstallDelegate implements IDelegate {
 
     @Override
-    public void stop(boolean arg0) {
+    public void execute(IProject project, IProjectFacetVersion facetVersion, 
Object config, IProgressMonitor monitor)
+            throws CoreException {
+
+        // nothing for now
     }
 
 }

Added: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java?rev=1504893&view=auto
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java
 (added)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java
 Fri Jul 19 15:02:22 2013
@@ -0,0 +1,16 @@
+package org.apache.sling.ide.eclipse.wst.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class SlingContentFacetUninstallDelegate implements IDelegate {
+
+    @Override
+    public void execute(IProject arg0, IProjectFacetVersion arg1, Object arg2, 
IProgressMonitor arg3)
+            throws CoreException {
+    }
+
+}

Propchange: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingContentFacetUninstallDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java?rev=1504893&r1=1504892&r2=1504893&view=diff
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
 (original)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
 Fri Jul 19 15:02:22 2013
@@ -16,12 +16,66 @@
  */
 package org.apache.sling.ide.eclipse.wst.internal;
 
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
 import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
 
 public class SlingLaunchpadBehaviour extends ServerBehaviourDelegate {
 
     @Override
-    public void stop(boolean arg0) {
+    public void stop(boolean force) {
+        // TODO stub
+        setServerState(IServer.STATE_STOPPED);
     }
 
+    public void start() {
+        // TODO stub
+        setServerState(IServer.STATE_STARTED);
+    }
+
+    // TODO refine signature, visibility
+    protected void setupLaunch(ILaunch launch, String launchMode, 
IProgressMonitor monitor) throws CoreException {
+        // TODO check that ports are free
+
+        setServerRestartState(false);
+        setServerState(IServer.STATE_STARTING);
+        setMode(launchMode);
+    }
+
+    @Override
+    public IStatus canPublish() {
+        IStatus canPublish = super.canPublish();
+        System.out.println("SlingLaunchpadBehaviour.canPublish() is " + 
canPublish);
+        return canPublish;
+    }
+
+    @Override
+    public boolean canPublishModule(IModule[] module) {
+        System.out.println("SlingLaunchpadBehaviour.canPublishModule()");
+        return super.canPublishModule(module);
+    }
+
+    @Override
+    protected void publishServer(int kind, IProgressMonitor monitor) throws 
CoreException {
+        System.out.println("SlingLaunchpadBehaviour.publishServer()");
+        super.publishServer(kind, monitor);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see 
org.eclipse.wst.server.core.model.ServerBehaviourDelegate#setupLaunchConfiguration(org.eclipse.debug.core.
+     * ILaunchConfigurationWorkingCopy, 
org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy 
workingCopy, IProgressMonitor monitor)
+            throws CoreException {
+        
System.out.println("SlingLaunchpadBehaviour.setupLaunchConfiguration()");
+        super.setupLaunchConfiguration(workingCopy, monitor);
+    }
 }

Added: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java?rev=1504893&view=auto
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java
 (added)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java
 Fri Jul 19 15:02:22 2013
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.wst.internal;
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+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.LaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+
+public class SlingLaunchpadLaunchConfigurationDelegate 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)
+     */
+    @Override
+    public void launch(ILaunchConfiguration configuration, String mode, 
ILaunch launch, IProgressMonitor monitor)
+            throws CoreException {
+
+        IServer server = ServerUtil.getServer(configuration);
+        if (server == null) {
+            throw new CoreException(new Status(IStatus.ERROR, 
"org.apache.sling.slingclipse", 0, "No server found",
+                    null));
+        }
+
+        if (server.shouldPublish() && ServerCore.isAutoPublishing())
+            server.publish(IServer.PUBLISH_INCREMENTAL, monitor);
+
+        SlingLaunchpadBehaviour launchpad = (SlingLaunchpadBehaviour) 
server.loadAdapter(SlingLaunchpadBehaviour.class,
+                monitor);
+
+        IVMInstall vm = verifyVMInstall(configuration);
+
+        IVMRunner runner = vm.getVMRunner(mode);
+        if (runner == null)
+            runner = vm.getVMRunner(ILaunchManager.RUN_MODE);
+
+        // TODO use
+        File workingDir = verifyWorkingDirectory(configuration);
+        String workingDirName = null;
+        if (workingDir != null)
+            workingDirName = workingDir.getAbsolutePath();
+
+        setDefaultSourceLocator(launch, configuration);
+
+        File java = new File("/usr/bin/java"); // TODO configurable and use
+
+        launchpad.setupLaunch(launch, mode, monitor);
+        launchpad.start();
+    }
+
+}

Propchange: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java?rev=1504893&view=auto
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java
 (added)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java
 Fri Jul 19 15:02:22 2013
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.wst.internal;
+
+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.debug.ui.sourcelookup.SourceLookupTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab;
+
+public class SlingLaunchpadLaunchConfigurationTabGroup extends 
AbstractLaunchConfigurationTabGroup {
+
+    @Override
+    public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+
+        ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[6];
+        tabs[0] = new ServerLaunchConfigurationTab(new String[] { 
"org.apache.sling.launchpad.server" });
+        tabs[0].setLaunchConfigurationDialog(dialog);
+        tabs[1] = new JavaArgumentsTab();
+        tabs[1].setLaunchConfigurationDialog(dialog);
+        tabs[2] = new JavaClasspathTab();
+        tabs[2].setLaunchConfigurationDialog(dialog);
+        tabs[3] = new SourceLookupTab();
+        tabs[3].setLaunchConfigurationDialog(dialog);
+        tabs[4] = new EnvironmentTab();
+        tabs[4].setLaunchConfigurationDialog(dialog);
+        tabs[5] = new CommonTab();
+        tabs[5].setLaunchConfigurationDialog(dialog);
+        setTabs(tabs);
+    }
+
+}

Propchange: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchConfigurationTabGroup.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Copied: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchableAdapterDelegate.java
 (from r1504892, 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java)
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchableAdapterDelegate.java?p2=sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchableAdapterDelegate.java&p1=sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java&r1=1504892&r2=1504893&rev=1504893&view=diff
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
 (original)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadLaunchableAdapterDelegate.java
 Fri Jul 19 15:02:22 2013
@@ -16,12 +16,28 @@
  */
 package org.apache.sling.ide.eclipse.wst.internal;
 
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.LaunchableAdapterDelegate;
 
-public class SlingLaunchpadBehaviour extends ServerBehaviourDelegate {
+public class SlingLaunchpadLaunchableAdapterDelegate extends 
LaunchableAdapterDelegate {
 
     @Override
-    public void stop(boolean arg0) {
+    public Object getLaunchable(IServer server, IModuleArtifact 
moduleArtifact) throws CoreException {
+
+        
System.out.println("SlingLaunchpadLaunchableAdapterDelegate.getLaunchable()");
+
+        if (server == null || moduleArtifact == null) {
+            return null;
+        }
+
+        SlingLaunchpadServer launchpad = (SlingLaunchpadServer) 
server.loadAdapter(SlingLaunchpadServer.class, null);
+        if (launchpad == null) {
+            return null;
+        }
+
+        return null;
     }
 
 }

Modified: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadRuntime.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadRuntime.java?rev=1504893&r1=1504892&r2=1504893&view=diff
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadRuntime.java
 (original)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadRuntime.java
 Fri Jul 19 15:02:22 2013
@@ -16,9 +16,15 @@
  */
 package org.apache.sling.ide.eclipse.wst.internal;
 
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.wst.server.core.model.RuntimeDelegate;
 
 public class SlingLaunchpadRuntime extends RuntimeDelegate {
 
-
+    @Override
+    public IStatus validate() {
+        // TODO stub
+        return Status.OK_STATUS;
+    }
 }

Modified: 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadServer.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadServer.java?rev=1504893&r1=1504892&r2=1504893&view=diff
==============================================================================
--- 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadServer.java
 (original)
+++ 
sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadServer.java
 Fri Jul 19 15:02:22 2013
@@ -21,11 +21,14 @@ import org.eclipse.core.runtime.CoreExce
 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.jst.server.core.FacetUtil;
 import org.eclipse.wst.server.core.IModule;
 import org.eclipse.wst.server.core.model.ServerDelegate;
 
 public class SlingLaunchpadServer extends ServerDelegate {
 
+    private static final String MODULE_TYPE_SLING_CONTENT = "sling.content";
     private SlingLaunchpadConfiguration config;
 
     public SlingLaunchpadConfiguration getConfiguration() {
@@ -50,18 +53,36 @@ public class SlingLaunchpadServer extend
      * org.eclipse.wst.server.core.IModule[])
      */
     @Override
-    public IStatus canModifyModules(IModule[] arg0, IModule[] arg1) {
-        return null;
+    public IStatus canModifyModules(IModule[] toAdd, IModule[] toRemove) {
+
+        System.out.println("SlingLaunchpadServer.canModifyModules()");
+
+        if (toAdd == null) {
+            return Status.OK_STATUS;
+        }
+
+        for (IModule module : toAdd) {
+
+            if 
(!MODULE_TYPE_SLING_CONTENT.equals(module.getModuleType().getId())) {
+                return new Status(IStatus.ERROR, 
"org.apache.sling.slingclipse", 0,
+                        "Will only handle modules of type 'sling.content'", 
null);
+            }
+        }
+
+        return Status.OK_STATUS;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see 
org.eclipse.wst.server.core.model.ServerDelegate#getChildModules(org.eclipse.wst.server.core.IModule[])
-     */
     @Override
-    public IModule[] getChildModules(IModule[] arg0) {
-        return null;
+    public IModule[] getChildModules(IModule[] module) {
+
+        System.out.println("SlingLaunchpadServer.getChildModules()");
+
+        if (module == null) {
+            return null;
+        }
+
+        // no nested modules for now
+        return new IModule[0];
     }
 
     /*
@@ -71,7 +92,15 @@ public class SlingLaunchpadServer extend
      */
     @Override
     public IModule[] getRootModules(IModule arg0) throws CoreException {
-        return null;
+
+        System.out.println("SlingLaunchpadServer.getRootModules()");
+
+        if (MODULE_TYPE_SLING_CONTENT.equals(arg0.getModuleType().getId())) {
+            return new IModule[] { arg0 };
+        }
+
+        throw new CoreException(new Status(IStatus.ERROR, 
"org.apache.sling.slingclipse", 0,
+                "Will only handle modules of type 'sling.content'", null));
     }
 
     /*
@@ -81,7 +110,22 @@ public class SlingLaunchpadServer extend
      * org.eclipse.wst.server.core.IModule[], 
org.eclipse.core.runtime.IProgressMonitor)
      */
     @Override
-    public void modifyModules(IModule[] arg0, IModule[] arg1, IProgressMonitor 
arg2) throws CoreException {
+    public void modifyModules(IModule[] toAdd, IModule[] toRemove, 
IProgressMonitor arg2) throws CoreException {
+
+        System.out.println("SlingLaunchpadServer.modifyModules()");
+
+        IStatus status = canModifyModules(toAdd, toRemove);
+        if (!status.isOK()) {
+            throw new CoreException(status);
+        }
+
+        for (IModule module : toAdd) {
+            System.out.println("Adding module " + module);
+        }
+
+        for (IModule module : toRemove) {
+            System.out.println("Removing module " + module);
+        }
     }
 
 }


Reply via email to