Author: stefanegli
Date: Tue Sep 10 13:13:58 2013
New Revision: 1521472

URL: http://svn.apache.org/r1521472
Log:
SLING-3051 : 'new sling bundle' wizard added to the project. this is based on 
the org.apache.sling:sling-bundle-archetype archetype - which creates a 
standalone project without a reactor

Added:
    
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
   (with props)
Modified:
    
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
    sling/trunk/tooling/ide/eclipse-ui/plugin.xml
    sling/trunk/tooling/ide/eclipse-ui/pom.xml
    
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java
    
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java

Modified: 
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java?rev=1521472&r1=1521471&r2=1521472&view=diff
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
 (original)
+++ 
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
 Tue Sep 10 13:13:58 2013
@@ -228,7 +228,11 @@ public class SlingLaunchpadBehaviour ext
                IJavaProject javaProject = ProjectHelper.asJavaProject(project);
                IPath outputLocation = javaProject.getOutputLocation();
                        outputLocation = 
outputLocation.makeRelativeTo(project.getFullPath());
-               method.addParameter("dir", project.getRawLocation().toString() 
+ "/" + outputLocation.toString());
+               IPath location = project.getRawLocation();
+               if (location==null) {
+                       location = project.getLocation();
+               }
+                       method.addParameter("dir", location.toString() + "/" + 
outputLocation.toString());
                monitor.worked(1);
             try {
                                httpClient.executeMethod(method);

Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1521472&r1=1521471&r2=1521472&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Tue Sep 10 13:13:58 2013
@@ -253,6 +253,21 @@
       </wizard>
    </extension-->
    <extension
+         point="org.eclipse.ui.newWizards">
+      <category
+            id="org.apache.sling.ide.eclipse.ui"
+            name="Sling">
+      </category>
+      <wizard
+            category="org.apache.sling.ide.eclipse.ui"
+            
class="org.apache.sling.ide.eclipse.ui.wizards.np.NewSlingBundleWizard"
+            icon="icons/obj16/sling.gif"
+            
id="org.apache.sling.ide.eclipse.ui.wizards.np.NewSlingBundleWizard"
+            name="New Sling Bundle Project"
+            project="true">
+      </wizard>
+   </extension>
+   <extension
          point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
       <propertyContributor
             
contributorId="org.apache.sling.ide.eclipse-ui.propertyContributor1"

Modified: sling/trunk/tooling/ide/eclipse-ui/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/pom.xml?rev=1521472&r1=1521471&r2=1521472&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/pom.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/pom.xml Tue Sep 10 13:13:58 2013
@@ -40,6 +40,21 @@
                   <overWrite>false</overWrite>
                   
<outputDirectory>${project.build.directory}/sling-tooling-support-install</outputDirectory>
                 </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.sling</groupId>
+                  <artifactId>sling-bundle-archetype</artifactId>
+                  <version>1.0.1-SNAPSHOT</version>
+                  <overWrite>false</overWrite>
+                  
<outputDirectory>${project.build.directory}/archetypes</outputDirectory>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.sling</groupId>
+                  <artifactId>sling-bundle-archetype</artifactId>
+                  <version>1.0.1-SNAPSHOT</version>
+                  <type>pom</type>
+                  <overWrite>false</overWrite>
+                  
<outputDirectory>${project.build.directory}/archetypes</outputDirectory>
+                </artifactItem>
               </artifactItems>
               <overWriteReleases>false</overWriteReleases>
               <overWriteSnapshots>true</overWriteSnapshots>

Modified: 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java?rev=1521472&r1=1521471&r2=1521472&view=diff
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java
 (original)
+++ 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java
 Tue Sep 10 13:13:58 2013
@@ -227,10 +227,12 @@ public abstract class AbstractNewSlingAp
                        configureBundleProject(aBundleProject, projects, 
monitor);
                }
                
