You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2007/12/20 08:49:21 UTC

svn commit: r605823 [1/2] - in /openejb/trunk/sandbox/openejb-eclipse-plugin: assembly/ eclipse/ features/org.apache.openejb.feature/ plugins/ plugins/org.apache.openejb.helper.annotation/ plugins/org.apache.openejb.helper.annotation/META-INF/ plugins/...

Author: jlaskowski
Date: Wed Dec 19 23:49:19 2007
New Revision: 605823

URL: http://svn.apache.org/viewvc?rev=605823&view=rev
Log:
OPENEJB-674 A basic eclipse plugin for OpenEJB

Contributed by: Jonathan Gallimore

Modified:
    openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/pom.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/maven-eclipse.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/maven-eclipse.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/IJavaProjectAnnotationFacade.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JavaProjectAnnotationFacade.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/OpenEjbXmlConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationWizard.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/maven-eclipse.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/pom.xml

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/pom.xml?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/pom.xml Wed Dec 19 23:49:19 2007
@@ -1,70 +1,127 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<project>
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.openejb</groupId>
-    <artifactId>assembly</artifactId>
-    <packaging>pom</packaging>
-    <name>${artifactId}</name>
-    <version>1.0.0</version>
-    <parent>
-        <groupId>org.apache.openejb</groupId>
-        <artifactId>eclipse-plugins</artifactId>
-        <version>1.0.0</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <finalName>openejb-eclipse-plugin-${version}-SNAPSHOT</finalName>
-                    <descriptors>
-                        <descriptor>src/main/assembly/deployable.xml</descriptor>
-                        <descriptor>src/main/assembly/updatesite.xml</descriptor>
-                    </descriptors>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attached</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>org.apache.openejb.helper.annotation</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>org.eclipse.jst.server.generic.openejb</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>org.apache.openejb.feature</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-    </dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.openejb</groupId>
+    <artifactId>assembly</artifactId>
+    <packaging>pom</packaging>
+    <name>${artifactId}</name>
+    <version>1.0.0</version>
+    <parent>
+        <groupId>org.apache.openejb</groupId>
+        <artifactId>eclipse-plugins</artifactId>
+        <version>1.0.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <finalName>openejb-eclipse-plugin-${version}-SNAPSHOT</finalName>
+                    <descriptors>
+                        <descriptor>src/main/assembly/deployable.xml</descriptor>
+                        <descriptor>src/main/assembly/updatesite.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attached</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+	    <plugin>
+		<artifactId>maven-dependency-plugin</artifactId>
+		<executions>
+			<execution>
+				<id>copy</id>
+				<phase>integration-test</phase>
+				<goals>
+					<goal>copy</goal>
+				</goals>
+				<configuration>
+					<outputDirectory>${settings.localRepository}/eclipse/eclipse/plugins</outputDirectory>
+					<overWriteSnapshots>
+						true
+					</overWriteSnapshots>
+					<artifactItems>
+						<artifactItem>
+						    <groupId>org.apache.openejb</groupId>
+						    <artifactId>org.apache.openejb.helper.annotation</artifactId>
+						    <version>1.0.0</version>
+						</artifactItem>
+						<artifactItem>
+						    <groupId>org.apache.openejb</groupId>
+						    <artifactId>org.apache.openejb.helper.annotation.test</artifactId>
+						    <version>1.0.0</version>
+						</artifactItem>
+					</artifactItems>
+				</configuration>
+			</execution>
+		</executions>
+	</plugin>
+	    <plugin>
+	    <artifactId>maven-antrun-plugin</artifactId>
+	    <executions>
+		<execution>
+		    <id>test</id>
+		    <phase>integration-test</phase>
+		    <configuration>
+			<tasks>
+				<echo message="Running tests..."/>
+				<property name="LOCAL_M2_REPO" value="${settings.localRepository}" />
+				<property name="java.home" value="${java.home}" />
+				<ant antfile="${basedir}/test.xml">
+					<target name="run"></target>
+				</ant>
+			</tasks>
+		    </configuration>
+		    <goals>
+			<goal>run</goal>
+		    </goals>
+		</execution>
+	    </executions>
+	</plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>org.apache.openejb.helper.annotation</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>org.eclipse.jst.server.generic.openejb</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>org.apache.openejb.feature</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+	<dependency>
+	    <groupId>org.apache.openejb</groupId>
+	    <artifactId>org.apache.openejb.helper.annotation.test</artifactId>
+	    <version>1.0.0</version>
+	</dependency>
+    </dependencies>
+</project>

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml Wed Dec 19 23:49:19 2007
@@ -22,7 +22,7 @@
 <project name="EuropaArtifacts">
 
     <target name="init">
-        <property name="europa_drop"    value="R-3.3.1-200709211145"/>
+        <property name="europa_drop"    value="R-3.3.1.1-200710231652"/>
         <property name="dtp_drop"       value="1.5"/>
         <property name="emf_drop"       value="2.3.1/R200709252135"/>
         <property name="gef_drop"       value="R-3.3.1-200709241000"/>
@@ -32,15 +32,16 @@
         <property name="europa_win32_url"   value="${base_url}/eclipse/downloads/drops/${europa_drop}/"/>
         <property name="europa_linux_url"   value="${base_url}/eclipse/downloads/drops/${europa_drop}/"/>
         <property name="europa_macos_url"   value="${base_url}/eclipse/downloads/drops/${europa_drop}/"/>
+	<property name="testing_url"   value="${base_url}/eclipse/downloads/drops/${europa_drop}/"/>
 
         <property name="dtp_download_url"   value="${base_url}/datatools/downloads/${dtp_drop}/"/>
         <property name="emf_download_url"   value="${base_url}/modeling/emf/emf/downloads/drops/${emf_drop}/"/>
         <property name="gef_download_url"   value="${base_url}/tools/gef/downloads/drops/${gef_drop}/"/>
         <property name="wtp_download_url"   value="${base_url}/webtools/downloads/drops/R2.0/${wtp_drop}/"/>
 
