[jbosstools-commits] JBoss Tools SVN: r43184 - in trunk/cdi/plugins/org.jboss.tools.cdi.gen: .settings and 13 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Aug 22 21:11:25 EDT 2012


Author: scabanovich
Date: 2012-08-22 21:11:24 -0400 (Wed, 22 Aug 2012)
New Revision: 43184

Added:
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/.classpath
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/.project
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/.settings/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/.settings/org.eclipse.jdt.core.prefs
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/META-INF/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/META-INF/MANIFEST.MF
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/about.html
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/build.properties
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/images/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/images/cdi16.png
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.properties
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.xml
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/pom.xml
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIGenPlugin.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIProjectGenerator.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenEngine.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenMessages.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/messages.properties
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotation.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotationReference.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenClass.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenField.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenInterface.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenMember.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenProject.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenQualifier.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenType.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/ui/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/ui/GenProjectHandler.java
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/target/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.classpath
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.project
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/beans.xml
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/cdi-api.jar
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/javax.inject.jar
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-api.jar
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-core.jar
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-se.jar
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-servlet.jar
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/src/
   trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/src/Q.java
Log:
JBIDE-12446
https://issues.jboss.org/browse/JBIDE-12446
Initial implementation of plugin that allows to generate random CDI projects.

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/.classpath
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/.classpath	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/.classpath	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/.project
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/.project	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/.project	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.jboss.tools.cdi.gen</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>
+		<buildCommand>
+			<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+	</natures>
+</projectDescription>


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/.settings/org.eclipse.jdt.core.prefs	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/META-INF/MANIFEST.MF	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,38 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Context and Dependency Injection Core
+Bundle-SymbolicName: org.jboss.tools.cdi.gen;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.jboss.tools.cdi.gen.CDIGenPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.jboss.tools.common,
+ org.eclipse.jdt.core;bundle-version="3.7.0",
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.jboss.tools.common.model,
+ org.jboss.tools.common.model.ui,
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
+ org.eclipse.wst.common.modulecore;bundle-version="1.2.100",
+ org.eclipse.wst.common.frameworks;bundle-version="1.2.0",
+ org.eclipse.wst.validation;bundle-version="1.2.300",
+ org.eclipse.jst.j2ee;bundle-version="1.1.500",
+ org.jboss.tools.jst.web.kb,
+ org.jboss.tools.common.el.core,
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
+ org.eclipse.jface.text;bundle-version="3.7.0",
+ org.eclipse.equinox.preferences;bundle-version="3.4.0",
+ org.eclipse.wst.sse.core;bundle-version="1.1.600",
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.apache.ant;bundle-version="1.7.1",
+ org.jboss.tools.jst.web,
+ org.jboss.tools.common.validation,
+ org.jboss.tools.cdi.core,
+ org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.jboss.tools.common.ui,
+ org.apache.velocity;bundle-version="1.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: JBoss by Red Hat
+Export-Package: org.jboss.tools.cdi.gen
+


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/about.html
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/about.html	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/about.html	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>&copy;2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this plug-in 
+("Content"). Unless otherwise indicated below, the Content is provided to you 
+under the terms and conditions of the Eclipse Public License Version 1.0 
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. 
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the 
+Content is being redistributed by another party ("Redistributor") and different 
+terms and conditions may apply to your use of any object code in the Content. 
+Check the Redistributor's license that was provided with the Content. If no such 
+license exists, contact the Redistributor. Unless otherwise indicated below, the 
+terms and conditions of the EPL still apply to any source code in the Content 
+and such source code may be obtained at
+  <A href="http://www.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/about.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/build.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/build.properties	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/build.properties	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,16 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               images/,\
+               plugin.properties,\
+               about.html,\
+               templates/
+src.includes = src/,\
+               plugin.xml,\
+               about.html,\
+               images/,\
+               plugin.properties,\
+               META-INF/,\
+               build.properties


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/images/cdi16.png
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/images/cdi16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.properties	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.properties	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,5 @@
+KBProblemName=CDI Problem
+
+KB_REQUIRED_FOR_CDI=CDI
+CDICoreValidator=CDI Core Validator
+CDIELValidationDelegate=CDI EL Validator
\ No newline at end of file


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.xml	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.xml	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+<extension
+      point="org.eclipse.ui.commands">
+      <command
+            id="org.jboss.tools.cdi.gen.command1"
+            categoryId="org.eclipse.ui.category.file"
+            name="Generate CDI Project"
+            defaultHandler="org.jboss.tools.cdi.gen.ui.GenProjectHandler"
+            >
+      </command>      
+</extension>
+
+<extension
+      point="org.eclipse.ui.popupMenus">
+		<objectContribution
+			id="org.jboss.tools.cdi.gen.gp"
+			objectClass="org.eclipse.core.resources.IResource"
+			adaptable="true">
+
+			<action
+				id="org.jboss.tools.cdi.gen.ui.GenProjectHandler"
+				label="Generate CDI Project"
+				class="org.jboss.tools.cdi.gen.ui.GenProjectHandler"
+				enablesFor="1"
+				menubarPath="org.eclipse.ui.projectConfigure/additions"/>
+
+		</objectContribution>
+
+</extension>
+</plugin>


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/pom.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/pom.xml	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/pom.xml	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion> 
+	<parent>
+		<groupId>org.jboss.tools.cdi</groupId>
+		<artifactId>plugins</artifactId>
+		<version>1.3.0-SNAPSHOT</version>
+	</parent>
+	<groupId>org.jboss.tools.cdi.plugins</groupId>
+	<artifactId>org.jboss.tools.cdi.gen</artifactId> 
+	
+	<packaging>eclipse-plugin</packaging>
+</project>


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIGenPlugin.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIGenPlugin.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIGenPlugin.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,56 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.common.log.BaseUIPlugin;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CDIGenPlugin extends BaseUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.jboss.tools.cdi.gen";
+
+	public static final String CA_CDI_EL_IMAGE_PATH = "images/ca/icons_CDI_EL.gif";
+
+	// The shared instance
+	private static CDIGenPlugin plugin;
+
+	/**
+	 * The constructor
+	 */
+	public CDIGenPlugin() {
+		plugin = this;
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static CDIGenPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIGenPlugin.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIProjectGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIProjectGenerator.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIProjectGenerator.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,188 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.cdi.gen.model.GenAnnotation;
+import org.jboss.tools.cdi.gen.model.GenAnnotationReference;
+import org.jboss.tools.cdi.gen.model.GenClass;
+import org.jboss.tools.cdi.gen.model.GenField;
+import org.jboss.tools.cdi.gen.model.GenInterface;
+import org.jboss.tools.cdi.gen.model.GenProject;
+import org.jboss.tools.cdi.gen.model.GenQualifier;
+import org.jboss.tools.cdi.gen.model.GenType;
+import org.jboss.tools.common.zip.UnzipOperation;
+import org.osgi.framework.Bundle;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class CDIProjectGenerator {
+	GenProject project = new GenProject();
+	File workspaceLocation;
+	
+	Random seed = new Random();
+
+	int packageCount = 50;
+	int interfaceCount = 50;
+	int qualifierCount = 50;
+	int classCount = 300;
+	int injectionsPerClassCount = 20;
+	
+	public CDIProjectGenerator() {}
+
+	public void setWorkspaceLocation(File workspaceLocation) {
+		this.workspaceLocation = workspaceLocation;
+	}
+
+	public void generate() {
+		project.setName("GeneratedProject");
+		createPackages();
+		createTypes();
+		//TODO
+		project.flush(workspaceLocation);
+	}
+
+	void createPackages() {
+		Set<String> pkgs = new HashSet<String>();
+		
+		for (int i = 0; i < packageCount; i++) {
+			StringBuffer sb = new StringBuffer("org.jboss.cdi.gen");
+			int j = 1;
+			for (; j < 5; j++) {
+				String pn = "pack" + j + "" + (seed.nextInt(3) + 1);
+				sb.append(".").append(pn);
+			}
+			while(pkgs.contains(sb.toString())) {
+				String pn = "pack" + j + "" + (seed.nextInt(3) + 1);
+				sb.append(".").append(pn);
+				j++;
+			}
+			pkgs.add(sb.toString());
+		}
+		
+		project.setPackages(pkgs);
+	}
+
+	void createTypes() {
+		GenInterface[] interfaces = new GenInterface[interfaceCount];
+		for (int i = 0; i < interfaceCount; i++) {
+			String name = "MyInterface" + i;
+			GenInterface type = new GenInterface();
+			type.setPackageName(getRandomPackage());
+			type.setTypeName(name);
+			project.addType(type);
+			interfaces[i] = type;
+		}
+		GenQualifier[] qualifiers = new GenQualifier[qualifierCount];
+		for (int i = 0; i < qualifierCount; i++) {
+			String name = "MyQualifier" + i;
+			GenQualifier type = new GenQualifier();
+			type.setPackageName(getRandomPackage());
+			type.setTypeName(name);
+			
+			project.addType(type);
+			qualifiers[i] = type;
+		}
+		GenClass[] classes = new GenClass[classCount];
+		for (int i = 0; i < classCount; i++) {
+			String name = "MyBean" + i;
+			GenClass type = new GenClass();
+			type.setPackageName(getRandomPackage());
+			type.setTypeName(name);
+			GenQualifier q = qualifiers[seed.nextInt(qualifierCount)];
+			type.addQualifierAnnotation(q, "qvalue" + i);
+			classes[i] = type;
+			
+			project.addType(type);
+		}
+		for (int i = classes.length - 1; i > 0; i--) {
+			int j = seed.nextInt(i);
+			GenClass c = classes[i];
+			classes[i] = classes[j];
+			classes[j] = c;
+		}
+		for (int i = 0; i < classes.length; i++) {
+			int j = seed.nextInt(classes.length);
+			if(i != j && (classes[j].getExtendedType() != null || !classes[j].getImplementedTypes().isEmpty())) {
+				classes[i].setExtendedType(classes[j]);
+			} else {
+				j = seed.nextInt(interfaceCount);
+				classes[i].addImplementedType(interfaces[j]);
+			}
+		}
+		
+		//Injections
+		GenAnnotation injectType = new GenAnnotation();
+		injectType.setPackageName("javax.inject");
+		injectType.setTypeName("Inject");
+		GenAnnotationReference inject = new GenAnnotationReference();
+		inject.setAnnotation(injectType);
+		for (int i = 0; i < classes.length; i++) {
+			for (int j = 0; j < injectionsPerClassCount; j++) {
+				GenField f = new GenField();
+				f.setName("f" + j);
+				f.addAnnotation(inject);
+				GenClass c = classes[seed.nextInt(classes.length)];
+				for (GenAnnotationReference q: c.getQualifiers()) {
+					f.addAnnotation(q);
+				}
+				while(c.getExtendedType() != null) c = c.getExtendedType();
+				GenType type = c;
+				if(!c.getImplementedTypes().isEmpty() && seed.nextFloat() < 0.6f) type = c.getImplementedTypes().get(0);
+				f.setType(type);
+				classes[i].addField(f);
+			}
+		}
+	}
+
+	private String getRandomPackage() {
+		return project.getPackages().get(seed.nextInt(project.getPackages().size()));
+	}
+
+	private static File TEMPLATE_FOLDER;
+
+	public static File getTemplatesFolder() throws IOException {
+		if(TEMPLATE_FOLDER==null) {
+			File templatesDir = null;
+			if(CDIGenPlugin.getDefault() != null) {
+				Bundle bundle = CDIGenPlugin.getDefault().getBundle();
+				String version = bundle.getVersion().toString();
+				IPath stateLocation = Platform.getStateLocation(bundle);
+				templatesDir = FileLocator.getBundleFile(bundle);
+				if(templatesDir.isFile()) {
+					File toCopy = new File(stateLocation.toFile(),version);
+					if(!toCopy.exists()) {
+						toCopy.mkdirs();
+						UnzipOperation unZip = new UnzipOperation(templatesDir.getAbsolutePath());
+						unZip.execute(toCopy,"templates.*");
+					}
+					templatesDir = toCopy;
+				}
+			} else {
+				templatesDir = new File("").getAbsoluteFile();
+			}
+			TEMPLATE_FOLDER = new File(templatesDir,"templates");
+		}
+		return TEMPLATE_FOLDER;
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/CDIProjectGenerator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenEngine.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenEngine.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenEngine.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,80 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenEngine {
+
+	static GenEngine instance = new GenEngine();
+
+	public static GenEngine getInstance() {
+		return instance;
+	}
+
+	public void executeTemplate(File sourceDir, File sourceFile, File targetFile, Map<String, Object> parameters) throws Exception {
+		if(!sourceFile.exists()) return;
+		
+		ClassLoader c = Thread.currentThread().getContextClassLoader();
+		Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+		try {
+
+		Properties properties = new Properties();
+		properties.put("file.resource.loader.path", sourceDir.getCanonicalPath()); //$NON-NLS-1$
+		String logFileName = Platform.getLocation().append(".metadata").append(".plugins").append(CDIGenPlugin.PLUGIN_ID).append("velocity.log").toFile().getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		properties.put("runtime.log", logFileName); //$NON-NLS-1$
+
+		Velocity.init(properties);
+
+		VelocityContext context = new VelocityContext(parameters);
+
+		File file = targetFile;
+		if (file.exists()) {
+			if (!file.delete()) {
+				throw new RuntimeException("Unable to delete file "+file.getAbsolutePath()); //$NON-NLS-1$
+			}
+		}
+		File folder = file.getParentFile();
+		folder.mkdirs();
+		if (!folder.exists() || !folder.isDirectory()) {
+			throw new RuntimeException("Unable to create folder "+folder.getAbsolutePath()); //$NON-NLS-1$
+		}
+		Writer writer = new BufferedWriter(new FileWriter(file));
+		Reader reader = new BufferedReader(new FileReader(sourceFile));
+
+		Velocity.evaluate(context, writer, "", reader); //$NON-NLS-1$
+
+		writer.flush();
+		writer.close();
+
+		} finally {
+			Thread.currentThread().setContextClassLoader(c);
+		}
+	}
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenMessages.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenMessages.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,34 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.jboss.tools.cdi.gen.messages";//$NON-NLS-1$
+	static {
+		// load message values from bundle file
+		NLS.initializeMessages(BUNDLE_NAME, GenMessages.class);		
+	}
+	private static ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
+	public static ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+	
+	public static String ERROR;
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/GenMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/messages.properties	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/messages.properties	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,12 @@
+WARNING=Warning
+OK=Ok
+DELETE=Delete 
+YES=Yes
+NO=No
+ERROR=Error
+FINISH=Finish
+RETRY=Retry
+CANCEL=Cancel
+ADD=Add 
+UP=Up
+DOWN=Down


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotation.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotation.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotation.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,20 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenAnnotation extends GenType {
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotation.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotationReference.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotationReference.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotationReference.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,53 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenAnnotationReference {
+	String packageName;
+	String typeName;
+	Map<String, Object> values = new HashMap<String, Object>();
+	
+	public GenAnnotationReference() {		
+	}
+
+	public void setAnnotation(GenAnnotation type) {
+		packageName = type.getPackageName();
+		typeName = type.getTypeName();
+	}
+
+	public String getPackageName() {
+		return packageName;
+	}
+
+	public String getTypeName() {
+		return typeName;
+	}
+
+	public Map<String, Object> getValues() {
+		return values;
+	}
+
+	public void setValue(String name, Object value) {
+		values.put(name, value);
+	}
+
+	public String getFullyQualifiedName() {
+		return getPackageName() + "." + getTypeName();
+	}
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenAnnotationReference.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenClass.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenClass.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenClass.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,113 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenClass extends GenType {
+	GenClass extendedType;
+	List<GenInterface> implementedTypes = new ArrayList<GenInterface>();
+	Set<GenAnnotationReference> qualifierAnnotations = new HashSet<GenAnnotationReference>();
+	List<GenField> fields = new ArrayList<GenField>();
+	
+	public GenClass() {}
+	
+	public void setExtendedType(GenClass extendedType) {
+		this.extendedType = extendedType;
+		addImport(extendedType.getFullyQualifiedName());
+	}
+
+	public void addImplementedType(GenInterface implementedType) {
+		if(!implementedTypes.contains(implementedType)) {
+			implementedTypes.add(implementedType);
+			addImport(implementedType.getFullyQualifiedName());
+		}
+	}
+
+	public GenClass getExtendedType() {
+		return extendedType;
+	}
+
+	public List<GenInterface> getImplementedTypes() {
+		return implementedTypes;
+	}
+
+	public void addQualifierAnnotation(GenQualifier q, String value) {
+		addImport(q.getFullyQualifiedName());
+		
+		GenAnnotationReference a = new GenAnnotationReference();
+		a.setAnnotation(q);
+		
+
+		if(value != null) {
+			a.getValues().put("value", "\"" + value + "\"");
+		}
+		
+		addAnnotation(a);
+		qualifierAnnotations.add(a);
+	}
+
+	public Set<GenAnnotationReference> getQualifiers() {
+		return qualifierAnnotations;
+	}
+
+	public void addField(GenField f) {
+		fields.add(f);
+		addImport(f.getType().getFullyQualifiedName());
+		for (GenAnnotationReference a: f.getAnnotations()) {
+			addImport(a.getFullyQualifiedName());
+		}
+	}
+
+	public void flush(StringBuilder sb) {
+		sb.append("package ").append(getPackageName()).append(";\n\n");
+		//imports
+		for (String i: imports) {
+			sb.append("import ").append(i).append(";\n");
+		}
+		sb.append("\n");
+		//annotations
+		flushAnnotations(sb);
+		//header
+		sb.append("public class ").append(getTypeName());
+		if(extendedType != null) {
+			sb.append(" extends ").append(extendedType.getTypeName());
+		}
+		int imported = 0;
+		for (GenInterface in: implementedTypes) {
+			if(imported == 0) {
+				sb.append(" implements ");
+			} else {
+				sb.append(", ");
+			}
+			imported++;
+			sb.append(in.getTypeName());
+		}
+		sb.append(" {\n");
+		
+		for (GenField f: fields) {
+			f.flush(sb);
+			sb.append("\n");
+		}
+		//TODO body
+		
+		sb.append("}");
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenClass.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenField.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenField.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenField.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,36 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenField extends GenMember {
+	GenType type;
+	
+	public GenField() {}
+
+	public void setType(GenType type) {
+		this.type = type;
+	}
+
+	public GenType getType() {
+		return type;
+	}
+
+	public void flush(StringBuilder sb) {
+		flushAnnotations(sb);
+		sb.append("protected ");
+		sb.append(type.getTypeName()).append(" ").append(getName()).append(";\n");
+	}
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenInterface.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenInterface.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenInterface.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,20 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenInterface extends GenType {
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenInterface.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenMember.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenMember.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenMember.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,61 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenMember {
+	protected Set<GenAnnotationReference> annotations = new HashSet<GenAnnotationReference>();
+	String name;
+
+	public GenMember() {}
+
+	public void addAnnotation(GenAnnotationReference annotation) {
+		annotations.add(annotation);
+	}
+	
+	public Set<GenAnnotationReference> getAnnotations() {
+		return annotations;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void flushAnnotations(StringBuilder sb) {
+		for (GenAnnotationReference a: getAnnotations()) {
+			sb.append("@").append(a.getTypeName());
+			Map<String, Object> vs = a.getValues();
+			if(!vs.isEmpty()) {
+				sb.append("(");
+				if(vs.size() == 1 && vs.containsKey("value")) {
+					sb.append(vs.get("value"));
+				} else {
+					//TODO
+				}
+				sb.append(")");
+			}
+			sb.append("\n");
+		}
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenMember.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenProject.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenProject.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,116 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.cdi.gen.CDIProjectGenerator;
+import org.jboss.tools.cdi.gen.GenEngine;
+import org.jboss.tools.common.util.FileUtil;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenProject {
+	String name;
+	List<String> packages = new ArrayList<String>();
+	Map<String, GenType> allTypes = new HashMap<String, GenType>();
+	
+
+	public GenProject() {
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public List<String> getPackages() {
+		return packages;
+	}
+
+	public void setPackages(Set<String> pkgs) {
+		packages.addAll(pkgs);
+	}
+
+	public void addType(GenType type) {
+		allTypes.put(type.getFullyQualifiedName(), type);
+	}
+
+	public void flush(File workspaceLocation) {		
+		File templates;
+		try {
+			templates = CDIProjectGenerator.getTemplatesFolder();
+		} catch (IOException e) {
+			e.printStackTrace();
+			return;
+		}
+		File projectLocation = new File(workspaceLocation, name);
+		if(projectLocation.exists()) {
+			FileUtil.clear(projectLocation);
+		} else {
+			projectLocation.mkdirs();
+		}
+		flushProjectFile(projectLocation);
+		FileUtil.copyDir(new File(templates, "lib"), new File(projectLocation, "lib"), true);
+		FileUtil.copyFile(new File(templates, ".classpath"), new File(projectLocation, ".classpath"));
+		new File(projectLocation, "src").mkdirs();
+
+		for (GenType type: allTypes.values()) {
+			String path = "src/" + type.getPackageName().replace('.', '/') + "/" + type.getTypeName() + ".java";
+			File f = new File(projectLocation, path);
+			f.getParentFile().mkdirs();
+			if(type instanceof GenInterface) {
+				String content = "package " + type.getPackageName() + ";\n";
+				content += "public interface " + type.getTypeName() + " {\n" + "}";
+				FileUtil.writeFile(f, content);
+			} else if(type instanceof GenQualifier) {
+				flushQualifier(f, templates, (GenQualifier)type);
+			} else if(type instanceof GenClass) {
+				StringBuilder content = new StringBuilder();
+				((GenClass)type).flush(content);
+				FileUtil.writeFile(f, content.toString());
+			}
+		}
+		//TODO
+	}
+
+	void flushProjectFile(File projectLocation) {
+		Map<String, Object> parameters = new HashMap<String, Object>();
+		parameters.put("projectName", getName());
+		try {
+			GenEngine.getInstance().executeTemplate(CDIProjectGenerator.getTemplatesFolder(), new File(CDIProjectGenerator.getTemplatesFolder(), ".project"), new File(projectLocation, ".project"), parameters);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	void flushQualifier(File targetFile, File templates, GenQualifier type) {
+		Map<String, Object> parameters = new HashMap<String, Object>();
+		parameters.put("type", type);
+		try {
+			GenEngine.getInstance().executeTemplate(templates, new File(templates, "src/Q.java"), targetFile, parameters);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenProject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenQualifier.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenQualifier.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenQualifier.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,24 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenQualifier extends GenAnnotation {
+
+	public GenQualifier() {
+		addImport(QUALIFIER_ANNOTATION_TYPE_NAME);
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenQualifier.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenType.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenType.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenType.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,54 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDIConstants;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenType extends GenMember implements CDIConstants {
+	Set<String> imports = new HashSet<String>();
+	String packageName;
+
+	public GenType() {
+	}
+
+	public void setPackageName(String packageName) {
+		this.packageName = packageName;
+	}
+
+	public String getPackageName() {
+		return packageName;
+	}
+
+	public void setTypeName(String typeName) {
+		setName(typeName);
+	}
+
+	public String getTypeName() {
+		return getName();
+	}
+
+	public String getFullyQualifiedName() {
+		return getPackageName() + "." + getName();
+	}
+
+	public void addImport(String type) {
+		imports.add(type);
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/model/GenType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/ui/GenProjectHandler.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/ui/GenProjectHandler.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/ui/GenProjectHandler.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,42 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.cdi.gen.ui;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.cdi.gen.CDIProjectGenerator;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenProjectHandler implements IObjectActionDelegate {
+
+	@Override
+	public void run(IAction action) {
+		CDIProjectGenerator g = new CDIProjectGenerator();
+		g.setWorkspaceLocation(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile());
+		g.generate();
+	}
+
+	@Override
+	public void selectionChanged(IAction action, ISelection selection) {
+	}
+
+	@Override
+	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+	}
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/src/org/jboss/tools/cdi/gen/ui/GenProjectHandler.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.classpath
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.classpath	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.classpath	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="lib/cdi-api.jar"/>
+	<classpathentry kind="lib" path="lib/javax.inject.jar"/>
+	<classpathentry kind="lib" path="lib/weld-api.jar"/>
+	<classpathentry kind="lib" path="lib/weld-core.jar"/>
+	<classpathentry kind="lib" path="lib/weld-se.jar"/>
+	<classpathentry kind="lib" path="lib/weld-servlet.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.project
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.project	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.project	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>$projectName</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.jboss.tools.cdi.core.cdibuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.jboss.tools.cdi.core.cdinature</nature>
+		<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+	</natures>
+</projectDescription>


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/beans.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/beans.xml	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/beans.xml	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd">
+    
+</beans>
\ No newline at end of file


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/beans.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/cdi-api.jar
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/cdi-api.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/javax.inject.jar
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/javax.inject.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-api.jar
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-api.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-core.jar
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-core.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-se.jar
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-se.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-servlet.jar
===================================================================
(Binary files differ)


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/lib/weld-servlet.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/src/Q.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/src/Q.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/src/Q.java	2012-08-23 01:11:24 UTC (rev 43184)
@@ -0,0 +1,23 @@
+package $type.packageName;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Qualifier
+ at Target({ TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+public @interface $type.typeName {
+
+	public String value() default "";
+
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.gen/templates/src/Q.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list