-               configureReactorProject(reactorProject, monitor);
-               monitor.worked(1);
-               if (monitor.isCanceled()) {
-                       return false;
+               if (reactorProject!=null) {
+                       configureReactorProject(reactorProject, monitor);
+                       monitor.worked(1);
+                       if (monitor.isCanceled()) {
+                               return false;
+                       }
                }
                
                finishConfiguration(projects, server, monitor);
@@ -267,14 +269,16 @@ public abstract class AbstractNewSlingAp
                        return false;
                }
                
-               ILaunchConfiguration launchConfig = 
-                               
DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(reactorProject.getFolder(".settings").getFolder(".launches").getFile("initial_install.launch"));
-               if (launchConfig!=null) {
-                       ILaunch theLaunch = 
launchConfig.launch(ILaunchManager.RUN_MODE, monitor, true);
-                       monitor.setTaskName("mvn install");
-                       while(!theLaunch.isTerminated()) {
-                               Thread.sleep(500);
-                               monitor.worked(1);
+               if (reactorProject!=null) {
+                       ILaunchConfiguration launchConfig = 
+                                       
DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(reactorProject.getFolder(".settings").getFolder(".launches").getFile("initial_install.launch"));
+                       if (launchConfig!=null) {
+                               ILaunch theLaunch = 
launchConfig.launch(ILaunchManager.RUN_MODE, monitor, true);
+                               monitor.setTaskName("mvn install");
+                               while(!theLaunch.isTerminated()) {
+                                       Thread.sleep(500);
+                                       monitor.worked(1);
+                               }
                        }
                }
                

Modified: 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java?rev=1521472&r1=1521471&r2=1521472&view=diff
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java
 (original)
+++ 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java
 Tue Sep 10 13:13:58 2013
@@ -307,7 +307,7 @@ public class ArchetypeParametersWizardPa
        }
 
        public String getArtifactId() {
-               return groupId.getText();
+               return artifactId.getText();
        }
 
        public String getVersion() {

Added: 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java?rev=1521472&view=auto
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
 (added)
+++ 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
 Tue Sep 10 13:13:58 2013
@@ -0,0 +1,66 @@
+/*
+ * 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.ui.wizards.np;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.maven.archetype.catalog.Archetype;
+import org.apache.sling.ide.eclipse.core.EmbeddedArchetypeInstaller;
+import org.apache.sling.ide.eclipse.ui.internal.Activator;
+import org.apache.sling.ide.eclipse.ui.internal.SharedImages;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+public class NewSlingBundleWizard extends AbstractNewSlingApplicationWizard {
+
+       @Override
+       public ImageDescriptor getLogo() {
+               return SharedImages.SLING_LOG;
+       }
+
+       @Override
+       public String doGetWindowTitle() {
+               return "New Sling Bundle Project";
+       }
+
+       @Override
+       public void installArchetypes() {
+               // embedding the 1.0.1-SNAPSHOT cos the 1.0.0 doesn't include 
the pom
+           EmbeddedArchetypeInstaller archetypeInstaller = new 
EmbeddedArchetypeInstaller(
+                       "org.apache.sling", "sling-bundle-archetype", 
"slingclipse-embedded");
+           try {
+               URL jarUrl = Activator.getDefault().getBundle().getResource(
+                               
"target/archetypes/sling-bundle-archetype-1.0.1-SNAPSHOT.jar");
+                       archetypeInstaller.addResource("jar", jarUrl);
+                       URL pomUrl = 
Activator.getDefault().getBundle().getResource(
+                                       
"target/archetypes/sling-bundle-archetype-1.0.1-SNAPSHOT.pom");
+                       archetypeInstaller.addResource("pom", pomUrl);
+                       
+                       archetypeInstaller.installArchetype();
+               } catch (IOException e) {
+                       // TODO proper logging
+                       e.printStackTrace();
+               }
+       }
+
+       @Override
+       public boolean acceptsArchetype(Archetype archetype) {
+               return (archetype.getGroupId().equals("org.apache.sling") &&
+                               
archetype.getArtifactId().equals("sling-bundle-archetype"));
+       }
+
+}

Propchange: 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to