You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by jg...@apache.org on 2008/12/10 23:16:52 UTC
svn commit: r725464 [2/2] - in /ibatis/trunk/java/tools/ibator: core/build/
eclipse/ eclipse/org.apache.ibatis.ibator.core/
eclipse/org.apache.ibatis.ibator.core/.settings/
eclipse/org.apache.ibatis.ibator.core/META-INF/
eclipse/org.apache.ibatis.ibato...
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/ibatordoc/ibator.css
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/ibatordoc/ibator.css?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/ibatordoc/ibator.css (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/ibatordoc/ibator.css Wed Dec 10 14:16:50 2008
@@ -0,0 +1,128 @@
+p, table, td, th { font-family: arial, helvetica, geneva, sans-serif; font-size: 10pt}
+pre { font-family: "Courier New", Courier, mono, serif; font-size: 10pt}
+h2 { font-family: arial, helvetica, geneva, sans-serif; font-size: 18pt; font-weight: bold; margin-top: 30px}
+code { font-family: "Courier New", Courier, mono, serif; font-size: 10pt}
+sup { font-family: arial,helvetica,geneva, sans-serif; font-size: 10px}
+h3 { font-family: arial, helvetica, geneva, sans-serif; font-size: 14pt; font-weight: bold}
+li { font-family: arial, helvetica, geneva, sans-serif; font-size: 10pt}
+h1 { font-family: arial, helvetica, geneva, sans-serif; font-size: 28px; font-weight: bold}
+body { font-family: arial, helvetica, geneva, sans-serif; font-size: 10pt; margin-top: 5mm; margin-left: 3mm}
+.indextop { font-size: x-large;; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold}
+.indexsub { font-size: xx-small;; font-family: Arial, Helvetica, sans-serif; color: #8080FF}
+
+pre {
+ padding: 0px;
+ margin-top: 0px;
+ margin-left: 0px;
+ margin-bottom: 0px;
+ margin-right: 0px;
+ text-align: left;
+}
+
+.code {
+ border: 1px dashed #3c78b5;
+ font-size: 11px;
+ font-family: Courier;
+ margin: 10px;
+ line-height: 13px;
+ text-align: left;
+ color: #000000;
+ background-color: #f0f0f0;
+ padding: 10px;
+}
+
+.code-xml {
+ color: #000000;
+}
+
+.schema-type
+{
+ color: #009100;
+ background-color: inherit;
+}
+
+.schema-type-link a:link
+{
+ color: #009100;
+ text-decoration: none
+}
+
+.schema-type-link a:visited
+{
+ color: #009100;
+ text-decoration: none
+}
+
+.schema-control {
+ color: #009100;
+ font-style: italic;
+ background-color: inherit;
+}
+
+.code-text {
+ color: #009100;
+ background-color: inherit;
+}
+
+.context-code {
+ color: #767676;
+ background-color: inherit;
+}
+
+.xml-text
+{
+ color: #009100;
+}
+
+.java-code
+{
+ color: #000000;
+}
+
+.java-comment
+{
+ color: #009100;
+}
+
+.java-javadoc-keyword
+{
+ font-weight: bold;
+}
+
+.java-keyword
+{
+ color: #7f0055;
+ font-weight: bold;
+}
+
+.java-literal
+{
+ color: #009100;
+}
+
+.java-context
+{
+ color: #767676;
+}
+
+.java-context-keyword
+{
+ font-weight: bold;
+}
+
+.screen-shot
+{
+ margin: 10px;
+}
+
+.block-indent
+{
+ margin: 10px;
+}
+
+.menuNav p
+{
+ display: none;
+ font-size: x-small;
+ text-align: right;
+}
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/plugin.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/plugin.xml?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/plugin.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/plugin.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.help.toc">
+ <toc
+ file="toc.xml"
+ primary="true">
+ </toc>
+ <toc
+ file="toc_ibatordoc.xml">
+ </toc>
+ <toc
+ file="toc_javadoc.xml">
+ </toc>
+ <toc
+ file="toc_eclipseui.xml">
+ </toc>
+ </extension>
+
+</plugin>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc.xml?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Apache iBATIS Ibator User's Guide">
+ <topic label="Using the Eclipse User Interface">
+ <anchor id="eclipseui"/>
+ </topic>
+ <topic label="Ibator Core Documentation">
+ <anchor id="ibatordoc"/>
+ </topic>
+ <topic label="API Reference">
+ <anchor id="javadoc"/>
+ </topic>
+</toc>
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_eclipseui.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Eclipse User Interface Guide" link_to="toc.xml#eclipseui">
+ <topic href="html/eclipseui/quickstart.html" label="Quickstart Guide">
+ </topic>
+ <topic href="html/eclipseui/eclipseui.html" label="Using the Eclipse User Interface">
+ </topic>
+ <topic href="html/eclipseui/usingAnt.html" label="Using the Ant Task">
+ </topic>
+ <topic href="html/eclipseui/releasenotes.html" label="Release Notes">
+ </topic>
+ <topic href="html/eclipseui/buildingFromSVN.html" label="Building from SVN">
+ </topic>
+</toc>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_ibatordoc.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_ibatordoc.xml?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_ibatordoc.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_ibatordoc.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Ibator Core Documentation" link_to="toc.xml#ibatordoc">
+ <topic href="html/ibatordoc/intro.html" label="Introduction">
+ </topic>
+ <topic href="html/ibatordoc/whatsNew.html" label="What's New">
+ </topic>
+ <topic href="html/ibatordoc/quickstart.html" label="Quick Start Guide">
+ </topic>
+ <topic href="html/ibatordoc/running.html" label="Running Ibator">
+ </topic>
+ <topic href="html/ibatordoc/afterRunning.html" label="Tasks After Running Ibator">
+ </topic>
+ <topic href="html/ibatordoc/migratingFromAbator.html" label="Migrating From Abator">
+ </topic>
+ <topic href="html/ibatordoc/configreference/xmlconfig.html" label="XML Configuration File Reference">
+ <topic href="html/ibatordoc/configreference/classPathEntry.html" label="<classPathEntry>"/>
+ <topic href="html/ibatordoc/configreference/columnOverride.html" label="<columnOverride>"/>
+ <topic href="html/ibatordoc/configreference/columnRenamingRule.html" label="<columnRenamingRule>"/>
+ <topic href="html/ibatordoc/configreference/commentGenerator.html" label="<commentGenerator>"/>
+ <topic href="html/ibatordoc/configreference/daoGenerator.html" label="<daoGenerator>"/>
+ <topic href="html/ibatordoc/configreference/generatedKey.html" label="<generatedKey>"/>
+ <topic href="html/ibatordoc/configreference/ibatorConfiguration.html" label="<ibatorConfiguration>"/>
+ <topic href="html/ibatordoc/configreference/ibatorContext.html" label="<ibatorContext>"/>
+ <topic href="html/ibatordoc/configreference/ibatorPlugin.html" label="<ibatorPlugin>"/>
+ <topic href="html/ibatordoc/configreference/ignoreColumn.html" label="<ignoreColumn>"/>
+ <topic href="html/ibatordoc/configreference/javaTypeResolver.html" label="<javaTypeResolver>"/>
+ <topic href="html/ibatordoc/configreference/javaModelGenerator.html" label="<javaModelGenerator>"/>
+ <topic href="html/ibatordoc/configreference/jdbcConnection.html" label="<jdbcConnection>"/>
+ <topic href="html/ibatordoc/configreference/properties.html" label="<properties>"/>
+ <topic href="html/ibatordoc/configreference/property.html" label="<property>"/>
+ <topic href="html/ibatordoc/configreference/sqlMapGenerator.html" label="<sqlMapGenerator>"/>
+ <topic href="html/ibatordoc/configreference/table.html" label="<table>"/>
+ </topic>
+ <topic href="html/ibatordoc/generatedobjects/results.html" label="Using the Generated Objects">
+ <topic href="html/ibatordoc/generatedobjects/javamodel.html" label="Java Model Objects">
+ </topic>
+ <topic href="html/ibatordoc/generatedobjects/sqlmap.html" label="SQL Map Files">
+ </topic>
+ <topic href="html/ibatordoc/generatedobjects/javadao.html" label="DAO Interfaces and Classes">
+ </topic>
+ <topic href="html/ibatordoc/generatedobjects/exampleClassUsage.html" label="Example Class Usage Notes">
+ </topic>
+ <topic href="html/ibatordoc/generatedobjects/extendingExampleClass.html" label="Extending the Example Classes">
+ </topic>
+ </topic>
+ <topic href="html/ibatordoc/usage/intro.html" label="Database Specific Information">
+ <topic href="html/ibatordoc/usage/db2.html" label="DB2">
+ </topic>
+ <topic href="html/ibatordoc/usage/mysql.html" label="MySql">
+ </topic>
+ <topic href="html/ibatordoc/usage/oracle.html" label="Oracle">
+ </topic>
+ </topic>
+ <topic href="html/ibatordoc/reference/intro.html" label="Other Reference Information">
+ <topic href="html/ibatordoc/reference/building.html" label="Building Ibator From Source">
+ </topic>
+ <topic href="html/ibatordoc/reference/extending.html" label="Extending Ibator">
+ </topic>
+ <topic href="html/ibatordoc/reference/pluggingIn.html" label="Implementing Ibator Plugins">
+ </topic>
+ </topic>
+ <topic href="html/ibatordoc/philosophy.html" label="Design Philisophy">
+ </topic>
+ <topic href="html/ibatordoc/license.html" label="Licensing Information">
+ </topic>
+</toc>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_javadoc.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_javadoc.xml?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_javadoc.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/toc_javadoc.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="API Reference" link_to="toc.xml#javadoc">
+ <topic label="Core Ibator Javadoc">
+ <topic href="html/javadoc/org/apache/ibatis/ibator/ant/package-summary.html" label="org.apache.ibatis.ibator.ant" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/api/package-summary.html" label="org.apache.ibatis.ibator.api" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/api/dom/package-summary.html" label="org.apache.ibatis.ibator.api.dom" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/api/dom/java/package-summary.html" label="org.apache.ibatis.ibator.api.dom.java" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/api/dom/xml/package-summary.html" label="org.apache.ibatis.ibator.api.dom.xml" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/config/package-summary.html" label="org.apache.ibatis.ibator.config" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/config/xml/package-summary.html" label="org.apache.ibatis.ibator.config.xml" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/exception/package-summary.html" label="org.apache.ibatis.ibator.exception" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/package-summary.html" label="org.apache.ibatis.ibator.generator" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/dao/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2.dao" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2.dao.elements" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/dao/templates/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2.dao.templates" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/model/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2.model" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2.sqlmap" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/package-summary.html" label="org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/internal/package-summary.html" label="org.apache.ibatis.ibator.internal" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/internal/db/package-summary.html" label="org.apache.ibatis.ibator.internal.db" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/internal/rules/package-summary.html" label="org.apache.ibatis.ibator.internal.rules" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/internal/types/package-summary.html" label="org.apache.ibatis.ibator.internal.types" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/internal/util/package-summary.html" label="org.apache.ibatis.ibator.internal.util" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/internal/util/messages/package-summary.html" label="org.apache.ibatis.ibator.internal.util.messages" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/plugins/package-summary.html" label="org.apache.ibatis.ibator.plugins" />
+ </topic>
+
+ <topic label="Ibator Eclipse Plugin Javadoc">
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/core/callback/package-summary.html" label="org.apache.ibatis.ibator.eclipse.core.callback"/>
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/core/merge/package-summary.html" label="org.apache.ibatis.ibator.eclipse.core.merge" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/ui/package-summary.html" label="org.apache.ibatis.ibator.eclipse.ui" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/ui/actions/package-summary.html" label="org.apache.ibatis.ibator.eclipse.ui.actions" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/ui/ant/package-summary.html" label="org.apache.ibatis.ibator.eclipse.ui.ant" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/ui/content/package-summary.html" label="org.apache.ibatis.ibator.eclipse.ui.content" />
+ <topic href="html/javadoc/org/apache/ibatis/ibator/eclipse/ui/wizards/package-summary.html" label="org.apache.ibatis.ibator.eclipse.ui.wizards" />
+ </topic>
+
+</toc>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.classpath
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.classpath?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.classpath (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.classpath Wed Dec 10 14:16:50 2008
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" output="antbin" path="antsrc"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.project
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.project?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.project (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.project Wed Dec 10 14:16:50 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.ibatis.ibator.eclipse.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.jdt.core.prefs?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.jdt.core.prefs (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.jdt.core.prefs Wed Dec 10 14:16:50 2008
@@ -0,0 +1,12 @@
+#Tue Dec 09 15:00:52 CST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.pde.core.prefs
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.pde.core.prefs?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.pde.core.prefs (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/.settings/org.eclipse.pde.core.prefs Wed Dec 10 14:16:50 2008
@@ -0,0 +1,3 @@
+#Tue Dec 09 15:06:12 CST 2008
+eclipse.preferences.version=1
+selfhosting.binExcludes=/org.apache.ibatis.ibator.eclipse.ui/antbin
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF Wed Dec 10 14:16:50 2008
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+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-Activator: org.apache.ibatis.ibator.eclipse.ui.IbatorUIPlugin
+Bundle-Vendor: ibatis.apache.org
+Require-Bundle: org.eclipse.ui;bundle-version="3.4.1",
+ org.eclipse.ui.ide;bundle-version="3.4.1",
+ org.eclipse.jdt.debug.ui;bundle-version="3.3.1",
+ org.apache.ant;bundle-version="1.7.0",
+ org.eclipse.ant.core;bundle-version="3.2.0",
+ org.eclipse.core.resources;bundle-version="3.4.1",
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.apache.ibatis.ibator.eclipse.core;bundle-version="1.2.0",
+ org.apache.ibatis.ibator.core;bundle-version="1.2.0",
+ 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
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/antsrc/org/apache/ibatis/ibator/eclipse/ui/ant/IbatorEclipseAntTask.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/antsrc/org/apache/ibatis/ibator/eclipse/ui/ant/IbatorEclipseAntTask.java?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/antsrc/org/apache/ibatis/ibator/eclipse/ui/ant/IbatorEclipseAntTask.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/antsrc/org/apache/ibatis/ibator/eclipse/ui/ant/IbatorEclipseAntTask.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,194 @@
+/*
+ * 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.ant;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.apache.ibatis.ibator.api.Ibator;
+import org.apache.ibatis.ibator.config.IbatorConfiguration;
+import org.apache.ibatis.ibator.config.xml.IbatorConfigurationParser;
+import org.apache.ibatis.ibator.eclipse.core.callback.EclipseProgressCallback;
+import org.apache.ibatis.ibator.eclipse.core.callback.EclipseShellCallback;
+import org.apache.ibatis.ibator.exception.InvalidConfigurationException;
+import org.apache.ibatis.ibator.exception.XMLParserException;
+import org.apache.ibatis.ibator.internal.util.StringUtility;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.PropertySet;
+import org.eclipse.ant.core.AntCorePlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class IbatorEclipseAntTask extends Task {
+ private PropertySet propertyset;
+ private String configfile;
+ private String contextIds;
+ private String fullyQualifiedTableNames;
+
+ /**
+ *
+ */
+ public IbatorEclipseAntTask() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ @Override
+ public void execute() throws BuildException {
+ if (!StringUtility.stringHasValue(configfile)) {
+ throw new BuildException("configfile is a required parameter");
+ }
+
+ List<String> warnings = new ArrayList<String>();
+
+ File configurationFile = new File(configfile);
+ if (!configurationFile.exists()) {
+ throw new BuildException("configfile " + configfile
+ + " does not exist");
+ }
+
+ Set<String> fullyqualifiedTables = new HashSet<String>();
+ if (StringUtility.stringHasValue(fullyQualifiedTableNames)) {
+ StringTokenizer st = new StringTokenizer(fullyQualifiedTableNames, ","); //$NON-NLS-1$
+ while (st.hasMoreTokens()) {
+ String s = st.nextToken().trim();
+ if (s.length() > 0) {
+ fullyqualifiedTables.add(s);
+ }
+ }
+ }
+
+ Set<String> contexts = new HashSet<String>();
+ if (StringUtility.stringHasValue(contextIds)) {
+ StringTokenizer st = new StringTokenizer(contextIds, ","); //$NON-NLS-1$
+ while (st.hasMoreTokens()) {
+ String s = st.nextToken().trim();
+ if (s.length() > 0) {
+ contexts.add(s);
+ }
+ }
+ }
+
+ IProgressMonitor monitor = (IProgressMonitor) getProject()
+ .getReferences()
+ .get(AntCorePlugin.ECLIPSE_PROGRESS_MONITOR);
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ try {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 1000);
+ subMonitor.beginTask("Generating iBATIS Artifacts:", 1000);
+ subMonitor.subTask("Parsing Configuration");
+
+ Properties p = propertyset == null ? null : propertyset.getProperties();
+
+ IbatorConfigurationParser cp = new IbatorConfigurationParser(p,
+ warnings);
+ IbatorConfiguration config = cp
+ .parseIbatorConfiguration(configurationFile);
+
+ subMonitor.worked(50);
+ monitor.subTask("Generating Files from Database Tables");
+
+ Ibator ibator = new Ibator(config, new EclipseShellCallback(),
+ warnings);
+
+ EclipseProgressCallback progressCallback = new EclipseProgressCallback(subMonitor.newChild(950));
+
+ ibator.generate(progressCallback, contexts, fullyqualifiedTables);
+
+ } catch (XMLParserException e) {
+ for (String error : e.getErrors()) {
+ log(error, Project.MSG_ERR);
+ }
+
+ throw new BuildException(e.getMessage());
+ } catch (SQLException e) {
+ throw new BuildException(e.getMessage());
+ } catch (IOException e) {
+ throw new BuildException(e.getMessage());
+ } catch (InvalidConfigurationException e) {
+ throw new BuildException(e.getMessage());
+ } catch (InterruptedException e) {
+ throw new BuildException("Cancelled by user");
+ } finally {
+ monitor.done();
+ }
+
+ for (String warning : warnings) {
+ log(warning, Project.MSG_WARN);
+ }
+ }
+
+ /**
+ * @return Returns the configfile.
+ */
+ public String getConfigfile() {
+ return configfile;
+ }
+
+ /**
+ * @param configfile
+ * The configfile to set.
+ */
+ public void setConfigfile(String configfile) {
+ this.configfile = configfile;
+ }
+
+ public PropertySet createPropertyset() {
+ if (propertyset == null) {
+ propertyset = new PropertySet();
+ }
+
+ return propertyset;
+ }
+
+ public String getContextIds() {
+ return contextIds;
+ }
+
+ public void setContextIds(String contextIds) {
+ this.contextIds = contextIds;
+ }
+
+ public String getFullyQualifiedTableNames() {
+ return fullyQualifiedTableNames;
+ }
+
+ public void setFullyQualifiedTableNames(String fullyQualifiedTableNames) {
+ this.fullyQualifiedTableNames = fullyQualifiedTableNames;
+ }
+}
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/build.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/build.properties?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/build.properties (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/build.properties Wed Dec 10 14:16:50 2008
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/antsupport.jar
+jars.compile.order = .,\
+ lib/antsupport.jar
+source.lib/antsupport.jar = antsrc/
+output.lib/antsupport.jar = antbin/
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/icons/iBatisLogo.gif
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/icons/iBatisLogo.gif?rev=725464&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/icons/iBatisLogo.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/lib/antsupport.jar
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/lib/antsupport.jar?rev=725464&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/lib/antsupport.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.core.resources.IFile"
+ class="org.apache.ibatis.ibator.eclipse.ui.content.AdapterFactory">
+ <adapter
+ type="org.apache.ibatis.ibator.eclipse.ui.content.IbatorConfigurationFileAdapter">
+ </adapter>
+ </factory>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.contentTypes">
+ <content-type
+ base-type="org.eclipse.core.runtime.xml"
+ file-extensions="xml"
+ file-names="ibatorConfig.xml"
+ id="org.apache.ibatis.ibator.eclipse.ui.ibator.configuration.file"
+ name="Apache iBATIS Ibator Configuration File"
+ priority="normal">
+ <describer
+ class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
+ <parameter
+ name="element"
+ value="ibatorConfiguration">
+ </parameter>
+ </describer>
+ </content-type>
+ </extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.apache.ibatis.ibator.eclipse.ui.IbatorConfigFileContribution"
+ objectClass="org.apache.ibatis.ibator.eclipse.ui.content.IbatorConfigurationFileAdapter">
+ <action
+ class="org.apache.ibatis.ibator.eclipse.ui.actions.RunIbatorAction"
+ enablesFor="1"
+ icon="icons/iBatisLogo.gif"
+ id="org.apache.ibatis.ibator.eclipse.ui.RunIbatorAction"
+ label="Generate iBATIS Artifacts"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ant.core.antTasks">
+ <antTask
+ class="org.apache.ibatis.ibator.eclipse.ui.ant.IbatorEclipseAntTask"
+ library="lib/antsupport.jar"
+ name="ibator.generate">
+ </antTask>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.apache.ibatis.ibator.eclipse.ui.category"
+ name="Apache iBATIS Ibator">
+ </category>
+ <wizard
+ category="org.apache.ibatis.ibator.eclipse.ui.category"
+ class="org.apache.ibatis.ibator.eclipse.ui.wizards.NewConfigFileWizard"
+ icon="icons/iBatisLogo.gif"
+ id="org.apache.ibatis.ibator.eclipse.ui.NewConfigFileWizard"
+ name="Apache iBATIS Ibator Configuration File">
+ </wizard>
+ </extension>
+</plugin>
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorUIPlugin.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,50 @@
+package org.apache.ibatis.ibator.eclipse.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class IbatorUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.apache.ibatis.ibator.eclipse.ui";
+
+ // The shared instance
+ private static IbatorUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public IbatorUIPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static IbatorUIPlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorAction.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,123 @@
+package org.apache.ibatis.ibator.eclipse.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ibatis.ibator.eclipse.ui.IbatorUIPlugin;
+import org.apache.ibatis.ibator.eclipse.ui.content.IbatorConfigurationFileAdapter;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class RunIbatorAction implements IObjectActionDelegate{
+
+ private IFile selectedFile;
+
+ public RunIbatorAction() {
+ }
+
+ public void run(IAction action) {
+ Shell shell = new Shell();
+
+ try {
+ List<String> warnings = new ArrayList<String>();
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ IRunnableWithProgress thread = new IbatorRunner(warnings);
+
+ dialog.run(true, true, thread);
+
+ if (warnings.size() > 0) {
+ MultiStatus ms = new MultiStatus(IbatorUIPlugin.PLUGIN_ID,
+ Status.WARNING, "Generation Warnings Occured", null);
+
+ Iterator<String> iter = warnings.iterator();
+ while (iter.hasNext()) {
+ Status status = new Status(Status.WARNING, IbatorUIPlugin
+ .PLUGIN_ID, Status.WARNING, iter.next(), null);
+ ms.add(status);
+ }
+
+ ErrorDialog.openError(shell, "Ibator for iBATIS",
+ "Run Complete With Warninigs", ms, Status.WARNING);
+ }
+ } catch (Exception e) {
+ handleException(e, shell);
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ StructuredSelection ss = (StructuredSelection) selection;
+ IbatorConfigurationFileAdapter adapter = (IbatorConfigurationFileAdapter) ss.getFirstElement();
+ if (adapter != null) {
+ selectedFile = adapter.getBaseFile();
+ }
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ private void handleException(Exception exception, Shell shell) {
+ IStatus status;
+
+ Throwable exceptionToHandle;
+ if (exception instanceof InvocationTargetException) {
+ exceptionToHandle = ((InvocationTargetException) exception)
+ .getCause();
+ } else {
+ exceptionToHandle = exception;
+ }
+
+ if (exceptionToHandle instanceof InterruptedException) {
+ status = new Status(IStatus.CANCEL, IbatorUIPlugin.PLUGIN_ID,
+ IStatus.CANCEL, "Cancelled by User", exceptionToHandle);
+ } else if (exceptionToHandle instanceof CoreException) {
+ status = ((CoreException) exceptionToHandle).getStatus();
+ } else {
+ String message = "Unexpected error while running Ibator.";
+
+ status = new Status(IStatus.ERROR, IbatorUIPlugin.PLUGIN_ID,
+ IStatus.ERROR, message, exceptionToHandle);
+
+ IbatorUIPlugin.getDefault().getLog().log(status);
+ }
+
+ ErrorDialog.openError(shell, "Ibator for iBATIS", "Generation Failed",
+ status, IStatus.ERROR | IStatus.CANCEL);
+ }
+
+ private class IbatorRunner implements IRunnableWithProgress {
+ private List<String> warnings;
+
+ public IbatorRunner(List<String> warnings) {
+ this.warnings = warnings;
+ }
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ try {
+ RunIbatorThread thread = new RunIbatorThread(selectedFile
+ .getLocation().toFile(), warnings);
+
+ ResourcesPlugin.getWorkspace().run(thread, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ }
+}
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/RunIbatorThread.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,129 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ibatis.ibator.api.Ibator;
+import org.apache.ibatis.ibator.config.IbatorConfiguration;
+import org.apache.ibatis.ibator.config.xml.IbatorConfigurationParser;
+import org.apache.ibatis.ibator.eclipse.core.callback.EclipseProgressCallback;
+import org.apache.ibatis.ibator.eclipse.core.callback.EclipseShellCallback;
+import org.apache.ibatis.ibator.eclipse.ui.IbatorUIPlugin;
+import org.apache.ibatis.ibator.exception.InvalidConfigurationException;
+import org.apache.ibatis.ibator.exception.XMLParserException;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class RunIbatorThread implements IWorkspaceRunnable {
+ private File inputFile;
+
+ private List<String> warnings;
+
+ /**
+ *
+ */
+ public RunIbatorThread(File inputFile, List<String> warnings) {
+ super();
+ this.inputFile = inputFile;
+ this.warnings = warnings;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) throws CoreException {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 1000);
+ subMonitor.beginTask("Generating iBATIS Artifacts:", 1000);
+
+ try {
+ subMonitor.subTask("Parsing Configuration");
+
+ IbatorConfigurationParser cp = new IbatorConfigurationParser(
+ warnings);
+ IbatorConfiguration config = cp.parseIbatorConfiguration(inputFile);
+
+ subMonitor.worked(50);
+
+ Ibator ibator = new Ibator(config, new EclipseShellCallback(), warnings);
+ monitor.subTask("Generating Files from Database Tables");
+ SubMonitor spm = subMonitor.newChild(950);
+ ibator.generate(new EclipseProgressCallback(spm));
+
+ } catch (InterruptedException e) {
+ throw new OperationCanceledException();
+ } catch (SQLException e) {
+ Status status = new Status(IStatus.ERROR, IbatorUIPlugin.PLUGIN_ID,
+ IStatus.ERROR, e.getMessage(), e);
+ IbatorUIPlugin.getDefault().getLog().log(status);
+ throw new CoreException(status);
+ } catch (IOException e) {
+ Status status = new Status(IStatus.ERROR, IbatorUIPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e);
+ IbatorUIPlugin.getDefault().getLog().log(status);
+ throw new CoreException(status);
+ } catch (XMLParserException e) {
+ List<String> errors = e.getErrors();
+ MultiStatus multiStatus = new MultiStatus(IbatorUIPlugin.PLUGIN_ID, IStatus.ERROR,
+ "XML Parser Errors\n See Details for more Information",
+ null);
+
+ Iterator<String> iter = errors.iterator();
+ while (iter.hasNext()) {
+ Status message = new Status(IStatus.ERROR, IbatorUIPlugin.PLUGIN_ID, IStatus.ERROR, iter.next(),
+ null);
+
+ multiStatus.add(message);
+ }
+ throw new CoreException(multiStatus);
+ } catch (InvalidConfigurationException e) {
+ List<String> errors = e.getErrors();
+
+ MultiStatus multiStatus = new MultiStatus(
+ IbatorUIPlugin.PLUGIN_ID,
+ IStatus.ERROR,
+ "Invalid Configuration\n See Details for more Information",
+ null);
+
+ Iterator<String> iter = errors.iterator();
+ while (iter.hasNext()) {
+ Status message = new Status(IStatus.ERROR, IbatorUIPlugin.PLUGIN_ID, IStatus.ERROR, iter.next(),
+ null);
+
+ multiStatus.add(message);
+ }
+ throw new CoreException(multiStatus);
+ } finally {
+ monitor.done();
+ }
+ }
+}
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 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 java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterFactory;
+
+/**
+ * This class provides a factory for different adapters used in the plugin.
+ * Namely, this class decides if any particular file is an ibator configuration
+ * file or not.
+ *
+ * @author Jeff Butler
+ */
+public class AdapterFactory implements IAdapterFactory {
+
+ public AdapterFactory() {
+ super();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IFile
+ && adapterType == IbatorConfigurationFileAdapter.class) {
+ if (isIbatorConfigurationFile((IFile) adaptableObject)) {
+ return new IbatorConfigurationFileAdapter(
+ (IFile) adaptableObject);
+ }
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class[] getAdapterList() {
+ return new Class[] { IbatorConfigurationFileAdapter.class };
+ }
+
+ private boolean isIbatorConfigurationFile(IFile file) {
+ String fileName = file.getName();
+ if (fileName.length() > 4) {
+ String extension = fileName.substring(fileName.length() - 4);
+ if (!extension.equalsIgnoreCase(".xml")) { //$NON-NLS-1$
+ return false;
+ }
+ } else {
+ return false;
+ }
+
+ InputStream is;
+ try {
+ is = file.getContents();
+ } catch (CoreException e) {
+ return false;
+ }
+
+ IbatorConfigVerifyer verifyer = new IbatorConfigVerifyer(is);
+
+ boolean rc = verifyer.isIbatorConfigFile();
+
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ ;
+ }
+
+ return rc;
+ }
+}
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigVerifyer.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2006 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 java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * This class does an elemental SAX parse to see if the given input
+ * stream represents an Ibator configuration file. The tests performed include:
+ *
+ * <ul>
+ * <li>Ensuring that the public ID is correct</li>
+ * <li>Ensuring that the root element is ibatorConfiguration</li>
+ * </ul>
+ *
+ * @author Jeff Butler
+ *
+ */
+public class IbatorConfigVerifyer extends DefaultHandler {
+ private InputStream inputStream;
+ private boolean isIbatorConfig;
+ private boolean rootElementRead;
+
+ /**
+ *
+ */
+ public IbatorConfigVerifyer(InputStream inputStream) {
+ super();
+ this.inputStream = inputStream;
+ this.isIbatorConfig = false;
+ }
+
+ public boolean isIbatorConfigFile() {
+ try {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setValidating(false);
+ SAXParser parser = factory.newSAXParser();
+
+ parser.parse(inputStream, this);
+ } catch (Exception e) {
+ // ignore
+ ;
+ }
+
+ return isIbatorConfig;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if (rootElementRead) {
+ throw new SAXException("Root element was not ibatorConfiguration");
+ }
+
+ rootElementRead = true;
+
+ if ("ibatorConfiguration".equals(qName)) {
+ isIbatorConfig = true;
+ throw new SAXException("Ignore the rest of the file");
+ }
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
+ if (!XmlConstants.IBATOR_CONFIG_PUBLIC_ID.equals(publicId)) {
+ throw new SAXException("Not an Ibator configuration file");
+ }
+
+ // return a null InpputSource - 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/IbatorConfigurationFileAdapter.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/IbatorConfigurationFileAdapter.java?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigurationFileAdapter.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/IbatorConfigurationFileAdapter.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2006 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.core.resources.IFile;
+
+/**
+ * This is the adapter class for files that are abator configuration files.
+ *
+ * @author Jeff Butler
+ */
+public class IbatorConfigurationFileAdapter {
+
+ private IFile baseFile;
+
+ public IbatorConfigurationFileAdapter(IFile baseFile) {
+ super();
+ this.baseFile = baseFile;
+ }
+
+ public IFile getBaseFile() {
+ return baseFile;
+ }
+
+}
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/wizards/NewConfigFileWizard.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/wizards/NewConfigFileWizard.java?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/wizards/NewConfigFileWizard.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/wizards/NewConfigFileWizard.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2005 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.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.ibatis.ibator.api.dom.xml.Attribute;
+import org.apache.ibatis.ibator.api.dom.xml.Document;
+import org.apache.ibatis.ibator.api.dom.xml.XmlElement;
+import org.apache.ibatis.ibator.eclipse.ui.IbatorUIPlugin;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * This is a sample new wizard. Its role is to create a new file
+ * resource in the provided container. If the container resource
+ * (a folder or a project) is selected in the workspace
+ * when the wizard is opened, it will accept it as the target
+ * container. The wizard creates one file with the extension
+ * "mpe". If a sample multi-page editor (also available
+ * as a template) is registered for the same extension, it will
+ * be able to open it.
+ */
+
+public class NewConfigFileWizard extends Wizard implements INewWizard {
+ private NewConfigFileWizardPage1 page;
+ private ISelection selection;
+
+ /**
+ * Constructor for NewConfigFileWizard.
+ */
+ public NewConfigFileWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * Adding the page to the wizard.
+ */
+
+ public void addPages() {
+ page = new NewConfigFileWizardPage1(selection);
+ addPage(page);
+ }
+
+ /**
+ * This method is called when 'Finish' button is pressed in
+ * the wizard. We will create an operation and run it
+ * using wizard as execution context.
+ */
+ public boolean performFinish() {
+ final String containerName = page.getLocation();
+ final String fileName = page.getFileName();
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ try {
+ doFinish(containerName, fileName, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ try {
+ getContainer().run(true, false, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException.getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The worker method. It will find the container, create the
+ * file if missing or just replace its contents, and open
+ * the editor on the newly created file.
+ */
+
+ private void doFinish(
+ String containerName,
+ String fileName,
+ IProgressMonitor monitor)
+ throws CoreException {
+ // create a sample file
+ monitor.beginTask("Creating " + fileName, 2);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = root.findMember(new Path(containerName));
+ if (!resource.exists() || !(resource instanceof IContainer)) {
+ throwCoreException("Container \"" + containerName + "\" does not exist.");
+ }
+ IContainer container = (IContainer) resource;
+ final IFile file = container.getFile(new Path(fileName));
+ try {
+ InputStream stream = openContentStream();
+ if (file.exists()) {
+ file.setContents(stream, true, true, monitor);
+ } else {
+ file.create(stream, true, monitor);
+ }
+ stream.close();
+ } catch (IOException e) {
+ }
+ monitor.worked(1);
+ monitor.setTaskName("Opening file for editing...");
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, file, true);
+ } catch (PartInitException e) {
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+
+ /**
+ * We will initialize file contents with a sample text.
+ */
+
+ private InputStream openContentStream() {
+
+ Document document = new Document(XmlConstants.IBATOR_CONFIG_PUBLIC_ID,
+ XmlConstants.IBATOR_CONFIG_SYSTEM_ID);
+
+ XmlElement ibatorConfiguration = new XmlElement("ibatorConfiguration"); //$NON-NLS-1$
+ document.setRootElement(ibatorConfiguration);
+
+ XmlElement ibatorContext = new XmlElement("ibatorContext"); //$NON-NLS-1$
+ ibatorContext.addAttribute(new Attribute("id", "context1")); //$NON-NLS-1$ //$NON-NLS-2$
+ ibatorConfiguration.addElement(ibatorContext);
+
+ XmlElement jdbcConnection = new XmlElement("jdbcConnection"); //$NON-NLS-1$
+ jdbcConnection.addAttribute(new Attribute("driverClass", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ jdbcConnection.addAttribute(new Attribute("connectionURL", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ jdbcConnection.addAttribute(new Attribute("userId", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ jdbcConnection.addAttribute(new Attribute("password", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ ibatorContext.addElement(jdbcConnection);
+
+ XmlElement javaModelGenerator = new XmlElement("javaModelGenerator"); //$NON-NLS-1$
+ javaModelGenerator.addAttribute(new Attribute("targetPackage", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ javaModelGenerator.addAttribute(new Attribute("targetProject", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ ibatorContext.addElement(javaModelGenerator);
+
+ XmlElement sqlMapGenerator = new XmlElement("sqlMapGenerator"); //$NON-NLS-1$
+ sqlMapGenerator.addAttribute(new Attribute("targetPackage", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ sqlMapGenerator.addAttribute(new Attribute("targetProject", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ ibatorContext.addElement(sqlMapGenerator);
+
+ XmlElement daoGenerator = new XmlElement("daoGenerator"); //$NON-NLS-1$
+ daoGenerator.addAttribute(new Attribute("targetPackage", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ daoGenerator.addAttribute(new Attribute("targetProject", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ daoGenerator.addAttribute(new Attribute("type", "GENERIC-CI")); //$NON-NLS-1$ //$NON-NLS-2$
+ ibatorContext.addElement(daoGenerator);
+
+ XmlElement table = new XmlElement("table"); //$NON-NLS-1$
+ table.addAttribute(new Attribute("schema", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ table.addAttribute(new Attribute("tableName", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ XmlElement columnOverride = new XmlElement("columnOverride"); //$NON-NLS-1$
+ columnOverride.addAttribute(new Attribute("column", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ columnOverride.addAttribute(new Attribute("property", "???")); //$NON-NLS-1$ //$NON-NLS-2$
+ table.addElement(columnOverride);
+ ibatorContext.addElement(table);
+
+ return new ByteArrayInputStream(document.getFormattedContent().getBytes());
+ }
+
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status =
+ new Status(IStatus.ERROR, IbatorUIPlugin.PLUGIN_ID, IStatus.OK, message, null);
+ throw new CoreException(status);
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if
+ * we can initialize from it.
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public void init(IWorkbench workbench, ISelection selection) {
+ this.selection = selection;
+ }
+}
\ No newline at end of file
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/wizards/NewConfigFileWizardPage1.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/wizards/NewConfigFileWizardPage1.java?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/wizards/NewConfigFileWizardPage1.java (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/wizards/NewConfigFileWizardPage1.java Wed Dec 10 14:16:50 2008
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2005 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.wizards;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+/**
+ * The "New" wizard page allows setting the container for
+ * the new file as well as the file name. The page
+ * will only accept file name without the extension OR
+ * with the extension that matches the expected one (mpe).
+ */
+
+public class NewConfigFileWizardPage1 extends WizardPage {
+ private Text locationText;
+ private Text fileText;
+ private ISelection selection;
+
+ /**
+ * Constructor for SampleNewWizardPage.
+ * @param selection - the current selection
+ */
+ public NewConfigFileWizardPage1(ISelection selection) {
+ super("wizardPage");
+ setTitle("Apache iBATIS Ibator Configuration File");
+ setDescription("This wizard creates a new Apache iBATIS Ibator configuration file.");
+ this.selection = selection;
+ }
+
+ /**
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&Location:");
+
+ locationText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ locationText.setLayoutData(gd);
+ locationText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ Button button = new Button(container, SWT.PUSH);
+ button.setText("Browse...");
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowse();
+ }
+ });
+ label = new Label(container, SWT.NULL);
+ label.setText("&File name:");
+
+ fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileText.setLayoutData(gd);
+ fileText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+ initialize();
+ dialogChanged();
+ setControl(container);
+ }
+
+ /**
+ * Tests if the current workbench selection is a suitable
+ * container to use.
+ */
+
+ private void initialize() {
+ if (selection!=null && selection.isEmpty()==false && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ if (ssel.size()>1) return;
+ Object obj = ssel.getFirstElement();
+
+ IResource resource = null;
+
+ if (obj instanceof IResource) {
+ resource = (IResource) obj;
+ } else if (obj instanceof IJavaElement) {
+ resource = ((IJavaElement) obj).getResource();
+ }
+
+ if (resource != null) {
+ IContainer container;
+ if (resource instanceof IContainer) {
+ container = (IContainer) resource;
+ } else {
+ container = resource.getParent();
+ }
+
+ locationText.setText(container.getFullPath().toString());
+ }
+ }
+ fileText.setText("ibatorConfig.xml");
+ }
+
+ /**
+ * Uses the standard container selection dialog to
+ * choose the new value for the container field.
+ */
+
+ private void handleBrowse() {
+ ContainerSelectionDialog dialog =
+ new ContainerSelectionDialog(
+ getShell(),
+ ResourcesPlugin.getWorkspace().getRoot(),
+ false,
+ "Select new file container");
+ if (dialog.open() == ContainerSelectionDialog.OK) {
+ Object[] result = dialog.getResult();
+ if (result.length == 1) {
+ locationText.setText(((Path)result[0]).toOSString());
+ }
+ }
+ }
+
+ /**
+ * Ensures that both text fields are set.
+ */
+
+ private void dialogChanged() {
+ String location = getLocation();
+ String fileName = getFileName();
+
+ Path path = new Path(location);
+
+ if (location.length() == 0) {
+ updateStatus("File location must be specified");
+ return;
+ }
+
+ if (fileName.length() == 0) {
+ updateStatus("File name must be specified");
+ return;
+ }
+
+ int segmentCount = path.segmentCount();
+ if (segmentCount < 2) {
+ // this is a project - check for it's existance
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(location);
+ if (!project.exists()) {
+ updateStatus("Project does not exist");
+ return;
+ }
+
+ IFile file = project.getFile(fileName);
+ if (file.exists()) {
+ updateStatus("File Already Exists");
+ return;
+ }
+ } else {
+ IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
+ if (!folder.exists()) {
+ updateStatus("Location does not exist");
+ return;
+ }
+
+ IFile file = folder.getFile(fileName);
+ if (file.exists()) {
+ updateStatus("File Already Exists");
+ return;
+ }
+ }
+
+ int dotLoc = fileName.lastIndexOf('.');
+ if (dotLoc != -1) {
+ String ext = fileName.substring(dotLoc + 1);
+ if (ext.equalsIgnoreCase("xml") == false) {
+ updateStatus("File extension must be \"xml\"");
+ return;
+ }
+ } else {
+ updateStatus("File extension must be \"xml\"");
+ return;
+ }
+
+ updateStatus(null);
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ public String getLocation() {
+ return locationText.getText();
+ }
+ public String getFileName() {
+ return fileText.getText();
+ }
+}
\ No newline at end of file
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/.project
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/.project?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/.project (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/.project Wed Dec 10 14:16:50 2008
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.ibatis.ibator</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/build.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/build.properties?rev=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/build.properties (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/build.properties Wed Dec 10 14:16:50 2008
@@ -0,0 +1 @@
+bin.includes = feature.xml
Added: 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=725464&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml (added)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator/feature.xml Wed Dec 10 14:16:50 2008
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.apache.ibatis.ibator"
+ label="Ibator Feature"
+ version="1.2.0"
+ provider-name="The Apache Software Foundation">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <plugin
+ id="org.apache.ibatis.ibator.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.apache.ibatis.ibator.eclipse.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.ibatis.ibator.eclipse.doc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.apache.ibatis.ibator.eclipse.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>