You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2008/09/29 18:32:58 UTC
svn commit: r700171 - in /openejb/trunk/sandbox/openejb-eclipse-plugin:
assembly/src/main/assembly/ eclipse/
features/org.apache.openejb.feature.devtools/ pde-test/ plugins/
plugins/org.apache.openejb.builder/
plugins/org.apache.openejb.builder/META-IN...
Author: jgallimore
Date: Mon Sep 29 09:32:57 2008
New Revision: 700171
URL: http://svn.apache.org/viewvc?rev=700171&view=rev
Log:
OEP-15 extract JDTFacade into common devtools.core plugin, and add quick fix functionality to single dependency resolver
Added:
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/ISingletonDependencyMarker.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/MarkerResolutionGenerator.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/META-INF/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/META-INF/MANIFEST.MF
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin_de.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/pom.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Activator.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Messages.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages_de.properties
Removed:
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JDTFacade.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/Messages.java
Modified:
openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/deployable.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/updatesite.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/pom.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature.devtools/feature.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/pde-test/pom.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/META-INF/MANIFEST.MF
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/plugin.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/pom.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/META-INF/MANIFEST.MF
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/pom.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java
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/pom.xml
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/pom.xml
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/deployable.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/deployable.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/deployable.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/deployable.xml Mon Sep 29 09:32:57 2008
@@ -40,6 +40,7 @@
<include>org.apache.openejb:org.apache.openejb.help.nlBidi</include>
<include>org.apache.openejb:org.apache.openejb.branding</include>
<include>org.apache.openejb:org.apache.openejb.builder</include>
+ <include>org.apache.openejb:org.apache.openejb.devtools.core</include>
</includes>
</dependencySet>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/updatesite.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/updatesite.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/updatesite.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/assembly/src/main/assembly/updatesite.xml Mon Sep 29 09:32:57 2008
@@ -40,6 +40,7 @@
<include>org.apache.openejb:org.apache.openejb.help.nlBidi</include>
<include>org.apache.openejb:org.apache.openejb.branding</include>
<include>org.apache.openejb:org.apache.openejb.builder</include>
+ <include>org.apache.openejb:org.apache.openejb.devtools.core</include>
</includes>
</dependencySet>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/pom.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/pom.xml Mon Sep 29 09:32:57 2008
@@ -41,10 +41,10 @@
<phase>validate</phase>
<configuration>
<tasks>
- <property name="LOCAL_M2_REPO" value="${settings.localRepository}"/>
+ <!--<property name="LOCAL_M2_REPO" value="${settings.localRepository}"/>
<ant antfile="${basedir}/build.xml">
<target name="${eclipsePlatformFamily}"></target>
- </ant>
+ </ant>-->
</tasks>
</configuration>
<goals>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature.devtools/feature.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature.devtools/feature.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature.devtools/feature.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature.devtools/feature.xml Mon Sep 29 09:32:57 2008
@@ -60,4 +60,10 @@
version="1.0.0"
unpack="false"/>
+ <plugin
+ id="org.apache.openejb.devtools.core"
+ download-size="0"
+ install-size="0"
+ version="1.0.0"
+ unpack="false"/>
</feature>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/pde-test/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/pde-test/pom.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/pde-test/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/pde-test/pom.xml Mon Sep 29 09:32:57 2008
@@ -45,6 +45,12 @@
<artifactItems>
<artifactItem>
<groupId>org.apache.openejb</groupId>
+ <artifactId>org.apache.openejb.devtools.core</artifactId>
+ <version>1.0.0</version>
+ <destFileName>org.apache.openejb.devtools.core_1.0.0.jar</destFileName>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.openejb</groupId>
<artifactId>org.apache.openejb.helper.annotation</artifactId>
<version>1.0.0</version>
<destFileName>org.apache.openejb.helper.annotation_1.0.0.jar</destFileName>
@@ -87,6 +93,11 @@
<dependencies>
<dependency>
<groupId>org.apache.openejb</groupId>
+ <artifactId>org.apache.openejb.devtools.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
<artifactId>org.apache.openejb.helper.annotation</artifactId>
<version>1.0.0</version>
</dependency>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/META-INF/MANIFEST.MF?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/META-INF/MANIFEST.MF (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/META-INF/MANIFEST.MF Mon Sep 29 09:32:57 2008
@@ -19,10 +19,12 @@
org.eclipse.jdt.ui,
org.eclipse.search,
org.eclipse.help,
- org.eclipse.ui.editors
+ org.eclipse.ui.editors,
+ org.apache.openejb.devtools.core
Eclipse-LazyStart: true
Bundle-ClassPath: .,
- target/classes/
+ target/classes/,
+ lib/ejb31-api-experimental-3.1-SNAPSHOT.jar
Main-Class: org.apache.openejb.helper.annotation.cli.Main
Export-Package: org.apache.openejb.helper.annotation
Bundle-Vendor: %providerName
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/plugin.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/plugin.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/plugin.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/plugin.xml Mon Sep 29 09:32:57 2008
@@ -67,6 +67,13 @@
</instanceof>
</enabledWhen>
</page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ class="org.apache.openejb.builder.MarkerResolutionGenerator"
+ markerType="org.apache.openejb.builder.dependsonMarker">
+ </markerResolutionGenerator>
</extension>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/pom.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/pom.xml Mon Sep 29 09:32:57 2008
@@ -58,20 +58,74 @@
</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>
- </plugins>
- </build>
+ <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-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.openejb
+ </groupId>
+ <artifactId>
+ ejb31-api-experimental
+ </artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>ejb31-api-experimental</artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>org.apache.openejb.devtools.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
</project>
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/ISingletonDependencyMarker.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/ISingletonDependencyMarker.java?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/ISingletonDependencyMarker.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/ISingletonDependencyMarker.java Mon Sep 29 09:32:57 2008
@@ -0,0 +1,8 @@
+package org.apache.openejb.builder;
+
+public interface ISingletonDependencyMarker {
+
+ public final static String DEPENDENCIES = "dependencies";
+ public static final String BEAN = "bean";
+
+}
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java Mon Sep 29 09:32:57 2008
@@ -107,8 +107,13 @@
Map attributes = new HashMap();
attributes.put(IMarker.LINE_NUMBER, compilationUnit.getLineNumber(sourceRange.getOffset()));
+ attributes.put(IMarker.CHAR_START, sourceRange.getOffset());
+ attributes.put(IMarker.CHAR_END, sourceRange.getOffset() + sourceRange.getLength());
+ attributes.put(IMarker.LINE_NUMBER, compilationUnit.getLineNumber(sourceRange.getOffset()));
attributes.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
attributes.put(IMarker.MESSAGE, expectedDependencies.size() == 0 ? "This bean should not have the @DependsOn annotation" : "This bean requires the @DependsOn annotation, and depends on: " + getDependencyList(expectedDependencies));
+ attributes.put(ISingletonDependencyMarker.DEPENDENCIES, expectedDependencies.toArray(new String[expectedDependencies.size()]));
+ attributes.put(ISingletonDependencyMarker.BEAN, singleton);
marker.setAttributes(attributes);
}
}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/MarkerResolutionGenerator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/MarkerResolutionGenerator.java?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/MarkerResolutionGenerator.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/MarkerResolutionGenerator.java Mon Sep 29 09:32:57 2008
@@ -0,0 +1,63 @@
+package org.apache.openejb.builder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ejb.DependsOn;
+
+import org.apache.openejb.devtools.core.JDTFacade;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+
+public class MarkerResolutionGenerator implements IMarkerResolutionGenerator {
+
+
+
+ public MarkerResolutionGenerator() {
+ super();
+ }
+
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ IMarkerResolution markerResolution = new IMarkerResolution() {
+
+ public String getLabel() {
+ return "Set dependencies";
+ }
+
+ public void run(IMarker marker) {
+ try {
+ String bean = (String) marker.getAttribute(ISingletonDependencyMarker.BEAN);
+ String[] dependencies = (String[]) marker.getAttribute(ISingletonDependencyMarker.DEPENDENCIES);
+
+ IProject project = marker.getResource().getProject();
+
+ JDTFacade facade = new JDTFacade(project);
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("value", dependencies);
+
+ facade.removeClassAnnotation(bean, DependsOn.class);
+
+ if (dependencies != null && dependencies.length > 0) {
+ facade.addClassAnnotation(bean, DependsOn.class, properties);
+ }
+
+ facade.getChange().perform(new NullProgressMonitor());
+
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ };
+
+ return new IMarkerResolution[] { markerResolution };
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/META-INF/MANIFEST.MF?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/META-INF/MANIFEST.MF (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/META-INF/MANIFEST.MF Mon Sep 29 09:32:57 2008
@@ -0,0 +1,36 @@
+Bundle-SymbolicName: org.apache.openejb.devtools.core;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Eclipse-AutoStart: true
+Bundle-Activator: org.apache.openejb.devtools.core.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.commands,
+ org.eclipse.jdt.core,
+ org.eclipse.core.filebuffers,
+ org.eclipse.jface.text,
+ org.eclipse.ui.ide,
+ org.eclipse.ltk.ui.refactoring,
+ org.eclipse.ltk.core.refactoring,
+ org.junit,
+ org.eclipse.jdt.ui,
+ org.eclipse.search,
+ org.eclipse.help
+Provide-Package: org.apache.openejb.devtools.core,
+ org.apache.openejb.plugins.common
+Bundle-ClassPath: .,
+ lib/javaee-api-5.0-1.jar,
+ lib/plugins-common-1.0.0.jar,
+ lib/jaxb-api-2.0.jar,
+ lib/jaxb-impl-2.0.3.jar,
+ lib/log4j-1.2.12.jar,
+ lib/openejb-core-3.1-SNAPSHOT.jar,
+ lib/openejb-jee-3.1-SNAPSHOT.jar,
+ lib/openejb-loader-3.1-SNAPSHOT.jar,
+ lib/swizzle-stream-1.0.1.jar,
+ lib/sxc-jaxb-0.7-SNAPSHOT.jar,
+ lib/sxc-runtime-0.7-SNAPSHOT.jar,
+ target/classes/
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.properties?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.properties Mon Sep 29 09:32:57 2008
@@ -0,0 +1,34 @@
+#######################################################################
+#
+# 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: 577442 $ $Date: 2007-09-19 21:43:00 +0100 (Wed, 19 Sep 2007) $
+#
+#######################################################################
+#
+# plugin.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+#
+#######################################################################
+
+# "pluginName" property - name of the plugin
+pluginName = Apache OpenEJB EJB 3.0 Core Plugin
+
+# "providerName" property - name of the company that provides the feature
+providerName = Apache OpenEJB Project
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.xml?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin.xml Mon Sep 29 09:32:57 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<!--
+ ~ 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.
+ -->
+<plugin>
+
+</plugin>
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin_de.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin_de.properties?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin_de.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/plugin_de.properties Mon Sep 29 09:32:57 2008
@@ -0,0 +1,34 @@
+#######################################################################
+#
+# 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: 577442 $ $Date: 2007-09-19 21:43:00 +0100 (Wed, 19 Sep 2007) $
+#
+#######################################################################
+#
+# plugin.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+#
+#######################################################################
+
+# "pluginName" property - name of the plugin
+pluginName = Apache OpenEJB EJB 3.0 Migrations-Plugin f\u00fcr Eclipse
+
+# "providerName" property - name of the company that provides the feature
+providerName = Apache OpenEJB Projekt
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/pom.xml?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/pom.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/pom.xml Mon Sep 29 09:32:57 2008
@@ -0,0 +1,203 @@
+<?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>
+ <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.devtools.core</artifactId>
+ <name>${artifactId}</name>
+ <version>1.0.0</version>
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>plugin.xml</include>
+ <include>about.html</include>
+ <include>plugin.properties</include>
+ <include>plugin_*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</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.openejb
+ </groupId>
+ <artifactId>
+ plugins-common
+ </artifactId>
+ <version>1.0.0</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ com.envoisolutions.sxc
+ </groupId>
+ <artifactId>sxc-jaxb</artifactId>
+ <version>0.7-SNAPSHOT</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ com.envoisolutions.sxc
+ </groupId>
+ <artifactId>sxc-runtime</artifactId>
+ <version>0.7-SNAPSHOT</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ org.apache.openejb
+ </groupId>
+ <artifactId>openejb-jee</artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ org.apache.openejb
+ </groupId>
+ <artifactId>
+ openejb-core
+ </artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ org.apache.openejb
+ </groupId>
+ <artifactId>
+ openejb-loader
+ </artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ org.apache.openejb
+ </groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-1</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>
+ log4j
+ </groupId>
+ <artifactId>
+ log4j
+ </artifactId>
+ <version>1.2.12</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.codehaus.swizzle</groupId>
+ <artifactId>swizzle-stream</artifactId>
+ <version>1.0.1</version>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>plugins-common</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-jee</artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-loader</artifactId>
+ <version>3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-1</version>
+ </dependency>
+ </dependencies>
+</project>
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Activator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Activator.java?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Activator.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Activator.java Mon Sep 29 09:32:57 2008
@@ -0,0 +1,83 @@
+/*
+ * 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.devtools.core;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.apache.openejb.devtools.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * 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);
+ }
+
+ public static IWorkbenchWindow getWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java Mon Sep 29 09:32:57 2008
@@ -0,0 +1,780 @@
+/*
+ * 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.devtools.core;
+
+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.apache.openejb.plugins.common.IJDTFacade;
+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.core.runtime.PlatformObject;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+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.ASTNode;
+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.Block;
+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.Modifier;
+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.jdt.core.dom.Modifier.ModifierKeyword;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.SearchRequestor;
+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
+ *
+ */
+@SuppressWarnings("unchecked") //$NON-NLS-1$
+public class JDTFacade implements IJDTFacade {
+
+ private class BasicSearchRequestor extends SearchRequestor {
+ private List<SearchMatch> matches = new ArrayList<SearchMatch>();
+
+ @Override
+ public void acceptSearchMatch(SearchMatch match) throws CoreException {
+ matches.add(match);
+ }
+
+ public SearchMatch[] getMatches() {
+ return matches.toArray(new SearchMatch[0]);
+ }
+ }
+
+ 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 JDTFacade(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)) {
+ AST ast = compilationUnit.getAST();
+
+ Name name = createQualifiedName(ast, classToImport);
+ ImportDeclaration importDeclaration = ast.newImportDeclaration();
+ importDeclaration.setName(name);
+ importDeclaration.setOnDemand(false);
+ importDeclaration.setStatic(false);
+
+ compilationUnit.imports().add(importDeclaration);
+ }
+ }
+
+ private Name createQualifiedName(AST ast, String classToImport) {
+ String[] parts = classToImport.split("\\."); //$NON-NLS-1$
+
+ 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);
+ }
+ }
+ return name;
+ }
+
+ private Type createQualifiedType(AST ast, String targetClass) {
+ String[] parts = targetClass.split("\\."); //$NON-NLS-1$
+
+ Type type = null;
+
+ for (int i = 0; i < parts.length; i++) {
+ SimpleName name = ast.newSimpleName(parts[i]);
+ if (i == 0) {
+ type = ast.newSimpleType(name);
+ } else {
+ type = ast.newQualifiedType(type, name);
+ }
+ }
+
+ return type;
+ }
+
+ /**
+ * 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(".")); //$NON-NLS-1$
+
+ 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);
+
+ cu.recordModifications();
+ return cu;
+ }
+
+ private Block parseBlock(String block) {
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setKind(ASTParser.K_STATEMENTS);
+ parser.setSource(block.toCharArray());
+ parser.setResolveBindings(true);
+
+ Block val = (Block) parser.createAST(null);
+ return val;
+ }
+
+ /*
+ * (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(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
+ return;
+ }
+
+ Annotation modifier = createModifier(cu.getAST(), annotation, properties, cu);
+ typeDeclaration.modifiers().add(0, modifier);
+ } catch (Exception e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.2"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
+ }
+ }
+
+ 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 method = getMethodDeclaration(typeDeclaration, methodName, signature);
+ if (method == null) {
+ return;
+ }
+ Annotation modifier = createModifier(cu.getAST(), annotationClass, properties, cu);
+ method.modifiers().add(0, modifier);
+
+ addImportToCompilationUnit(annotationClass.getCanonicalName(), cu);
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.3"), annotationClass.getCanonicalName(), methodName, fullyQualifiedClassName)); //$NON-NLS-1$
+ }
+ }
+
+ private MethodDeclaration getMethodDeclaration(TypeDeclaration typeDeclaration, String methodName, String[] signature) {
+ MethodDeclaration m = null;
+
+ 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))) {
+ m = method;
+ }
+ }
+ return m;
+ }
+
+ 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(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.4"), annotation.getCanonicalName(), targetField, targetClass)); //$NON-NLS-1$
+ }
+ }
+
+ public Change getChange() {
+ CompositeChange compositeChange = new CompositeChange(Messages.getString("org.apache.openejb.helper.annotation.compositChangeString")); //$NON-NLS-1$
+
+ 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"); //$NON-NLS-1$
+ 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]);
+ }
+
+ @SuppressWarnings("unchecked") //$NON-NLS-1$
+ public void removeInterface(String targetClass, String interfaceToRemove) {
+ try {
+ CompilationUnit cu = getCompilationUnit(targetClass);
+ TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+
+ Iterator iter = typeDeclaration.superInterfaceTypes().iterator();
+ while (iter.hasNext()) {
+ Object obj = iter.next();
+ if (obj instanceof SimpleType) {
+ SimpleType type = (SimpleType) obj;
+ String qualifiedName = type.resolveBinding().getQualifiedName();
+
+ if (qualifiedName.equals(interfaceToRemove)) {
+ iter.remove();
+ }
+ }
+
+ }
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.5"), interfaceToRemove, targetClass)); //$NON-NLS-1$
+ }
+ }
+
+ public void removeAbstractModifierFromClass(String targetClass) {
+ try {
+ CompilationUnit cu = getCompilationUnit(targetClass);
+ BodyDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+ removeAbstractModifier(typeDeclaration.modifiers());
+ } catch (Exception e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.6"), targetClass)); //$NON-NLS-1$
+ }
+ }
+
+ private void removeAbstractModifier(List modifiers) {
+ Iterator iterator = modifiers.iterator();
+ while (iterator.hasNext()) {
+ IExtendedModifier modifier = (IExtendedModifier) iterator.next();
+ if (modifier instanceof Modifier) {
+ if (((Modifier) modifier).isAbstract()) {
+ iterator.remove();
+ }
+ }
+ }
+ }
+
+ public void removeAbstractModifierFromMethod(String targetClass, String methodName, String[] signature, String methodBody) {
+ try {
+ String code = methodBody;
+
+ CompilationUnit compilationUnit = getCompilationUnit(targetClass);
+ TypeDeclaration typeDeclaration = getTypeDeclaration(compilationUnit, targetClass);
+ MethodDeclaration methodDeclaration = getMethodDeclaration(typeDeclaration, methodName, signature);
+ removeAbstractModifier(methodDeclaration.modifiers());
+
+ List parameters = methodDeclaration.parameters();
+ for (int i = 0; i < parameters.size(); i++) {
+ SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(i);
+ code = code.replaceAll("\\$\\{" + Integer.toString(i) + "\\}", parameter.resolveBinding().getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ Block block = parseBlock(code);
+ block = (Block) ASTNode.copySubtree(methodDeclaration.getAST(), block);
+
+ methodDeclaration.setBody((Block) block);
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.7"), targetClass, methodName)); //$NON-NLS-1$
+ }
+ }
+
+ public boolean classImplements(String targetClass, String targetInterface) {
+ try {
+ CompilationUnit cu = getCompilationUnit(targetClass);
+ TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+
+ Iterator iter = typeDeclaration.superInterfaceTypes().iterator();
+ while (iter.hasNext()) {
+ Object obj = iter.next();
+ if (obj instanceof SimpleType) {
+ SimpleType type = (SimpleType) obj;
+ String qualifiedName = type.resolveBinding().getQualifiedName();
+
+ if (qualifiedName.equals(targetInterface)) {
+ return true;
+ }
+ }
+
+ }
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.8"), targetClass)); //$NON-NLS-1$
+ }
+
+ return false;
+ }
+
+ public String getSuperClass(String targetClass) {
+ try {
+ TypeDeclaration type = getTypeDeclaration(getCompilationUnit(targetClass), targetClass);
+ Type superclassType = type.getSuperclassType();
+
+ if (superclassType == null) {
+ return targetClass;
+ }
+
+ return superclassType.resolveBinding().getQualifiedName();
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.9"), targetClass)); //$NON-NLS-1$
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+ public String getMethodReturnType(String targetClass, String methodName, String[] signature) {
+ try {
+ CompilationUnit compilationUnit = getCompilationUnit(targetClass);
+ TypeDeclaration typeDeclaration = getTypeDeclaration(compilationUnit, targetClass);
+ MethodDeclaration methodDeclaration = getMethodDeclaration(typeDeclaration, methodName, signature);
+
+ return methodDeclaration.resolveBinding().getReturnType().getQualifiedName();
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.10"), targetClass, methodName)); //$NON-NLS-1$
+ }
+
+ return null;
+ }
+
+ public void addField(String targetClass, String fieldName, String fieldType) {
+ try {
+ CompilationUnit compilationUnit = getCompilationUnit(targetClass);
+ TypeDeclaration typeDeclaration = getTypeDeclaration(compilationUnit, targetClass);
+
+ VariableDeclarationFragment variableDeclaration = typeDeclaration.getAST().newVariableDeclarationFragment();
+ variableDeclaration.setName(typeDeclaration.getAST().newSimpleName(fieldName));
+
+ FieldDeclaration fieldDeclaration = typeDeclaration.getAST().newFieldDeclaration(variableDeclaration);
+ Type type = createQualifiedType(compilationUnit.getAST(), fieldType);
+ fieldDeclaration.setType(type);
+ Modifier privateModifier = fieldDeclaration.getAST().newModifier(ModifierKeyword.PRIVATE_KEYWORD);
+ fieldDeclaration.modifiers().add(privateModifier);
+ typeDeclaration.bodyDeclarations().add(fieldDeclaration);
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.11"), fieldName, targetClass)); //$NON-NLS-1$
+ }
+
+ }
+
+ public void addAnnotationToFieldsOfType(String targetClass, Class<?> annotation, Map<String, Object> properties) {
+ try {
+ IType element = javaProject.findType(targetClass);
+
+ SearchEngine searchEngine = new SearchEngine();
+ SearchPattern pattern = SearchPattern.createPattern(element, IJavaSearchConstants.REFERENCES);
+ SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
+ IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
+
+ BasicSearchRequestor requestor = new BasicSearchRequestor();
+ searchEngine.search(pattern, participants, scope, requestor, null);
+
+ SearchMatch[] matches = requestor.getMatches();
+ for (SearchMatch match : matches) {
+ try {
+ IJavaElement javaElement = (IJavaElement) ((PlatformObject) (match.getElement())).getAdapter(IJavaElement.class);
+
+ // only support field
+ if (javaElement.getElementType() != IJavaElement.FIELD) {
+ continue;
+ }
+
+ // field name
+ String name = javaElement.getElementName();
+
+ // target class to add annotation to
+ String foundClass = ((IType) javaElement.getParent()).getFullyQualifiedName();
+
+ addFieldAnnotation(foundClass, name, annotation, properties);
+ } catch (Exception e) {
+
+ }
+ }
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public void addInterface(String targetClass, String interfaceClass) {
+ try {
+ CompilationUnit cu = getCompilationUnit(targetClass);
+ addImportToCompilationUnit(interfaceClass, cu);
+
+ TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+ AST ast = cu.getAST();
+ SimpleType interfaceType = ast.newSimpleType(createQualifiedName(ast, interfaceClass));
+
+ typeDeclaration.superInterfaceTypes().add(interfaceType);
+ } catch (CoreException e) {
+ warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), interfaceClass, targetClass)); //$NON-NLS-1$
+ }
+ }
+
+ public void addWarning(String warning) {
+ warnings.add(warning);
+ }
+
+ public void removeClassAnnotation(String targetClass, Class<?> cls) {
+ // TODO Auto-generated method stub
+ try {
+ CompilationUnit cu = getCompilationUnit(targetClass);
+ TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+
+ List modifiers = typeDeclaration.modifiers();
+ Iterator iterator = modifiers.iterator();
+
+ while (iterator.hasNext()) {
+ IExtendedModifier modifier = (IExtendedModifier) iterator.next();
+ if (modifier.isAnnotation()) {
+ Annotation annotation = (Annotation) modifier;
+ if (cls.getCanonicalName().equals(annotation.resolveTypeBinding().getQualifiedName())) {
+ iterator.remove();
+ }
+ }
+ }
+
+ } catch (JavaModelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Messages.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Messages.java?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Messages.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/Messages.java Mon Sep 29 09:32:57 2008
@@ -0,0 +1,23 @@
+package org.apache.openejb.devtools.core;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.apache.openejb.devtools.core.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages.properties?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages.properties Mon Sep 29 09:32:57 2008
@@ -0,0 +1,17 @@
+org.apache.openejb.helper.annotation.conversionExceptionMsg.1=Unable to unmarshal XML
+org.apache.openejb.helper.annotation.conversionExceptionMsg.2=Unable to unmarshal XML (parser configuration error)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.3=Unable to unmarshal XML (SAX error - XML badly formed?)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.4=Unable to convert openejb-jar.xml to orm.xml
+org.apache.openejb.helper.annotation.warnings.1=Annotation %1$s already used on %2$s
+org.apache.openejb.helper.annotation.warnings.2=An error occurred adding annotation %1$s to class %2$s
+org.apache.openejb.helper.annotation.warnings.3=An error occurred adding annotation %1$s to method %2$s on %3$s
+org.apache.openejb.helper.annotation.warnings.4=An error occurred adding annotation %1$s to field %2$s on %3$s
+org.apache.openejb.helper.annotation.compositChangeString=Add EJB 3.0 Annotations
+org.apache.openejb.helper.annotation.warnings.5=An error occurred removing %1$s from %2$s
+org.apache.openejb.helper.annotation.warnings.6=An error occurred removing abstract from %1$s
+org.apache.openejb.helper.annotation.warnings.7=Unable to remove abstract modifier from: %1$s.%2$s
+org.apache.openejb.helper.annotation.warnings.8=An error occurred determining interfaces of %1$s
+org.apache.openejb.helper.annotation.warnings.9=Error occurred getting superclass of %1$s
+org.apache.openejb.helper.annotation.warnings.10=Error getting return type of %1$s.%2$s
+org.apache.openejb.helper.annotation.warnings.11=Error adding field %1$s on %2$s
+org.apache.openejb.helper.annotation.warnings.12=An error occurred adding %1$s to %2$s
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages_de.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages_de.properties?rev=700171&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages_de.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/resources/org/apache/openejb/devtools/core/messages_de.properties Mon Sep 29 09:32:57 2008
@@ -0,0 +1,17 @@
+org.apache.openejb.helper.annotation.conversionExceptionMsg.1=Fehler beim Erstellen des XML Dokuments
+org.apache.openejb.helper.annotation.conversionExceptionMsg.2=Fehler beim Erstellen des XML Dokuments (parser configuration error)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.3=Fehler beim Erstellen des XML Dokuments (SAX error - XML Dokument ist wom\u00f6glich nicht wohlgeformt?)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.4=openejb-jar.xml konnte nicht nach orm.xml konvertiert werden
+org.apache.openejb.helper.annotation.warnings.1=Annotation %1$s existiert bereits f\u00fcr %2$s
+org.apache.openejb.helper.annotation.warnings.2=Beim Erstellen der Annotation %1$s f\u00fcr die Klasse %2$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.3=Beim Erstellen der Annotation %1$s f\u00fcr die Methode %2$s der Klasse %3$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.4=Beim Erstellen der Annotation %1$s f\u00fcr das Feld %2$s der Klasse %3$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.compositChangeString=EJB 3.0 Annotations hinzuf\u00fcgen
+org.apache.openejb.helper.annotation.warnings.5=Beim Entfernen der Annotation %1$s f\u00fcr die Klasse %2$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.6=Beim entfernen des Schl\u00fcsselworts abstract f\u00fcr die Klasse %1$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.7=Der abstract Modifikator konnte von %1$s.%2$s nicht entfernt werden
+org.apache.openejb.helper.annotation.warnings.8=Die Schnittstellen von %1$s konnten nicht ermittelt werden
+org.apache.openejb.helper.annotation.warnings.9=Die Basisklasse von %1$s konnte nicht ermittelt werden
+org.apache.openejb.helper.annotation.warnings.10=Der r\u00fcckgabewert von %1$s.%2$s konnte nicht ermittelt werden
+org.apache.openejb.helper.annotation.warnings.11=Das Feld %1$s konnte nicht zur Klasse %2$s hinzugef\u00fcgt werden
+org.apache.openejb.helper.annotation.warnings.12=Die Schnittstellenklasse %1$s konnte der Klasse %2$s nicht hinzugef\u00fcgt werden
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/META-INF/MANIFEST.MF?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/META-INF/MANIFEST.MF (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/META-INF/MANIFEST.MF Mon Sep 29 09:32:57 2008
@@ -12,7 +12,8 @@
org.eclipse.jdt.launching,
org.eclipse.ui,
org.apache.openejb.helper.annotation,
- org.eclipse.ltk.core.refactoring
+ org.eclipse.ltk.core.refactoring,
+ org.apache.openejb.devtools.core
Bundle-Classpath: .,
lib/javaee-api-5.0-1.jar,
target/classes/
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/pom.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/pom.xml Mon Sep 29 09:32:57 2008
@@ -109,5 +109,10 @@
<artifactId>org.apache.openejb.helper.annotation</artifactId>
<version>1.0.0</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>org.apache.openejb.devtools.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
</dependencies>
</project>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java Mon Sep 29 09:32:57 2008
@@ -33,7 +33,7 @@
import junit.framework.TestCase;
-import org.apache.openejb.helper.annotation.JDTFacade;
+import org.apache.openejb.devtools.core.JDTFacade;
import org.apache.openejb.helper.annotation.fixtures.ProjectFixture;
import org.apache.openejb.helper.annotation.fixtures.StreamFixture;
import org.eclipse.core.runtime.CoreException;
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=700171&r1=700170&r2=700171&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 Mon Sep 29 09:32:57 2008
@@ -18,21 +18,10 @@
org.junit,
org.eclipse.jdt.ui,
org.eclipse.search,
- org.eclipse.help
+ org.eclipse.help,
+ org.apache.openejb.devtools.core
Eclipse-LazyStart: true
Bundle-ClassPath: .,
- lib/openejb-jee-3.1-SNAPSHOT.jar,
- lib/openejb-core-3.1-SNAPSHOT.jar,
- lib/openejb-loader-3.1-SNAPSHOT.jar,
- lib/xbean-finder-3.2-SNAPSHOT.jar,
- lib/plugins-common-1.0.0.jar,
- lib/sxc-runtime-0.7-SNAPSHOT.jar,
- lib/sxc-jaxb-0.7-SNAPSHOT.jar,
- lib/javaee-api-5.0-1.jar,
- lib/jaxb-api-2.0.jar,
- lib/jaxb-impl-2.0.3.jar,
- lib/log4j-1.2.12.jar,
- lib/swizzle-stream-1.0.1.jar,
target/classes/
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/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml?rev=700171&r1=700170&r2=700171&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 Mon Sep 29 09:32:57 2008
@@ -72,132 +72,13 @@
<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>
- com.envoisolutions.sxc
- </groupId>
- <artifactId>sxc-jaxb</artifactId>
- <version>0.7-SNAPSHOT</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- com.envoisolutions.sxc
- </groupId>
- <artifactId>sxc-runtime</artifactId>
- <version>0.7-SNAPSHOT</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- org.apache.openejb
- </groupId>
- <artifactId>openejb-jee</artifactId>
- <version>3.1-SNAPSHOT</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- org.apache.openejb
- </groupId>
- <artifactId>
- openejb-core
- </artifactId>
- <version>3.1-SNAPSHOT</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- org.apache.openejb
- </groupId>
- <artifactId>
- openejb-loader
- </artifactId>
- <version>3.1-SNAPSHOT</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- org.apache.openejb
- </groupId>
- <artifactId>javaee-api</artifactId>
- <version>5.0-1</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- org.apache.openejb
- </groupId>
- <artifactId>
- plugins-common
- </artifactId>
- <version>1.0.0</version>
- </artifactItem>
- <artifactItem>
- <groupId>
- log4j
- </groupId>
- <artifactId>
- log4j
- </artifactId>
- <version>1.2.12</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.codehaus.swizzle</groupId>
- <artifactId>swizzle-stream</artifactId>
- <version>1.0.1</version>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.openejb</groupId>
- <artifactId>openejb-jee</artifactId>
- <version>3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-core</artifactId>
- <version>3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-loader</artifactId>
- <version>3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>plugins-common</artifactId>
+ <artifactId>org.apache.openejb.devtools.core</artifactId>
<version>1.0.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>javaee-api</artifactId>
- <version>5.0-1</version>
- </dependency>
</dependencies>
</project>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.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/wizards/EJBMigrationRefactoring.java?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java Mon Sep 29 09:32:57 2008
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.openejb.helper.annotation.JDTFacade;
+import org.apache.openejb.devtools.core.JDTFacade;
import org.apache.openejb.plugins.common.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/pom.xml?rev=700171&r1=700170&r2=700171&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/pom.xml Mon Sep 29 09:32:57 2008
@@ -143,6 +143,7 @@
</pluginManagement>
</build>
<modules>
+ <module>org.apache.openejb.devtools.core</module>
<module>org.apache.openejb.branding</module>
<module>org.apache.openejb.helper.annotation</module>
<module>org.apache.openejb.builder</module>