ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r728378 - in /ibatis/trunk/java/tools/ibator/eclipse: IbatorUpdateSite/ org.apache.ibatis.ibator.core/ org.apache.ibatis.ibator.core/META-INF/ org.apache.ibatis.ibator.eclipse.core/META-INF/ org.apache.ibatis.ibator.eclipse.core/src/org/apa...
Date Sun, 21 Dec 2008 03:24:59 GMT
Author: jgbutler
Date: Sat Dec 20 19:24:58 2008
New Revision: 728378

URL: http://svn.apache.org/viewvc?rev=728378&view=rev
Log:
[ibator] updates for the Ibator Eclipse Plugin

Added:
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorClasspathVariableInitializer.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/AddIbatorAction.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/JavaProjectAdapter.java
Modified:
    ibatis/trunk/java/tools/ibator/eclipse/IbatorUpdateSite/site.xml
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/META-INF/MANIFEST.MF
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/build.properties
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/META-INF/MANIFEST.MF
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/src/org/apache/ibatis/ibator/eclipse/core/merge/JavaFileMerger.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/META-INF/MANIFEST.MF
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml

Modified: ibatis/trunk/java/tools/ibator/eclipse/IbatorUpdateSite/site.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/IbatorUpdateSite/site.xml?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/IbatorUpdateSite/site.xml (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/IbatorUpdateSite/site.xml Sat Dec 20 19:24:58 2008
@@ -3,6 +3,9 @@
    <feature url="features/org.apache.ibatis.ibator_1.2.0.jar" id="org.apache.ibatis.ibator" version="1.2.0">
       <category name="Ibator Version 1.2"/>
    </feature>
+   <feature url="features/org.apache.ibatis.ibator_1.2.1.jar" id="org.apache.ibatis.ibator" version="1.2.1">
+      <category name="Ibator Version 1.2"/>
+   </feature>
    <category-def name="Ibator Version 1.2" label="Ibator Version 1.2">
       <description>
          Versions of the Ibator featured based on Ibator version 1.2 and Eclipse version 3.4.1

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/META-INF/MANIFEST.MF?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/META-INF/MANIFEST.MF (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/META-INF/MANIFEST.MF Sat Dec 20 19:24:58 2008
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Ibator Core Plug-in
 Bundle-SymbolicName: org.apache.ibatis.ibator.core
-Bundle-Version: 1.2.0
+Bundle-Version: 1.2.1
 Bundle-ClassPath: ibator.jar
 Export-Package: org.apache.ibatis.ibator.ant,
  org.apache.ibatis.ibator.api,

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/build.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/build.properties?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/build.properties (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.core/build.properties Sat Dec 20 19:24:58 2008
@@ -1,4 +1,5 @@
 bin.includes = META-INF/,\
                ibator.jar,\
                LICENSE,\
-               NOTICE
+               NOTICE,\
+               ibator-src.zip

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/META-INF/MANIFEST.MF?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/META-INF/MANIFEST.MF (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/META-INF/MANIFEST.MF Sat Dec 20 19:24:58 2008
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Apache iBATIS Ibator Eclipse Core Support Plug-in
 Bundle-SymbolicName: org.apache.ibatis.ibator.eclipse.core
-Bundle-Version: 1.2.0
+Bundle-Version: 1.2.1
 Bundle-Vendor: ibatis.apache.org
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Export-Package: org.apache.ibatis.ibator.eclipse.core.callback,

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/src/org/apache/ibatis/ibator/eclipse/core/merge/JavaFileMerger.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/src/org/apache/ibatis/ibator/eclipse/core/merge/JavaFileMerger.java?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/src/org/apache/ibatis/ibator/eclipse/core/merge/JavaFileMerger.java (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.core/src/org/apache/ibatis/ibator/eclipse/core/merge/JavaFileMerger.java Sat Dec 20 19:24:58 2008
@@ -15,18 +15,15 @@
  */
 package org.apache.ibatis.ibator.eclipse.core.merge;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ibatis.ibator.exception.ShellException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.dom.AST;
 import org.eclipse.jdt.core.dom.ASTNode;
@@ -78,20 +75,13 @@
         ASTParser astParser = ASTParser.newParser(AST.JLS3);
         NewJavaFileVisitor newJavaFileVisitor = visitNewJavaFile(astParser);
 
-        IFile existingFile = getFile();
-        
-        ICompilationUnit icu = JavaCore.createCompilationUnitFrom(existingFile);
-        IDocument document;
-        try {
-            document = new Document(icu.getSource());
-        } catch (CoreException e) {
-            throw new ShellException(e.getStatus().getMessage(), e);
-        }
+        String existingFile = getExistingFileContents();
+        IDocument document = new Document(existingFile);
 
         // delete ibator generated stuff, and collect imports
         ExistingJavaFileVisitor visitor = new ExistingJavaFileVisitor(javaDocTags);
 
-        astParser.setSource(icu);
+        astParser.setSource(existingFile.toCharArray());
         CompilationUnit cu = (CompilationUnit) astParser.createAST(null);
         AST ast = cu.getAST();
         cu.recordModifications();
@@ -101,7 +91,7 @@
         if (typeDeclaration == null) {
             StringBuffer sb = new StringBuffer();
             sb.append("No types defined in the file ");
-            sb.append(existingFile.getName());
+            sb.append(existingFilePath);
 
             throw new ShellException(sb.toString());
         }
@@ -276,20 +266,36 @@
         return newVisitor;
     }
     
-    private IFile getFile() throws ShellException {
-        IPath path = new Path(existingFilePath);
-        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-        IFile file = root.getFileForLocation(path);
-        if (file != null && file.exists()) {
-            return file;
-        } else {
+    private String getExistingFileContents() throws ShellException {
+        File file = new File(existingFilePath);
+        
+        if (!file.exists()) {
             // this should not happen because ibator only returns the path
             // calculated by the eclipse callback
             StringBuilder sb = new StringBuilder();
             sb.append("The file ");
             sb.append(existingFilePath);
-            sb.append(" does not exist in this workspace");
+            sb.append(" does not exist");
             throw new ShellException(sb.toString());
         }
+
+        try {
+            StringBuilder sb = new StringBuilder();
+            BufferedReader br = new BufferedReader(new FileReader(file));
+            char[] buffer = new char[1024];
+            int returnedBytes = br.read(buffer);
+            while (returnedBytes != -1) {
+                sb.append(buffer, 0, returnedBytes);
+                returnedBytes = br.read(buffer);
+            }
+        
+            br.close();
+            return sb.toString();
+        } catch (IOException e) {
+            StringBuilder sb = new StringBuilder();
+            sb.append("IOException reading the file ");
+            sb.append(existingFilePath);
+            throw new ShellException(sb.toString(), e);
+        }
     }
 }

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/META-INF/MANIFEST.MF?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/META-INF/MANIFEST.MF (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/META-INF/MANIFEST.MF Sat Dec 20 19:24:58 2008
@@ -2,5 +2,5 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Apache iBATIS Ibator Documentation Plug-in
 Bundle-SymbolicName: org.apache.ibatis.ibator.eclipse.doc; singleton:=true
-Bundle-Version: 1.2.0
+Bundle-Version: 1.2.1
 Bundle-Vendor: ibatis.apache.org

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml Sat Dec 20 19:24:58 2008
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <project default="refresh">
   <path id="org.abache.ibatis.ibator.doc.javadocclasspath">
   	<pathelement location="../org.apache.ibatis.ibator.eclipse.ui/bin"/>
@@ -14,7 +13,7 @@
       access="protected" 
       author="true" 
       destdir="html/javadoc" 
-      doctitle="Apache iBATIS Ibator" 
+      doctitle="Apache iBATIS Ibator API Specifications" 
       nodeprecated="false" 
       nodeprecatedlist="false" 
       noindex="false" 

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html Sat Dec 20 19:24:58 2008
@@ -14,6 +14,7 @@
   <li>A new file wizard for creating configuration files</li>
   <li>An popup menu action to run Ibator</li>
   <li>An integrated Ant Task</li>
+  <li>Classpath Variables for Ibator</li>
 </ul>
 
 <h2>New Configuration File Wizard</h2>
@@ -34,5 +35,20 @@
 <p>See the page <a href="usingAnt.html">Using the Integrated Ant Task</a> for more
 information about using the integrated Ant task.</p>
 
+<h2>Classpath Variables</h2>
+<p>The plugin defines these classpath variables that will be useful for anyone
+implementing an Ibator extension:</p>
+<ul>
+  <li><code>IBATOR_JAR</code> - this points to the Ibator JAR file included
+      with the plugin.</li>
+  <li><code>IBATOR_JAR_SRC</code> - this points to the source archive for Ibator
+      included with the plugin.  You can attach this source archive to the
+      Ibator JAR file to browse the source code.</li>
+</ul>
+<p>You can uses these variables to easily add Ibator to the build path of your
+Ibator extension project.  Ibator also defines a menu option that will add these
+variables to any Java project.  Right click on any Java project, then
+take the menu option "Add Ibator to Build Path".</p>  
+
 </body>
 </html>

Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html?rev=728378&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html Sat Dec 20 19:24:58 2008
@@ -0,0 +1,221 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Manual Test Scripts</title>
+  <link type="text/css" rel="stylesheet" href="../ibatordoc/ibator.css"/>
+</head>
+<body>
+<h1>Manual Test Scripts</h1>
+<p>This page details test scripts for testing the different parts of the Ibator UI.
+This information may also be helpfol in learning how to use the different parts
+of the Eclipse user interface.</p>
+<h2>Setup</h2>
+<ol>
+  <li>Make sure that MySQL is installed and running.  The following scripts also assume
+      that the password for <code>root</code> is also <code>root</code></li>
+  <li>Make sure that you have downloaded the MySQL Connector for Java and unzipped
+      it somewhere on your local drive.</li>
+  <li>If you have not created the Ibator test database already, then execute the
+      following script:
+      <pre>
+
+drop schema if exists ibatortest;
+create schema ibatortest;
+use ibatortest;
+create table a (id int not null, description varchar(50), primary key(id));
+create table b (id int not null, description varchar(50), primary key(id));
+create table c (id int not null, description varchar(50), primary key(id));
+create table d (id int not null, description varchar(50), primary key(id));
+create table e (id int not null, description varchar(50), primary key(id));
+create table f (id int not null, description varchar(50), primary key(id));
+create table g (id int not null, description varchar(50), primary key(id));
+create table h (id int not null, description varchar(50), primary key(id));
+create table i (id int not null, description varchar(50), primary key(id));
+create table j (id int not null, description varchar(50), primary key(id));
+      </pre>
+  </li>
+</ol>
+
+<h2>Tests</h2>
+<p>The following tests are intended to be executed in the order listed.  Some
+tests build on items created in previous tests.</p>
+<h3>Installation</h3>
+<ol>
+  <li>Install a fresh version of Eclipse (version 3.4.1 or later)</li>
+  <li>Open the fresh Eclipse install, and create a new (empty) workspace</li>
+  <li>Configure a local update site to point to the newly generated site
+      (Help&gt;Software Updates...)</li>
+  <li>Show all versions of the feature</li>
+  <li>Install the oldest version of the feature</li>
+  <li>Restart Eclipse</li>
+  <li>Do a regular software update and ensure that the newest version of the
+      feature is lasted as an install option (this may also install other Eclipse updates)</li>
+  <li>Restart Eclipse</li>
+  <li>Ensure that the latest version of the feature is listed as installed</li>
+</ol>
+
+<h3>Documentation</h3>
+<ol>
+  <li>Start Eclipse if not already started</li>
+  <li>Open the Eclipse help (Help&gt;Help Contents)</li>
+  <li>Ensure that the book "Apache iBATIS Ibator User's Guide" apprears
+      in the contents.</li>
+  <li>Ensure that every item in the contents points to a valid page,
+      and that all pages are referenced in the table of contents.  This is
+      especially important if new packages or help pages have been added anywhere.</li>
+  <li>Ensure that the latest version of the relase notes is shown both in the
+      Eclipse UI documentation, and the Core Ibator documentation.</li>
+</ol>
+
+<h3>New File Wizard</h3>
+<ol>
+  <li>Create a new JavaProject called "IbatorTest".  Make sure there is a separate source folder
+      called <code>src</code></li>
+  <li>Add an additional source folder called <code>generatedsrc</code></li>
+  <li>Configure the build path to add the iBATIS JAR file (typically an external JAR
+     in the ../devlib directory)</li>
+  <li>Create a new package in the <code>src</code> folder called <code>config</code></li>
+  <li>Make a new Ibator configuration file:
+    <ol type="a">
+      <li>Right click on the <code>config</code> package</li>
+      <li>Select New&gt;Other&gt;Apache iBATIS Ibator&gt;Apache iBATIS Ibator Configuration File</li>
+      <li>Press Next</li>
+      <li>Verify that Location is set to "IbatorTest/src/config"</li>
+      <li>Verify that File Name is set to "ibatorConfig.xml"</li>
+      <li>Press Finish</li>
+      <li>Verify that an editor opens with a skeleton Ibator configuration File</li>
+    </ol></li>
+    <li>Right click on the new file, then take the option "Generate iBATIS Artifacts"</li>
+    <li>Verify that an error dialog is shown with the detail message "Exception getting JDBC Driver"</li>
+    <li>Press "OK" to dismiss the dialog</li>
+</ol>
+
+<h3>Generate iBATIS Artifacts</h3>
+<ol>
+  <li>Open an editor on the file "ibatorConfig.xml" that you created in the previous test</li>
+  <li>Change the contents of the file to the following:
+    <pre>
+
+&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;!DOCTYPE ibatorConfiguration
+  PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN"
+  "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd"&gt;
+&lt;ibatorConfiguration&gt;
+  &lt;classPathEntry location="/JavaTools/mysql-connector-java-5.0.6/mysql-connector-java-5.0.6-bin.jar" /&gt;
+  &lt;ibatorContext id="context1" targetRuntime="Ibatis2Java5" &gt;
+    &lt;jdbcConnection driverClass="com.mysql.jdbc.Driver"
+      connectionURL="jdbc:mysql://localhost/ibatortest"
+      userId="root" password="root" &gt;
+    &lt;/jdbcConnection&gt;
+    &lt;javaModelGenerator targetPackage="gen.model" targetProject="IbatorTest" /&gt;
+    &lt;sqlMapGenerator targetPackage="gen.sql" targetProject="IbatorTest" /&gt;
+    &lt;daoGenerator targetPackage="gen.dao" targetProject="IbatorTest" type="GENERIC-CI" /&gt;
+    &lt;table tableName="a" /&gt;
+  &lt;/ibatorContext&gt;
+
+  &lt;ibatorContext id="context2" targetRuntime="Ibatis2Java5" &gt;
+    &lt;jdbcConnection driverClass="com.mysql.jdbc.Driver"
+      connectionURL="jdbc:mysql://localhost/ibatortest"
+      userId="root" password="root" &gt;
+    &lt;/jdbcConnection&gt;
+    &lt;javaModelGenerator targetPackage="gen.src.model" targetProject="IbatorTest/generatedsrc" /&gt;
+    &lt;sqlMapGenerator targetPackage="gen.src.sql" targetProject="IbatorTest/generatedsrc" /&gt;
+    &lt;daoGenerator targetPackage="gen.src.dao" targetProject="IbatorTest/generatedsrc" type="GENERIC-SI" /&gt;
+    &lt;table schema="ibatortest" tableName="%" /&gt;
+  &lt;/ibatorContext&gt;
+&lt;/ibatorConfiguration&gt;
+    </pre></li>
+    <li>Change the location of the JDBC driver in the <code>&lt;classPathEntry&gt;</code> element
+      if different on your system</li>
+    <li>Save the file</li>
+    <li>Right click on the file, then take the option "Generate iBATIS Artifacts"</li>
+    <li>Verify that code is generated in the two different source folders.  Code for table "a"
+        should be in the "src" folder, code for tables "a" through "j" should be in the
+        "generatedsrc" folder.  Verify that there are no compliation errors or warnings.</li>
+</ol>
+
+<h3>Java File Merger</h3>
+<ol>
+  <li>Open the Java file <code>gen.dao.ADAOImpl.java</code> in the "src" folder</li>
+  <li>Note the time of generation of the file from one of the <code>@ibatorgenerated</code> comments</li>
+  <li>Add a private field of any type called <code>mergetest</code> and generate a getter and setter
+      for the field.</li>
+  <li>Save and close the file</li>
+  <li>Right click on the Ibator configuration file from the last test, and then
+      take the option "Generate iBATIS Artifacts"</li>
+  <li>Verify that the progress bar is reasonably accurate</li>
+  <li>Open the Java file <code>gen.dao.ADAOImpl.java</code> in the "src" folder</li>
+  <li>Verify that the time of generation is later than the time noted above</li>
+  <li>Verify that the field <code>mergetest</code>, and its getter and setter remain
+    in the file (they will have been moved to the bottom of the file)</li>
+  <li>Open the Ibator configuration file from the last test.</li>
+  <li>Change the DAO type in <code>context1</code> to <code>SPRING</code></li>
+  <li>Save and close the file</li>
+  <li>Right click on the Ibator configuration file, and then
+      take the option "Generate iBATIS Artifacts"</li>
+  <li>Verify that <code>src.dao.ADAOImpl</code> now extends <code>SqlMapClientDaoSupport<.code>.
+      Note that there will be several errors in the workspace now because of the new dependancies
+      on Spring that were generated.</li>
+
+  <li>Re open the Ibator configuration file.</li>
+  <li>Change the DAO type in <code>context1</code> back to <code>GENERIC-CI</code></li>
+  <li>Save and close the file</li>
+  <li>Right click on the Ibator configuration file, and then
+      take the option "Generate iBATIS Artifacts"</li>
+  <li>Verify that <code>src.dao.ADAOImpl</code> doesn't extend anything.  There will be one
+      error in the file related to the Spring import (the Java merger does not reconcile all
+      imports).  Delete the import and verify that there are no other errors in the
+      workspace.  Also, verigy that the field <code>mergetest</code> and its
+      associated getter and setter still exist.</li>
+</ol>
+
+<h3>Ant Build</h3>
+<ol>
+  <li>Close Eclipse if it is still open, then reopen Eclipse (this resets the plugin classloader
+      for the custom classpath portion of the test).</li>
+  <li>Open the Ibator configuration file from the last test.</li>
+  <li>Delete the <code>&lt;classPathEntry&gt;</code> element from the file.</li>
+  <li>Save and close the file.</li>
+  <li>Create a new file <code>build.xml</code> in the "IbatorTest/src/config" package.</li>
+  <li>Change the contents of the new file to the following:
+    <pre>
+
+&lt;project default="runIbator"&gt;
+  &lt;target name="runIbator"&gt;
+    &lt;eclipse.convertPath resourcepath="IbatorTest/src/config/ibatorConfig.xml"
+                         property="thePath"/&gt;
+    &lt;ibator.generate configfile="${thePath}" &gt;
+    &lt;/ibator.generate&gt;
+  &lt;/target&gt;
+&lt;/project&gt;
+    </pre>
+  </li>
+  <li>Save and close the file.</li>
+  <li>Delete the Java file <code>gen.dao.ADAO.java</code>.  There will now be errors in the
+      workspace.</li>
+  <li>Right click on the new <code>build.xml</code> file, then select the
+      menu option "Run As&gt;Ant Build...".  You should see the Ant launch configuration
+      dialog open.</li>
+  <li>Select the "JRE" tab, then select the "Run in the same JRE as the workspace" radio
+      button.</li>
+  <li>Press the "Run" button</li>
+  <li>You should see an error dialog open with a runtime exception stating "Exception
+      getting JDBC Driver".  Press "OK" to dismiss the dialog.</li>
+  <li>Right click on the new <code>build.xml</code> file, then select the
+      menu option "Run As&gt;Ant Build...".  You should see the Ant launch configuration
+      dialog open.</li>
+  <li>Select the "Classpath" tab, then add the MySQL driver to "User Entries"</li>
+  <li>Press the "Run" button</li>
+  <li>After Ibator runs, you should see a "BUILD SUCCESSFUL" message.</li>
+  <li>Verify that the workspace errors are gone.</li>
+</ol>
+
+<h3>Classpath Variables</h3>
+<ol>
+  <li></li>
+</ol>
+
+</body>
+</html>

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html Sat Dec 20 19:24:58 2008
@@ -8,6 +8,16 @@
 </head>
 <body>
 <h1>Ibator Eclipse Feature Release Notes</h1>
+<h2>Version 1.2.1</h2>
+<ul>
+  <li>Fixed an issue with the JavaFileMerger where it fails in the corner
+      case where a file does not exist, but is then generated more than
+      once by the same run of Ibator</li>
+  <li>Added IBATOR_JAR classpath variable</li>
+  <li>Added IBATOR_JAR_SRC classpath variable</li>
+  <li>Added menu option to add Ibator to the build path of any Java project</li>
+</ul>
+
 <h2>Version 1.2.0</h2>
 <ul>
   <li>As of version 1.2.0, Abator is renamed to Ibator</li>

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml Sat Dec 20 19:24:58 2008
@@ -12,4 +12,6 @@
       </topic>
       <topic href="html/eclipseui/buildingFromSVN.html" label="Building from SVN">
       </topic>
+      <topic href="html/eclipseui/manualTesting.html" label="Manual Test Scripts">
+      </topic>
 </toc>

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF Sat Dec 20 19:24:58 2008
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Apache iBATIS Ibator Ui Plug-in
 Bundle-SymbolicName: org.apache.ibatis.ibator.eclipse.ui;singleton:=true
-Bundle-Version: 1.2.0
+Bundle-Version: 1.2.1
 Bundle-Activator: org.apache.ibatis.ibator.eclipse.ui.IbatorUIPlugin
 Bundle-Vendor: ibatis.apache.org
 Require-Bundle: org.eclipse.ui;bundle-version="3.4.1",
@@ -17,4 +17,3 @@
  org.eclipse.jdt.core;bundle-version="3.4.2"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
-Export-Package: org.apache.ibatis.ibator.eclipse.ui.content

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml Sat Dec 20 19:24:58 2008
@@ -11,6 +11,13 @@
                type="org.apache.ibatis.ibator.eclipse.ui.content.IbatorConfigurationFileAdapter">
          </adapter>
       </factory>
+      <factory
+            adaptableType="org.eclipse.jdt.core.IJavaProject"
+            class="org.apache.ibatis.ibator.eclipse.ui.content.AdapterFactory">
+         <adapter
+               type="org.apache.ibatis.ibator.eclipse.ui.content.JavaProjectAdapter">
+         </adapter>
+      </factory>
    </extension>
    
    <extension
@@ -46,6 +53,19 @@
                menubarPath="additions">
          </action>
       </objectContribution>
+      <objectContribution
+            adaptable="true"
+            id="org.apache.ibatis.ibator.eclipse.ui.IbatorLessProjectContribution"
+            objectClass="org.apache.ibatis.ibator.eclipse.ui.content.JavaProjectAdapter">
+         <action
+               class="org.apache.ibatis.ibator.eclipse.ui.actions.AddIbatorAction"
+               enablesFor="1"
+               icon="icons/iBatisLogo.gif"
+               id="org.apache.ibatis.ibator.eclipse.ui.AddIbatorAction"
+               label="Add Ibator to Build Path"
+               menubarPath="additions">
+         </action>
+      </objectContribution>
    </extension>
    <extension
          point="org.eclipse.ant.core.antTasks">
@@ -69,4 +89,17 @@
             name="Apache iBATIS Ibator Configuration File">
       </wizard>
    </extension>
+   <extension
+         point="org.eclipse.jdt.core.classpathVariableInitializer">
+      <classpathVariableInitializer
+            class="org.apache.ibatis.ibator.eclipse.ui.IbatorClasspathVariableInitializer"
+            readOnly="true"
+            variable="IBATOR_JAR">
+      </classpathVariableInitializer>
+      <classpathVariableInitializer
+            class="org.apache.ibatis.ibator.eclipse.ui.IbatorClasspathVariableInitializer"
+            readOnly="true"
+            variable="IBATOR_JAR_SRC">
+      </classpathVariableInitializer>
+   </extension>
 </plugin>

Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorClasspathVariableInitializer.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorClasspathVariableInitializer.java?rev=728378&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorClasspathVariableInitializer.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorClasspathVariableInitializer.java Sat Dec 20 19:24:58 2008
@@ -0,0 +1,102 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed 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.ibatis.ibator.eclipse.ui;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.ClasspathVariableInitializer;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class IbatorClasspathVariableInitializer extends
+        ClasspathVariableInitializer {
+
+    public static final String IBATOR_JAR = "IBATOR_JAR"; //$NON-NLS-1$
+    public static final String IBATOR_JAR_SRC = "IBATOR_JAR_SRC"; //$NON-NLS-1$
+    
+    /**
+     * 
+     */
+    public IbatorClasspathVariableInitializer() {
+        super();
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jdt.core.ClasspathVariableInitializer#initialize(java.lang.String)
+     */
+    @Override
+    public void initialize(String variable) {
+        if (IBATOR_JAR.equals(variable)) {
+            initializeIbatorJar();
+        } else if (IBATOR_JAR_SRC.equals(variable)) {
+            initializeIbatorJarSource();
+        }
+    }
+    
+    private void initializeIbatorJar() {
+        Bundle bundle= Platform.getBundle("org.apache.ibatis.ibator.core"); //$NON-NLS-1$
+        if (bundle == null) {
+            JavaCore.removeClasspathVariable(IBATOR_JAR, null);
+            return;
+        }
+        URL installLocation= bundle.getEntry("/ibator.jar"); //$NON-NLS-1$
+        URL local= null;
+        try {
+            local= FileLocator.toFileURL(installLocation);
+        } catch (IOException e) {
+            JavaCore.removeClasspathVariable(IBATOR_JAR, null);
+            return;
+        }
+        try {
+            String fullPath= new File(local.getPath()).getAbsolutePath();
+            JavaCore.setClasspathVariable(IBATOR_JAR, new Path(fullPath), null);
+        } catch (JavaModelException e1) {
+            JavaCore.removeClasspathVariable(IBATOR_JAR, null);
+        }
+    }
+
+    private void initializeIbatorJarSource() {
+        Bundle bundle= Platform.getBundle("org.apache.ibatis.ibator.core"); //$NON-NLS-1$
+        if (bundle == null) {
+            JavaCore.removeClasspathVariable(IBATOR_JAR_SRC, null);
+            return;
+        }
+        URL installLocation= bundle.getEntry("/ibator-src.zip"); //$NON-NLS-1$
+        URL local= null;
+        try {
+            local= FileLocator.toFileURL(installLocation);
+        } catch (IOException e) {
+            JavaCore.removeClasspathVariable(IBATOR_JAR_SRC, null);
+            return;
+        }
+        try {
+            String fullPath= new File(local.getPath()).getAbsolutePath();
+            JavaCore.setClasspathVariable(IBATOR_JAR_SRC, new Path(fullPath), null);
+        } catch (JavaModelException e1) {
+            JavaCore.removeClasspathVariable(IBATOR_JAR_SRC, null);
+        }
+    }
+}

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java Sat Dec 20 19:24:58 2008
@@ -1,3 +1,18 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed 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.ibatis.ibator.eclipse.ui;
 
 import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -5,6 +20,8 @@
 
 /**
  * The activator class controls the plug-in life cycle
+ * 
+ * @author Jeff Butler
  */
 public class IbatorUIPlugin extends AbstractUIPlugin {
 

Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/AddIbatorAction.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/AddIbatorAction.java?rev=728378&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/AddIbatorAction.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/AddIbatorAction.java Sat Dec 20 19:24:58 2008
@@ -0,0 +1,77 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed 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.ibatis.ibator.eclipse.ui.actions;
+
+import org.apache.ibatis.ibator.eclipse.ui.IbatorClasspathVariableInitializer;
+import org.apache.ibatis.ibator.eclipse.ui.content.JavaProjectAdapter;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class AddIbatorAction implements IObjectActionDelegate {
+    
+    private IJavaProject iJavaProject;
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run(IAction action) {
+        IPath jarPath = new Path(IbatorClasspathVariableInitializer.IBATOR_JAR);
+        IPath srcPath = new Path(IbatorClasspathVariableInitializer.IBATOR_JAR_SRC);
+        
+        IClasspathEntry newEntry = JavaCore.newVariableEntry(jarPath, srcPath, null);
+        
+        try {
+            IClasspathEntry[] oldClasspath = iJavaProject.getRawClasspath();
+            IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length + 1];
+            System.arraycopy(oldClasspath, 0, newClasspath, 0, oldClasspath.length);
+            newClasspath[oldClasspath.length] = newEntry;
+            iJavaProject.setRawClasspath(newClasspath, null);
+        } catch (Exception e) {
+            // ignore
+            ;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged(IAction action, ISelection selection) {
+        StructuredSelection ss = (StructuredSelection) selection;
+        JavaProjectAdapter project = (JavaProjectAdapter) ss.getFirstElement();
+        if (project != null) {
+            iJavaProject = project.getJavaProject();
+        }
+    }
+}

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java Sat Dec 20 19:24:58 2008
@@ -1,3 +1,18 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed 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.ibatis.ibator.eclipse.ui.actions;
 
 import java.lang.reflect.InvocationTargetException;
@@ -24,6 +39,11 @@
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
 public class RunIbatorAction implements IObjectActionDelegate{
 
     private IFile selectedFile;

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java Sat Dec 20 19:24:58 2008
@@ -13,7 +13,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.ibatis.ibator.eclipse.ui.actions;
 
 import java.io.File;

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java Sat Dec 20 19:24:58 2008
@@ -18,9 +18,13 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.ibatis.ibator.eclipse.ui.IbatorClasspathVariableInitializer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
 
 /**
  * This class provides a factory for different adapters used in the plugin.
@@ -43,6 +47,12 @@
                 return new IbatorConfigurationFileAdapter(
                         (IFile) adaptableObject);
             }
+        } else if (adaptableObject instanceof IJavaProject) {
+            if (adapterType == JavaProjectAdapter.class) {
+                if (!isIbatorProject((IJavaProject) adaptableObject)) {
+                    return new JavaProjectAdapter((IJavaProject) adaptableObject);
+                }
+            }
         }
 
         return null;
@@ -50,7 +60,8 @@
 
     @SuppressWarnings("unchecked")
     public Class[] getAdapterList() {
-        return new Class[] { IbatorConfigurationFileAdapter.class };
+        return new Class[] { IbatorConfigurationFileAdapter.class,
+                JavaProjectAdapter.class};
     }
 
     private boolean isIbatorConfigurationFile(IFile file) {
@@ -84,4 +95,34 @@
         
         return rc;
     }
+    
+    /**
+     * returns true if the project has Ibator on it's classpath
+     * 
+     * @param project
+     * @return
+     */
+    private boolean isIbatorProject(IJavaProject project) {
+        boolean rc = false;
+        
+        try {
+            IClasspathEntry[] classpath = project.getRawClasspath();
+            for (IClasspathEntry iClasspathEntry : classpath) {
+                if (iClasspathEntry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) {
+                    continue;
+                }
+                
+                IPath path = iClasspathEntry.getPath();
+                if (path.segment(0).equals(IbatorClasspathVariableInitializer.IBATOR_JAR)) {
+                    rc = true;
+                    break;
+                }
+            }
+        } catch (Exception e) {
+            // ignore
+            ;
+        }
+        
+        return rc;
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java Sat Dec 20 19:24:58 2008
@@ -87,7 +87,7 @@
             throw new SAXException("Not an Ibator configuration file");
         }
         
-        // return a null InpputSource - we don't want to go to the Internet
+        // return a null InputSource - we don't want to go to the Internet
         StringReader nullStringReader = new StringReader("");
         return new InputSource(nullStringReader);
     }

Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/JavaProjectAdapter.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/JavaProjectAdapter.java?rev=728378&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/JavaProjectAdapter.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/JavaProjectAdapter.java Sat Dec 20 19:24:58 2008
@@ -0,0 +1,41 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed 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.ibatis.ibator.eclipse.ui.content;
+
+import org.eclipse.jdt.core.IJavaProject;
+
+/**
+ * This is the adaptor class for a project that does not contain
+ * Ibator on it's classpath
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class JavaProjectAdapter {
+    
+    private IJavaProject javaProject;
+
+    public JavaProjectAdapter(IJavaProject javaProject) {
+        super();
+        this.javaProject = javaProject;
+    }
+
+    public IJavaProject getJavaProject() {
+        return javaProject;
+    }
+}
+

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml?rev=728378&r1=728377&r2=728378&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml Sat Dec 20 19:24:58 2008
@@ -2,7 +2,7 @@
 <feature
       id="org.apache.ibatis.ibator"
       label="%featureName"
-      version="1.2.0"
+      version="1.2.1"
       provider-name="%providerName">
 
    <description>



Mime
View raw message