Author: snjeza
Date: 2009-06-15 19:52:42 -0400 (Mon, 15 Jun 2009)
New Revision: 15976
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/.classpath
trunk/maven/plugins/org.jboss.tools.maven.core/.project
trunk/maven/plugins/org.jboss.tools.maven.core/.settings/
trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.core/bin/
trunk/maven/plugins/org.jboss.tools.maven.core/build.properties
trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.core/src/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/IJBossMavenConstants.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
trunk/maven/plugins/org.jboss.tools.maven.seam/.classpath
trunk/maven/plugins/org.jboss.tools.maven.seam/.project
trunk/maven/plugins/org.jboss.tools.maven.seam/.settings/
trunk/maven/plugins/org.jboss.tools.maven.seam/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.seam/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.seam/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.seam/about.html
trunk/maven/plugins/org.jboss.tools.maven.seam/about.ini
trunk/maven/plugins/org.jboss.tools.maven.seam/about.mappings
trunk/maven/plugins/org.jboss.tools.maven.seam/about.properties
trunk/maven/plugins/org.jboss.tools.maven.seam/bin/
trunk/maven/plugins/org.jboss.tools.maven.seam/build.properties
trunk/maven/plugins/org.jboss.tools.maven.seam/jboss_about.png
trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.seam/poms/
trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
trunk/maven/plugins/org.jboss.tools.maven.seam/src/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/ParentAdder.java
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
trunk/maven/plugins/org.jboss.tools.maven.ui/.classpath
trunk/maven/plugins/org.jboss.tools.maven.ui/.project
trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/
trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.ui/about.html
trunk/maven/plugins/org.jboss.tools.maven.ui/about.ini
trunk/maven/plugins/org.jboss.tools.maven.ui/about.mappings
trunk/maven/plugins/org.jboss.tools.maven.ui/about.properties
trunk/maven/plugins/org.jboss.tools.maven.ui/bin/
trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties
trunk/maven/plugins/org.jboss.tools.maven.ui/jboss_about.png
trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.ui/src/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Activator.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3874 Maven integration
Added: trunk/maven/plugins/org.jboss.tools.maven.core/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/.classpath (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/.classpath 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.core/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/.project (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/.project 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.jdt.core.prefs 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,8 @@
+#Thu May 28 21:41:43 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Maven Core
+Bundle-SymbolicName: org.jboss.tools.maven.core; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.maven.core.MavenCoreActivator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.wst.common.project.facet.core;visibility:=reexport,
+ org.eclipse.jst.common.project.facet.core;visibility:=reexport,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.wst.common.frameworks;visibility:=reexport,
+ org.eclipse.jst.common.frameworks;visibility:=reexport,
+ org.eclipse.wst.common.modulecore;visibility:=reexport,
+ org.maven.ide.eclipse;visibility:=reexport,
+ org.maven.ide.components.maven_embedder;visibility:=reexport,
+ org.eclipse.jdt.core;visibility:=reexport,
+ org.maven.ide.eclipse.jdt;visibility:=reexport,
+ org.eclipse.jst.j2ee;visibility:=reexport,
+ org.eclipse.jst.j2ee.web;visibility:=reexport,
+ org.jboss.tools.common;visibility:=reexport,
+ org.eclipse.jdt.launching;visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: JBoss, a division of Red Hat
+Export-Package: org.jboss.tools.maven.core,
+ org.jboss.tools.maven.core.internal.project.facet
Added: trunk/maven/plugins/org.jboss.tools.maven.core/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/build.properties 2009-06-15 23:52:42
UTC (rev 15976)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.facets">
+
+ <project-facet id="jboss.m2">
+ <label>JBoss Maven Integration</label>
+ <description>
+ Adds support for Maven.
+ </description>
+ <default-version version="1.0"/>
+ </project-facet>
+
+ <project-facet-version facet="jboss.m2" version="1.0">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[5.0"/>
+ <requires facet="jst.web" version="[2.3"/>
+ </and>
+ </constraint>
+ </project-facet-version>
+
+ <action id="jboss.m2.install" facet="jboss.m2"
type="INSTALL" version="1.0">
+ <delegate
class="org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDelegate"/>
+ <config-factory
class="org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider"/>
+ </action>
+
+ </extension>
+
+ <extension
point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <supported>
+ <runtime-component any="true"/>
+ <facet id="jboss.m2" version="1.0"/>
+ </supported>
+ </extension>
+
+</plugin>
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/IJBossMavenConstants.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/IJBossMavenConstants.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/IJBossMavenConstants.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,34 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core;
+
+
+
+/**
+ * @author snjeza
+ *
+ */
+
+public interface IJBossMavenConstants {
+
+ static final String M2_FACET_ID="jboss.m2";
+ static final String ARTIFACT_ID = "artifactId";
+ static final String GROUP_ID = "groupId";
+ static final String VERSION = "version";
+ static final String NAME = "name";
+ static final String DESCRIPTION = "description";
+ static final String PACKAGING = "packaging";
+ static final String MAVEN_MODEL_VERSION = "4.0.0";
+ static final String PROJECT_VERSION = "project.version";
+ static final String SEAM_MAVEN_VERSION = "seamMavenVersion";
+ static final String SEAM_VERSION = "seam.version";
+ static final String REMOVE_WTP_CLASSPATH_CONTAINERS =
"removeWTPClasspathContainers";
+}
\ No newline at end of file
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,434 @@
+package org.jboss.tools.maven.core;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Resource;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.maven.ide.eclipse.MavenPlugin;
+import org.maven.ide.eclipse.core.IMavenConstants;
+import org.maven.ide.eclipse.embedder.MavenModelManager;
+import org.maven.ide.eclipse.jdt.BuildPathManager;
+import org.maven.ide.eclipse.project.IProjectConfigurationManager;
+import org.maven.ide.eclipse.project.ResolverConfiguration;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class MavenCoreActivator extends Plugin {
+
+ private static final String SEPARATOR = "/";
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.core";
+
+ public static final String OWNER_PROJECT_FACETS_ATTR = "owner.project.facets";
//$NON-NLS-1$
+
+ public static final String BASEDIR = "${basedir}";
+
+ // The shared instance
+ private static MavenCoreActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public MavenCoreActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static MavenCoreActivator getDefault() {
+ return plugin;
+ }
+
+ public static IStatus getStatus(String message) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, message);
+
+ }
+
+ public static IStatus getStatus(String message, Throwable e) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, message,e);
+ }
+
+ public static IProject createMavenProject(String projectName, IProgressMonitor monitor,
Model model, boolean force) throws CoreException {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(projectName);
+ if (project.exists() && !force ) {
+ return project;
+ }
+ if (!project.exists()) {
+ project.create(monitor);
+ project.open(monitor);
+ }
+ IJavaProject javaProject = JavaCore.create(project);
+ IProjectDescription description = project.getDescription();
+ String[] natureIds = description.getNatureIds();
+ boolean hasJavaNature = false;
+ for (int i = 0; i < natureIds.length; i++) {
+ if (JavaCore.NATURE_ID.equals(natureIds[i])) {
+ hasJavaNature = true;
+ break;
+ }
+ }
+ if (!hasJavaNature) {
+ createFolder("target",monitor, project);
+ IFolder binFolder = createFolder("target/classes",monitor, project);
+ String[] newNatureIds = new String[natureIds.length + 1];
+ for (int i = 0; i < natureIds.length; i++) {
+ newNatureIds[i]=natureIds[i];
+ }
+ newNatureIds[natureIds.length] = JavaCore.NATURE_ID;
+ description.setNatureIds(newNatureIds);
+ project.setDescription(description, monitor);
+ javaProject.setRawClasspath(new IClasspathEntry[0], monitor);
+ javaProject.setOutputLocation(binFolder.getFullPath(), monitor);
+ IClasspathEntry entry = JavaRuntime.getDefaultJREContainerEntry();
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
+ System.arraycopy(entries, 0, newEntries, 0, entries.length);
+ newEntries[entries.length] = entry;
+ javaProject.setRawClasspath(newEntries, monitor);
+ }
+ if (FacetedProjectFramework.hasProjectFacet(project,
IJ2EEFacetConstants.ENTERPRISE_APPLICATION)) {
+ String sourceDirectory = getSourceDirectory(javaProject);
+ if (sourceDirectory == null || sourceDirectory.trim().length() <= 0) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder rootVFolder = component.getRootFolder();
+ IContainer rootFolder = rootVFolder.getUnderlyingFolder();
+ IPath path = rootFolder.getFullPath();
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
+ System.arraycopy(entries, 0, newEntries, 0, entries.length);
+ newEntries[entries.length] = JavaCore.newSourceEntry(path);
+ javaProject.setRawClasspath(newEntries, monitor);
+ }
+ }
+ addMavenCapabilities(project, monitor, model);
+ return project;
+ }
+
+ public static void addMavenCapabilities(IProject project, IProgressMonitor monitor,
Model model) throws CoreException {
+ IFile pom = project.getFile(IMavenConstants.POM_FILE_NAME);
+ if (!pom.exists() && model != null) {
+ MavenModelManager modelManager = MavenPlugin.getDefault().getMavenModelManager();
+ modelManager.createMavenModel(pom, model);
+ }
+
+ boolean hasMavenNature = MavenCoreActivator.addMavenNature(project, monitor);
+
+ if (!hasMavenNature) {
+ IClasspathAttribute attribute = JavaCore.newClasspathAttribute(
+ MavenCoreActivator.OWNER_PROJECT_FACETS_ATTR,
+ IJBossMavenConstants.M2_FACET_ID);
+ IJavaProject javaProject = JavaCore.create(project);
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
+ MavenCoreActivator.updateMavenProjectConfiguration(project);
+ }
+ }
+
+ private static IFolder createFolder(String folderName,IProgressMonitor monitor,
+ IProject project) throws CoreException {
+ IFolder folder = project.getFolder(folderName);
+ folder.create(false, true, monitor);
+ return folder;
+ }
+
+ public static boolean addMavenNature(IProject project,
+ IProgressMonitor monitor) throws CoreException {
+ boolean hasMavenNature = project.hasNature(IMavenConstants.NATURE_ID);
+ if (!hasMavenNature) {
+ IProjectDescription description = project.getDescription();
+ String[] prevNatures = description.getNatureIds();
+ String[] newNatures = new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 1, prevNatures.length);
+ newNatures[0] = IMavenConstants.NATURE_ID;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, monitor);
+ }
+ IJavaProject javaProject = JavaCore.create(project);
+ IPath path = new Path(BuildPathManager.CONTAINER_ID);
+ setContainerPath(monitor, javaProject, path);
+ return hasMavenNature;
+ }
+
+ public static String getSourceDirectory(IJavaProject javaProject) throws
JavaModelException {
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ IPath path = null;
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ path = entries[i].getPath();
+ break;
+ }
+ }
+ if (path == null) {
+ return null;
+ }
+ path = path.makeRelativeTo(javaProject.getPath());
+ String value = path.toString();
+ if (value.startsWith(SEPARATOR)) {
+ return BASEDIR + path.toString();
+ } else {
+ return BASEDIR + SEPARATOR + path.toString();
+ }
+ }
+
+ public static void addClasspathAttribute(IJavaProject javaProject,
+ IClasspathAttribute attribute, IProgressMonitor monitor) throws JavaModelException {
+ IClasspathEntry[] cp = javaProject.getRawClasspath();
+ for (int i = 0; i < cp.length; i++) {
+ if (IClasspathEntry.CPE_CONTAINER == cp[i].getEntryKind()
+ && BuildPathManager.isMaven2ClasspathContainer(cp[i]
+ .getPath())) {
+ LinkedHashMap<String, IClasspathAttribute> attrs = new LinkedHashMap<String,
IClasspathAttribute>();
+ for (IClasspathAttribute attr : cp[i].getExtraAttributes()) {
+ attrs.put(attr.getName(), attr);
+ }
+ attrs.put(attribute.getName(), attribute);
+ IClasspathAttribute[] newAttrs = attrs.values().toArray(
+ new IClasspathAttribute[attrs.size()]);
+ cp[i] = JavaCore.newContainerEntry(cp[i].getPath(), cp[i]
+ .getAccessRules(), newAttrs, cp[i].isExported());
+ break;
+ }
+ }
+ javaProject.setRawClasspath(cp, monitor);
+
+ }
+
+ public static void setContainerPath(IProgressMonitor monitor,
+ IJavaProject javaProject, IPath containerPath) throws CoreException {
+ IClasspathEntry entry = JavaCore
+ .newContainerEntry(containerPath, false);
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
+ System.arraycopy(entries, 0, newEntries, 0, entries.length);
+ newEntries[entries.length] = entry;
+ javaProject.setRawClasspath(newEntries, monitor);
+ }
+
+ public static void updateMavenProjectConfiguration(IProject project)
+ throws CoreException {
+ ResolverConfiguration resolverConfiguration = new ResolverConfiguration();
+ resolverConfiguration.setIncludeModules(false);
+ // FIXME
+ resolverConfiguration.setResolveWorkspaceProjects(true);
+ resolverConfiguration.setActiveProfiles("");
+ IProjectConfigurationManager configurationManager = MavenPlugin
+ .getDefault().getProjectConfigurationManager();
+ configurationManager.updateProjectConfiguration(project,
+ resolverConfiguration, //
+ MavenPlugin.getDefault().getMavenRuntimeManager()
+ .getGoalOnUpdate(), new NullProgressMonitor());
+ }
+
+ public static void addMavenWarPlugin(Build build, IProject project) throws
JavaModelException {
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins");
+ plugin.setArtifactId("maven-war-plugin");
+
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" );
+ Xpp3Dom webappDirectory = new Xpp3Dom("webappDirectory");
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder rootFolder = component.getRootFolder();
+ IContainer root = rootFolder.getUnderlyingFolder();
+ String webContentRoot = root.getProjectRelativePath().toString();
+ configuration.addChild(webappDirectory);
+ Xpp3Dom warSourceDirectory = new Xpp3Dom("warSourceDirectory");
+ if (webContentRoot.startsWith(SEPARATOR)) {
+ webappDirectory.setValue(MavenCoreActivator.BASEDIR + webContentRoot);
+ warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + webContentRoot);
+ } else {
+ webappDirectory.setValue(MavenCoreActivator.BASEDIR + SEPARATOR + webContentRoot);
+ warSourceDirectory.setValue(MavenCoreActivator.BASEDIR + SEPARATOR + webContentRoot);
+ }
+
+ configuration.addChild(warSourceDirectory);
+ plugin.setConfiguration(configuration);
+ build.getPlugins().add(plugin);
+
+ addResource(build, project, null);
+ }
+
+ public static void addResource(Build build, IProject project, String sourceDirectory)
+ throws JavaModelException {
+ Resource resource = new Resource();
+ if (sourceDirectory == null) {
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject != null && javaProject.exists()) {
+ sourceDirectory = getSourceDirectory(javaProject);
+ }
+ }
+ if (sourceDirectory != null) {
+ resource.setDirectory(sourceDirectory);
+ List<String> excludes = new ArrayList<String>();
+ excludes.add("**/*.java");
+ resource.setExcludes(excludes);
+ }
+ build.getResources().add(resource);
+ }
+
+ public static void addMavenEarPlugin(Build build, IProject project, IDataModel
m2FacetModel, boolean addModule) throws JavaModelException {
+ String sourceDirectory = getEarRoot(project);
+ build.setSourceDirectory(sourceDirectory);
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins");
+ plugin.setArtifactId("maven-ear-plugin");
+
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" );
+ Xpp3Dom version = new Xpp3Dom("version");
+ version.setValue("5");
+ configuration.addChild(version);
+ Xpp3Dom generateApplicationXml = new Xpp3Dom("generateApplicationXml");
+ generateApplicationXml.setValue("false");
+ configuration.addChild(generateApplicationXml);
+ Xpp3Dom defaultLibBundleDir = new Xpp3Dom("defaultLibBundleDir");
+ defaultLibBundleDir.setValue("lib");
+ configuration.addChild(defaultLibBundleDir);
+
+ if (addModule) {
+ Xpp3Dom modules = new Xpp3Dom("modules");
+ configuration.addChild(modules);
+
+ Xpp3Dom ejbProject = getEarModule(
+ "ejbModule",
+ m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID),
+ m2FacetModel.getStringProperty(IJBossMavenConstants.ARTIFACT_ID)
+ + "-ejb", "/");
+ modules.addChild(ejbProject);
+
+ Xpp3Dom seamModule = getEarModule("ejbModule", "org.jboss.seam",
+ "jboss-seam", "/");
+ modules.addChild(seamModule);
+
+ Xpp3Dom webProject = getEarModule(
+ "webModule",
+ m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID),
+ m2FacetModel.getStringProperty(IJBossMavenConstants.ARTIFACT_ID),
+ "/");
+ Xpp3Dom contextRoot = new Xpp3Dom("contextRoot");
+ contextRoot.setValue(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.ARTIFACT_ID));
+ webProject.addChild(contextRoot);
+ modules.addChild(webProject);
+
+ Xpp3Dom richFacesApi = getEarModule("jarModule",
+ "org.richfaces.framework", "richfaces-api", "/lib");
+ modules.addChild(richFacesApi);
+
+ Xpp3Dom commonDigester = getEarModule("jarModule",
+ "commons-digester", "commons-digester", "/lib");
+ modules.addChild(commonDigester);
+ }
+ plugin.setConfiguration(configuration);
+
+ build.getPlugins().add(plugin);
+
+ addResource(build, project, sourceDirectory);
+ }
+
+ private static Xpp3Dom getEarModule(String module,
+ String groupIdString,String artifactIdString, String bundleDirString) {
+ Xpp3Dom earModule = new Xpp3Dom(module);
+ //modules.addChild(earModule);
+ Xpp3Dom groupId = new Xpp3Dom("groupId");
+ groupId.setValue(groupIdString);
+ earModule.addChild(groupId);
+ Xpp3Dom artifactId = new Xpp3Dom("artifactId");
+ artifactId.setValue(artifactIdString);
+ earModule.addChild(artifactId);
+ Xpp3Dom bundleDir = new Xpp3Dom("bundleDir");
+ bundleDir.setValue(bundleDirString);
+ earModule.addChild(bundleDir);
+ return earModule;
+ }
+
+ public static void addMavenEjbPlugin(Build build, IProject project) throws
JavaModelException {
+ org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
+ plugin.setGroupId("org.apache.maven.plugins");
+ plugin.setArtifactId("maven-ejb-plugin");
+ plugin.setInherited("true");
+
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" );
+ Xpp3Dom ejbVersion = new Xpp3Dom("ejbVersion");
+ ejbVersion.setValue("3.0");
+ configuration.addChild(ejbVersion);
+ plugin.setConfiguration(configuration);
+ build.getPlugins().add(plugin);
+
+ addResource(build, project, null);
+ }
+
+ public static String getOutputDirectory(IJavaProject javaProject) throws CoreException
{
+ IPath path = javaProject.getOutputLocation();
+ path = path.makeRelativeTo(javaProject.getPath());
+ if (path == null) {
+ return null;
+ }
+ String value = path.toString();
+ if (value.startsWith(SEPARATOR)) {
+ return MavenCoreActivator.BASEDIR + path.toString();
+ } else {
+ return MavenCoreActivator.BASEDIR + SEPARATOR + path.toString();
+ }
+ }
+
+ public static String getEarRoot(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder rootFolder = component.getRootFolder();
+ IContainer root = rootFolder.getUnderlyingFolder();
+ String sourceDirectory = root.getProjectRelativePath().toString();
+ return sourceDirectory;
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDataModelProvider.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,71 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.internal.project.facet;
+
+import java.util.Set;
+
+import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+
+/**
+ * @author snjeza
+ *
+ */
+public class MavenFacetInstallDataModelProvider extends
+ FacetInstallDataModelProvider {
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if(propertyName.equals(FACET_ID)){
+ return IJBossMavenConstants.M2_FACET_ID;
+ }
+ if (propertyName.equals(IJBossMavenConstants.ARTIFACT_ID)) {
+ return getDefaultProperty(FACET_PROJECT_NAME);
+ }
+ if (propertyName.equals(IJBossMavenConstants.GROUP_ID)) {
+ return "org.jboss.tools";
+ }
+ if (propertyName.equals(IJBossMavenConstants.VERSION)) {
+ return "0.0.1-SNAPSHOT";
+ }
+ if (propertyName.equals(IJBossMavenConstants.NAME)) {
+ return getDefaultProperty(FACET_PROJECT_NAME);
+ }
+ if (propertyName.equals(IJBossMavenConstants.DESCRIPTION)) {
+ return "";
+ }
+ if (propertyName.equals(IJBossMavenConstants.PACKAGING)) {
+ return "war";
+ }
+ if (propertyName.equals(IJBossMavenConstants.SEAM_MAVEN_VERSION)) {
+ return "";
+ }
+ if (propertyName.equals(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS)) {
+ return Boolean.TRUE;
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ public Set<String> getPropertyNames() {
+ Set<String> propertyNames = super.getPropertyNames();
+ propertyNames.add(IJBossMavenConstants.ARTIFACT_ID);
+ propertyNames.add(IJBossMavenConstants.GROUP_ID);
+ propertyNames.add(IJBossMavenConstants.VERSION);
+ propertyNames.add(IJBossMavenConstants.NAME);
+ propertyNames.add(IJBossMavenConstants.DESCRIPTION);
+ propertyNames.add(IJBossMavenConstants.PACKAGING);
+ propertyNames.add(IJBossMavenConstants.SEAM_MAVEN_VERSION);
+ propertyNames.add(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS);
+ return propertyNames;
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/project/facet/MavenFacetInstallDelegate.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,111 @@
+package org.jboss.tools.maven.core.internal.project.facet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Resource;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+import org.maven.ide.eclipse.MavenPlugin;
+import org.maven.ide.eclipse.core.IMavenConstants;
+import org.maven.ide.eclipse.embedder.MavenModelManager;
+
+public class MavenFacetInstallDelegate implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object cfg,
+ IProgressMonitor monitor) throws CoreException {
+ IDataModel config = null;
+
+ if (cfg != null) {
+ config = (IDataModel) cfg;
+ } else {
+ throw new CoreException(
+ MavenCoreActivator
+ .getStatus("Internal Error creating JBoss Maven Facet. Missing
configuration"));
+ }
+
+ IFile pom = project.getFile(IMavenConstants.POM_FILE_NAME);
+ IJavaProject javaProject = JavaCore.create(project);
+ IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy) config
+ .getProperty(IFacetDataModelProperties.FACETED_PROJECT_WORKING_COPY);
+ if (!pom.exists()) {
+ Model model = new Model();
+ model.setModelVersion(IJBossMavenConstants.MAVEN_MODEL_VERSION);
+ model.setGroupId(config
+ .getStringProperty(IJBossMavenConstants.GROUP_ID));
+ String artifactId = config.getStringProperty(IJBossMavenConstants.ARTIFACT_ID);
+ model.setArtifactId(artifactId);
+ model.setVersion(config
+ .getStringProperty(IJBossMavenConstants.VERSION));
+ model.setName(config.getStringProperty(IJBossMavenConstants.NAME));
+ model.setPackaging(config
+ .getStringProperty(IJBossMavenConstants.PACKAGING));
+ model.setDescription(config
+ .getStringProperty(IJBossMavenConstants.DESCRIPTION));
+
+ Build build = new Build();
+ //build.setFinalName(artifactId);
+ String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ build.setOutputDirectory(outputDirectory);
+ String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
+ if (sourceDirectory != null) {
+ build.setSourceDirectory(sourceDirectory);
+ }
+
+ if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
+
+ MavenCoreActivator.addMavenWarPlugin(build, project);
+ }
+ if (fpwc.hasProjectFacet(IJ2EEFacetConstants.EJB_FACET)) {
+
+ MavenCoreActivator.addMavenEjbPlugin(build, project);
+ }
+ if (fpwc.hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
+
+ MavenCoreActivator.addMavenEarPlugin(build, project, config, false);
+ }
+ model.setBuild(build);
+
+ MavenModelManager modelManager = MavenPlugin.getDefault().getMavenModelManager();
+ modelManager.createMavenModel(pom, model);
+ }
+
+ boolean hasMavenNature = MavenCoreActivator.addMavenNature(project, monitor);
+
+ if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
+ IClasspathAttribute attribute = JavaCore.newClasspathAttribute(
+ IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY,
+ ClasspathDependencyUtil.getDefaultRuntimePath(true).toString());
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
+ }
+ // FIXME
+ IClasspathAttribute attribute = JavaCore.newClasspathAttribute(
+ MavenCoreActivator.OWNER_PROJECT_FACETS_ATTR,
+ IJBossMavenConstants.M2_FACET_ID);
+ MavenCoreActivator.addClasspathAttribute(javaProject, attribute, monitor);
+ if (!hasMavenNature) {
+ MavenCoreActivator.updateMavenProjectConfiguration(project);
+ }
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/.classpath (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/.classpath 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/.project (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/.project 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.seam</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/plugins/org.jboss.tools.maven.seam/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.seam/.settings/org.eclipse.jdt.core.prefs 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,8 @@
+#Sat Jun 06 23:32:05 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/META-INF/MANIFEST.MF 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Integration Seam projects with Maven
+Bundle-SymbolicName: org.jboss.tools.maven.seam;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.maven.seam.MavenSeamActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.maven.core,
+ org.jboss.tools.seam.core,
+ org.maven.ide.components.maven_model_edit,
+ org.eclipse.jst.j2ee.core
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: JBoss, a division of Red Hat
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/about.html (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/about.html 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>Integration Seam projects with Maven</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>Integration Seam projects with Maven</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/about.ini
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/about.ini (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/about.ini 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog
(translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which
the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/about.mappings
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/about.mappings
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/about.mappings 2009-06-15 23:52:42 UTC
(rev 15976)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/about.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/about.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/about.properties 2009-06-15 23:52:42
UTC (rev 15976)
@@ -0,0 +1,2 @@
+blurb=Integration Seam projects with Maven\n\nVersion\: {featureVersion}\n\n(c) Copyright
JBoss, a division of Red Hat, contributors and others 2004 - 2009. All rights
reserved.\nVisit http\://jboss.org/tools
+
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/build.properties 2009-06-15 23:52:42
UTC (rev 15976)
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ jboss_about.png,\
+ poms/
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.seam/jboss_about.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.listeners">
+ <listener
class="org.jboss.tools.maven.seam.internal.project.facet.MavenPostInstallListener"
+ eventTypes="POST_INSTALL"/>
+ </extension>
+
+</plugin>
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/poms/parent-pom.xml 2009-06-15 23:52:42
UTC (rev 15976)
@@ -0,0 +1,427 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>template</groupId>
+ <artifactId>template</artifactId>
+ <packaging>pom</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <properties>
+ <seam.version>2.1.1.GA</seam.version>
+ <jsf.version>1.2_08</jsf.version>
+ <richfaces.version>3.3.0.GA</richfaces.version>
+ <hibernate-validator.version>3.1.0.GA</hibernate-validator.version>
+
<hibernate-annotations.version>3.4.0.GA</hibernate-annotations.version>
+
<hibernate-entitymanager.version>3.4.0.GA</hibernate-entitymanager.version>
+ <junit.version>3.8.1</junit.version>
+ <testng.version>5.8</testng.version>
+ <jboss.embedded.version>beta3</jboss.embedded.version>
+ <slf4j.version>1.4.2</slf4j.version>
+ <javax.activation.version>1.1</javax.activation.version>
+ <ejb.api.version>3.0</ejb.api.version>
+ <jsr250-api.version>1.0</jsr250-api.version>
+ <persistence-api.version>1.0</persistence-api.version>
+
<hibernate-commons-annotations.version>3.3.0.ga</hibernate-commons-annotations.version>
+ <servlet.version>2.5</servlet.version>
+ <commons.digester.version>1.8</commons.digester.version>
+ <javax.el.version>1.0</javax.el.version>
+ <drools.version>4.0.4</drools.version>
+ <jbpm.version>3.2.2</jbpm.version>
+ <mvel.version>1.2.21</mvel.version>
+ <project.version>0.0.1-SNAPSHOT</project.version>
+ </properties>
+
+ <prerequisites>
+ <maven>2.0.9</maven>
+ </prerequisites>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <name>JBoss Repository</name>
+ <
url>http://repository.jboss.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>jboss-snapshots</id>
+ <name>JBoss Snapshot Repository</name>
+ <
url>http://snapshots.jboss.org/maven2</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>${hibernate-validator.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>${hibernate-annotations.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${hibernate-entitymanager.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>dom4j</artifactId>
+ <groupId>dom4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ioc</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-mail</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-seam</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-seam-ui</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-pdf</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-seam</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-seam-ui</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-remoting</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-seam</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>dom4j</artifactId>
+ <groupId>dom4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-excel</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-seam</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-seam-ui</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-debug</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-seam</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${servlet.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui</artifactId>
+ <version>${richfaces.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>${richfaces.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>${richfaces.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </exclusion>
+
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>${testng.version}</version>
+ <type>jar</type>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam.embedded</groupId>
+ <artifactId>hibernate-all</artifactId>
+ <version>${jboss.embedded.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam.embedded</groupId>
+ <artifactId>jboss-embedded-all</artifactId>
+ <version>${jboss.embedded.version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ </exclusion>
+ </exclusions>
+
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam.embedded</groupId>
+ <artifactId>thirdparty-all</artifactId>
+ <version>${jboss.embedded.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-nop</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>${javax.activation.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <version>${ejb.api.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>${jsr250-api.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>${persistence-api.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>${hibernate-commons-annotations.version}</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>${commons.digester.version}</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>commons-logging</artifactId>
+ <groupId>commons-logging</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>${javax.el.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ <version>${drools.version}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>core</artifactId>
+ <groupId>org.eclipse.jdt</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xercesImpl</artifactId>
+ <groupId>xerces</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>janino</artifactId>
+ <groupId>janino</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>mvel14</artifactId>
+ <groupId>org.mvel</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>${jbpm.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>commons-logging</artifactId>
+ <groupId>commons-logging</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel14</artifactId>
+ <version>${mvel.version}</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,785 @@
+package org.jboss.tools.maven.seam;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.application.ApplicationFactory;
+import org.eclipse.jst.j2ee.application.EjbModule;
+import org.eclipse.jst.j2ee.application.WebModule;
+import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
+import org.eclipse.jst.j2ee.project.facet.EarFacetRuntimeHandler;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate;
+import org.maven.ide.eclipse.MavenPlugin;
+import org.maven.ide.eclipse.core.IMavenConstants;
+import org.maven.ide.eclipse.embedder.MavenModelManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class MavenSeamActivator extends AbstractUIPlugin {
+
+ private static final String WAR_ARCHIVE_SUFFIX = ".war";
+
+ private static final String EJB_ARCHIVE_SUFFIX = ".jar";
+
+ private static final String TEST_SUFFIX = "-test";
+
+ private static final String EJB_SUFFIX = "-ejb";
+
+ private static final String EAR_SUFFIX = "-ear";
+
+ private static final String PARENT_SUFFIX = "-parent";
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.seam";
+
+ // The shared instance
+ private static MavenSeamActivator plugin;
+
+ private String webProjectName;
+ private String artifactId;
+
+ private String parentProjectName;
+ private String parentArtifactId;
+
+ private String earProjectName;
+ private String earArtifactId;
+
+ private String ejbProjectName;
+ private String ejbArtifactId;
+
+ private String testProjectName;
+ private String testArtifactId;
+
+ /**
+ * The constructor
+ */
+ public MavenSeamActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static MavenSeamActivator getDefault() {
+ return plugin;
+ }
+
+
+ public void configureSeamProject(IDataModel seamFacetModel,
+ IDataModel m2FacetModel) {
+ Assert.isNotNull(seamFacetModel);
+ Assert.isNotNull(m2FacetModel);
+ webProjectName =
seamFacetModel.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
+ artifactId = m2FacetModel.getStringProperty(IJBossMavenConstants.ARTIFACT_ID);
+ parentProjectName = webProjectName + PARENT_SUFFIX;
+ parentArtifactId = artifactId + PARENT_SUFFIX;
+ testProjectName = webProjectName + TEST_SUFFIX;
+ testArtifactId = artifactId + TEST_SUFFIX;
+ configureParentProject(m2FacetModel, seamFacetModel);
+ configureWarProject(m2FacetModel, seamFacetModel);
+ configureTestProject(m2FacetModel, seamFacetModel);
+ if (!SeamFacetAbstractInstallDelegate
+ .isWarConfiguration(seamFacetModel)) {
+
+ earProjectName = webProjectName + EAR_SUFFIX;
+ earArtifactId = artifactId + EAR_SUFFIX;
+ ejbProjectName = webProjectName + EJB_SUFFIX;
+ ejbArtifactId = artifactId + EJB_SUFFIX;
+
+ configureEjbProject(m2FacetModel, seamFacetModel);
+ configureEarProject(m2FacetModel, seamFacetModel);
+
+ }
+ }
+
+ private void configureTestProject(IDataModel m2FacetModel,
+ IDataModel seamFacetModel) {
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(testProjectName);
+ IFile pom = project.getFile(IMavenConstants.POM_FILE_NAME);
+ IJavaProject javaProject = JavaCore.create(project);
+ if (!pom.exists()) {
+ Model model = new Model();
+ model.setModelVersion(IJBossMavenConstants.MAVEN_MODEL_VERSION);
+ model.setGroupId(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.GROUP_ID));
+ model.setArtifactId(testArtifactId);
+ model.setVersion(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.VERSION));
+ model.setName(m2FacetModel.getStringProperty(IJBossMavenConstants.NAME) + " -
test");
+ model.setPackaging("jar");
+ model.setDescription(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.DESCRIPTION));
+
+ Parent parent = new Parent();
+ parent.setArtifactId(parentArtifactId);
+ parent.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ parent.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
+ model.setParent(parent);
+
+ List dependencies = model.getDependencies();
+
+ Dependency dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam.embedded");
+ dependency.setArtifactId("hibernate-all");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam.embedded");
+ dependency.setArtifactId("jboss-embedded-all");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam.embedded");
+ dependency.setArtifactId("thirdparty-all");
+ dependencies.add(dependency);
+
+ dependency = getSeamDependency();
+ dependency.setScope("test");
+ dependencies.add(dependency);
+
+ dependency = getJSFApi();
+ dependency.setScope("test");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.activation");
+ dependency.setArtifactId("activation");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.testng");
+ dependency.setArtifactId("testng");
+ // FIXME
+ dependency.setVersion("${testng.version}");
+ dependency.setClassifier("jdk15");
+ dependency.setScope("test");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.slf4j");
+ dependency.setArtifactId("slf4j-api");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.slf4j");
+ dependency.setArtifactId("slf4j-nop");
+ dependencies.add(dependency);
+
+ Build build = new Build();
+ try {
+ //build.setFinalName(testProjectName);
+ String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
+ if (sourceDirectory != null) {
+ build.setSourceDirectory(sourceDirectory);
+ }
+ String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ build.setOutputDirectory(outputDirectory);
+ MavenCoreActivator.addResource(build, project, sourceDirectory);
+ model.setBuild(build);
+ MavenCoreActivator.createMavenProject(testProjectName, null, model, true);
+ } catch (Exception e) {
+ MavenSeamActivator.log(e);
+ }
+
+ }
+
+ }
+
+ private void configureEarProject(IDataModel m2FacetModel,
+ IDataModel seamFacetModel) {
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(earProjectName);
+ IFile pom = project.getFile(IMavenConstants.POM_FILE_NAME);
+ //IJavaProject javaProject = JavaCore.create(project);
+ if (!pom.exists()) {
+ Model model = new Model();
+ model.setModelVersion(IJBossMavenConstants.MAVEN_MODEL_VERSION);
+ model.setGroupId(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.GROUP_ID));
+ model.setArtifactId(earArtifactId);
+ model.setVersion(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.VERSION));
+ model.setName(m2FacetModel.getStringProperty(IJBossMavenConstants.NAME) + " -
EAR");
+ model.setPackaging("ear");
+ model.setDescription(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.DESCRIPTION));
+
+ Parent parent = new Parent();
+ parent.setArtifactId(parentArtifactId);
+ parent.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ parent.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
+ model.setParent(parent);
+
+ List dependencies = model.getDependencies();
+
+ Dependency dependency = new Dependency();
+ dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ dependency.setArtifactId(ejbProjectName);
+ dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
+ dependency.setType("ejb");
+ dependency.setScope("compile");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ dependency.setArtifactId(webProjectName);
+ dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
+ dependency.setType("war");
+ dependency.setScope("compile");
+ dependencies.add(dependency);
+
+ dependency = getSeamDependency();
+ dependency.setVersion("${seam.version}");
+ dependency.setType("ejb");
+ dependency.setScope("compile");
+ List exclusions = dependency.getExclusions();
+ Exclusion exclusion = new Exclusion();
+ exclusion.setGroupId("javassist");
+ exclusion.setArtifactId("javassist");
+ exclusions.add(exclusion);
+
+ exclusion = new Exclusion();
+ exclusion.setGroupId("javax.el");
+ exclusion.setArtifactId("el-api");
+ exclusions.add(exclusion);
+
+ exclusion = new Exclusion();
+ exclusion.setGroupId("dom4j");
+ exclusion.setArtifactId("dom4j");
+ exclusions.add(exclusion);
+
+ dependencies.add(dependency);
+
+ dependency = getRichFacesApi();
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ exclusions = dependency.getExclusions();
+ exclusion = new Exclusion();
+ exclusion.setGroupId("commons-collections");
+ exclusion.setArtifactId("commons-collections");
+ exclusions.add(exclusion);
+ exclusion = new Exclusion();
+ exclusion.setGroupId("commons-logging");
+ exclusion.setArtifactId("commons-logging");
+ exclusions.add(exclusion);
+
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.drools");
+ dependency.setArtifactId("drools-compiler");
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.mvel");
+ dependency.setArtifactId("mvel14");
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jbpm");
+ dependency.setArtifactId("jbpm-jpdl");
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("commons-digester");
+ dependency.setArtifactId("commons-digester");
+ dependencies.add(dependency);
+
+ Build build = new Build();
+ try {
+ //build.setFinalName(earProjectName);
+
+ String sourceDirectory = MavenCoreActivator.getEarRoot(project);
+ if (sourceDirectory != null) {
+ build.setSourceDirectory(sourceDirectory);
+ }
+ build.setOutputDirectory("target/classes");
+ MavenCoreActivator.addMavenEarPlugin(build, project, m2FacetModel, true);
+ model.setBuild(build);
+ MavenCoreActivator.createMavenProject(earProjectName, null, model, true);
+ removeWTPContainers(m2FacetModel, project);
+ configureApplicationXml(project, m2FacetModel, null);
+ //removeRuntime(project);
+ //IProject ejbProject =
ResourcesPlugin.getWorkspace().getRoot().getProject(ejbProjectName);
+ //removeRuntime(ejbProject);
+ //EarFacetRuntimeHandler.updateModuleProjectRuntime(project, ejbProject, null);
+ //IProject webProject =
ResourcesPlugin.getWorkspace().getRoot().getProject(webProjectName);
+ //removeRuntime(webProject);
+ //EarFacetRuntimeHandler.updateModuleProjectRuntime(project, webProject, null);
+ } catch (Exception e) {
+ MavenSeamActivator.log(e);
+ }
+
+ }
+ }
+
+ protected void configureApplicationXml(IProject project, IDataModel m2FacetModel,
IProgressMonitor monitor) {
+ EARArtifactEdit earArtifactEdit = null;
+ try {
+ earArtifactEdit = EARArtifactEdit.getEARArtifactEditForWrite(project);
+ if(earArtifactEdit!=null) {
+ Application application = earArtifactEdit.getApplication();
+ EList modules = application.getModules();
+ for (Iterator iterator = modules.iterator(); iterator.hasNext();) {
+ Object module = (Object) iterator.next();
+ if (module instanceof WebModule) {
+ WebModule webModule = (WebModule) module;
+ String uri = webModule.getUri();
+ String value = webProjectName + WAR_ARCHIVE_SUFFIX;
+ if (value.equals(uri)) {
+ String newUri = artifactId + "-" +
m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION) + WAR_ARCHIVE_SUFFIX;
+ webModule.setUri(newUri);
+ }
+ }
+ if (module instanceof EjbModule) {
+ EjbModule ejbModule = (EjbModule) module;
+ String uri = ejbModule.getUri();
+ String value = ejbProjectName + EJB_ARCHIVE_SUFFIX;
+ if (value.equals(uri)) {
+ String newUri = ejbArtifactId + "-" +
m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION) + EJB_ARCHIVE_SUFFIX;
+ ejbModule.setUri(newUri);
+ }
+ }
+ }
+
+ earArtifactEdit.save(monitor);
+ }
+ } finally {
+ if(earArtifactEdit!=null) {
+ earArtifactEdit.dispose();
+ }
+ }
+ }
+ private void removeRuntime(IProject project) throws CoreException {
+ IFacetedProject facetedProject = ProjectFacetsManager.create( project );
+ facetedProject.setRuntime(null, null);
+
+ }
+
+ private void configureEjbProject(IDataModel m2FacetModel,
+ IDataModel seamFacetModel) {
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(ejbProjectName);
+ IFile pom = project.getFile(IMavenConstants.POM_FILE_NAME);
+ IJavaProject javaProject = JavaCore.create(project);
+ if (!pom.exists()) {
+ Model model = new Model();
+ model.setModelVersion(IJBossMavenConstants.MAVEN_MODEL_VERSION);
+ model.setGroupId(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.GROUP_ID));
+ model.setArtifactId(ejbArtifactId);
+ model.setVersion(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.VERSION));
+ model.setName(m2FacetModel.getStringProperty(IJBossMavenConstants.NAME) + " -
EJB");
+ model.setPackaging("ejb");
+ model.setDescription(m2FacetModel
+ .getStringProperty(IJBossMavenConstants.DESCRIPTION));
+
+ Parent parent = new Parent();
+ parent.setArtifactId(parentArtifactId);
+ parent.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ parent.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
+ model.setParent(parent);
+
+ List dependencies = model.getDependencies();
+
+ Dependency dependency = getSeamDependency();
+ dependency.setScope("provided");
+ dependencies.add(dependency);
+ dependencies.add(getJSFApi());
+ dependencies.add(getRichFacesApi());
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.ejb");
+ dependency.setArtifactId("ejb-api");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.annotation");
+ dependency.setArtifactId("jsr250-api");
+ dependencies.add(dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.persistence");
+ dependency.setArtifactId("persistence-api");
+ dependencies.add(dependency);
+
+ dependencies.add(getHibernateAnnotations());
+ dependencies.add(getHibernateCommonAnnotations());
+ dependencies.add(getHibernateValidator());
+
+ Build build = new Build();
+ try {
+ // FIXME
+ //build.setFinalName(ejbArtifactId);
+ String outputDirectory = MavenCoreActivator.getOutputDirectory(javaProject);
+ build.setOutputDirectory(outputDirectory);
+ String sourceDirectory = MavenCoreActivator.getSourceDirectory(javaProject);
+ if (sourceDirectory != null) {
+ build.setSourceDirectory(sourceDirectory);
+ }
+ MavenCoreActivator.addMavenEjbPlugin(build, project);
+ model.setBuild(build);
+ MavenCoreActivator.createMavenProject(ejbProjectName, null, model, true);
+ removeWTPContainers(m2FacetModel, project);
+ } catch (Exception e) {
+ MavenSeamActivator.log(e);
+ }
+
+ }
+
+ }
+
+ private void configureWarProject(IDataModel m2FacetModel,IDataModel seamFacetModel) {
+ try {
+ IProject webProject =
ResourcesPlugin.getWorkspace().getRoot().getProject(webProjectName);
+
+ IFile pomFile = webProject.getFile(IMavenConstants.POM_FILE_NAME);
+ MavenModelManager modelManager = MavenPlugin.getDefault().getMavenModelManager();
+
+ String artifactId = parentProjectName;
+ String groupId = m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID);
+ String version = m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION);
+ modelManager.updateProject(pomFile, new ParentAdder(groupId, artifactId, version));
+
+ Dependency dependency = getHibernateValidator();
+ //dependency.setScope("provided");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = getHibernateAnnotations();
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.hibernate");
+ dependency.setArtifactId("hibernate-entitymanager");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = getSeamDependency();
+ if (!SeamFacetAbstractInstallDelegate
+ .isWarConfiguration(seamFacetModel)) {
+ dependency.setScope("provided");
+ }
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-ui");
+ List<Exclusion> exclusions = dependency.getExclusions();
+ Exclusion exclusion = new Exclusion();
+ exclusion.setGroupId("org.jboss.seam");
+ exclusion.setArtifactId("jboss-seam");
+ exclusions.add(exclusion);
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-ioc");
+ exclusions = dependency.getExclusions();
+ exclusion = new Exclusion();
+ exclusion.setGroupId("org.jboss.seam");
+ exclusion.setArtifactId("jboss-seam");
+ exclusions.add(exclusion);
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-debug");
+
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-mail");
+
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-pdf");
+
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-remoting");
+
+ modelManager.addDependency(pomFile,dependency);
+
+ if (FacetedProjectFramework.hasProjectFacet(webProject,
ISeamFacetDataModelProperties.SEAM_FACET_ID,
ISeamFacetDataModelProperties.SEAM_FACET_VERSION_21)) {
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam-excel");
+
+ modelManager.addDependency(pomFile,dependency);
+ }
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.servlet");
+ dependency.setArtifactId("servlet-api");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.richfaces.ui");
+ dependency.setArtifactId("richfaces-ui");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = getRichFacesApi();
+ if (!SeamFacetAbstractInstallDelegate
+ .isWarConfiguration(seamFacetModel)) {
+ dependency.setScope("provided");
+ }
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.richfaces.framework");
+ dependency.setArtifactId("richfaces-impl");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = getJSFApi();
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.faces");
+ dependency.setArtifactId("jsf-impl");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("javax.el");
+ dependency.setArtifactId("el-api");
+ modelManager.addDependency(pomFile,dependency);
+
+ if (SeamFacetAbstractInstallDelegate
+ .isWarConfiguration(seamFacetModel)) {
+ dependency = new Dependency();
+ dependency.setGroupId("org.drools");
+ dependency.setArtifactId("drools-compiler");
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.mvel");
+ dependency.setArtifactId("mvel14");
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("org.jbpm");
+ dependency.setArtifactId("jbpm-jpdl");
+ dependency.setType("jar");
+ dependency.setScope("compile");
+ modelManager.addDependency(pomFile,dependency);
+
+ dependency = new Dependency();
+ dependency.setGroupId("commons-digester");
+ dependency.setArtifactId("commons-digester");
+ modelManager.addDependency(pomFile,dependency);
+ }
+
+ // ejb project
+
+ if (!SeamFacetAbstractInstallDelegate
+ .isWarConfiguration(seamFacetModel)) {
+ dependency = new Dependency();
+ dependency.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ dependency.setArtifactId(ejbProjectName);
+ dependency.setVersion(m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION));
+ dependency.setType("ejb");
+ dependency.setScope("provided");
+ modelManager.addDependency(pomFile,dependency);
+ }
+ removeWTPContainers(m2FacetModel, webProject);
+ } catch (Exception e) {
+ MavenSeamActivator.log(e);
+ }
+ }
+
+ private void removeWTPContainers(IDataModel m2FacetModel,
+ IProject webProject) throws JavaModelException {
+ if
(m2FacetModel.getBooleanProperty(IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS)) {
+ IJavaProject javaProject = JavaCore.create(webProject);
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ List<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry = entries[i];
+ boolean add = true;
+ if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ // FIXME
+ IPath path = entry.getPath();
+ if (path != null) {
+ String value = path.toString();
+ if (value.startsWith("org.eclipse.jst")) {
+ add = false;
+ }
+ }
+ }
+ if (add) {
+ newEntries.add(entry);
+ }
+ }
+ javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[0]), null);
+ }
+ }
+
+ private Dependency getHibernateValidator() {
+ Dependency dependency = new Dependency();
+ dependency.setGroupId("org.hibernate");
+ dependency.setArtifactId("hibernate-validator");
+ return dependency;
+ }
+
+ private Dependency getHibernateAnnotations() {
+ Dependency dependency;
+ dependency = new Dependency();
+ dependency.setGroupId("org.hibernate");
+ dependency.setArtifactId("hibernate-annotations");
+ return dependency;
+ }
+
+ private Dependency getHibernateCommonAnnotations() {
+ Dependency dependency;
+ dependency = new Dependency();
+ dependency.setGroupId("org.hibernate");
+ dependency.setArtifactId("hibernate-commons-annotations");
+ return dependency;
+ }
+
+ private Dependency getRichFacesApi() {
+ Dependency dependency;
+ dependency = new Dependency();
+ dependency.setGroupId("org.richfaces.framework");
+ dependency.setArtifactId("richfaces-api");
+ return dependency;
+ }
+
+ private Dependency getJSFApi() {
+ Dependency dependency;
+ dependency = new Dependency();
+ dependency.setGroupId("javax.faces");
+ dependency.setArtifactId("jsf-api");
+ return dependency;
+ }
+
+ private Dependency getSeamDependency() {
+ Dependency dependency;
+ dependency = new Dependency();
+ dependency.setGroupId("org.jboss.seam");
+ dependency.setArtifactId("jboss-seam");
+ return dependency;
+ }
+
+ private void configureParentProject(IDataModel m2FacetModel, IDataModel seamFacetModel)
{
+ Bundle bundle = getDefault().getBundle();
+ URL parentPomEntryURL = bundle.getEntry("/poms/parent-pom.xml");
+ try {
+ URL resolvedURL = FileLocator.resolve(parentPomEntryURL);
+ File pomFile = new File(FileLocator.toFileURL(resolvedURL).getFile());
+ MavenModelManager modelManager = MavenPlugin.getDefault().getMavenModelManager();
+ Model model = modelManager.readMavenModel(pomFile);
+ model.setArtifactId(parentArtifactId);
+ model.setGroupId(m2FacetModel.getStringProperty(IJBossMavenConstants.GROUP_ID));
+ String projectVersion = m2FacetModel.getStringProperty(IJBossMavenConstants.VERSION);
+ String name = m2FacetModel.getStringProperty(IJBossMavenConstants.NAME);
+ if (name != null && name.trim().length() > 0) {
+ model.setName(name + " - parent");
+ }
+ String description= m2FacetModel.getStringProperty(IJBossMavenConstants.DESCRIPTION);
+ if (description != null && description.trim().length() > 0) {
+ model.setDescription(description + " - parent");
+ }
+ model.setVersion(projectVersion);
+
+ Properties properties = model.getProperties();
+ properties.put(IJBossMavenConstants.PROJECT_VERSION, projectVersion);
+ String seamVersion =
m2FacetModel.getStringProperty(IJBossMavenConstants.SEAM_MAVEN_VERSION);
+ if (seamVersion != null && seamVersion.trim().length() > 0) {
+ properties.put(IJBossMavenConstants.SEAM_VERSION, seamVersion);
+ }
+
+ List<String> modules = model.getModules();
+ modules.add("../" + artifactId);
+ if (!SeamFacetAbstractInstallDelegate
+ .isWarConfiguration(seamFacetModel)) {
+ modules.add("../" + ejbArtifactId);
+ modules.add("../" + earArtifactId);
+ }
+
+ MavenCoreActivator.createMavenProject(parentProjectName, null, model, false);
+ } catch (Exception e) {
+ log(e);
+ }
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ getDefault().getLog().log(status);
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/ParentAdder.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/ParentAdder.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/ParentAdder.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,31 @@
+package org.jboss.tools.maven.seam;
+
+import org.maven.ide.components.pom.Model;
+import org.maven.ide.components.pom.Parent;
+import org.maven.ide.components.pom.PomFactory;
+import org.maven.ide.eclipse.embedder.ProjectUpdater;
+
+public class ParentAdder extends ProjectUpdater {
+
+ private static final PomFactory POM_FACTORY = PomFactory.eINSTANCE;
+ private final String groupId;
+ private final String artifactId;
+ private final String version;
+
+ public ParentAdder(String groupId, String artifactId, String version) {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ }
+
+ public void update(Model model) {
+ Parent parent = model.getParent();
+ if(parent==null) {
+ parent = POM_FACTORY.createParent();
+ parent.setArtifactId(artifactId);
+ parent.setGroupId(groupId);
+ parent.setVersion(version);
+ model.setParent(parent);
+ }
+ }
+ }
\ No newline at end of file
Added:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/internal/project/facet/MavenPostInstallListener.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,65 @@
+package org.jboss.tools.maven.seam.internal.project.facet;
+
+import java.util.Set;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+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.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+import
org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
+import org.jboss.tools.maven.seam.MavenSeamActivator;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
+
+public class MavenPostInstallListener implements IFacetedProjectListener {
+
+ private IDataModel m2FacetModel, seamFacetModel;
+ private boolean configured = false;
+
+ private static final String M2_FACET_MODEL_PROVIDER =
"org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider";
+ private static final String SEAM_FACET_MODEL_PROVIDER =
"org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider";
+ public void handleEvent(IFacetedProjectEvent event) {
+ IFacetedProject facetedProject = event.getProject();
+ Set<IProjectFacetVersion> projectFacets = facetedProject
+ .getProjectFacets();
+
+ boolean isSeamProject = false;
+ boolean isM2Project = false;
+ for (IProjectFacetVersion projectFacetVersion : projectFacets) {
+ IProjectFacet projectFacet = projectFacetVersion.getProjectFacet();
+ if (ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(projectFacet
+ .getId())) {
+ isSeamProject = true;
+ }
+ if (IJBossMavenConstants.M2_FACET_ID.equals(projectFacet.getId())) {
+ isM2Project = true;
+ }
+ }
+
+ IProjectFacetActionEvent actionEvent = (IProjectFacetActionEvent) event;
+ Object object = actionEvent.getActionConfig();
+ if (object instanceof IDataModel) {
+ IDataModel dataModel = (IDataModel) object;
+ if ( SEAM_FACET_MODEL_PROVIDER.equals(dataModel.getID())) {
+ seamFacetModel = dataModel;
+ }
+
+ if ( M2_FACET_MODEL_PROVIDER.equals(dataModel.getID()) ) {
+ m2FacetModel = dataModel;
+ }
+ }
+ if (!isSeamProject) {
+ configured = false;
+ }
+
+ if (isSeamProject && isM2Project && !configured) {
+ MavenSeamActivator.getDefault().configureSeamProject(seamFacetModel,m2FacetModel);
+ configured=true;
+ }
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/.classpath (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/.classpath 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/.project (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/.project 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,8 @@
+#Thu May 28 22:27:10 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF 2009-06-15 23:52:42
UTC (rev 15976)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Maven Integration
+Bundle-SymbolicName: org.jboss.tools.maven.ui; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.maven.ui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.wst.common.project.facet.ui,
+ org.eclipse.wst.common.frameworks.ui,
+ org.eclipse.core.resources,
+ org.jboss.tools.maven.core
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: JBoss, a division of Red Hat
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/about.html (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/about.html 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>JBoss Maven Integration</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Maven Integration</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/about.ini
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/about.ini (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/about.ini 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog
(translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which
the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/about.mappings
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/about.mappings
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/about.mappings 2009-06-15 23:52:42 UTC
(rev 15976)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/about.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/about.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/about.properties 2009-06-15 23:52:42 UTC
(rev 15976)
@@ -0,0 +1,2 @@
+blurb=JBoss Maven Integration\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss, a
division of Red Hat, contributors and others 2004 - 2009. All rights reserved.\nVisit
http\://jboss.org/tools
+
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties 2009-06-15 23:52:42 UTC
(rev 15976)
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ jboss_about.png,\
+ about.properties,\
+ about.mappings,\
+ about.ini,\
+ about.html
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.ui/jboss_about.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml (rev
0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2009-06-15 23:52:42 UTC (rev
15976)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+ <wizard-pages action="jboss.m2.install">
+ <page
class="org.jboss.tools.maven.ui.internal.project.facet.MavenFacetInstallPage"/>
+ </wizard-pages>
+ </extension>
+
+</plugin>
Added:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Activator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Activator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Activator.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,50 @@
+package org.jboss.tools.maven.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.ui";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/project/facet/MavenFacetInstallPage.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -0,0 +1,159 @@
+package org.jboss.tools.maven.ui.internal.project.facet;
+
+import java.util.Map;
+import java.util.SortedSet;
+
+import javax.swing.JButton;
+
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
+import org.eclipse.swt.SWT;
+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.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
+import org.eclipse.wst.common.project.facet.ui.IWizardContext;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+
+public class MavenFacetInstallPage extends DataModelWizardPage implements
+IFacetWizardPage {
+
+ private static final String SEAM_FACET_ID = "jst.seam";
+ private Text groupId;
+ private Text artifactId;
+ private Text version;
+ private Combo packaging;
+ public static final IProjectFacet SEAM_FACET =
ProjectFacetsManager.getProjectFacet(SEAM_FACET_ID);
+
+ public MavenFacetInstallPage() {
+ super(DataModelFactory.createDataModel(new AbstractDataModelProvider() {
+ }), "jboss.m2.facet.install.page"); //$NON-NLS-1$
+ setTitle("JBoss M2 capabilities");
+ setDescription("Add M2 capabilities to this Web Project");
+
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gd);
+
+ groupId = createField(composite,"Group Id:",IJBossMavenConstants.GROUP_ID);
+ artifactId = createField(composite, "Artifact Id:",
IJBossMavenConstants.ARTIFACT_ID);
+ String projectName =
getDataModel().getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
+ artifactId.setText(projectName);
+
+ version = createField(composite, "Version:", IJBossMavenConstants.VERSION);
+
+ Label packagingLabel = new Label(composite, SWT.NONE);
+ packagingLabel.setText("Packaging:");
+ packaging = new Combo(composite, SWT.READ_ONLY);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ packaging.setLayoutData(gd);
+ synchHelper.synchCombo(packaging, IJBossMavenConstants.PACKAGING, null);
+ // FIXME
+ String[] items = { "war","ear", "ejb", "jar"
};
+ packaging.setItems(items);
+ IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy)
getDataModel().getProperty(IFacetDataModelProperties.FACETED_PROJECT_WORKING_COPY);
+ if (fpwc.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
+ packaging.select(0);
+ } else if (fpwc.hasProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET)) {
+ packaging.select(1);
+ } else if (fpwc.hasProjectFacet(IJ2EEFacetConstants.EJB_FACET)) {
+ packaging.select(2);
+ } else {
+ packaging.select(3);
+ }
+
+ Text name = createField(composite, "Name:", IJBossMavenConstants.NAME);
+ name.setText(projectName);
+ createField(composite, "Description", IJBossMavenConstants.DESCRIPTION);
+
+ if (fpwc.hasProjectFacet(SEAM_FACET)) {
+ Text seamVersion = createField(composite, "Seam Maven version:",
IJBossMavenConstants.SEAM_MAVEN_VERSION);
+ IProjectFacetVersion seamFacetVersion = fpwc.getProjectFacetVersion(SEAM_FACET);
+ if ("2.0".equals(seamFacetVersion.getVersionString())) {
+ seamVersion.setText("2.0.2.SP1");
+ } else {
+ seamVersion.setText("2.1.1.GA");
+ }
+ Button removeWTPContainers = new Button(composite,SWT.CHECK);
+ removeWTPContainers.setText("Remove WTP Classpath containers");
+ synchHelper.synchCheckbox(removeWTPContainers,
IJBossMavenConstants.REMOVE_WTP_CLASSPATH_CONTAINERS, null);
+ // FIXME add the Validate button
+ }
+
+ validatePage();
+ return composite;
+ }
+
+ @Override
+ protected void validatePage() {
+ setErrorMessage(null);
+ if (groupId.getText().trim().length() <= 0) {
+ setErrorMessage("The groupId field is required.");
+ } else if (artifactId.getText().trim().length() <= 0) {
+ setErrorMessage("The artifactId field is required.");
+ } else if (version.getText().trim().length() <= 0) {
+ setErrorMessage("The version field is required.");
+ } else if (packaging.getText().trim().length() <= 0) {
+ setErrorMessage("The packaging field is required.");
+ }
+
+ }
+
+ private Text createField(Composite composite, String labelText,String property) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(labelText);
+ Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ text.setLayoutData(gd);
+ synchHelper.synchText(text, property, null);
+ return text;
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[0];
+ }
+
+ public void setConfig(Object config) {
+ model.removeListener(this);
+ synchHelper.dispose();
+
+ model = (IDataModel) config;
+ model.addListener(this);
+ synchHelper = initializeSynchHelper(model);
+ }
+
+ @Override
+ public void dispose() {
+ model.removeListener(this);
+ super.dispose();
+ }
+
+ public void setWizardContext(IWizardContext context) {
+
+ }
+ public void transferStateToConfig() {
+
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2009-06-15 23:50:20
UTC (rev 15975)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2009-06-15 23:52:42
UTC (rev 15976)
@@ -17,7 +17,7 @@
org.eclipse.wst.common.project.facet.core,
org.eclipse.jst.jsf.core,
org.apache.ant,
- org.eclipse.wst.validation,
+ org.eclipse.wst.validation;visibility:=reexport,
org.eclipse.jst.j2ee.web,
org.eclipse.jst.j2ee,
org.eclipse.jface.text,
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -30,6 +30,7 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
@@ -54,6 +55,8 @@
public static final String CA_SEAM_EL_IMAGE_PATH =
"images/ca/icons_Seam_EL.gif";
public static final String CA_SEAM_MESSAGES_IMAGE_PATH =
"images/ca/icons_Message_Bundles.gif";
+
+ static final String M2_FACET_ID = "jboss.m2"; //$NON-NLS-1$
/**
* The constructor
*/
@@ -324,5 +327,13 @@
}
return fImageDescRegistry;
}
+
+ public boolean hasM2Facet(IProject project) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, M2_FACET_ID);
+ } catch (CoreException e) {
+ return false;
+ }
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -48,6 +48,11 @@
* Seam 2.0 Facet Version constant
*/
String SEAM_FACET_VERSION_20 = "2.0"; //$NON-NLS-1$
+
+ /**
+ * Seam 2.1 Facet Version constant
+ */
+ String SEAM_FACET_VERSION_21 = "2.1"; //$NON-NLS-1$
// Seam Preferences names constants
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -30,6 +30,7 @@
import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.seam.core.SeamCorePlugin;
// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it
in our unittests!
public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate{
@@ -115,16 +116,22 @@
super.copyFilesToWarProject(project, fv, model, monitor);
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
if(isWarConfiguration(model)) {
- AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
+ if (!SeamCorePlugin.getDefault().hasM2Facet(project)) {
+ AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
+ }
final IContainer source = warActionSrcRootFolder.getUnderlyingFolder();
File actionsSrc = new File(project.getLocation().toFile(),
source.getFullPath().removeFirstSegments(1).toString());
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"),
actionsSrc, true); //$NON-NLS-1$
- AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
+ if (!SeamCorePlugin.getDefault().hasM2Facet(project)) {
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
+ }
} else {
- AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
+ if (!SeamCorePlugin.getDefault().hasM2Facet(project)) {
+ AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
+ }
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -102,9 +102,11 @@
StringBuffer testLibraries = new StringBuffer();
- for (String file : allLibs) {
- testLibraries.append("\t<classpathentry kind=\"lib\"
path=\"lib/" + file + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject)) {
+ for (String file : allLibs) {
+ testLibraries.append("\t<classpathentry kind=\"lib\"
path=\"lib/" + file + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
StringBuffer requiredProjects = new StringBuffer();
requiredProjects.append(
@@ -183,16 +185,14 @@
}
}
- AntCopyUtils.copyFiles(
- new File(seamRuntime.getHomeDir(), "lib"), //$NON-NLS-1$
- testLibDir,
- new AntCopyUtils.FileSetFileFilter(includeLibs));
+ if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject)) {
+ AntCopyUtils.copyFiles(new File(seamRuntime.getHomeDir(), "lib"),
//$NON-NLS-1$
+ testLibDir, new AntCopyUtils.FileSetFileFilter(includeLibs));
- //seam2 has a lib/test
- AntCopyUtils.copyFiles(
- new File(seamRuntime.getHomeDir(), "lib/test"), //$NON-NLS-1$
- testLibDir,
- new AntCopyUtils.FileSetFileFilter(includeLibs));
+ // seam2 has a lib/test
+ AntCopyUtils.copyFiles(new File(seamRuntime.getHomeDir(), "lib/test"),
//$NON-NLS-1$
+ testLibDir, new AntCopyUtils.FileSetFileFilter(includeLibs));
+ }
SeamFacetAbstractInstallDelegate.createComponentsProperties(testSrcDir, "",
true); //$NON-NLS-1$
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -267,7 +267,7 @@
* @param model
* @return
*/
- static boolean isWarConfiguration(IDataModel model) {
+ public static boolean isWarConfiguration(IDataModel model) {
return
ISeamFacetDataModelProperties.DEPLOY_AS_WAR.equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -222,6 +222,9 @@
* @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
*/
public boolean accept(File dir, String name) {
+ if (SeamCorePlugin.getDefault().hasM2Facet(seamWebProject)) {
+ return false;
+ }
return name.lastIndexOf(".jar") > 0; //$NON-NLS-1$
}
});
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-06-15
23:50:20 UTC (rev 15975)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-06-15
23:52:42 UTC (rev 15976)
@@ -25,9 +25,13 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
@@ -69,6 +73,7 @@
import org.eclipse.wst.server.core.IServerLifecycleListener;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.ui.ServerUIUtil;
+import org.eclipse.wst.validation.internal.operations.ValidationBuilder;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.tools.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -277,17 +282,24 @@
IProject ejbProject = null;
List<IProject> projects = new ArrayList<IProject>();
+ String parentProjectName = warProject.getName() + "-parent";
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject parentProject = wsRoot.getProject(parentProjectName);
+ if (parentProject != null && parentProject.exists()) {
+ projects.add(parentProject);
+ }
// build projects. We need to build it before publishing on server.
+ projects.add(warProject);
if(deployAsEar) {
String ejbProjectName =
model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT);
String earProjectName =
model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT);
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+
earProject = wsRoot.getProject(earProjectName);
ejbProject = wsRoot.getProject(ejbProjectName);
+ projects.add(ejbProject);
projects.add(earProject);
- projects.add(ejbProject);
}
- projects.add(warProject);
+
if(ejbProject != null) {
provideClassPath(projects, ejbProject);
@@ -307,7 +319,7 @@
String configFolder = jbs.getConfigDirectory();
AntCopyUtils.copyFiles(driverJars, new File(configFolder, "lib"), false);
}
-
+
RegistrationHelper.runRegisterInServerJob(warProject, server);
IPath filePath = new Path("resources").append(warProject.getName() +
"-ds.xml");