-        <property name="europa_jee_win32"       value="eclipse-SDK-3.3.1-win32.zip"/>
-        <property name="europa_jee_linux"       value="eclipse-SDK-3.3.1-linux-gtk.tar"/>
-        <property name="europa_jee_macos"       value="eclipse-SDK-3.3.1-macosx-carbon.tar"/>
+        <property name="europa_jee_win32"       value="eclipse-SDK-3.3.1.1-win32.zip"/>
+        <property name="europa_jee_linux"       value="eclipse-SDK-3.3.1.1-linux-gtk.tar"/>
+        <property name="europa_jee_macos"       value="eclipse-SDK-3.3.1.1-macosx-carbon.tar"/>
         <property name="europa_jee_linux_gz"    value="${europa_jee_linux}.gz"/>
         <property name="europa_jee_macos_gz"    value="${europa_jee_macos}.gz"/>
 
@@ -48,6 +49,7 @@
         <property name="emf_sdo"    value="emf-sdo-xsd-SDK-2.3.1.zip"/>
         <property name="gef_sdk"    value="GEF-SDK-3.3.1.zip"/>
         <property name="wtp_sdk"    value="wtp-sdk-${wtp_drop}.zip"/>
+	<property name="testing"    value="eclipse-test-framework-3.3.1.1.zip"/>
 
         <property name="protocol"   value="&amp;r=1&amp;protocol=http"/>
     </target>
@@ -103,7 +105,8 @@
         <antcall target="dtp"/>  
         <antcall target="emf"/> 
         <antcall target="gef"/>  
-        <antcall target="wtp"/>  
+        <antcall target="wtp"/>
+	<antcall target="test-api"/>
     </target>
 
     <target name="dtp" depends="init" description="Download Data Tools Platform (DTP) artifact">
@@ -121,6 +124,22 @@
                dest="${LOCAL_M2_REPO}/eclipse"/>
     </target>
 
+    <target name="test-api" depends="init" description="Download Eclipse Test framework">
+        <echo>-----------------------------------------</echo>
+        <echo>Downloading ${testing_url}${testing}</echo>
+        <echo>-----------------------------------------</echo>
+        <mkdir dir="${LOCAL_M2_REPO}/org/eclipse/eclipse/3.3"/>
+        <get src="${testing_url}${testing}${protocol}"
+             dest="${LOCAL_M2_REPO}/org/eclipse/eclipse/3.3/${testing}" 
+             verbose="true"
+             usetimestamp="true"/>
+        <echo>Unzipping ${testing} to the expected location in ${LOCAL_M2_REPO}</echo>
+        <mkdir dir="${LOCAL_M2_REPO}/eclipse"/>
+        <unzip src="${LOCAL_M2_REPO}/org/eclipse/eclipse/3.3/${testing}" 
+               dest="${LOCAL_M2_REPO}/eclipse"/>
+    </target>
+
+    
     <target name="emf" depends="init" description="Download Eclipse Modeling Framework (EMF) artifact">
         <echo>-----------------------------------------</echo>
         <echo>Downloading ${emf_download_url}${emf_sdo}</echo>

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/maven-eclipse.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/maven-eclipse.xml?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/maven-eclipse.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/maven-eclipse.xml Wed Dec 19 23:49:19 2007
@@ -1,8 +0,0 @@
-<project default="copy-resources">
-  <target name="init"/>
-  <target name="copy-resources" depends="init">
-    <copy todir="target/classes/META-INF" filtering="false">
-      <fileset dir="C:/Jonno/OpenEJB/eclipse-plugins/features" includes="LICENSE|NOTICE"/>
-    </copy>
-  </target>
-</project>
\ No newline at end of file

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF Wed Dec 19 23:49:19 2007
@@ -13,12 +13,11 @@
  org.eclipse.jface.text,
  org.eclipse.ui.ide,
  org.eclipse.ltk.ui.refactoring,
- org.eclipse.ltk.core.refactoring
+ org.eclipse.ltk.core.refactoring,
+ org.junit
 Eclipse-LazyStart: true
-Export-Package: org.apache.openejb.helper.annotation,
- org.apache.openejb.helper.annotation.actions
 Bundle-ClassPath: .,
- lib/jaxb-impl-2.0.jar,
+ lib/jaxb-impl-2.0.3.jar,
  lib/activation-1.1.jar,
  lib/jaxb-api-2.0.jar,
  lib/jsr173-1.0.jar,
@@ -27,5 +26,8 @@
  lib/geronimo-stax-api_1.0_spec-1.0.jar,
  lib/openejb-jee-3.0.0-SNAPSHOT.jar,
  lib/xbean-finder-3.2-SNAPSHOT.jar,
- lib/geronimo-ejb_3.0_spec-1.0.jar
+ lib/geronimo-ejb_3.0_spec-1.0.jar,
+ lib/geronimo-annotation_1.0_spec-1.1.jar,
+ lib/geronimo-interceptor_3.0_spec-1.0.jar
 Main-Class: org.apache.openejb.helper.annotation.cli.Main
