You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2013/09/12 17:16:06 UTC
svn commit: r1522611 - in /sling/trunk/tooling/ide: ./
eclipse-core/src/org/apache/sling/ide/eclipse/core/ eclipse-m2e-ui/
eclipse-m2e-ui/META-INF/ eclipse-m2e-ui/icons/ eclipse-m2e-ui/icons/obj16/
eclipse-m2e-ui/src/ eclipse-m2e-ui/src/org/ eclipse-m2...
Author: stefanegli
Date: Thu Sep 12 15:16:05 2013
New Revision: 1522611
URL: http://svn.apache.org/r1522611
Log:
SLING-3056 : eclipse-m2e-ui plugin and m2e-feature added, resulting from a separation of m2eclipse dependent code from the slingclipse plugins and features. This adds a new feature to the p2update config too.
Added:
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ConfigurationHelper.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/
sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/
sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/MANIFEST.MF (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/build.properties (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/icons/
sling/trunk/tooling/ide/eclipse-m2e-ui/icons/obj16/
sling/trunk/tooling/ide/eclipse-m2e-ui/icons/obj16/sling.gif (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/pom.xml (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SharedImages.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling-logo.png (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling.gif (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java (with props)
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java (with props)
sling/trunk/tooling/ide/m2e-feature/
sling/trunk/tooling/ide/m2e-feature/build.properties (with props)
sling/trunk/tooling/ide/m2e-feature/feature.xml (with props)
sling/trunk/tooling/ide/m2e-feature/pom.xml (with props)
Removed:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConfigurationHelper.java
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
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java
Modified:
sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF
sling/trunk/tooling/ide/eclipse-ui/plugin.xml
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToContentPackageAction.java
sling/trunk/tooling/ide/p2update/category.xml
sling/trunk/tooling/ide/pom.xml
Added: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ConfigurationHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ConfigurationHelper.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ConfigurationHelper.java (added)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ConfigurationHelper.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,58 @@
+/*
+ * 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.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+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.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class ConfigurationHelper {
+
+ public static void convertToContentPackageProject(IProject aContentProject,
+ IProgressMonitor monitor, String jcr_root) throws CoreException {
+ IProjectFacet slingContentFacet = ProjectFacetsManager.getProjectFacet("sling.content");
+ IFacetedProject fp2 = ProjectFacetsManager.create(aContentProject, true, null);
+ fp2.installProjectFacet(slingContentFacet.getLatestVersion(), null, null);
+
+ ProjectUtil.setSyncDirectoryPath(aContentProject, jcr_root);
+
+ // temp hack: install the launch file
+ IFolder dotLaunches = aContentProject.getFolder(".settings").getFolder(".launches");
+ dotLaunches.create(true, true, monitor);
+ IFile launchFile = dotLaunches.getFile("clean_package_content_package_install.launch");
+ String l = MavenLaunchHelper.createMavenLaunchConfigMemento(aContentProject.getLocation().toOSString(),
+ "clean package content-package:install", null, false, null);
+ InputStream in = new ByteArrayInputStream(l.getBytes());
+ launchFile.create(in, true, monitor);
+ }
+
+ public static void convertToBundleProject(IProject aBundleProject)
+ throws CoreException {
+ IProjectFacet slingContentFacet = ProjectFacetsManager.getProjectFacet("sling.bundle");
+ IFacetedProject fp2 = ProjectFacetsManager.create(aBundleProject, true, null);
+ fp2.installProjectFacet(slingContentFacet.getLatestVersion(), null, null);
+ }
+
+}
Propchange: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ConfigurationHelper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/MANIFEST.MF?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/MANIFEST.MF (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/MANIFEST.MF Thu Sep 12 15:16:05 2013
@@ -0,0 +1,47 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Slingclipse-M2Eclipse-based-WST-plugin
+Bundle-SymbolicName: org.apache.sling.ide.eclipse-m2e-ui;singleton:=true
+Bundle-Activator: org.apache.sling.ide.eclipse.m2e.internal.Activator
+Bundle-Version: 0.0.1.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: .
+Import-Package: org.apache.commons.httpclient;version="3.1.0",
+ org.apache.commons.httpclient.auth;version="3.1.0",
+ org.apache.commons.httpclient.methods;version="3.1.0",
+ org.apache.commons.httpclient.methods.multipart;version="3.1.0",
+ org.apache.commons.httpclient.params;version="3.1.0",
+ org.apache.maven.archetype.catalog,
+ org.apache.maven.archetype.metadata,
+ org.apache.maven.artifact.repository,
+ org.apache.maven.model,
+ org.apache.sling.ide.eclipse.core,
+ 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.internal.ui,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.m2e.core,
+ org.eclipse.m2e.core.embedder,
+ org.eclipse.m2e.core.internal,
+ org.eclipse.m2e.core.internal.archetype,
+ org.eclipse.m2e.core.project,
+ org.eclipse.swt,
+ org.eclipse.swt.events,
+ org.eclipse.swt.layout,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.plugin,
+ org.eclipse.ui.progress,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.server.core,
+ org.osgi.framework;version="1.6.0"
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/*.xml
+Export-Package: org.apache.sling.ide.eclipse.ui.wizards.np
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/build.properties
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/build.properties?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/build.properties (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/build.properties Thu Sep 12 15:16:05 2013
@@ -0,0 +1,5 @@
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ target/sling-tooling-support-install/
+source.. = src/
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/build.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/icons/obj16/sling.gif
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/icons/obj16/sling.gif?rev=1522611&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/icons/obj16/sling.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml Thu Sep 12 15:16:05 2013
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <!-- Define the launch configuration's tab group -->
+
+
+ <!-- Define images -->
+
+ <!-- Define the editor section(s) we contribute to the WST UI -->
+
+ <!-- Runtime images -->
+
+ <!-- Menu contributions -->
+
+ <!-- Property page for project to select directory to sync -->
+ <!--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.NewNodeWizard"
+ id="org.apache.sling.ide.eclipse.ui.wizards.NewNodeWizard"
+ name="New node">
+ <selection
+ class="selection.Selection1">
+ </selection>
+ </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>
+
+
+
+
+</plugin>
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/pom.xml?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/pom.xml (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/pom.xml Thu Sep 12 15:16:05 2013
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sling.ide</groupId>
+ <artifactId>reactor</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.apache.sling.ide.eclipse-m2e-ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>Sling IDE Tools: Eclipse M2Eclipse-based UI</name>
+<build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.tooling.support.install</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <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>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.apache.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-dependency-plugin
+ </artifactId>
+ <versionRange>[2.8,)</versionRange>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+</build></project>
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,28 @@
+package org.apache.sling.ide.eclipse.m2e.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ public static final String PLUGIN_ID = "org.apache.sling.ide.eclipse-m2e-ui";
+ public static Activator INSTANCE;
+
+ public static Activator getDefault() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ INSTANCE = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ INSTANCE = null;
+
+ super.stop(context);
+ }
+}
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SharedImages.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SharedImages.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SharedImages.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SharedImages.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,33 @@
+/*
+ * 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.m2e.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * The <tt>SharedImages</tt> class contains references to images
+ *
+ */
+public final class SharedImages {
+
+ public static final ImageDescriptor SLING_LOG = ImageDescriptor.createFromFile(SharedImages.class, "sling-logo.png");
+ public static final ImageDescriptor SLING_ICON = ImageDescriptor.createFromFile(SharedImages.class, "sling.gif");
+
+ private SharedImages() {
+ }
+
+}
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SharedImages.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling-logo.png
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling-logo.png?rev=1522611&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling-logo.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling.gif
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling.gif?rev=1522611&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/sling.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,336 @@
+/*
+ * 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.ByteArrayInputStream;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.archetype.catalog.Archetype;
+import org.apache.maven.model.Model;
+import org.apache.sling.ide.eclipse.core.ConfigurationHelper;
+import org.apache.sling.ide.eclipse.core.MavenLaunchHelper;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+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.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.project.MavenUpdateRequest;
+import org.eclipse.m2e.core.project.ProjectImportConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
+
+public abstract class AbstractNewSlingApplicationWizard extends Wizard implements INewWizard {
+ private ChooseArchetypeWizardPage chooseArchetypePage;
+ private ArchetypeParametersWizardPage archetypeParametersPage;
+ private SetupServerWizardPage setupServerWizardPage;
+
+ // branding
+ public abstract ImageDescriptor getLogo();
+ public abstract String doGetWindowTitle();
+ public abstract void installArchetypes();
+ public abstract boolean acceptsArchetype(Archetype archetype2);
+
+ /**
+ * Constructor for AbstractNewSlingApplicationWizard.
+ */
+ public AbstractNewSlingApplicationWizard() {
+ super();
+ setWindowTitle(doGetWindowTitle());
+ setNeedsProgressMonitor(true);
+ }
+
+
+ /**
+ * Adding the page to the wizard.
+ */
+
+ public void addPages() {
+ chooseArchetypePage = new ChooseArchetypeWizardPage(this);
+ addPage(chooseArchetypePage);
+ archetypeParametersPage = new ArchetypeParametersWizardPage(this);
+ addPage(archetypeParametersPage);
+ setupServerWizardPage = new SetupServerWizardPage(this);
+ addPage(setupServerWizardPage);
+ }
+
+ public ChooseArchetypeWizardPage getChooseArchetypePage() {
+ return chooseArchetypePage;
+ }
+
+ /**
+ * This method is called when 'Finish' button is pressed in
+ * the wizard. We will create an operation and run it
+ * using wizard as execution context.
+ */
+ public boolean performFinish() {
+ try {
+ getContainer().run(false, true, new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ try {
+ performFinish(monitor);
+ } catch (Exception e) {
+ // TODO proper logging
+ e.printStackTrace();
+ MessageBox messageBox = new MessageBox(Display.getDefault().getActiveShell(),
+ SWT.OK | SWT.ICON_ERROR);
+ messageBox.setText("Creating application failed");
+ StringBuffer sb = new StringBuffer();
+ Throwable t = e;
+ while(t!=null) {
+ if (sb.length()!=0) {
+ sb.append(System.getProperty("line.separator"));
+ }
+ sb.append(t.getMessage());
+ t = t.getCause();
+ }
+ messageBox.setMessage(sb.toString());
+ messageBox.open();
+ }
+ }
+
+ });
+ return true;
+ } catch (InterruptedException e) {
+ // that's fine, the user interrupted - dont complain
+ return false;
+ } catch (InvocationTargetException e) {
+ // TODO proper logging
+ e.printStackTrace();
+ MessageBox messageBox = new MessageBox(Display.getDefault().getActiveShell(),
+ SWT.OK | SWT.ICON_ERROR);
+ messageBox.setText("Creating application failed");
+ StringBuffer sb = new StringBuffer();
+ Throwable t = e;
+ while(t!=null) {
+ if (sb.length()!=0) {
+ sb.append(System.getProperty("line.separator"));
+ }
+ sb.append(t.getMessage());
+ t = t.getCause();
+ }
+ messageBox.setMessage(sb.toString());
+ messageBox.open();
+ return false;
+ }
+ }
+
+ private boolean performFinish(IProgressMonitor monitor) throws Exception {
+
+ IPath location = chooseArchetypePage.getLocation();
+ Archetype archetype = chooseArchetypePage.getSelectedArchetype();
+ String groupId = archetypeParametersPage.getGroupId();
+ String artifactId = archetypeParametersPage.getArtifactId();
+ String version = archetypeParametersPage.getVersion();
+ String javaPackage = archetypeParametersPage.getJavaPackage();
+ Properties properties = archetypeParametersPage.getProperties();
+ ProjectImportConfiguration configuration = new ProjectImportConfiguration();
+
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ IServer server = setupServerWizardPage.getOrCreateServer();
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+
+ List<IProject> projects = MavenPlugin.getProjectConfigurationManager().createArchetypeProjects(
+ location, archetype, groupId, artifactId, version, javaPackage, properties, configuration, monitor);
+
+ monitor.worked(3);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+
+ List<IProject> contentProjects = new LinkedList<IProject>();
+ List<IProject> bundleProjects = new LinkedList<IProject>();
+ IProject reactorProject = null;
+ for (Iterator<IProject> it = projects.iterator(); it.hasNext();) {
+ IProject project = it.next();
+ IFile pomFile = project.getFile("pom.xml");
+ if (!pomFile.exists()) {
+ // then ignore this project - we only deal with maven projects
+ continue;
+ }
+ final Model model = MavenPlugin.getMavenModelManager().readMavenModel(pomFile);
+ final String packaging = model.getPackaging();
+
+ if ("content-package".equals(packaging)) {
+ contentProjects.add(project);
+ } else if ("bundle".equals(packaging)) {
+ bundleProjects.add(project);
+ } else if ("pom".equals(packaging)) {
+ if (reactorProject==null) {
+ reactorProject = project;
+ } else {
+ IPath currLocation = project.getFullPath();
+ IPath prevLocation = reactorProject.getFullPath();
+ if (currLocation.isPrefixOf(prevLocation)) {
+ // assume reactor is up in the folder structure
+ reactorProject = project;
+ }
+ }
+ }
+ }
+
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+
+ for (Iterator<IProject> it = contentProjects.iterator(); it.hasNext();) {
+ IProject aContentProject = it.next();
+ configureContentProject(aContentProject, projects, monitor);
+ }
+ for (Iterator<IProject> it = bundleProjects.iterator(); it.hasNext();) {
+ IProject aBundleProject = it.next();
+ configureBundleProject(aBundleProject, projects, monitor);
+ }
+
+ if (reactorProject!=null) {
+ configureReactorProject(reactorProject, monitor);
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ }
+
+ finishConfiguration(projects, server, monitor);
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+
+ updateProjectConfigurations(projects, true, monitor);
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ // add the bundle and content projects, ie modules, to the server
+ List<IModule> modules = new LinkedList<IModule>();
+ for (Iterator<IProject> it = bundleProjects.iterator(); it.hasNext();) {
+ IProject project = it.next();
+ IModule module = ServerUtil.getModule(project);
+ modules.add(module);
+ }
+ for (Iterator<IProject> it = contentProjects.iterator(); it.hasNext();) {
+ IProject project = it.next();
+ IModule module = ServerUtil.getModule(project);
+ modules.add(module);
+ }
+ wc.modifyModules(modules.toArray(new IModule[modules.size()]), new IModule[0], monitor);
+ IServer newServer = wc.save(true, monitor);
+ newServer.start(ILaunchManager.RUN_MODE, monitor);
+
+ monitor.worked(2);
+ if (monitor.isCanceled()) {
+ return false;
+ }
+
+ 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);
+ }
+ }
+ }
+
+ wc.getOriginal().publish(IServer.PUBLISH_FULL, monitor);
+
+ // also add 'java 1.6' and 'jst.ejb 3.1'
+// IFacetedProject fp2 = ProjectFacetsManager.create(uiProject, true, null);
+// IProjectFacet java = ProjectFacetsManager.getProjectFacet("java");
+// fp2.installProjectFacet(java.getVersion("1.6"), null, null);
+// IProjectFacet dynamicWebModule = ProjectFacetsManager.getProjectFacet("jst.web");
+// fp2.installProjectFacet(dynamicWebModule.getLatestVersion(), null, null);
+
+ monitor.worked(2);
+ updateProjectConfigurations(projects, false, monitor);
+ monitor.worked(1);
+ monitor.done();
+ return true;
+ }
+
+ protected void finishConfiguration(List<IProject> projects,
+ IServer server, IProgressMonitor monitor) throws CoreException {
+ // nothing to be done by default - hook for subclasses
+ }
+
+ protected void updateProjectConfigurations(List<IProject> projects, boolean forceDependencyUpdate, IProgressMonitor monitor) throws CoreException {
+ for (Iterator<IProject> it = projects.iterator(); it.hasNext();) {
+ IProject project = it.next();
+ MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(new MavenUpdateRequest(project, /*mavenConfiguration.isOffline()*/false, forceDependencyUpdate), monitor);
+ }
+ }
+
+ protected void configureBundleProject(IProject aBundleProject,
+ List<IProject> projects, IProgressMonitor monitor) throws CoreException {
+ ConfigurationHelper.convertToBundleProject(aBundleProject);
+ }
+
+ protected void configureContentProject(IProject aContentProject,
+ List<IProject> projects, IProgressMonitor monitor) throws CoreException {
+ ConfigurationHelper.convertToContentPackageProject(aContentProject, monitor, "src/main/content/jcr_root");
+ }
+
+ protected void configureReactorProject(IProject reactorProject, IProgressMonitor monitor) throws CoreException {
+ // temp hack: install the launch file
+ IFolder dotLaunches = reactorProject.getFolder(".settings").getFolder(".launches");
+ dotLaunches.create(true, true, monitor);
+ IFile launchFile = dotLaunches.getFile("initial_install.launch");
+ String l = MavenLaunchHelper.createMavenLaunchConfigMemento(reactorProject.getLocation().toOSString(),
+ "install", null, false, null);
+ InputStream in = new ByteArrayInputStream(l.getBytes());
+ launchFile.create(in, true, monitor);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+}
\ No newline at end of file
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,331 @@
+/*
+ * 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.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.archetype.catalog.Archetype;
+import org.apache.maven.archetype.metadata.RequiredProperty;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CellNavigationStrategy;
+import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerFocusCellManager;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.archetype.ArchetypeManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+@SuppressWarnings("restriction")
+public class ArchetypeParametersWizardPage extends WizardPage {
+
+ private static final String KEY_PROPERTY = "key";
+
+ private static final String VALUE_PROPERTY = "value";
+
+ private Text groupId;
+
+ private Text artifactId;
+
+ private Text javaPackage;
+
+ private boolean javaPackageModified;
+
+ private final AbstractNewSlingApplicationWizard parent;
+
+ private TableViewer propertiesViewer;
+
+ private Table propertiesTable;
+
+ private List<RequiredProperty> properties;
+
+ private Text version;
+
+ public ArchetypeParametersWizardPage(AbstractNewSlingApplicationWizard parent) {
+ super("archetypeParametersPage");
+ this.parent = parent;
+ setTitle("Configure Archetype Properties");
+ setDescription("This step configured the archetype properties");
+ setImageDescriptor(parent.getLogo());
+ }
+
+ /**
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 2;
+ layout.verticalSpacing = 9;
+
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&Group Id:");
+ groupId = new Text(container, SWT.BORDER | SWT.SINGLE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ groupId.setLayoutData(gd);
+ groupId.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ if (!javaPackageModified) {
+ if (artifactId.getText().length()==0) {
+ javaPackage.setText(groupId.getText());
+ } else {
+ javaPackage.setText(groupId.getText()+"."+artifactId.getText());
+ }
+ }
+ }
+ });
+
+ label = new Label(container, SWT.NULL);
+ label.setText("&Artifact Id:");
+
+ artifactId = new Text(container, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ artifactId.setLayoutData(gd);
+ artifactId.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ if (groupId.getText().length()==0) {
+ javaPackage.setText(artifactId.getText());
+ } else {
+ javaPackage.setText(groupId.getText()+"."+artifactId.getText());
+ }
+ }
+ });
+
+ label = new Label(container, SWT.NULL);
+ label.setText("&Version:");
+
+ version = new Text(container, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ version.setLayoutData(gd);
+ version.setText("0.0.1-SNAPSHOT");
+ version.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ label = new Label(container, SWT.NULL);
+ label.setText("&Package:");
+
+ javaPackage = new Text(container, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ javaPackage.setLayoutData(gd);
+ javaPackageModified = false;
+ javaPackage.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ javaPackageModified = true;
+ }
+ });
+ javaPackage.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ label = new Label(container, SWT.NULL);
+ gd = new GridData(SWT.LEFT, SWT.TOP, false, false);
+ label.setLayoutData(gd);
+ label.setText("&Parameters:");
+
+
+ propertiesViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);
+ propertiesTable = propertiesViewer.getTable();
+ propertiesTable.setLinesVisible(true);
+ propertiesTable.setHeaderVisible(true);
+ propertiesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
+
+ CellNavigationStrategy strategy = new CellNavigationStrategy();
+ TableViewerFocusCellManager focusCellMgr = new TableViewerFocusCellManager(propertiesViewer,
+ new FocusCellOwnerDrawHighlighter(propertiesViewer),
+ strategy);
+
+ TableColumn propertiesTableNameColumn = new TableColumn(propertiesTable, SWT.NONE);
+ propertiesTableNameColumn.setWidth(130);
+ propertiesTableNameColumn.setText("Name");
+
+ TableColumn propertiesTableValueColumn = new TableColumn(propertiesTable, SWT.NONE);
+ propertiesTableValueColumn.setWidth(230);
+ propertiesTableValueColumn.setText("Value");
+
+ propertiesViewer.setColumnProperties(new String[] {KEY_PROPERTY, VALUE_PROPERTY});
+
+ propertiesViewer.setCellEditors(new CellEditor[] {new TextCellEditor(propertiesTable, SWT.NONE),
+ new TextCellEditor(propertiesTable, SWT.NONE)});
+ propertiesViewer.setCellModifier(new ICellModifier() {
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ public void modify(Object element, String property, Object value) {
+ if(element instanceof TableItem) {
+ ((TableItem) element).setText(getTextIndex(property), String.valueOf(value));
+ dialogChanged();
+ }
+ }
+
+ public Object getValue(Object element, String property) {
+ if(element instanceof TableItem) {
+ return ((TableItem) element).getText(getTextIndex(property));
+ }
+ return null;
+ }
+ });
+
+ initialize();
+ setPageComplete(false);
+ setControl(container);
+ }
+
+ protected int getTextIndex(String property) {
+ if (KEY_PROPERTY.equals(property)) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ initialize();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void initialize() {
+ if (propertiesTable==null) {
+ return;
+ }
+
+ Archetype archetype = parent.getChooseArchetypePage().getSelectedArchetype();
+ if (archetype==null) {
+ return;
+ }
+
+ try {
+ ArchetypeManager archetypeManager = MavenPluginActivator.getDefault().getArchetypeManager();
+ ArtifactRepository remoteArchetypeRepository = archetypeManager.getArchetypeRepository(archetype);
+ properties = (List<RequiredProperty>) archetypeManager.getRequiredProperties(archetype, remoteArchetypeRepository, null);
+
+ Table table = propertiesViewer.getTable();
+ table.setItemCount(properties.size());
+ int i = 0;
+ for (Iterator<RequiredProperty> it = properties.iterator(); it.hasNext();) {
+ RequiredProperty rp = it.next();
+ TableItem item = table.getItem(i++);
+ if (!rp.getKey().equals(item.getText())) {
+ // then create it - otherwise, reuse it
+ item.setText(0, rp.getKey());
+ item.setText(1, "");
+ item.setData(item);
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Could not process archetype: "+e.getMessage(), e);
+ }
+
+ }
+
+
+ /**
+ * Ensures that both text fields are set.
+ */
+
+ private void dialogChanged() {
+ if (groupId.getText().length()==0) {
+ updateStatus("group Id must be specified");
+ return;
+ }
+ if (artifactId.getText().length()==0) {
+ updateStatus("artifact Id must be specified");
+ return;
+ }
+ if (version.getText().length()==0) {
+ updateStatus("version must be specified");
+ return;
+ }
+ if (javaPackage.getText().length()==0) {
+ updateStatus("package must be specified");
+ return;
+ }
+ int cnt = propertiesTable.getItemCount();
+ for(int i=0; i<cnt; i++) {
+ TableItem item = propertiesTable.getItem(i);
+ if (item.getText(1).length()==0) {
+ updateStatus(item.getText(0)+" must be specified");
+ return;
+ }
+ }
+
+ updateStatus(null);
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ public String getGroupId() {
+ return groupId.getText();
+ }
+
+ public String getArtifactId() {
+ return artifactId.getText();
+ }
+
+ public String getVersion() {
+ return version.getText();
+ }
+
+ public String getJavaPackage() {
+ return javaPackage.getText();
+ }
+
+ public Properties getProperties() {
+ int cnt = propertiesTable.getItemCount();
+ Properties p = new Properties();
+ for(int i=0; i<cnt; i++) {
+ TableItem item = propertiesTable.getItem(i);
+ p.put(item.getText(0), item.getText(1));
+ }
+ return p;
+ }
+
+}
\ No newline at end of file
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ArchetypeParametersWizardPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,278 @@
+/*
+ * 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.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.archetype.catalog.Archetype;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory;
+import org.eclipse.m2e.core.internal.archetype.ArchetypeManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.progress.IProgressService;
+
+@SuppressWarnings("restriction")
+public class ChooseArchetypeWizardPage extends WizardPage {
+
+ private static final String LOADING_PLEASE_WAIT = "loading, please wait...";
+ private List knownArchetypesList;
+ private Map<String, Archetype> archetypesMap = new HashMap<String, Archetype>();
+ private Button useDefaultWorkspaceLocationButton;
+ private Label locationLabel;
+ private Combo locationCombo;
+ private final AbstractNewSlingApplicationWizard parent;
+
+ public ChooseArchetypeWizardPage(AbstractNewSlingApplicationWizard parent) {
+ super("chooseArchetypePage");
+ this.parent = parent;
+ setTitle("Choose Project Location and Archetype");
+ setDescription("This step defines the project location and archetype");
+ setImageDescriptor(parent.getLogo());
+ }
+
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+
+ useDefaultWorkspaceLocationButton = new Button(container, SWT.CHECK);
+ GridData useDefaultWorkspaceLocationButtonData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
+ useDefaultWorkspaceLocationButton.setLayoutData(useDefaultWorkspaceLocationButtonData);
+ useDefaultWorkspaceLocationButton
+ .setText("Use default Workspace location");
+ useDefaultWorkspaceLocationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ boolean inWorkspace = useDefaultWorkspaceLocationButton.getSelection();
+ locationLabel.setEnabled(!inWorkspace);
+ locationCombo.setEnabled(!inWorkspace);
+ dialogChanged();
+ }
+ });
+ useDefaultWorkspaceLocationButton.setSelection(true);
+
+ locationLabel = new Label(container, SWT.NONE);
+ GridData locationLabelData = new GridData();
+ locationLabelData.horizontalIndent = 10;
+ locationLabel.setLayoutData(locationLabelData);
+ locationLabel.setText("Location:");
+ locationLabel.setEnabled(false);
+
+ locationCombo = new Combo(container, SWT.NONE);
+ GridData locationComboData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ locationCombo.setLayoutData(locationComboData);
+ locationCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+ locationCombo.setEnabled(false);
+
+ Button locationBrowseButton = new Button(container, SWT.NONE);
+ GridData locationBrowseButtonData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ locationBrowseButton.setLayoutData(locationBrowseButtonData);
+ locationBrowseButton.setText("Browse...");
+ locationBrowseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setText("Select Location");
+
+ String path = locationCombo.getText();
+ if(path.length() == 0) {
+ path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toPortableString();
+ }
+ dialog.setFilterPath(path);
+
+ String selectedDir = dialog.open();
+ if(selectedDir != null) {
+ locationCombo.setText(selectedDir);
+ useDefaultWorkspaceLocationButton.setSelection(false);
+ dialogChanged();
+ }
+ }
+ });
+
+
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&Archetype:");
+
+ knownArchetypesList = new List(container, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ knownArchetypesList.setLayoutData(gd);
+ knownArchetypesList.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ dialogChanged();
+ }
+ });
+ knownArchetypesList.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ getContainer().showPage(getNextPage());
+ }
+ });
+
+ initialize();
+ setPageComplete(false);
+ setControl(container);
+ }
+
+ public Archetype getSelectedArchetype() {
+ String[] sel = knownArchetypesList.getSelection();
+ if (sel==null || sel.length!=1) {
+ return null;
+ }
+ String s = sel[0];
+ Archetype a = archetypesMap.get(s);
+ return a;
+ }
+
+ private void initialize() {
+ knownArchetypesList.add(LOADING_PLEASE_WAIT);
+ IWorkbench workbench = DebugUIPlugin.getDefault().getWorkbench();
+ IProgressService progressService = workbench.getProgressService();
+ try {
+ progressService.run(true, false, new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask("discovering archetypes...", 5);
+ ArchetypeManager manager = MavenPluginActivator.getDefault().getArchetypeManager();
+ monitor.worked(1);
+
+ // optionally allow the parent to install any archetypes
+ parent.installArchetypes();
+
+ Collection<ArchetypeCatalogFactory> archetypeCatalogs = manager.getArchetypeCatalogs();
+ monitor.worked(2);
+ ArrayList<Archetype> list = new ArrayList<Archetype>();
+ for(ArchetypeCatalogFactory catalog : archetypeCatalogs) {
+ try {
+ @SuppressWarnings("unchecked")
+ java.util.List<Archetype> arcs = catalog.getArchetypeCatalog().getArchetypes();
+ if(arcs != null) {
+ list.addAll(arcs);
+ }
+ } catch(Exception ce) {
+ ce.printStackTrace();
+ }
+ }
+ monitor.worked(1);
+ for (Iterator<Archetype> it = list
+ .iterator(); it.hasNext();) {
+ Archetype archetype2 = it.next();
+ if (parent.acceptsArchetype(archetype2)) {
+ String key = keyFor(archetype2);
+ archetypesMap.put(key, archetype2);
+ }
+
+ }
+ monitor.worked(1);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Set<String> keys = archetypesMap.keySet();
+ knownArchetypesList.removeAll();
+ for (Iterator<String> it = keys.iterator(); it
+ .hasNext();) {
+ String aKey = it.next();
+ knownArchetypesList.add(aKey);
+ }
+ knownArchetypesList.pack();
+ }
+ });
+ monitor.done();
+
+ }
+ });
+ } catch (InvocationTargetException e) {
+ // TODO proper logging
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO proper logging
+ e.printStackTrace();
+ }
+ }
+
+ private String keyFor(Archetype archetype2) {
+ return archetype2.getGroupId() + " : "+archetype2.getArtifactId() + " : "+archetype2.getVersion();
+ }
+
+ private void dialogChanged() {
+ if (knownArchetypesList.getItemCount()==1 &&
+ knownArchetypesList.getItem(0).equals(LOADING_PLEASE_WAIT)) {
+ setErrorMessage(null);
+ setPageComplete(false);
+ return;
+ }
+ if (knownArchetypesList.getSelectionCount()!=1) {
+ updateStatus("archetype must be selected");
+ return;
+ }
+ if (!useDefaultWorkspaceLocationButton.getSelection() &&
+ locationCombo.getText().length()==0) {
+ updateStatus("location must be specified");
+ return;
+ }
+ updateStatus(null);
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ public IPath getLocation() {
+ if (!useDefaultWorkspaceLocationButton.getSelection() &&
+ locationCombo.getText().length()>0) {
+ return new Path(locationCombo.getText());
+ } else {
+ return null;
+ }
+ }
+
+}
\ No newline at end of file
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java Thu Sep 12 15:16:05 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.m2e.internal.Activator;
+import org.apache.sling.ide.eclipse.m2e.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-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/NewSlingBundleWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java Thu Sep 12 15:16:05 2013
@@ -0,0 +1,441 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.multipart.ByteArrayPartSource;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.PartSource;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.sling.ide.eclipse.core.ISlingLaunchpadServer;
+import org.apache.sling.ide.eclipse.m2e.internal.Activator;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+
+public class SetupServerWizardPage extends WizardPage {
+
+ private Button useExistingServer;
+ private Combo existingServerCombo;
+ private Button setupNewServer;
+ private Text newServerName;
+ private Text newServerHostnameName;
+ private Text newServerPort;
+ private Text newServerDebugPort;
+ private Button installToolingSupportBundle;
+
+ private Map<String, IServer> serversMap = new HashMap<String, IServer>();
+
+ public SetupServerWizardPage(AbstractNewSlingApplicationWizard parent) {
+ super("chooseArchetypePage");
+ setTitle("Select or Setup Launchpad Server");
+ setDescription("This step defines which server to use with the new Sling application.");
+ setImageDescriptor(parent.getLogo());
+ }
+
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+
+ useExistingServer = new Button(container, SWT.RADIO);
+ GridData useExistingServerButtonData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
+ useExistingServer.setLayoutData(useExistingServerButtonData);
+ useExistingServer.setText("Add to existing server");
+
+ Label existingServerLabel = new Label(container, SWT.NONE);
+ GridData locationLabelData = new GridData();
+ locationLabelData.horizontalIndent = 10;
+ existingServerLabel.setLayoutData(locationLabelData);
+ existingServerLabel.setText("Location:");
+ existingServerLabel.setEnabled(true);
+
+ existingServerCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
+ GridData locationComboData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ existingServerCombo.setLayoutData(locationComboData);
+ existingServerCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+ existingServerCombo.setEnabled(true);
+
+ {
+ setupNewServer = new Button(container, SWT.RADIO);
+ GridData setupNewServerButtonData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
+ setupNewServer.setLayoutData(setupNewServerButtonData);
+ setupNewServer.setText("Setup new server");
+ }
+
+ {
+ Label newServerLabel;
+ newServerLabel = new Label(container, SWT.NONE);
+ GridData newServerLabelData = new GridData();
+ newServerLabelData.horizontalIndent = 10;
+ newServerLabel.setLayoutData(newServerLabelData);
+ newServerLabel.setText("Server name:");
+ newServerLabel.setEnabled(true);
+ }
+
+ {
+ newServerName = new Text(container, SWT.BORDER);
+ GridData newServerNameData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ newServerName.setLayoutData(newServerNameData);
+ }
+
+ {
+ Label newServerHostnameLabel;
+ newServerHostnameLabel = new Label(container, SWT.NONE);
+ GridData newServerHostnameLabelData = new GridData();
+ newServerHostnameLabelData.horizontalIndent = 10;
+ newServerHostnameLabel.setLayoutData(newServerHostnameLabelData);
+ newServerHostnameLabel.setText("Host name:");
+ newServerHostnameLabel.setEnabled(true);
+ }
+
+ {
+ newServerHostnameName = new Text(container, SWT.BORDER);
+ GridData newServerHostnameNameData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ newServerHostnameName.setLayoutData(newServerHostnameNameData);
+ }
+
+ {
+ Label newServerPortLabel;
+ newServerPortLabel = new Label(container, SWT.NONE);
+ GridData newServerPortLabelData = new GridData();
+ newServerPortLabelData.horizontalIndent = 10;
+ newServerPortLabel.setLayoutData(newServerPortLabelData);
+ newServerPortLabel.setText("Port:");
+ newServerPortLabel.setEnabled(true);
+ }
+
+ {
+ newServerPort = new Text(container, SWT.BORDER);
+ GridData newServerPortData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ newServerPort.setLayoutData(newServerPortData);
+ }
+
+ {
+ Label newServerDebugPortLabel;
+ newServerDebugPortLabel = new Label(container, SWT.NONE);
+ GridData newServerDebugPortLabelData = new GridData();
+ newServerDebugPortLabelData.horizontalIndent = 10;
+ newServerDebugPortLabel.setLayoutData(newServerDebugPortLabelData);
+ newServerDebugPortLabel.setText("Debug Port:");
+ newServerDebugPortLabel.setEnabled(true);
+ }
+
+ {
+ newServerDebugPort = new Text(container, SWT.BORDER);
+ GridData newServerDebugPortData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ newServerDebugPort.setLayoutData(newServerDebugPortData);
+ }
+
+ {
+ installToolingSupportBundle = new Button(container, SWT.CHECK);
+ GridData installToolingSupportBundleData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ installToolingSupportBundleData.horizontalIndent = 10;
+ installToolingSupportBundle.setLayoutData(installToolingSupportBundleData);
+ installToolingSupportBundle.setText("Check/Install org.apache.sling.tooling.support.install bundle");
+ installToolingSupportBundle.setSelection(true);
+ }
+
+
+ SelectionAdapter radioListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ existingServerCombo.setEnabled(useExistingServer.getSelection());
+ newServerName.setEnabled(setupNewServer.getSelection());
+ newServerHostnameName.setEnabled(setupNewServer.getSelection());
+ newServerPort.setEnabled(setupNewServer.getSelection());
+ newServerDebugPort.setEnabled(setupNewServer.getSelection());
+ installToolingSupportBundle.setEnabled(setupNewServer.getSelection());
+ dialogChanged();
+ }
+ };
+ useExistingServer.addSelectionListener(radioListener);
+ setupNewServer.addSelectionListener(radioListener);
+ useExistingServer.setSelection(false);
+ setupNewServer.setSelection(true);
+ installToolingSupportBundle.setSelection(true);
+
+ ModifyListener ml = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ };
+ KeyListener kl = new KeyListener() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ dialogChanged();
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ dialogChanged();
+ }
+ };
+ newServerName.addModifyListener(ml);
+ newServerName.addKeyListener(kl);
+ newServerHostnameName.addModifyListener(ml);
+ newServerHostnameName.addKeyListener(kl);
+ newServerPort.addModifyListener(ml);
+ newServerPort.addKeyListener(kl);
+ newServerDebugPort.addModifyListener(ml);
+ newServerDebugPort.addKeyListener(kl);
+
+ initialize();
+ setPageComplete(false);
+ setControl(container);
+ }
+
+ private void initialize() {
+ IServer[] servers = ServerCore.getServers();
+ for (int i = 0; i < servers.length; i++) {
+ IServer server = servers[i];
+ String key = keyFor(server);
+ serversMap.put(key, server);
+ existingServerCombo.add(key);
+ }
+ }
+
+ private String keyFor(IServer server) {
+ return server.getName();
+ }
+
+ private void dialogChanged() {
+ if (useExistingServer.getSelection()) {
+ if (existingServerCombo.getSelectionIndex()==-1) {
+ updateStatus("Choose existing server from the list");
+ return;
+ }
+ } else if (setupNewServer.getSelection()) {
+ if (newServerName.getText().length()==0 ||
+ getHostname().length()==0 ||
+ newServerPort.getText().length()==0 ||
+ newServerDebugPort.getText().length()==0) {
+ updateStatus("Enter values for new server");
+ return;
+ }
+ }
+ updateStatus(null);
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+
+ private boolean containsToolingSupportBundle() {
+ String hostname = getHostname();
+ int launchpadPort = getPort();
+ GetMethod method = new GetMethod("http://"+hostname+":"+launchpadPort+"/system/console/bundles/org.apache.sling.tooling.support.install");
+
+ try {
+ return getHttpClient("admin", "admin").executeMethod(method) == 200;
+ } catch (IOException e) {
+ // TODO proper logging
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * Get the http client
+ * @param user
+ * @param password
+ */
+ protected HttpClient getHttpClient(String user, String password) {
+ final HttpClient client = new HttpClient();
+ client.getHttpConnectionManager().getParams().setConnectionTimeout(
+ 5000);
+
+ // authentication stuff
+ client.getParams().setAuthenticationPreemptive(true);
+ Credentials defaultcreds = new UsernamePasswordCredentials(user,
+ password);
+ client.getState().setCredentials(AuthScope.ANY, defaultcreds);
+
+ return client;
+ }
+
+ protected int post(String targetURL, String user, String passwd, InputStream in, String fileName) throws IOException {
+ // append pseudo path after root URL to not get redirected for nothing
+ final PostMethod filePost = new PostMethod(targetURL + "/install");
+
+ try {
+ // set referrer
+ filePost.setRequestHeader("referer", "about:blank");
+
+ List<Part> partList = new ArrayList<Part>();
+ partList.add(new StringPart("action", "install"));
+ partList.add(new StringPart("_noredir_", "_noredir_"));
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ copyStream(in, baos);
+ PartSource partSource = new ByteArrayPartSource(fileName, baos.toByteArray());
+ partList.add(new FilePart("bundlefile", partSource));
+ partList.add(new StringPart("bundlestart", "start"));
+
+ Part[] parts = partList.toArray(new Part[partList.size()]);
+
+ filePost.setRequestEntity(new MultipartRequestEntity(parts,
+ filePost.getParams()));
+
+ int status = getHttpClient(user, passwd).executeMethod(filePost);
+ return status;
+ } finally {
+ filePost.releaseConnection();
+ }
+ }
+
+ private void copyStream(InputStream in, OutputStream os) throws IOException {
+ final byte[] bytes = new byte[4*1024];
+ while (true) {
+ final int numRead = in.read(bytes);
+ if (numRead < 0) {
+ break;
+ }
+ os.write(bytes, 0, numRead);
+ }
+ }
+
+ private int installToolingSupportBundle() throws IOException {
+ String hostname = getHostname();
+ int launchpadPort = getPort();
+ String targetURL = "http://"+hostname+":"+launchpadPort+"/system/console";
+ String fileName = "org.apache.sling.tooling.support.install-0.0.1-SNAPSHOT.jar";
+ URL jarUrl = Activator.getDefault().getBundle().getResource(
+ "target/sling-tooling-support-install/"+fileName);
+ return post(targetURL, "admin", "admin", jarUrl.openStream(), fileName);
+ }
+
+ IServer getOrCreateServer() {
+ if (useExistingServer.getSelection()) {
+ String key = existingServerCombo.getItem(existingServerCombo.getSelectionIndex());
+ return serversMap.get(key);
+ } else {
+ IServerType serverType = ServerCore.findServerType("org.apache.sling.ide.launchpadServer");
+ @SuppressWarnings("unused")
+ IRuntime existingRuntime = null;//ServerCore.findRuntime("org.apache.sling.ide.launchpadRuntimeType");
+ IRuntime[] existingRuntimes = ServerCore.getRuntimes();
+ for (int i = 0; i < existingRuntimes.length; i++) {
+ IRuntime aRuntime = existingRuntimes[i];
+ if (aRuntime.getRuntimeType().getId().equals("org.apache.sling.ide.launchpadRuntimeType")) {
+ existingRuntime = aRuntime;
+ }
+ }
+
+ boolean installedLocally = false;
+ if (installToolingSupportBundle.getSelection()) {
+ if (containsToolingSupportBundle()) {
+ // then nothing to overwrite
+ installedLocally = true;
+ } else {
+ // then auto-install it if possible
+ try {
+ int status = installToolingSupportBundle();
+
+ if (status!=HttpStatus.SC_OK) {
+ MessageDialog.openError(getShell(), "Could not install sling tooling support bundle",
+ "Could not install sling tooling support bundle: "+status);
+ } else {
+ installedLocally = true;
+ }
+ } catch (IOException e) {
+ //TODO proper logging
+ e.printStackTrace();
+ MessageDialog.openError(getShell(), "Could not install sling tooling support bundle",
+ "Could not install sling tooling support bundle: "+e.getMessage());
+ }
+ }
+ }
+
+ IRuntimeType serverRuntime = ServerCore.findRuntimeType("org.apache.sling.ide.launchpadRuntimeType");
+ try {
+ IRuntime runtime = serverRuntime.createRuntime(null, new NullProgressMonitor());
+ runtime = runtime.createWorkingCopy().save(true, new NullProgressMonitor());
+ IServerWorkingCopy wc = serverType.createServer(null, null, runtime, new NullProgressMonitor());
+ wc.setHost(getHostname());
+ wc.setName(newServerName.getText() + " (external)");
+ wc.setAttribute(ISlingLaunchpadServer.PROP_PORT, getPort());
+ wc.setAttribute(ISlingLaunchpadServer.PROP_DEBUG_PORT, Integer.parseInt(newServerDebugPort.getText()));
+ wc.setAttribute(ISlingLaunchpadServer.PROP_INSTALL_LOCALLY, installedLocally);
+ wc.setAttribute("auto-publish-setting", 2); // 2: automatically publish when resources change
+ wc.setAttribute("auto-publish-time", 0); // 0: zero delay after a resource change (and the builder was kicked, I guess)
+ wc.setRuntime(runtime);
+ return wc.save(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ // TODO proper logging
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+
+ private int getPort() {
+ return Integer.parseInt(newServerPort.getText());
+ }
+
+ private String getHostname() {
+ return newServerHostnameName.getText();
+ }
+
+}
\ No newline at end of file
Propchange: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/SetupServerWizardPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF?rev=1522611&r1=1522610&r2=1522611&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF Thu Sep 12 15:16:05 2013
@@ -84,5 +84,4 @@ Require-Bundle: org.eclipse.wst.common.p
org.eclipse.ui.views.properties.tabbed
Service-Component: OSGI-INF/*.xml
Export-Package: org.apache.sling.ide.eclipse.ui,
- org.apache.sling.ide.eclipse.ui.wizards,
- org.apache.sling.ide.eclipse.ui.wizards.np
+ org.apache.sling.ide.eclipse.ui.wizards
Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1522611&r1=1522610&r2=1522611&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Thu Sep 12 15:16:05 2013
@@ -253,21 +253,6 @@
</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/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java?rev=1522611&r1=1522610&r2=1522611&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java Thu Sep 12 15:16:05 2013
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import org.apache.sling.ide.eclipse.core.ConfigurationHelper;
import org.apache.sling.ide.eclipse.core.internal.ProjectHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToContentPackageAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToContentPackageAction.java?rev=1522611&r1=1522610&r2=1522611&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToContentPackageAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToContentPackageAction.java Thu Sep 12 15:16:05 2013
@@ -19,6 +19,7 @@ package org.apache.sling.ide.eclipse.ui.
import java.lang.reflect.InvocationTargetException;
import org.apache.maven.model.Model;
+import org.apache.sling.ide.eclipse.core.ConfigurationHelper;
import org.apache.sling.ide.eclipse.core.internal.ProjectHelper;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
Added: sling/trunk/tooling/ide/m2e-feature/build.properties
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/m2e-feature/build.properties?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/m2e-feature/build.properties (added)
+++ sling/trunk/tooling/ide/m2e-feature/build.properties Thu Sep 12 15:16:05 2013
@@ -0,0 +1 @@
+bin.includes=feature.xml
\ No newline at end of file
Propchange: sling/trunk/tooling/ide/m2e-feature/build.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/m2e-feature/feature.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/m2e-feature/feature.xml?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/m2e-feature/feature.xml (added)
+++ sling/trunk/tooling/ide/m2e-feature/feature.xml Thu Sep 12 15:16:05 2013
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.apache.sling.ide.m2e-feature"
+ label="Sling IDE Tools, M2e-based"
+ version="0.0.1.qualifier"
+ provider-name="The Apache Foundation">
+
+ <plugin
+ id="org.apache.sling.ide.eclipse-m2e-ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Propchange: sling/trunk/tooling/ide/m2e-feature/feature.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: sling/trunk/tooling/ide/m2e-feature/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/m2e-feature/pom.xml?rev=1522611&view=auto
==============================================================================
--- sling/trunk/tooling/ide/m2e-feature/pom.xml (added)
+++ sling/trunk/tooling/ide/m2e-feature/pom.xml Thu Sep 12 15:16:05 2013
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sling.ide</groupId>
+ <artifactId>reactor</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.apache.sling.ide.m2e-feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <name>Sling IDE Tools: M2Eclipse-based Feature</name>
+</project>
Propchange: sling/trunk/tooling/ide/m2e-feature/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: sling/trunk/tooling/ide/p2update/category.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/p2update/category.xml?rev=1522611&r1=1522610&r2=1522611&view=diff
==============================================================================
--- sling/trunk/tooling/ide/p2update/category.xml (original)
+++ sling/trunk/tooling/ide/p2update/category.xml Thu Sep 12 15:16:05 2013
@@ -3,5 +3,8 @@
<feature url="features/org.apache.sling.ide.feature_0.0.1.qualifier.jar" id="org.apache.sling.ide.feature" version="0.0.1.qualifier">
<category name="sling"/>
</feature>
+ <feature url="features/org.apache.sling.ide.m2e-feature_0.0.1.qualifier.jar" id="org.apache.sling.ide.m2e-feature" version="0.0.1.qualifier">
+ <category name="sling"/>
+ </feature>
<category-def name="sling" label="Sling"/>
</site>
Modified: sling/trunk/tooling/ide/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/pom.xml?rev=1522611&r1=1522610&r2=1522611&view=diff
==============================================================================
--- sling/trunk/tooling/ide/pom.xml (original)
+++ sling/trunk/tooling/ide/pom.xml Thu Sep 12 15:16:05 2013
@@ -16,6 +16,8 @@
<module>eclipse-core</module>
<module>eclipse-ui</module>
<module>feature</module>
+ <module>eclipse-m2e-ui</module>
+ <module>m2e-feature</module>
<module>p2update</module>
</modules>