+Export-Package: org.apache.openejb.helper.annotation

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/maven-eclipse.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/maven-eclipse.xml?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/maven-eclipse.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/maven-eclipse.xml Wed Dec 19 23:49:19 2007
@@ -1,11 +0,0 @@
-<project default="copy-resources">
-  <target name="init"/>
-  <target name="copy-resources" depends="init">
-    <copy todir="target/classes/META-INF" filtering="false">
-      <fileset dir="META-INF" includes="MANIFEST.MF"/>
-    </copy>
-    <copy todir="target/classes/lib" filtering="false">
-      <fileset dir="lib" includes="*.jar"/>
-    </copy>
-  </target>
-</project>
\ No newline at end of file

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml Wed Dec 19 23:49:19 2007
@@ -1,219 +1,201 @@
-<!--
-	~ Licensed to the Apache Software Foundation (ASF) under one or more
-	~ contributor license agreements.  See the NOTICE file distributed with
-	~ this work for additional information regarding copyright ownership.
-	~ The ASF licenses this file to You under the Apache License, Version 2.0
-	~ (the "License"); you may not use this file except in compliance with
-	~ the License.  You may obtain a copy of the License at
-	~
-	~    http://www.apache.org/licenses/LICENSE-2.0
-	~
-	~ Unless required by applicable law or agreed to in writing, software
-	~ distributed under the License is distributed on an "AS IS" BASIS,
-	~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	~ See the License for the specific language governing permissions and
-	~ limitations under the License.
--->
-<!-- $Rev: 577554 $ $Date: 2007-09-20 06:35:12 +0100 (Thu, 20 Sep 2007) $ -->
-<project>
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.openejb</groupId>
-	<artifactId>org.apache.openejb.helper.annotation</artifactId>
-	<version>1.0.0</version>
-	<packaging>jar</packaging>
-	<name>${artifactId}</name>
-	<parent>
-		<groupId>org.apache.openejb</groupId>
-		<artifactId>eclipse-plugins-parent</artifactId>
-		<version>1.0.0</version>
-		<relativePath>../pom.xml</relativePath>
-	</parent>
-	<build>
-		<resources>
-			<resource>
-				<directory>.</directory>
-				<includes>
-					<include>plugin.xml</include>
-				</includes>
-			</resource>
-			<resource>
-				<targetPath>META-INF</targetPath>
-				<directory>META-INF</directory>
-				<includes>
-					<include>MANIFEST.MF</include>
-				</includes>
-			</resource>
-			<resource>
-				<directory>lib</directory>
-				<targetPath>lib</targetPath>
-				<includes>
-					<include>*.jar</include>
-				</includes>
-			</resource>
-		</resources>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-eclipse-plugin</artifactId>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.geronimo.devtools</groupId>
-				<artifactId>maven-eclipsepde-plugin</artifactId>
-			</plugin>
-			<plugin>
-				<artifactId>maven-antrun-plugin</artifactId>
-			</plugin>
-			<plugin>
-				<artifactId>maven-jar-plugin</artifactId>
-			</plugin>
-			<plugin>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>copy</id>
-						<phase>generate-resources</phase>
-						<goals>
-							<goal>copy</goal>
-						</goals>
-						<configuration>
-							<outputDirectory>lib</outputDirectory>
-							<overWriteSnapshots>
-								true
-							</overWriteSnapshots>
-							<artifactItems>
-								<artifactItem>
-									<groupId>org.apache.xbean</groupId>
-									<artifactId>
-										xbean-finder
-									</artifactId>
-									<version>3.2-SNAPSHOT</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>javax.activation</groupId>
-									<artifactId>activation</artifactId>
-									<version>1.1</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>javax.xml</groupId>
-									<artifactId>jsr173</artifactId>
-									<version>1.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>javax.xml.bind</groupId>
-									<artifactId>jsr173_api</artifactId>
-									<version>1.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>
-										org.apache.geronimo.specs
-									</groupId>
-									<artifactId>
-										geronimo-activation_1.1_spec
-									</artifactId>
-									<version>1.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>
-										org.apache.geronimo.specs
-									</groupId>
-									<artifactId>
-										geronimo-stax-api_1.0_spec
-									</artifactId>
-									<version>1.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>javax.xml.bind</groupId>
-									<artifactId>jaxb-api</artifactId>
-									<version>2.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>com.sun.xml.bind</groupId>
-									<artifactId>jaxb-impl</artifactId>
-									<version>2.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>
-										org.apache.openejb
-									</groupId>
-									<artifactId>openejb-jee</artifactId>
-									<version>3.0.0-SNAPSHOT</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>javax.xml</groupId>
-									<artifactId>jsr173</artifactId>
-									<version>1.0</version>
-								</artifactItem>
-								<artifactItem>
-									<groupId>
-										org.apache.geronimo.specs
-									</groupId>
-									<artifactId>
-										geronimo-ejb_3.0_spec
-									</artifactId>
-									<version>1.0</version>
-								</artifactItem>
-							</artifactItems>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-ejb_3.0_spec</artifactId>
-			<version>1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.xbean</groupId>
-			<artifactId>xbean-finder</artifactId>
-			<version>3.2-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.activation</groupId>
-			<artifactId>activation</artifactId>
-			<version>1.1</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.xml</groupId>
-			<artifactId>jsr173</artifactId>
-			<version>1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.xml.bind</groupId>
-			<artifactId>jsr173_api</artifactId>
-			<version>1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-activation_1.1_spec</artifactId>
-			<version>1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-stax-api_1.0_spec</artifactId>
-			<version>1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.xml.bind</groupId>
-			<artifactId>jaxb-api</artifactId>
-			<version>2.0</version>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.xml.bind</groupId>
-			<artifactId>jaxb-impl</artifactId>
-			<version>2.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.openejb</groupId>
-			<artifactId>openejb-jee</artifactId>
-			<version>3.0.0-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.xml</groupId>
-			<artifactId>jsr173</artifactId>
-			<version>1.0</version>
-		</dependency>
-	</dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8"?><project>
+  <parent>
+    <artifactId>eclipse-plugins-parent</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>1.0.0</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.openejb</groupId>
+  <artifactId>org.apache.openejb.helper.annotation</artifactId>
+  <name>${artifactId}</name>
+  <version>1.0.0</version>
+  <build>
+    <resources>
+      <resource>
+        <directory>.</directory>
+        <includes>
+          <include>plugin.xml</include>
+        </includes>
+      </resource>
+      <resource>
+        <targetPath>META-INF</targetPath>
+        <directory>META-INF</directory>
+        <includes>
+          <include>MANIFEST.MF</include>
+        </includes>
+      </resource>
+      <resource>
+        <targetPath>lib</targetPath>
+        <directory>lib</directory>
+        <includes>
+          <include>*.jar</include>
+        </includes>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <artifactId>maven-eclipse-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.geronimo.devtools</groupId>
+        <artifactId>maven-eclipsepde-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>lib</outputDirectory>
+              <overWriteSnapshots>true</overWriteSnapshots>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.xbean</groupId>
+                  <artifactId>xbean-finder</artifactId>
+                  <version>3.2-SNAPSHOT</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>javax.activation</groupId>
+                  <artifactId>activation</artifactId>
+                  <version>1.1</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>javax.xml</groupId>
+                  <artifactId>jsr173</artifactId>
+                  <version>1.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>javax.xml.bind</groupId>
+                  <artifactId>jsr173_api</artifactId>
+                  <version>1.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.geronimo.specs</groupId>
+                  <artifactId>geronimo-activation_1.1_spec</artifactId>
+                  <version>1.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.geronimo.specs</groupId>
+                  <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+                  <version>1.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>javax.xml.bind</groupId>
+                  <artifactId>jaxb-api</artifactId>
+                  <version>2.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>com.sun.xml.bind</groupId>
+                  <artifactId>jaxb-impl</artifactId>
+                  <version>2.0.3</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.openejb</groupId>
+                  <artifactId>openejb-jee</artifactId>
+                  <version>3.0.0-SNAPSHOT</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>javax.xml</groupId>
+                  <artifactId>jsr173</artifactId>
+                  <version>1.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.geronimo.specs</groupId>
+                  <artifactId>geronimo-ejb_3.0_spec</artifactId>
+                  <version>1.0</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.geronimo.specs</groupId>
+                  <artifactId>geronimo-annotation_1.0_spec</artifactId>
+                  <version>1.1</version>
+                </artifactItem>
+                <artifactItem>
+			        <groupId>org.apache.geronimo.specs</groupId>
+			        <artifactId>geronimo-interceptor_3.0_spec</artifactId>
+			        <version>1.0</version>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-ejb_3.0_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-finder</artifactId>
+      <version>3.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml</groupId>
+      <artifactId>jsr173</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jsr173_api</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-activation_1.1_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <version>2.0.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-jee</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml</groupId>
+      <artifactId>jsr173</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-annotation_1.0_spec</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-interceptor_3.0_spec</artifactId>
+        <version>1.0</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/IJavaProjectAnnotationFacade.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/IJavaProjectAnnotationFacade.java?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/IJavaProjectAnnotationFacade.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/IJavaProjectAnnotationFacade.java Wed Dec 19 23:49:19 2007
@@ -1,50 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */ 
-
-package org.apache.openejb.helper.annotation;
-
-import java.util.Map;
-
-public interface IJavaProjectAnnotationFacade {
-
-	/**
-	 * Adds an annotation to a class
-	 * @param targetClass Fully qualified name of the class to add the annotation to
-	 * @param annotation Fully qualified name of the annotation
-	 */
-	public void addClassAnnotation(String targetClass,	String annotation);
-
-	/**
-	 * Adds an annotation to a class, with the specified properties
-	 * @param targetClass Fully qualified name of the class to add the annotation to
-	 * @param annotation Fully qualified name of the annotation
-	 * @param properties Properties for the annotation to be added
-	 */
-	public void addClassAnnotation(String targetClass, String annotation, Map<String, Object> properties);
-
-	public void addClassAnnotation(String targetClass, Class annotation, Map<String,Object> properties);
-
-	public void addMethodAnnotation(String fullyQualifiedClassName, String methodName, Class annotationClass, Map<String, Object> properties);
-
-	public void addMethodAnnotation(String targetClass, String methodName, String annotationToAdd, Map<String, Object> properties);
-
-	public void addFieldAnnotation(String targetClass, String targetField, Class annotation, Map<String, Object> properties);
-
-	public void addFieldAnnotation(String targetClass, String targetField, String annotation, Map<String, Object> properties);
-	
-	
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */ 
+
+package org.apache.openejb.helper.annotation;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import org.eclipse.ltk.core.refactoring.Change;
+
+public interface IJavaProjectAnnotationFacade {
+
+	public void addClassAnnotation(String targetClass, Class<? extends Annotation> annotation, Map<String,Object> properties);
+
+	public void addMethodAnnotation(String fullyQualifiedClassName, String methodName, String[] signature, Class<?> annotationClass, Map<String, Object> properties);
+
+	public void addFieldAnnotation(String targetClass, String targetField, Class<?> annotation, Map<String, Object> properties);
+
+	public Change getChange();
+
+	
 }

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JavaProjectAnnotationFacade.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JavaProjectAnnotationFacade.java?rev=605823&r1=605822&r2=605823&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JavaProjectAnnotationFacade.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JavaProjectAnnotationFacade.java Wed Dec 19 23:49:19 2007
@@ -1,435 +1,465 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.openejb.helper.annotation;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IBuffer;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
-import org.eclipse.jdt.core.dom.BodyDeclaration;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.IExtendedModifier;
-import org.eclipse.jdt.core.dom.ImportDeclaration;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.QualifiedName;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.DocumentChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Add annotations to source files in an Eclipse Java project
- * 
- */
-public class JavaProjectAnnotationFacade implements IJavaProjectAnnotationFacade {
-
-	protected IJavaProject javaProject;
-
-	protected Map<String, CompilationUnit> cuMap = new HashMap<String, CompilationUnit>();
-
-	/**
-	 * Creates a new annotation facade
-	 * 
-	 * @param project
-	 *            Eclipse project to work on
-	 */
-	public JavaProjectAnnotationFacade(IProject project) {
-		this.javaProject = JavaCore.create(project);
-	}
-
-	protected CompilationUnit getCompilationUnit(String targetClass) throws JavaModelException {
-		IType type = javaProject.findType(targetClass);
-		ICompilationUnit compilationUnit = type.getCompilationUnit();
-
-		String path = compilationUnit.getPath().toString();
-
-		if (cuMap.keySet().contains(path)) {
-			return cuMap.get(path);
-		}
-
-		CompilationUnit cu = parse(compilationUnit);
-		cuMap.put(path, cu);
-
-		return cu;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.openejb.helper.annotation.IAnnotationHelper#addClassAnnotation(java.lang.String,
-	 *      java.lang.String)
-	 */
-	public void addClassAnnotation(String fullClassName, String annotationToAdd) {
-		addClassAnnotation(fullClassName, annotationToAdd, null);
-	}
-
-	/**
-	 * Adds a class to the list of imports for a compilation unit This method
-	 * will check to see if the class has already been imported
-	 * 
-	 * @param classToImport
-	 *            The fully qualified name of the class to import
-	 * @param compilationUnit
-	 *            The compilation unit to add the import to
-	 */
-	void addImportToCompilationUnit(String classToImport, CompilationUnit compilationUnit) {
-		if (!isClassImported(classToImport, compilationUnit)) {
-			String[] parts = classToImport.split("\\.");
-
-			AST ast = compilationUnit.getAST();
-
-			Name name = null;
-
-			for (int i = 0; i < parts.length; i++) {
-				SimpleName simpleName = ast.newSimpleName(parts[i]);
-				if (i == 0) {
-					name = simpleName;
-				} else {
-					name = ast.newQualifiedName(name, simpleName);
-				}
-			}
-
-			ImportDeclaration importDeclaration = ast.newImportDeclaration();
-			importDeclaration.setName(name);
-			importDeclaration.setOnDemand(false);
-			importDeclaration.setStatic(false);
-
-			compilationUnit.imports().add(importDeclaration);
-		}
-	}
-
-	/**
-	 * Determines whether the specified class has been imported in the
-	 * compilation unit
-	 * 
-	 * @param importedClass
-	 *            The imported (or not) class
-	 * @param compilationUnit
-	 *            The compilation unit to check
-	 * @return Whether of not the class has been imported
-	 */
-	private boolean isClassImported(String importedClass, CompilationUnit compilationUnit) {
-		Iterator iterator = compilationUnit.imports().iterator();
-		String packageName = importedClass.substring(0, importedClass.lastIndexOf("."));
-
-		while (iterator.hasNext()) {
-			ImportDeclaration importDeclaration = (ImportDeclaration) iterator.next();
-			String importedName = importDeclaration.getName().toString();
-			if (importedName.equals(packageName) || importedName.equals(importedClass)) {
-				return true;
-			}
-		}
-
-		return false;
-	}
-
-	/**
-	 * Parses the specified compilation unit to obtain an AST
-	 * 
-	 * @param compilationUnit
-	 *            The compilation unit to parse
-	 * @return The parsed compilation unit AST object
-	 */
-	CompilationUnit parse(ICompilationUnit compilationUnit) {
-		ASTParser parser = ASTParser.newParser(AST.JLS3);
-		parser.setKind(ASTParser.K_COMPILATION_UNIT);
-		parser.setSource(compilationUnit);
-		parser.setResolveBindings(true);
-		CompilationUnit cu = (CompilationUnit) parser.createAST(null);
-		cu.recordModifications();
-		return cu;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.openejb.helper.annotation.IAnnotationHelper#addClassAnnotation(java.lang.String,
-	 *      java.lang.Class, java.util.Map)
-	 */
-	public void addClassAnnotation(String targetClass, Class annotation, Map<String, Object> properties) {
-		addClassAnnotation(targetClass, annotation.getCanonicalName(), properties);
-	}
-
-	boolean addModifierToDeclaration(BodyDeclaration declaration, Annotation annotation) {
-		Iterator iterator = declaration.modifiers().iterator();
-		while (iterator.hasNext()) {
-			IExtendedModifier modifier = (IExtendedModifier) iterator.next();
-			if (!(modifier instanceof Annotation)) {
-				continue;
-			}
-
-			if (((Annotation) modifier).getTypeName().toString().equals(annotation.getTypeName().toString())) {
-				// break out if this type already has this annotation
-				return false;
-			}
-		}
-
-		declaration.modifiers().add(0, annotation);
-		return true;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.openejb.helper.annotation.IJavaProjectAnnotationFacade#addClassAnnotation(java.lang.String,
-	 *      java.lang.String, java.util.Map)
-	 */
-	public void addClassAnnotation(String targetClass, String annotationToAdd, Map<String, Object> properties) {
-		try {
-
-			// try and get a java element that corresponds to the annotation
-			IType annotationType = javaProject.findType(annotationToAdd);
-			if (!annotationType.isAnnotation()) {
-				return;
-			}
-
-			CompilationUnit cu = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
-
-			boolean modifierAdded = addModifierToDeclaration(typeDeclaration, createAnnotationWithProperties(cu.getAST(), annotationType, properties));
-			if (modifierAdded) {
-				addImportToCompilationUnit(annotationToAdd, cu);
-			}
-
-		} catch (MalformedTreeException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (CoreException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	TypeDeclaration getTypeDeclaration(CompilationUnit compilationUnit, String targetClass) throws CoreException {
-		IType type = javaProject.findType(targetClass);
-
-		Iterator typesIterator = compilationUnit.types().iterator();
-
-		while (typesIterator.hasNext()) {
-			TypeDeclaration typeDeclaration = (TypeDeclaration) typesIterator.next();
-			if (typeDeclaration.getName().toString().equals(type.getElementName())) {
-				return typeDeclaration;
-			}
-		}
-
-		return null;
-	}
-
-	/**
-	 * Saves changes made to the AST of the compilation unit. Assumes that
-	 * <code>compilationUnit.recordModifications()</code> has been called
-	 * 
-	 * @param compilationUnit
-	 *            The compilation unit to save
-	 * @throws CoreException
-	 * @throws BadLocationException
-	 * @throws JavaModelException
-	 * @deprecated
-	 */
-	void saveChangesTo(CompilationUnit compilationUnit) throws CoreException, BadLocationException, JavaModelException {
-		ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
-		IPath path = compilationUnit.getJavaElement().getPath();
-		bufferManager.connect(path, null);
-
-		ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
-		IDocument document = textFileBuffer.getDocument();
-
-		TextEdit edits = compilationUnit.rewrite(document, javaProject.getOptions(true));
-		edits.apply(document);
-		String newSource = document.get();
-		IBuffer buffer = ((ICompilationUnit) compilationUnit.getJavaElement()).getBuffer();
-		buffer.setContents(newSource);
-		buffer.save(null, true);
-
-		textFileBuffer.commit(null, true);
-		bufferManager.disconnect(path, null);
-	}
-
-	/**
-	 * Creates a new annotation object to be added to the AST, with the
-	 * specified properties
-	 * 
-	 * @param ast
-	 *            The AST to create the annotation for
-	 * @param annotationType
-	 *            The type of annotation to create
-	 * @param properties
-	 *            The properties for the annotation to add
-	 * @return The created annotation AST object
-	 */
-	Annotation createAnnotationWithProperties(AST ast, IType annotationType, Map<String, Object> properties) {
-		SimpleName annotationTypeName = ast.newSimpleName(annotationType.getElementName());
-		Annotation annotation;
-
-		if (properties != null) {
-			annotation = ast.newNormalAnnotation();
-			Iterator<String> propertyIterator = properties.keySet().iterator();
-			while (propertyIterator.hasNext()) {
-				String propertyName = (String) propertyIterator.next();
-				annotation.setProperty(propertyName, properties.get(propertyName));
-
-				MemberValuePair annotationProperty = ast.newMemberValuePair();
-				annotationProperty.setName(ast.newSimpleName(propertyName));
-				
-				QualifiedName expression = ast.newQualifiedName(ast.newSimpleName("TransactionManagementType"), ast.newSimpleName("BEAN"));
-				annotationProperty.setValue(expression);
-
-				((NormalAnnotation) annotation).values().add(annotationProperty);
-			}
-		} else {
-			annotation = ast.newMarkerAnnotation();
-		}
-
-		annotation.setTypeName(annotationTypeName);
-		return annotation;
-	}
-
-	public void addMethodAnnotation(String fullyQualifiedClassName, String methodName, Class annotationClass, Map<String, Object> properties) {
-		addMethodAnnotation(fullyQualifiedClassName, methodName, annotationClass.getCanonicalName(), properties);
-	}
-
-	public void addMethodAnnotation(String targetClass, String methodName, String annotationToAdd, Map<String, Object> properties) {
-		try {
-			// try and get a java element that corresponds to the annotation
-			IType annotationType = javaProject.findType(annotationToAdd);
-			if (!annotationType.isAnnotation()) {
-				return;
-			}
-
-			CompilationUnit cu = getCompilationUnit(targetClass);
-
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
-
-			MethodDeclaration[] methods = typeDeclaration.getMethods();
-			Iterator<MethodDeclaration> iterator = Arrays.asList(methods).iterator();
-			while (iterator.hasNext()) {
-				MethodDeclaration method = (MethodDeclaration) iterator.next();
-				if (method.getName().toString().equals(methodName)) {
-					boolean modifierAdded = addModifierToDeclaration(method, createAnnotationWithProperties(cu.getAST(), annotationType, properties));
-					if (modifierAdded) {
-						addImportToCompilationUnit(annotationToAdd, cu);
-					}
-				}
-			}
-
-		} catch (CoreException e) {
-
-		}
-	}
-
-	public void addFieldAnnotation(String targetClass, String targetField, Class annotation, Map<String, Object> properties) {
-		addFieldAnnotation(targetClass, targetField, annotation.getCanonicalName(), properties);
-	}
-
-	public void addFieldAnnotation(String targetClass, String targetField, String annotation, Map<String, Object> properties) {
-		try {
-			// try and get a java element that corresponds to the annotation
-			IType annotationType = javaProject.findType(annotation);
-			if (!annotationType.isAnnotation()) {
-				return;
-			}
-
-			CompilationUnit cu = getCompilationUnit(targetClass);
-
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
-			FieldDeclaration[] fields = typeDeclaration.getFields();
-
-			Iterator<FieldDeclaration> iterator = Arrays.asList(fields).iterator();
-			while (iterator.hasNext()) {
-				FieldDeclaration field = iterator.next();
-				if (field.fragments().size() == 0) {
-					continue;
-				}
-
-				VariableDeclarationFragment varibleDeclaration = (VariableDeclarationFragment) field.fragments().get(0);
-				if (varibleDeclaration.getName().toString().equals(targetField)) {
-					boolean modifierAdded = addModifierToDeclaration(field, createAnnotationWithProperties(cu.getAST(), annotationType, properties));
-					if (modifierAdded) {
-						addImportToCompilationUnit(annotation, cu);
-					}
-				}
-			}
-
-		} catch (CoreException e) {
-
-		}
-	}
-
-	public Change getChange() {
-		CompositeChange compositeChange = new CompositeChange("Add EJB 3.0 Annotations");
-
-		Iterator<CompilationUnit> iterator = cuMap.values().iterator();
-		while (iterator.hasNext()) {
-			try {
-				CompilationUnit cu = (CompilationUnit) iterator.next();
-				ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
-				IPath path = cu.getJavaElement().getPath();
-				bufferManager.connect(path, null);
-
-				ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
-				IDocument document = textFileBuffer.getDocument();
-
-				TextEdit edit = cu.rewrite(document, javaProject.getOptions(true));
-
-				TextFileChange dc = new TextFileChange(path.toString(), (IFile) cu.getJavaElement().getResource());
-				//DocumentChange dc = new DocumentChange(path.toString(), document);
-				dc.setTextType("java");
-				dc.setEdit(edit);
-				dc.setSaveMode(TextFileChange.FORCE_SAVE);
-
-				compositeChange.add(dc);
-
-			} catch (CoreException e) {
-
-			}
-		}
-
-		return compositeChange;
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openejb.helper.annotation;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.IExtendedModifier;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeLiteral;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Add annotations to source files in an Eclipse Java project
+ * 
+ */
+public class JavaProjectAnnotationFacade implements IJavaProjectAnnotationFacade {
+
+	protected IJavaProject javaProject;
+	protected Map<String, CompilationUnit> cuMap = new HashMap<String, CompilationUnit>();
+	protected List<String> warnings = new ArrayList<String>();
+
+	/**
+	 * Creates a new annotation facade
+	 * 
+	 * @param project
+	 * Eclipse project to work on
+	 */
+	public JavaProjectAnnotationFacade(IProject project) {
+		this.javaProject = JavaCore.create(project);
+	}
+
+	
+	/**
+	 * Gets the compilation unit for the specified class
+	 * If this compilation unit hasn't already been requested, it will be parsed, and the resulting compilation unit will be cached.
+	 * 
+	 * @param cls Class to search for
+	 * @return Compilation unit containing specified class
+	 * @throws JavaModelException
+	 */
+	protected CompilationUnit getCompilationUnit(String cls) throws JavaModelException {
+		IType type = javaProject.findType(cls);
+		ICompilationUnit compilationUnit = type.getCompilationUnit();
+
+		String path = compilationUnit.getPath().toString();
+
+		if (cuMap.keySet().contains(path)) {
+			return cuMap.get(path);
+		}
+
+		CompilationUnit cu = parse(compilationUnit);
+		cuMap.put(path, cu);
+
+		return cu;
+	}
+
+	/**
+	 * Adds a class to the list of imports for a compilation unit. This method will check to see if the class has already been imported
+	 * 
+	 * @param classToImport 	The fully qualified name of the class to import
+	 * @param compilationUnit 	The compilation unit to add the import to
+	 */
+	void addImportToCompilationUnit(String classToImport, CompilationUnit compilationUnit) {
+		if (!isClassImported(classToImport, compilationUnit)) {
+			String[] parts = classToImport.split("\\.");
+
+			AST ast = compilationUnit.getAST();
+
+			Name name = null;
+
+			for (int i = 0; i < parts.length; i++) {
+				SimpleName simpleName = ast.newSimpleName(parts[i]);
+				if (i == 0) {
+					name = simpleName;
+				} else {
+					name = ast.newQualifiedName(name, simpleName);
+				}
+			}
+
+			ImportDeclaration importDeclaration = ast.newImportDeclaration();
+			importDeclaration.setName(name);
+			importDeclaration.setOnDemand(false);
+			importDeclaration.setStatic(false);
+
+			compilationUnit.imports().add(importDeclaration);
+		}
+	}
+
+	/**
+	 * Determines whether the specified class has been imported in the
+	 * compilation unit
+	 * 
+	 * @param importedClass		 The imported (or not) class
+	 * @param compilationUnit 	 The compilation unit to check
+	 * @return 					 Whether of not the class has been imported
+	 */
+	private boolean isClassImported(String importedClass, CompilationUnit compilationUnit) {
+		Iterator<ImportDeclaration> iterator = compilationUnit.imports().iterator();
+		String packageName = importedClass.substring(0, importedClass.lastIndexOf("."));
+
+		while (iterator.hasNext()) {
+			ImportDeclaration importDeclaration = iterator.next();
+			String importedName = importDeclaration.getName().toString();
+			if (importedName.equals(packageName) || importedName.equals(importedClass)) {
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * Parses the specified compilation unit to obtain an AST
+	 * 
+	 * @param compilationUnit	 The compilation unit to parse
+	 * @return 					 The parsed compilation unit AST object
+	 */
+	CompilationUnit parse(ICompilationUnit compilationUnit) {
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		parser.setKind(ASTParser.K_COMPILATION_UNIT);
+		parser.setSource(compilationUnit);
+		parser.setResolveBindings(true);
+		CompilationUnit cu = (CompilationUnit) parser.createAST(null);
+
+		long mc = cu.getAST().modificationCount();
+		cu.recordModifications();
+		return cu;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.openejb.helper.annotation.IAnnotationHelper#addClassAnnotation(java.lang.String,
+	 *      java.lang.Class, java.util.Map)
+	 */
+	public void addClassAnnotation(String targetClass, Class<? extends java.lang.annotation.Annotation> annotation, Map<String, Object> properties) {
+		try {
+			CompilationUnit cu = getCompilationUnit(targetClass);
+			BodyDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+
+			if (isAnnotationAlreadyUsedOnDeclaration(annotation, typeDeclaration)) {
+				warnings.add("Annotation " + annotation.getCanonicalName() + " already used on " + targetClass);
+				return;
+			}
+
+			Annotation modifier = createModifier(cu.getAST(), annotation, properties, cu);
+			typeDeclaration.modifiers().add(0,modifier);
+		} catch (Exception e) {
+			warnings.add("An error occurred adding annotation " + annotation.getCanonicalName() + " to class " + targetClass);
+		}
+	}
+
+	private boolean isAnnotationAlreadyUsedOnDeclaration(Class<? extends java.lang.annotation.Annotation> annotation, BodyDeclaration declaration) {
+		IExtendedModifier[] modifiers = (IExtendedModifier[]) declaration.modifiers().toArray(new IExtendedModifier[0]);
+		for (IExtendedModifier modifier : modifiers) {
+			if (! (modifier instanceof Annotation)) {
+				continue;
+			}
+			
+			Annotation annotationModifer = (Annotation) modifier;
+			if (annotationModifer.getTypeName().toString().equals(annotation.getCanonicalName())) {
+				return true;
+			}
+		}
+		
+		return false;
+	}
+
+	/**
+	 * Finds the type declaration for the specified class in a compilation unit
+	 
+	 * @param compilationUnit Compilation unit to search
+	 * @param targetClass	  Type to find
+	 * @return
+	 * @throws CoreException
+	 */
+	protected TypeDeclaration getTypeDeclaration(CompilationUnit compilationUnit, String targetClass) throws CoreException {
+		IType type = javaProject.findType(targetClass);
+
+		TypeDeclaration[] typeDeclarations = (TypeDeclaration[]) compilationUnit.types().toArray(new TypeDeclaration[0]);
+		for (TypeDeclaration typeDeclaration : typeDeclarations) {
+			if (typeDeclaration.getName().toString().equals(type.getElementName())) {
+				return typeDeclaration;
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * Creates a new annotation object to be added to the AST, with the
+	 * specified properties
+	 * 
+	 * @param ast 				The AST to create the annotation for
+	 * @param annotation   		The type of annotation to create
+	 * @param properties		The properties for the annotation to add
+	 * @param cu 			Compilation Unit
+	 * @return 					The created annotation AST object
+	 * @throws JavaModelException 
+	 */
+	protected Annotation createModifier(AST ast, Class<?> annotation, Map<String, Object> properties, CompilationUnit cu) throws JavaModelException {
+		// try and get a java element that corresponds to the annotation
+		IType annotationType = javaProject.findType(annotation.getCanonicalName());
+		if (!annotationType.isAnnotation()) {
+			return null;
+		}
+
+		addImportToCompilationUnit(annotation.getCanonicalName(), cu);
+		
+		Annotation result = null;
+		Name annotationTypeName = ast.newSimpleName(annotationType.getElementName());
+
+		if (properties != null) {
+			result = ast.newNormalAnnotation();
+
+			
+			Method[] methods = annotation.getDeclaredMethods();
+			for (Method method : methods) {
+				Class<?> returnType = method.getReturnType();
+				
+				// get the matching value in the properties
+				Object value = properties.get(method.getName());
+				
+				if (value == null && method.getDefaultValue() == null) {
+					// TODO: throw an exception here
+				}
+
+				if (value == null) {
+					// no need to do anything - the default will be used
+					continue;
+				}
+				
+				if (value.getClass().isArray() != returnType.isArray()) {
+					// TODO: throw an exception here
+				}
+				
+				MemberValuePair annotationProperty = ast.newMemberValuePair();
+				annotationProperty.setName(ast.newSimpleName(method.getName()));
+
+				Expression expression = createAnnotationPropertyValueExpression(cu, returnType, value);
+
+				if (expression != null) {
+					annotationProperty.setValue(expression);
+					((NormalAnnotation) result).values().add(annotationProperty);
+				}
+
+			}
+		} else {
+			result = ast.newMarkerAnnotation();
+		}
+
+		result.setTypeName(annotationTypeName);
+		return result;
+	}
+
+
+	/**
+	 * Creates an expression to be used as the 'value' part of a MemberValuePair
+	 * on an annotation modifier
+	 * @param cu Compilation unit to work on
+	 * @param type Type of value the annotation expects
+	 * @param value The value we want to create an expression for
+	 * 
+	 * @return The expression created
+	 * @throws JavaModelException 
+	 */
+	private Expression createAnnotationPropertyValueExpression(CompilationUnit cu,	Class<?> type, Object value) throws JavaModelException {
+		Expression expression = null;
+		
+		AST ast = cu.getAST();
+		
+		if (type.isAnnotation() && (value instanceof Map)) {
+			return createModifier(ast, type, (Map)value, cu);
+		} else if (value.getClass().isArray()) {
+			Object[] objects = (Object[])value;
+
+			expression = ast.newArrayInitializer();
+			
+			for (Object object : objects) {
+				Expression objExpr = createAnnotationPropertyValueExpression(cu, type.getComponentType(), object);
+				((ArrayInitializer) expression).expressions().add(objExpr);
+			}
+		} else if ((value instanceof String) && (type == Class.class)) {
+			expression = ast.newTypeLiteral();
+			SimpleType newSimpleType = ast.newSimpleType(ast.newName((String)value));
+			((TypeLiteral)expression).setType(newSimpleType);
+			
+			addImportToCompilationUnit((String)value, cu);
+		} else	if (value instanceof String) {
+			expression = ast.newStringLiteral();
+			((StringLiteral)expression).setLiteralValue(value.toString());
+		} else if (value.getClass().isEnum()) {
+			String enumClass = value.getClass().getSimpleName();
+			String enumVal   = value.toString();
+			expression = ast.newQualifiedName(ast.newSimpleName(enumClass), ast.newSimpleName(enumVal));
+
+			addImportToCompilationUnit(value.getClass().getCanonicalName(), cu);
+		}
+		
+		return expression;
+	}
+
+	public void addMethodAnnotation(String fullyQualifiedClassName, String methodName, String[] signature, Class<?> annotationClass, Map<String, Object> properties) {
+		try {
+			CompilationUnit cu = getCompilationUnit(fullyQualifiedClassName);
+
+			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, fullyQualifiedClassName);
+
+			MethodDeclaration[] methods = typeDeclaration.getMethods();
+			Iterator<MethodDeclaration> iterator = Arrays.asList(methods).iterator();
+			while (iterator.hasNext()) {
+				MethodDeclaration method = iterator.next();
+				
+				if (method.getName().toString().equals(methodName) && (signature == null || signatureMatches(method, signature))) {
+					Annotation modifier = createModifier(cu.getAST(), annotationClass, properties, cu);
+					method.modifiers().add(0,modifier);
+					
+					addImportToCompilationUnit(annotationClass.getCanonicalName(), cu);
+				}
+			}
+
+		} catch (CoreException e) {
+			warnings.add("An error occurred adding annotation " + annotationClass.getCanonicalName() + " to method " + methodName + " on " + fullyQualifiedClassName);
+		}
+	}
+
+	private boolean signatureMatches(MethodDeclaration method,
+			String[] signature) {
+
+		if (signature.length != method.parameters().size()) {
+			return false;
+		}
+		
+		for (int i = 0; i < signature.length; i++) {
+			SingleVariableDeclaration var = (SingleVariableDeclaration) method.parameters().get(i);
+			Type type = var.getType();
+			
+			ITypeBinding typeBinding = type.resolveBinding();
+			
+			if (!(typeBinding.getQualifiedName().toString().equals(signature[i]))) {
+				return false;
+			}
+		}
+		
+		return true;
+	}
+
+	public void addFieldAnnotation(String targetClass, String targetField, Class<?> annotation, Map<String, Object> properties) {
+		try {
+			CompilationUnit cu = getCompilationUnit(targetClass);
+
+			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			FieldDeclaration[] fields = typeDeclaration.getFields();
+
+			Iterator<FieldDeclaration> iterator = Arrays.asList(fields).iterator();
+			while (iterator.hasNext()) {
+				FieldDeclaration field = iterator.next();
+				if (field.fragments().size() == 0) {
+					continue;
+				}
+
+				VariableDeclarationFragment varibleDeclaration = (VariableDeclarationFragment) field.fragments().get(0);
+				if (varibleDeclaration.getName().toString().equals(targetField)) {
+					Annotation modifier = createModifier(cu.getAST(), annotation, properties, cu);
+					field.modifiers().add(0,modifier);
+					
+					addImportToCompilationUnit(annotation.getCanonicalName(), cu);
+				}
+			}
+
+		} catch (CoreException e) {
+			warnings.add("An error occurred adding annotation " + annotation.getCanonicalName() + " to field " + targetField + " on " + targetClass);
+		}
+	}
+
+	public Change getChange() {
+		CompositeChange compositeChange = new CompositeChange("Add EJB 3.0 Annotations");
+
+		Iterator<CompilationUnit> iterator = cuMap.values().iterator();
+		while (iterator.hasNext()) {
+			try {
+				CompilationUnit cu = iterator.next();
+				ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
+				IPath path = cu.getJavaElement().getPath();
+				bufferManager.connect(path, null);
+
+				ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
+				IDocument document = textFileBuffer.getDocument();
+
+				TextEdit edit = cu.rewrite(document, javaProject.getOptions(true));
+				TextFileChange dc = new TextFileChange(path.toString(), (IFile) cu.getJavaElement().getResource());
+				dc.setTextType("java");
+				dc.setEdit(edit);
+				dc.setSaveMode(TextFileChange.FORCE_SAVE);
+
+				compositeChange.add(dc);
+			} catch (CoreException e) {
+			}
+		}
+
+		return compositeChange;
+	}
+
+
+	public String[] getWarnings() {
+		return warnings.toArray(new String[0]);
+	}
+}