<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog @ SIB Visions &#187; Eclipse</title>
	<atom:link href="http://blog.sibvisions.com/tag/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sibvisions.com</link>
	<description>Blog @ SIB Visions</description>
	<lastBuildDate>Mon, 13 Apr 2026 09:47:01 +0000</lastBuildDate>
		<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Eclipse 2018.12 with ANT and JRE 6</title>
		<link>https://blog.sibvisions.com/2019/03/16/eclipse-2018-12-with-ant-and-jre-6/</link>
		<comments>https://blog.sibvisions.com/2019/03/16/eclipse-2018-12-with-ant-and-jre-6/#comments</comments>
		<pubDate>Sat, 16 Mar 2019 13:16:34 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">https://blog.sibvisions.com/?p=8256</guid>
		<description><![CDATA[The support for ANT and JRE6 with Eclipse 2018.12.
The plugin was created for:
Version: 2018-12 (4.10.0)
Build id: 20181214-0600
Don't forget the -clean start (read the original article for more details)!
One more thing you should do:
Photon includes ANT > 1.10. This version requires Java 8. In order to use Java 6, you have to download ANT 1.9.x. Simply [...]]]></description>
			<content:encoded><![CDATA[<p>The support for ANT and JRE6 with Eclipse 2018.12.</p>
<p>The plugin was created for:</p>
<div class="codesnip-container" >Version: 2018-12 (4.10.0)<br />
Build id: 20181214-0600</div>
<p>Don't forget the -clean start (read the original article for more details)!</p>
<p>One more thing you should do:</p>
<p>Photon includes ANT > 1.10. This version requires Java 8. In order to use Java 6, you have to download ANT 1.9.x. Simply download ANT and set the ANT Home to your version, via </p>
<div class="codesnip-container" >(Window >>) Preferences >> ANT >> Runtime >> Ant Home...</div>
<p>If you try to use the bundled ANT with JRE 6, it will fail with an Exception.</p>
<p>Download the plugin from <a href="https://blog.sibvisions.com/wp-content/uploads/2019/03/ANT_plugin_JRE6_2018_12.zip">here</a>. It works for us - no warranty!</p>
<p>More Details:  <a href="https://blog.sibvisions.com/2018/09/20/eclipse-photon-with-ant-and-jre6/">Eclipse Photon with ANT and JRE6</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2019/03/16/eclipse-2018-12-with-ant-and-jre-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse Photon with ANT and JRE6</title>
		<link>https://blog.sibvisions.com/2018/09/20/eclipse-photon-with-ant-and-jre6/</link>
		<comments>https://blog.sibvisions.com/2018/09/20/eclipse-photon-with-ant-and-jre6/#comments</comments>
		<pubDate>Thu, 20 Sep 2018 06:34:57 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">https://blog.sibvisions.com/?p=8139</guid>
		<description><![CDATA[The support for ANT and JRE6 with Eclipse Photon.
The plugin was created for:
Version: Photon Release (4.8.0)
Build id: 20180619-1200
Don't forget the -clean start (read the original article for more details)!
One more thing you should do:
Photon includes ANT > 1.10. This version requires Java 8. In order to use Java 6, you have to download ANT 1.9.x. [...]]]></description>
			<content:encoded><![CDATA[<p>The support for ANT and JRE6 with Eclipse Photon.</p>
<p>The plugin was created for:</p>
<div class="codesnip-container" >Version: Photon Release (4.8.0)<br />
Build id: 20180619-1200</div>
<p>Don't forget the -clean start (read the original article for more details)!</p>
<p>One more thing you should do:</p>
<p>Photon includes ANT > 1.10. This version requires Java 8. In order to use Java 6, you have to download ANT 1.9.x. Simply download ANT and set the ANT Home to your version, via </p>
<div class="codesnip-container" >(Window >>) Preferences >> ANT >> Runtime >> Ant Home...</div>
<p>If you try to use the bundled ANT with JRE 6, it will fail with an Exception.</p>
<p>Download the plugin from <a href="https://blog.sibvisions.com/wp-content/uploads/2018/09/ANT_plugin_JRE6_Photon.zip">here</a>. It works for us - no warranty!</p>
<p>More Details:  <a href="https://blog.sibvisions.com/2018/03/15/eclipse-oxygen-2-with-ant-and-jre6/">Eclipse Oxygen.2 with ANT and JRE6</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2018/09/20/eclipse-photon-with-ant-and-jre6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Eclipse Oxygen.1 with ANT and JRE6</title>
		<link>https://blog.sibvisions.com/2017/10/08/eclipse-oxygen-1-with-ant-and-jre6/</link>
		<comments>https://blog.sibvisions.com/2017/10/08/eclipse-oxygen-1-with-ant-and-jre6/#comments</comments>
		<pubDate>Sun, 08 Oct 2017 21:21:06 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">https://blog.sibvisions.com/?p=7321</guid>
		<description><![CDATA[Long awaited, now it's here 
The support for ANT and JRE6 with Eclipse Oxygen.1 (September 2017).
This is a follow-up post for: Eclipse NEON with ANT and JRE6
The plugin was created for:
Version: Oxygen.1 Release (4.7.1)
Build id: 20170914-1200
Don't forget the -clean start (read the original article for more details)!
Download the plugin from here. It works for us [...]]]></description>
			<content:encoded><![CDATA[<p>Long awaited, now it's here <img src='https://blog.sibvisions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
The support for ANT and JRE6 with Eclipse Oxygen.1 (September 2017).</p>
<p>This is a follow-up post for: <a href="https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/">Eclipse NEON with ANT and JRE6</a></p>
<p>The plugin was created for:</p>
<div class="codesnip-container" >Version: Oxygen.1 Release (4.7.1)<br />
Build id: 20170914-1200</div>
<p>Don't forget the -clean start (read the original article for more details)!</p>
<p>Download the plugin from <a href="https://blog.sibvisions.com/wp-content/uploads/2017/10/ANT_plugin_JRE6_Oxygen.1.zip">here</a>. It works for us - no warranty!</p>
<p>For more details about the installation, read <a href="http://blog.sibvisions.com/2015/09/25/eclipse-mars-with-ant-and-jre-6-story/">this article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2017/10/08/eclipse-oxygen-1-with-ant-and-jre6/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Eclipse NEON with ANT and JRE6</title>
		<link>https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/</link>
		<comments>https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/#comments</comments>
		<pubDate>Thu, 30 Jun 2016 15:05:31 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=5712</guid>
		<description><![CDATA[This is a follow-up post for: Eclipse MARS with ANT and JRE 6 (story).
New Eclipse version, same problem. We have an updated ant plugin for you.
The plugin was created for:
Version: Neon Release (4.6.0)
Build id: 20160613-1800
Don't forget the -clean start (read the original article for more details).
Download the plugin from here. It works for us - [...]]]></description>
			<content:encoded><![CDATA[<p>This is a follow-up post for: <a href="http://blog.sibvisions.com/2015/09/25/eclipse-mars-with-ant-and-jre-6-story/">Eclipse MARS with ANT and JRE 6 (story)</a>.</p>
<p>New Eclipse version, same problem. We have an updated ant plugin for you.<br />
The plugin was created for:</p>
<div class="codesnip-container" >Version: Neon Release (4.6.0)<br />
Build id: 20160613-1800</div>
<p>Don't forget the <em>-clean</em> start (read the original article for more details).</p>
<p>Download the plugin from <a href="http://bit.ly/29onA6b">here</a>. It works for us - <strong>no warranty</strong>!</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Eclipse MARS with ANT and JRE 6 (story)</title>
		<link>https://blog.sibvisions.com/2015/09/25/eclipse-mars-with-ant-and-jre-6-story/</link>
		<comments>https://blog.sibvisions.com/2015/09/25/eclipse-mars-with-ant-and-jre-6-story/#comments</comments>
		<pubDate>Fri, 25 Sep 2015 21:54:59 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=5045</guid>
		<description><![CDATA[Eclipse Mars is available since June 25th. We didn't update our IDEs because it wasn't needed. 
Some days ago we played around with JavaFXPorts Eclipse plugin. This plugin requires Eclipse Mars. So far so good. We made some tests with Mars, and everything was fine. We installed all required plugins for our internal and customer [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse Mars is available since June 25th. We didn't update our IDEs because it wasn't needed. </p>
<p>Some days ago we played around with <a href="http://gluonhq.com/open-source/javafxports/">JavaFXPorts</a> Eclipse plugin. This plugin requires Eclipse Mars. So far so good. We made some tests with Mars, and everything was fine. We installed all required plugins for our internal and customer projects and configured a first workspace....<br />
After everything was done, we tried to work with Eclipse Mars - no problems... BUT we have many projects with Java 6 compatibility. </p>
<p><strong>Why Java 6?</strong></p>
<p>Some big legacy projects/applications and Oracle Forms compatibility. There are more reasons, but it's not unusual to be backwards compatible, especially for frameworks and libraries!</p>
<p>Long story, short: <em>It's not possible to start an ANT task with Java 6</em>, because Java 7 is required. A nice error message appears:</p>
<p><center><strong>JRE version less than 1.7 is not supported.</strong></center></p>
<p>BUT it's still possible to choose any JRE in Runtime configuration dialog.<br />
Why shouldn't it be possible to start ANT with "any" JRE?</p>
<p>We tried to find help in the world wide web and found some postings about our problem:</p>
<p><a href="http://stackoverflow.com/questions/31052878/run-eclipse-mars-with-java-1-6">http://stackoverflow.com/questions/31052878/run-eclipse-mars-with-java-1-6</a><br />
<a href="http://stackoverflow.com/questions/31808102/eclipse-mars-ant-doesnt-support-jdk-1-6-anymore">http://stackoverflow.com/questions/31808102/eclipse-mars-ant-doesnt-support-jdk-1-6-anymore</a></p>
<p>And two bug database entries:</p>
<p><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=474386">https://bugs.eclipse.org/bugs/show_bug.cgi?id=474386</a><br />
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=461031">https://bugs.eclipse.org/bugs/show_bug.cgi?id=461031</a></p>
<p>It's absolutely incomprehensible why the first ticket is in state: <strong>RESOLVED INVALID</strong> and the<br />
second one: <strong>VERIFIED FIXED</strong>.<br />
OK, the second one was for a different requirement, but the first one explains the problem.</p>
<p><strong>Why did the developer ignore the user requirement? </strong></p>
<p>It's possible to call ANT with "any" JRE, without Eclipse and other IDEs don't have such crazy limitations! We didn't plan to use another IDE just for building our software!</p>
<p>I can't live with recommended workarounds because suggested steps were not usuable with big projects!<br />
So, we tried to solve the problem for us. The source code of the ANT plugin is available <a href="http://git.eclipse.org/c/platform/eclipse.platform.git/refs/tags">here</a>, so it shouldn't be a problem to "fix" the problem.</p>
<p>After reading source code, we found that the only reason why it's not possible to use JREs < version 7, is Java 7 Syntax:</p>
<ul>
<li>Diamond operator, e.g. List&lt;MyObject&gt; list = new ArrayList<>();</li>
<li>try-with-resources, e.g. try (InputStream stream = createInputStream()) { ...}</li>
</ul>
<p>And of course, the plugin was configured for execution environment JavaSE-1.7. </p>
<p>Our solution: Removed Java version check in class <em>org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate</em>, method launch:</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;"><span class="co1">//String path = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, new String(&quot;&quot;)); //$NON-NLS-1$</span><br />
<span class="co1">//if (!path.isEmpty()) {</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; IPath jrePath = Path.fromPortableString(path);</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; IVMInstall vm = JavaRuntime.getVMInstall(jrePath);</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; if (vm instanceof AbstractVMInstall) {</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AbstractVMInstall install = (AbstractVMInstall) vm;</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String vmver = install.getJavaVersion();</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // versionToJdkLevel only handles 3 char versions = 1.5, 1.6, 1.9, etc</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (vmver.length() &gt; 3) {</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vmver = vmver.substring(0, 3);</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int ver = (int) (CompilerOptions.versionToJdkLevel(vmver) &gt;&gt;&gt; 16);</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ver &lt; ClassFileConstants.MAJOR_VERSION_1_7) {</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // IStatus status = new Status(IStatus.ERROR, AntLaunching.PLUGIN_ID, 1,</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__2, null);</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // throw new CoreException(status);</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span class="co1">//&nbsp; &nbsp; &nbsp; }</span><br />
<span class="co1">//}</span></div>
</div>
<p>We set the execution environment for <em>org.eclipse.ant.launching</em>, <em>org.eclipse.ant.core</em> and <em>org.eclipse.ant.ui</em> to JavaSE-1.6 and made the source code compatible with Java 6 syntax.</p>
<p>After we built the required jar files, we had problems with Eclipse, because there was something like a plugin cache (not sure what exactly). We made a test with <strong>-clean</strong> command line parameter and were happy. It was possible to start ANT tasks - with JRE 6 - without modifications, directly via Eclipse.</p>
<p>It's not difficult to create your own ANT plugin, but <a href="http://blog.sibvisions.com/wp-content/uploads/2015/09/ANT_plugin_JRE6_Mars.zip">here</a> are our jar files.<br />
The libs were built for</p>
<div class="codesnip-container" >Version: Mars Release (4.5.0)<br />
Build id: 20150621-1200</div>
<p>The tag-id of the ANT plugin source code: <strong>I20150430-1445</strong>.</p>
<p><strong>Installation?</strong></p>
<ul>
<li><a href="http://blog.sibvisions.com/wp-content/uploads/2015/09/ANT_plugin_JRE6_Mars.zip">Download the zip</a> archive, extract the content to &lt;eclipse_dir&gt;/plugins.</li>
<li>Start eclipse with parameter -clean (only once)</li>
<li>Configure JRE6 for your ANT task, via <em>Externals Tool configuration...</em></li>
</ul>
<p>Feel free to use our changed files but we don't guarantee that it doesn't destroy your Eclipse Mars installation <img src='https://blog.sibvisions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
We didn't have any problems so far, but send us your impressions.</p>
<p>We didn't publish the changed source code right now, but let us know if you need it - it's still under EPL.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2015/09/25/eclipse-mars-with-ant-and-jre-6-story/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>JavaFXPorts with Eclipse</title>
		<link>https://blog.sibvisions.com/2015/09/22/javafxports-with-eclipse/</link>
		<comments>https://blog.sibvisions.com/2015/09/22/javafxports-with-eclipse/#comments</comments>
		<pubDate>Tue, 22 Sep 2015 14:59:25 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JavaFXPorts]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=5027</guid>
		<description><![CDATA[Some weeks ago, Gluon released the first version of their Eclipse plugin...]]></description>
			<content:encoded><![CDATA[<p>Some weeks ago, Gluon released the first version of their <a href="http://gluonhq.com/the-new-gluon-plugin-for-eclipse/">Eclipse plugin</a> for creating/building mobile applications with Java(FX).</p>
<p>We had some experience with their NetBeans plugin but our preferred IDE was Eclipse. So, an Eclipse plugin was good for us <img src='https://blog.sibvisions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
The NetBeans version worked without bigger problems and we expected the same quality for the Eclipse plugin.</p>
<p>We followed the <a href="http://gluonhq.com/the-new-gluon-plugin-for-eclipse/">official installation instructions</a> and didn't have any problem. But the problems started after we tried to create Android or iOS specific code. It wasn't possible to access javafxports, android or robovm classes, because the jar files weren't found. The classpath with NetBeans had references to all libraries, but the Eclipse project didn't have such references.</p>
<p>We tried to find some information in the documentation and found the NFC example application. The <a href="https://bitbucket.org/johanvos/androidnfcreader/src/c2f6ef73afaf8d1ad918cce3796d1886b1683276/build.gradle?at=default&#038;fileviewer=file-view-default">build file</a> had additional dependencies for android and javafxports. We changed the build file of our Eclipse project:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">dependencies <span class="br0">&#123;</span><br />
&nbsp; &nbsp; compile files<span class="br0">&#40;</span><span class="st0">&quot;C:/tools/android/android-sdk_r04-windows/platforms/android-21/android.jar&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; compile <span class="st0">&quot;org.javafxports:jfxdvk:8u60-b3&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; compile fileTree<span class="br0">&#40;</span>dir<span class="sy0">:</span> <span class="st0">'libs'</span><span class="sy0">,</span> include<span class="sy0">:</span> <span class="st0">'*.jar'</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; runtime fileTree<span class="br0">&#40;</span>dir<span class="sy0">:</span> <span class="st0">'libs'</span><span class="sy0">,</span> include<span class="sy0">:</span> <span class="st0">'*.jar'</span><span class="br0">&#41;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>and after some Gradle/Refresh Dependencies, Refresh All clicks, all Errors were fixed!<br />
It was horrible, because after clicking Refresh Dependencies, nothing happened and after some more clicks, all errors were gone. Not sure if this was a Gradle project problem, or Gluon plugin problem.</p>
<p>Our full build script (without robovm):</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">buildscript <span class="br0">&#123;</span><br />
&nbsp; &nbsp; repositories <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jcenter<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; dependencies <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; classpath <span class="st0">'org.javafxports:jfxmobile-plugin:1.0.1'</span></p>
<p>&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p>apply plugin<span class="sy0">:</span> <span class="st0">'org.javafxports.jfxmobile'</span></p>
<p>repositories <span class="br0">&#123;</span><br />
&nbsp; &nbsp; jcenter<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="br0">&#125;</span></p>
<p>dependencies <span class="br0">&#123;</span><br />
&nbsp; &nbsp; compile files<span class="br0">&#40;</span><span class="st0">&quot;C:/tools/android/android-sdk_r04-windows/platforms/android-21/android.jar&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; compile <span class="st0">&quot;org.javafxports:jfxdvk:8u60-b3&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; compile fileTree<span class="br0">&#40;</span>dir<span class="sy0">:</span> <span class="st0">'libs'</span><span class="sy0">,</span> include<span class="sy0">:</span> <span class="st0">'*.jar'</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; runtime fileTree<span class="br0">&#40;</span>dir<span class="sy0">:</span> <span class="st0">'libs'</span><span class="sy0">,</span> include<span class="sy0">:</span> <span class="st0">'*.jar'</span><span class="br0">&#41;</span><br />
<span class="br0">&#125;</span></p>
<p>mainClassName <span class="sy0">=</span> <span class="st0">'com.sibvisions.mobilefx.android.DemoERPApplication'</span><br />
&nbsp; &nbsp; <br />
jfxmobile <span class="br0">&#123;</span><br />
&nbsp; &nbsp; ios <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; forceLinkClasses <span class="sy0">=</span> <span class="br0">&#91;</span> <span class="st0">'com.sibvisions.mobilefx.ios.**.*'</span> <span class="br0">&#93;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; android <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; androidSdk <span class="sy0">=</span> <span class="st0">'C:/tools/android/android-sdk_r04-windows'</span><br />
&nbsp; &nbsp; &nbsp; compileSdkVersion <span class="sy0">=</span> <span class="nu0">21</span> &nbsp;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<div style="padding-top: 15px"><i>Hints</i></div>
<ul>
<li><a href="http://www.androidcentral.com/how-enable-developer-settings-android-42">Enable developer options</a> for your Android device</li>
<li>Show log messages from your Android device: <em><ANDROID_HOME>\platform-tools\adb logcat</em></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2015/09/22/javafxports-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EPlug 1.2.0</title>
		<link>https://blog.sibvisions.com/2015/07/20/eplug-1-2-0/</link>
		<comments>https://blog.sibvisions.com/2015/07/20/eplug-1-2-0/#comments</comments>
		<pubDate>Mon, 20 Jul 2015 09:00:07 +0000</pubDate>
		<dc:creator>rzenz</dc:creator>
				<category><![CDATA[Release notes]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[EPlug]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=4735</guid>
		<description><![CDATA[Great news for everyone who uses, or plans to use our Eclipse plugin called EPlug, a new version  is available! Version 1.2.0 brings a whole truckload of new features and bug fixes.
Changes (Pro and VisionX)

Completion for resources is now more reliable
Sped up the time it takes for VisionX to reload a file if a change [...]]]></description>
			<content:encoded><![CDATA[<p>Great news for everyone who uses, or plans to use our <a href="http://www.sibvisions.com/eplug">Eclipse plugin called EPlug</a>, a new version  is available! Version 1.2.0 brings a whole truckload of new features and bug fixes.</p>
<h3 style="padding-top: 15px;">Changes (Pro and VisionX)</h3>
<ul>
<li>Completion for resources is now more reliable</li>
<li>Sped up the time it takes for VisionX to reload a file if a change was made in Eclipse</li>
<li>MetaData changes are now properly handled</li>
<li>When selecting from VisionX to Eclipse it will be made sure that the server and client class both show up</li>
<li>Added the "Checkl File (EPlug)" command, which allows to easily re-run all checks on the current file</li>
<li>The hyperlinks for server calls/actions are now "fuzzy", which means that if there is no function with that signature, the next best function will be the target</li>
<li>Improved the error messages if there was a problem when checking databooks</li>
<li>Added completion for generic resources, which means you now can get completion for any resource in your project</li>
<li>The call to UIImage.getImage(String) is now checked at compile time if the resource exists</li>
<li>By default, databooks are now checked while you're typing for instant feedback. This can be disabled in the project properties</li>
<li>Added a view that displays all databooks in the current file, including column name and type</li>
<li>Added support for the constructor of UIEditor</li>
<li>Dramatically increased the speed of compile time checks</li>
</ul>
<h3 style="padding-top: 15px;">Eclipse Mars</h3>
<p>Also we have tested and developed EPlug with Eclipse Mars, which means that you can use it in the latest and greatest Eclipse release version. Of course we haven't dropped support for older versions, EPlug should continue to work even on Eclipse Juno.</p>
<h3 style="padding-top: 15px;">Download</h3>
<p>You can install <a href="http://marketplace.eclipse.org/content/eplug-visionx">EPlug directly from the Eclipse Marketplace</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2015/07/20/eplug-1-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EPlug - The Big Guided Tour</title>
		<link>https://blog.sibvisions.com/2015/07/16/eplug-the-big-guided-tour/</link>
		<comments>https://blog.sibvisions.com/2015/07/16/eplug-the-big-guided-tour/#comments</comments>
		<pubDate>Thu, 16 Jul 2015 11:09:32 +0000</pubDate>
		<dc:creator>rzenz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Release notes]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[EPlug]]></category>
		<category><![CDATA[JVx]]></category>
		<category><![CDATA[VisionX]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=4619</guid>
		<description><![CDATA[Since last year we are offering an Eclipse Plugin that integrates  the JVx workflow into Eclipse. Now that EPlug 1.2 has been released, we believe it's long overdue to give you a guided tour of the experience that EPlug is offering.
Trial
We offer a free trial period so that you can test EPlug without any problems. [...]]]></description>
			<content:encoded><![CDATA[<p>Since last year we are <a href="http://www.sibvisions.com/eplug">offering an Eclipse Plugin</a> that integrates  the JVx workflow into Eclipse. Now that EPlug 1.2 has been released, we believe it's long overdue to give you a guided tour of the experience that EPlug is offering.</p>
<h3 style="padding-top: 15px">Trial</h3>
<p>We offer a free trial period so that you can test EPlug without any problems. The first time you start Eclipse with EPlug you will be asked if you'd like to only test EPlug, or if you'd like to select an already purchased Pro license.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/trial.png" alt="Showing the EPlug license welcome screen." width="500" height="400" /></center></p>
<p>When clicking the <strong>Trial</strong> button, a new trial license will be issued and you'll be able to evaluate EPlug with all features for 30 days.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/trialfinished.png" alt="Showing the trial window." width="500" height="400" /></center></p>
<h3 style="padding-top: 15px">'First Run' Wizard</h3>
<p>One of the biggest usability improvements compared to previous versions is discoverability of how to use and activate EPlug. With the new version we have added a "First Run Wizard" which allows to directly activate EPlug on selected projects.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/firstrunwizard.png" alt="First Run Wizard" width="500" height="400" /></center></p>
<h3 style="padding-top: 15px">Usage</h3>
<p>EPlug integrates seamlessly into Eclipse, but to use most of its features it has to be activated on each project you want to use it with. This can be done in the previously shown First Run Wizard, or by right-clicking a project and selecting "Activate EPlug" under "Configure".</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/activate.png" alt="Showing how to activate EPlug." width="500" height="200" /></center></p>
<p>From there on you will be able to use code completion, compile time checks and all the other features on this project.</p>
<h1 style="padding-top: 25px; font-size: 18px;">Better and extended commands</h1>
<p>A handful of commands are added by EPlug, which make it faster to navigate in JVx projects.</p>
<h3 style="padding-top: 15px">Go to complement class</h3>
<p>It's often the case that you want to go from the server to the client class, or from the client to the server class. Most of the time in Eclipse this involves expanding trees and looking for the correct class in the Package Explorer. That is why we've implement the command "Go to complement class", which enables you to quickly jump from the server to client, or the other way round.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/06/gotocomplement1.png" alt="The context menu of Eclipse showing the &quot;Go to complement class&quot;." width="500" height="400" /></center></p>
<p>As you can see the command is available from the context menu, but you can also bind it to a key in the "Keys" preferences.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/06/gotocomplement2arrow.png" alt="Showing the motion of the command." width="500" height="696" /></center></p>
<h3 style="padding-top: 15px">Open Declaration</h3>
<p>The "Open Declaration" command, sometimes known by its key binding "F3", allows you to jump to the declaration of whatever is currently under the cursor. We've extended this command with the possibility to jump to the declaration of event handlers (actions), server methods and storage's. If the item underneath the cursor is not handled by our extension, the  default "Open Declaration" command will be invoked.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/06/opendeclaration1.png" alt="The context menu of Eclipse showing the &quot;Open Declaration (EPlug)&quot; command." width="500" height="400" /></center></p>
<p>The declaration:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/06/opendeclaration2.png" alt="Showing the target of the command." width="500" height="400" /></center></p>
<p>Because we've extended the "Open Declaration" command, you can bind the "Open Declaration (EPlug)" command also to "F3" and enjoy faster navigating in your JVx files without any downsides.</p>
<h1 style="padding-top: 25px; font-size: 18px;">DataBooks</h1>
<p>The biggest and most important feature of EPlug is its support for data books. EPlug offers code completion, compile time checks and more for column names on remote and local data books.</p>
<h3 style="padding-top: 15px;">Code completion</h3>
<p>Everytime you want to get or set a value, or wire up an editor you will receive code completion suggestions with all column names that are in the databook, it doesn't matter if those are remote or added locally.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/databookscompletion.png" alt="Showing the code completion of columns." width="500" height="200" /></center></p>
<h3 style="padding-top: 15px">Compile time checks</h3>
<p>Of course we also added compile time checks, which means that you can never mistype a column name ever again.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/databookscompiletime.png" alt="Showing the compile time checks of column names." width="500" height="400" /></center></p>
<p>With the newest version, these compile time checks are even active while you type!</p>
<h3 style="padding-top: 15px">Text hovers</h3>
<p>When hovering above a column name, a simple text hover will inform you about the type of the column.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/databookstexthover.png" alt="Showing the text hovers of columns." width="500" height="400" /></center></p>
<h3 style="padding-top: 15px">Storage support</h3>
<p>RemoteDataBooks require to have the correct name set so that the server side storage is found, of course we do also offer code completion, compile time checks, text hovers and hyperlinks for this.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/storagescompletion.png" alt="Showing the code completion for storages." width="500" height="400" /></center></p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/storagescompiletime.png" alt="Showing the compile time checks of storages." width="500" height="400" /></center></p>
<h3 style="padding-top: 15px">The DataBook View</h3>
<p>And last but for sure not least, with the newest version a feature has been added which I've been looking forward to for quite some time: The DataBook View. A view similar to the Outline view, which displays all databooks in the current file and all of its columns.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/databooksview.png" alt="Showing the DataBookView." width="500" height="260" /></center></p>
<h1 style="padding-top: 25px; font-size: 18px;">Actions/Events and server calls</h1>
<p>Support for actions, events and server calls is the second big EPlug feature. For events and actions we support a very Lambda-like system that uses reflection and strings. Obviously the compiler was never able to understand this system and provide feedback or support for it, but with EPlug this has changed.</p>
<h3 style="padding-top: 15px">Code Completion</h3>
<p>Whenever you want to wire up an event, you'll now receive code completion for all fitting methods in the used class.</p>
<p>Action methods:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/actionscompletion.png" alt="Showing the code completion for events." width="500" height="200" /></center></p>
<p>Remote calls:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/servercallscompletion.png" alt="Showing the code completion for server calls." width="500" height="200" /></center></p>
<p>As you can see in upper image, we also provide a fast and convenient way to create methods if necessary.</p>
<h3 style="padding-top: 15px">Compile time checks</h3>
<p>During compilation the actions, events and server calls are checked for their correctness, and if there is a problem it'll be reported to you.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/actionscompiletime.png" alt="Showing the compile time checks of actions." width="500" height="200" /></center></p>
<p>You can also see the quick fixes for this problem, which do not only offer to create the missing method, but also suggesting methods with similar names in case a typo happened.</p>
<h3 style="padding-top: 15px">Text hovers, hyperlinks and refactoring support</h3>
<p>Additionally EPlug provides text hover and hyperlink support, that means that you can now jump to the methods by using your mouse (Ctrl+Left Click) or the "Open Declaration (EPlug)" command. Refactoring support has also been added, which means that you can now rename action/event handlers without having to manually search for all uses and change those.</p>
<h1 style="padding-top: 25px; font-size: 18px;">Resources</h1>
<p>Dealing with resources can often be a pain in the neck, especially if you constantly have to look up the path and check if you're now using the correct image. Because we also felt these pains, we've added functionality to EPlug to make sure that working with resources becomes easy and painless.</p>
<h3 style="padding-top: 15px">Support for UIImage</h3>
<p>Whenever you use UIImage methods, you can now enjoy code completion, previews of the images and compile time checks.</p>
<p><center><img class="alignnone" src="http://blog.sibvisions.com/wp-content/uploads/2015/07/resourcescompletion.png" alt="Showing the code completion for UIImage." width="500" height="200" /></center></p>
<p>Preview:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/resourcespreview.png" alt="Showing the preview of images in UIImage." width="500" height="400" /></center></p>
<p>Compile checks:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/resourcescompiletime.png" alt="Compile time checks of resources." width="500" height="200" /></center></p>
<h3 style="padding-top: 15px">Generic resource completion</h3>
<p>For all other resources, we do only offer a "generic" code completion system and no preview. Still, this is a huge help.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/resourcescompletiongeneric.png" alt="Showing the code completion for other resources." width="500" height="200" /></center></p>
<h1 style="padding-top: 25px; font-size: 18px;">Comments</h1>
<p>One of the more simple and not so obvious features of EPlug is that it allows to have code completion of the current class in comments, and also provides the JVx category separators.</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/ccicseparator.png" alt="Showing the code completion for comments." width="500" height="400" /></center></p>
<p>Separator:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/ccicseparator2.png" alt="Showing the code completion for comments." width="500" height="400" /></center></p>
<p>Action/call completion in comments:</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/cciccompletion.png" alt="Showing the code completion for comments." width="500" height="200" /></center></p>
<h1 style="padding-top: 25px; font-size: 18px;">VisionX support</h1>
<p>Now we've arrive at the big final, support for <a title="VisionX" href="http://www.sibvisions.com/en/java-developer">VisionX</a>. For all of you who do not know VisionX, it is our product for rapidly building applications from scratch or migrating already existing systems. It allows to build GUIs and the respective database backend within a matter of minutes. Even though VisionX allows you to build whole applications, from time to time you'll want to do something by hand and this is the great thing about VisionX, all projects and applications are automatically and by design already Eclipse projects. So all you need to do is import the project into Eclipse and start working on it. To improve this workflow further EPlug does offer various features.</p>
<h3 style="padding-top: 15px;">Selection synchronization</h3>
<p>The selection in Eclipse and VisionX can be automatically synchronized, so that whatever you're working on in the one application is also visible and selected in the other</p>
<p><center><img src="http://blog.sibvisions.com/wp-content/uploads/2015/07/visionx.png" alt="Showing the selection between VisionX and Eclipse." width="500" height="213" /></center></p>
<h1 style="padding-top: 25px; font-size: 18px;">Automatic applying of changes</h1>
<p>VisionX will also automatically refresh its current view if you change a sourcefile in Eclipse, allowing to rapidly and verify changes in a workscreen without the need to manually reload the workscreen.</p>
<h1 style="padding-top: 25px; font-size: 18px;">How and where to get it?</h1>
<p>EPlug comes in two flavors, <a title="EPlug for JVX" href="http://marketplace.eclipse.org/content/eplug-jvx">EPlug for JVx</a> and <a title="EPlug for VisionX" href="http://marketplace.eclipse.org/content/eplug-visionx">EPlug for VisionX</a>, both are available from the Eclipse Marketplace and can be installed and used freely for 30 days. Afterwards a license is necessary to keep using all features.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2015/07/16/eplug-the-big-guided-tour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VisionX RnD news - IDE integration</title>
		<link>https://blog.sibvisions.com/2014/07/15/visionx-rnd-news-ide-integration/</link>
		<comments>https://blog.sibvisions.com/2014/07/15/visionx-rnd-news-ide-integration/#comments</comments>
		<pubDate>Tue, 15 Jul 2014 09:00:36 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[EPlug]]></category>
		<category><![CDATA[VisionX]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=3072</guid>
		<description><![CDATA[We want to tell you some fantastic news from our RnD team: The next big step for VisionX will be an IDE integration feature. 
Our team is working very hard to reach the goals. The result will be an Eclipse plugin that connects to VisionX and allows bidirectional communication. We won't embedd VisionX in Eclipse [...]]]></description>
			<content:encoded><![CDATA[<p>We want to tell you some fantastic news from our RnD team: The next big step for VisionX will be an IDE integration feature. </p>
<p>Our team is working very hard to reach the goals. The result will be an Eclipse plugin that connects to VisionX and allows bidirectional communication. We won't embedd VisionX in Eclipse because it makes no sense for us, but we'll use the whole power of the IDE.</p>
<p><strong>What will be supported?</strong></p>
<ul>
<li><strong>Event links (Eclipse)</strong>
<p>A click on an event action string will jump to the right method.</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;">databook.<span class="me1">eventValuesChanged</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">addListener</span><span class="br0">&#40;</span><span class="kw1">this</span>, <span class="st0">&quot;doValuesChanged&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>The click on <em>doValuesChanged</em> will jump to the method in the work-screen.
</li>
<li><strong>Call links (Eclipse)</strong>
<p>A click on an action/object call will jump to the right method, in the right life-cycle object.</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;">getConnection<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">callAction</span><span class="br0">&#40;</span><span class="st0">&quot;getLicenseInformation&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>The click on <em>getLicenseInformation</em> will jump to the method in the life-cycle object.</p>
</li>
<li><b>DataBook links (Eclipse)</b>
<p>A click on the name of a databook will jump to the storage definition, in the life-cycle object.</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;">RemoteDataBook rdb <span class="sy0">=</span> <span class="kw1">new</span> RemoteDataBook<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
rdb.<span class="me1">setDataSource</span><span class="br0">&#40;</span>dataSource<span class="br0">&#41;</span><span class="sy0">;</span><br />
rdb.<span class="me1">setName</span><span class="br0">&#40;</span><span class="st0">&quot;users&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
rdb.<span class="me1">open</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>The click on <em>users</em> will jump to the DBStorage definition, in the the life-cycle object.</p>
</li>
<li><strong>Auto completion (Eclipse)</strong>
<p>We'll offer auto completion for table columns, event methods, action/object calls, ...</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;">databook.<span class="me1">getRowDefinition</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getColumnDefinition</span><span class="br0">&#40;</span><span class="st0">&quot;DESCRIPTION&quot;</span><span class="br0">&#41;</span>.<span class="me1">getDataType</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">setCellEditor</span><span class="br0">&#40;</span>VisionXUtil.<span class="me1">MULTILINE_EDITOR</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>It'll be possible to get a list of all available columns, like <em>DESCRIPTION</em>.
</li>
<li><strong>Column checks (Eclipse)</strong>
<p>We'll check if all column names are valid and will show compiler warnings/errors.</li>
<li><strong>Jump to Eclipse</strong>
<p>It'll be possible, with VisionX, to jump to the source code of e.g. actions, component definitions or databooks in Eclipse. We'll introduce some new Buttons in VisionX, for that feature.</p>
<p><div id="attachment_3073" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.sibvisions.com/wp-content/uploads/2014/07/visionx_eplug.png" rel="lightbox[3072]"><img src="http://blog.sibvisions.com/wp-content/uploads/2014/07/visionx_eplug-300x232.png" alt="VisionX E-Plug" title="visionx_eplug" width="300" height="232" class="size-medium wp-image-3073" /></a><p class="wp-caption-text">VisionX E-Plug</p></div></li>
<li><strong>Jump to VisionX</strong>
<p>It'll be possible, with Eclipse, to highlight selected GUI components directly in VisionX.
</ul>
<p>No worries, we have more features for you! </p>
<p>The IDE integration will be available as <a href="http://www.sibvisions.com/en/your-business/155-produktvergleich">optional</a> VisionX module.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2014/07/15/visionx-rnd-news-ide-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Source Code modification with Eclipse AST</title>
		<link>https://blog.sibvisions.com/2012/12/03/source-code-modification-with-eclipse-ast/</link>
		<comments>https://blog.sibvisions.com/2012/12/03/source-code-modification-with-eclipse-ast/#comments</comments>
		<pubDate>Mon, 03 Dec 2012 13:00:32 +0000</pubDate>
		<dc:creator>rjahn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[AST]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDT]]></category>

		<guid isPermaLink="false">http://blog.sibvisions.com/?p=1840</guid>
		<description><![CDATA[We heavily use Eclipse AST and JDT. The problem with both APIs is that you don't find a lot of documentation or examples. The best documentation was and is the source code. It shows all secrets.
Last friday at Eclipse DemoCamp Vienna, I discussed with CodeCop about AST and JDT and the missing documentation  
I [...]]]></description>
			<content:encoded><![CDATA[<p>We heavily use Eclipse AST and JDT. The problem with both APIs is that you don't find a lot of documentation or examples. The best documentation was and is the source code. It shows all secrets.</p>
<p>Last friday at Eclipse DemoCamp Vienna, I discussed with <a href="http://blog.code-cop.org/">CodeCop</a> about AST and JDT and the missing documentation <img src='https://blog.sibvisions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I wrote a simple class for class/superclass/package/javadoc manipulation some months ago. It is included in VisionX and is not free, but no matter. Here is the source code:</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;"><span class="coMULTI">/* <br />
(c) SIB Visions 2012 </p>
<p>http://www.sibvisions.com<br />
*/</span><br />
<span class="kw1">public</span> <span class="kw1">class</span> SimpleSourceFile <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><br />
&nbsp; &nbsp; <span class="co1">// Class members</span><br />
&nbsp; &nbsp; <span class="co1">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the source parser. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> ASTParser parser<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the parsed tokens of the source file. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> CompilationUnit cuSource<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the original document. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> <span class="kw3">Document</span> docOrig<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the class type info. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> TypeDeclaration tdClass<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the javadoc of the class. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> JavadocInfo jdoc<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the full qualified name of the class. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> <span class="kw3">String</span> sClassName<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the full qualified name of the super class after loading. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> <span class="kw3">String</span> sLoadedSuperClass<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** the full qualified name of the parent class. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> <span class="kw3">String</span> sSuperClass<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/** whether the source is changed. */</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> <span class="kw4">boolean</span> bChanged <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; <span class="co1">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><br />
&nbsp; &nbsp; <span class="co1">// Initialization</span><br />
&nbsp; &nbsp; <span class="co1">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Creates a new instance of &lt;code&gt;SimpleSourceFile&lt;/code&gt; without source<br />
&nbsp; &nbsp; &nbsp;* information.<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> SimpleSourceFile<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; load<span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Creates a new instance of &lt;code&gt;SimpleSourceFile&lt;/code&gt; with a given <br />
&nbsp; &nbsp; &nbsp;* source file.<br />
&nbsp; &nbsp; &nbsp;* &nbsp;<br />
&nbsp; &nbsp; &nbsp;* @param pFile the java source file<br />
&nbsp; &nbsp; &nbsp;* @throws IOException if an error occurs during reading the file<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> SimpleSourceFile<span class="br0">&#40;</span><span class="kw3">File</span> pFile<span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">IOException</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>pFile.<span class="me1">exists</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JavaSource source <span class="sy0">=</span> JavaSource.<span class="me1">get</span><span class="br0">&#40;</span>pFile.<span class="me1">getAbsolutePath</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>source <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">synchronized</span><span class="br0">&#40;</span>source<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; load<span class="br0">&#40;</span><span class="kw1">new</span> <span class="kw3">String</span><span class="br0">&#40;</span>FileUtil.<span class="me1">getContent</span><span class="br0">&#40;</span>pFile<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; load<span class="br0">&#40;</span><span class="kw1">new</span> <span class="kw3">String</span><span class="br0">&#40;</span>FileUtil.<span class="me1">getContent</span><span class="br0">&#40;</span>pFile<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; load<span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Creates a new instance of &lt;code&gt;SimpleSourceFile&lt;/code&gt; with a given <br />
&nbsp; &nbsp; &nbsp;* source stream. The stream is closed after reading<br />
&nbsp; &nbsp; &nbsp;* &nbsp;<br />
&nbsp; &nbsp; &nbsp;* @param pStream the java source stream<br />
&nbsp; &nbsp; &nbsp;* @throws IOException if an error occurs during reading the stream<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> SimpleSourceFile<span class="br0">&#40;</span><span class="kw3">InputStream</span> pStream<span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">IOException</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">this</span><span class="br0">&#40;</span>pStream, <span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Creates a new instance of &lt;code&gt;SimpleSourceFile&lt;/code&gt; with a given <br />
&nbsp; &nbsp; &nbsp;* source stream.<br />
&nbsp; &nbsp; &nbsp;* &nbsp;<br />
&nbsp; &nbsp; &nbsp;* @param pStream the java source stream<br />
&nbsp; &nbsp; &nbsp;* @param pAutoClose whether the stream should be closed after reading<br />
&nbsp; &nbsp; &nbsp;* @throws IOException if an error occurs during reading the stream<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> SimpleSourceFile<span class="br0">&#40;</span><span class="kw3">InputStream</span> pStream, <span class="kw4">boolean</span> pAutoClose<span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">IOException</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; load<span class="br0">&#40;</span><span class="kw1">new</span> <span class="kw3">String</span><span class="br0">&#40;</span>FileUtil.<span class="me1">getContent</span><span class="br0">&#40;</span>pStream, pAutoClose<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co1">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><br />
&nbsp; &nbsp; <span class="co1">// User-defined methods</span><br />
&nbsp; &nbsp; <span class="co1">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Loads the properties from the source file.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param pSource the java source<br />
&nbsp; &nbsp; &nbsp;*/</span>@SuppressWarnings<span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;unchecked&quot;</span>, <span class="st0">&quot;rawtypes&quot;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="kw1">private</span> <span class="kw4">void</span> load<span class="br0">&#40;</span><span class="kw3">String</span> pSource<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jdoc <span class="sy0">=</span> <span class="kw1">new</span> JavadocInfo<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>parser <span class="sy0">==</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parser <span class="sy0">=</span> ASTUtil.<span class="me1">createParser</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; parser.<span class="me1">setSource</span><span class="br0">&#40;</span>pSource.<span class="me1">toCharArray</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; cuSource <span class="sy0">=</span> <span class="br0">&#40;</span>CompilationUnit<span class="br0">&#41;</span> parser.<span class="me1">createAST</span><span class="br0">&#40;</span><span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>docOrig <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; docOrig.<span class="me1">set</span><span class="br0">&#40;</span>pSource<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; docOrig <span class="sy0">=</span> <span class="kw1">new</span> <span class="kw3">Document</span><span class="br0">&#40;</span>pSource<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//we support only one class per file</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">List</span> types <span class="sy0">=</span> cuSource.<span class="me1">types</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>types.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> 0 <span class="sy0">&amp;&amp;</span> types.<span class="me1">get</span><span class="br0">&#40;</span>0<span class="br0">&#41;</span> <span class="kw1">instanceof</span> TypeDeclaration<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tdClass <span class="sy0">=</span> <span class="br0">&#40;</span>TypeDeclaration<span class="br0">&#41;</span> types.<span class="me1">get</span><span class="br0">&#40;</span>0<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sPackage<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//we have to use the current package, if set</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cuSource.<span class="me1">getPackage</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sPackage <span class="sy0">=</span> cuSource.<span class="me1">getPackage</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">&quot;.&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sPackage <span class="sy0">=</span> <span class="st0">&quot;&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sClassName <span class="sy0">=</span> sPackage <span class="sy0">+</span> tdClass.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>tdClass.<span class="me1">getSuperclassType</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sSuperName <span class="sy0">=</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>SimpleType<span class="br0">&#41;</span><span class="br0">&#40;</span>tdClass.<span class="me1">getSuperclassType</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sSuperName.<span class="me1">indexOf</span><span class="br0">&#40;</span><span class="st0">'.'</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sSuperClass <span class="sy0">=</span> sSuperName<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//try to detect the full qualified name of the super class through the imports</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">List</span> <span class="sy0">&lt;</span> ImportDeclaration <span class="sy0">&gt;</span> liImports <span class="sy0">=</span> cuSource.<span class="me1">imports</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">boolean</span> bFound <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>liImports <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sTempName <span class="sy0">=</span> <span class="st0">&quot;.&quot;</span> <span class="sy0">+</span> sSuperName<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sImport<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> 0, anz <span class="sy0">=</span> liImports.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy0">!</span>bFound <span class="sy0">&amp;&amp;</span> i <span class="sy0">&lt;</span> anz<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sImport <span class="sy0">=</span> liImports.<span class="me1">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sImport.<span class="me1">endsWith</span><span class="br0">&#40;</span>sTempName<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bFound <span class="sy0">=</span> <span class="kw2">true</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sSuperClass <span class="sy0">=</span> liImports.<span class="me1">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>bFound<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//we use the current package</span><br />
<span class="co2"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sSuperClass</span> <span class="sy0">=</span> sPackage <span class="sy0">+</span> sSuperName<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//cache for optimizing imports in apply</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sLoadedSuperClass <span class="sy0">=</span> sSuperClass<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jdoc <span class="sy0">=</span> <span class="kw1">new</span> JavadocInfo<span class="br0">&#40;</span>tdClass.<span class="me1">getJavadoc</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, pSource<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tdClass <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//currently loaded file can not be changed!</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bChanged <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Sets the comment for the class.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param pText the comment<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> setClassComment<span class="br0">&#40;</span><span class="kw3">String</span> pText<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bChanged <span class="sy0">|=</span> <span class="sy0">!</span>CommonUtil.<span class="me1">equals</span><span class="br0">&#40;</span>pText, jdoc.<span class="me1">getDescription</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; jdoc.<span class="me1">setDescription</span><span class="br0">&#40;</span>pText<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Gets the comment for the class.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @return the comment<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw3">String</span> getClassComment<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> jdoc.<span class="me1">getDescription</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Sets the full qualified name of the class.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param pName the class name<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> setClassName<span class="br0">&#40;</span><span class="kw3">String</span> pName<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>pName <span class="sy0">==</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">throw</span> <span class="kw1">new</span> <span class="kw3">IllegalArgumentException</span><span class="br0">&#40;</span><span class="st0">&quot;It is not allowed to remove the class definition (class name = null)!&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; bChanged <span class="sy0">|=</span> <span class="sy0">!</span>CommonUtil.<span class="me1">equals</span><span class="br0">&#40;</span>pName, sClassName<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; sClassName <span class="sy0">=</span> pName<span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Gets the full qualified name of the class.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @return the class name<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw3">String</span> getClassName<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> sClassName<span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Sets the full qualified class name of the parent class.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param pSuperClass the full qualified class name of the parent class<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> setSuperClass<span class="br0">&#40;</span><span class="kw3">String</span> pSuperClass<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bChanged <span class="sy0">|=</span> <span class="sy0">!</span>CommonUtil.<span class="me1">equals</span><span class="br0">&#40;</span>pSuperClass, sSuperClass<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; sSuperClass <span class="sy0">=</span> pSuperClass<span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Gets the full qualified class name of the parent class.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @return the class name<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw3">String</span> getSuperClass<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> sSuperClass<span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Replaces the relevant information with the specific values<br />
&nbsp; &nbsp; &nbsp;* and saves the source file.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @throws Exception if the source modification fails<br />
&nbsp; &nbsp; &nbsp;*/</span>@SuppressWarnings<span class="br0">&#40;</span><span class="st0">&quot;unchecked&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="kw1">protected</span> <span class="kw4">void</span> apply<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>bChanged<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; AST ast <span class="sy0">=</span> cuSource.<span class="me1">getAST</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; ASTRewrite arw <span class="sy0">=</span> ASTRewrite.<span class="me1">create</span><span class="br0">&#40;</span>ast<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Change Package, Classname and Constructor</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sCurrentPackage<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//set package</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span><span class="br0">&#91;</span><span class="br0">&#93;</span> sClassInfo <span class="sy0">=</span> ClassUtil.<span class="me1">splitName</span><span class="br0">&#40;</span>sClassName<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cuSource.<span class="me1">getPackage</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>cuSource.<span class="me1">getPackage</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, PackageDeclaration.<span class="me1">NAME_PROPERTY</span>, ast.<span class="me1">newName</span><span class="br0">&#40;</span>sClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="br0">&#41;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sCurrentPackage <span class="sy0">=</span> sClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PackageDeclaration pdcl <span class="sy0">=</span> ast.<span class="me1">newPackageDeclaration</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pdcl.<span class="me1">setName</span><span class="br0">&#40;</span>ast.<span class="me1">newName</span><span class="br0">&#40;</span>sClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>cuSource, CompilationUnit.<span class="me1">PACKAGE_PROPERTY</span>, pdcl, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sCurrentPackage <span class="sy0">=</span> sClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>cuSource, CompilationUnit.<span class="me1">PACKAGE_PROPERTY</span>, <span class="kw2">null</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sCurrentPackage <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>tdClass <span class="sy0">==</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//new class</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tdClass <span class="sy0">=</span> ast.<span class="me1">newTypeDeclaration</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tdClass.<span class="me1">setName</span><span class="br0">&#40;</span>ast.<span class="me1">newSimpleName</span><span class="br0">&#40;</span>sClassInfo<span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListRewrite lrwImp <span class="sy0">=</span> arw.<span class="me1">getListRewrite</span><span class="br0">&#40;</span>cuSource, CompilationUnit.<span class="me1">TYPES_PROPERTY</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lrwImp.<span class="me1">insertFirst</span><span class="br0">&#40;</span>tdClass, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//change class name</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SimpleName snClass <span class="sy0">=</span> ast.<span class="me1">newSimpleName</span><span class="br0">&#40;</span>sClassInfo<span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>tdClass, TypeDeclaration.<span class="me1">NAME_PROPERTY</span>, snClass, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//chage constructors</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MethodDeclaration<span class="br0">&#91;</span><span class="br0">&#93;</span> methods <span class="sy0">=</span> tdClass.<span class="me1">getMethods</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>methods <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>MethodDeclaration method<span class="sy0">:</span> methods<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>method.<span class="me1">isConstructor</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>method, MethodDeclaration.<span class="me1">NAME_PROPERTY</span>, snClass, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//change Superclass</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">List</span> <span class="sy0">&lt;</span> ImportDeclaration <span class="sy0">&gt;</span> liImports <span class="sy0">=</span> cuSource.<span class="me1">imports</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//remove &quot;old&quot; import</span><br />
<span class="co2"> &nbsp; &nbsp; &nbsp; &nbsp;if</span> <span class="br0">&#40;</span>sLoadedSuperClass <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>liImports <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">boolean</span> bFound <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> liImports.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">-</span> <span class="nu0">1</span><span class="sy0">;</span> <span class="sy0">!</span>bFound <span class="sy0">&amp;&amp;</span> i <span class="sy0">&gt;=</span> <span class="nu0">0</span><span class="sy0">;</span> i<span class="sy0">--</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sLoadedSuperClass.<span class="me1">equals</span><span class="br0">&#40;</span>liImports.<span class="me1">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bFound <span class="sy0">=</span> <span class="kw2">true</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">remove</span><span class="br0">&#40;</span>liImports.<span class="me1">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liImports.<span class="me1">remove</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sSuperClass <span class="sy0">==</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>tdClass, TypeDeclaration.<span class="me1">SUPERCLASS_TYPE_PROPERTY</span>, <span class="kw2">null</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//check new super class import</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span><span class="br0">&#91;</span><span class="br0">&#93;</span> sSuperClassInfo <span class="sy0">=</span> ClassUtil.<span class="me1">splitName</span><span class="br0">&#40;</span>sSuperClass<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sSuperClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">boolean</span> bFound <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sCurrentPackage <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bFound <span class="sy0">=</span> sSuperClassInfo<span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">equals</span><span class="br0">&#40;</span>sCurrentPackage<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>bFound<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>liImports <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> 0, anz <span class="sy0">=</span> liImports.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy0">!</span>bFound <span class="sy0">&amp;&amp;</span> i <span class="sy0">&lt;</span> anz<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bFound <span class="sy0">=</span> sSuperClass.<span class="me1">equals</span><span class="br0">&#40;</span>liImports.<span class="me1">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//class not already importet -&gt; add import</span><br />
<span class="co2"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if</span> <span class="br0">&#40;</span><span class="sy0">!</span>bFound<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImportDeclaration idSuper <span class="sy0">=</span> ast.<span class="me1">newImportDeclaration</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; idSuper.<span class="me1">setName</span><span class="br0">&#40;</span>ast.<span class="me1">newName</span><span class="br0">&#40;</span>sSuperClass<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListRewrite lrwImp <span class="sy0">=</span> arw.<span class="me1">getListRewrite</span><span class="br0">&#40;</span>cuSource, CompilationUnit.<span class="me1">IMPORTS_PROPERTY</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lrwImp.<span class="me1">insertLast</span><span class="br0">&#40;</span>idSuper, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>tdClass, TypeDeclaration.<span class="me1">SUPERCLASS_TYPE_PROPERTY</span>, ast.<span class="me1">newSimpleType</span><span class="br0">&#40;</span>ast.<span class="me1">newName</span><span class="br0">&#40;</span>sSuperClassInfo<span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Change Javadoc of the class</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="st0">&quot;&quot;</span>.<span class="me1">equals</span><span class="br0">&#40;</span>jdoc.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//no javadoc</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>tdClass, TypeDeclaration.<span class="me1">JAVADOC_PROPERTY</span>, <span class="kw2">null</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arw.<span class="me1">set</span><span class="br0">&#40;</span>tdClass, TypeDeclaration.<span class="me1">JAVADOC_PROPERTY</span>, jdoc.<span class="me1">createJavadoc</span><span class="br0">&#40;</span>tdClass.<span class="me1">getAST</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Modify AST</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; TextEdit edit <span class="sy0">=</span> arw.<span class="me1">rewriteAST</span><span class="br0">&#40;</span>docOrig, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; edit.<span class="me1">apply</span><span class="br0">&#40;</span>docOrig<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; ASTUtil.<span class="me1">applyFormat</span><span class="br0">&#40;</span>docOrig<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//simple reparse (important for the comments)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; parser.<span class="me1">setSource</span><span class="br0">&#40;</span>docOrig.<span class="me1">get</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">toCharArray</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; cuSource <span class="sy0">=</span> <span class="br0">&#40;</span>CompilationUnit<span class="br0">&#41;</span> parser.<span class="me1">createAST</span><span class="br0">&#40;</span><span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Modify comments</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Class comment after the last bracket</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> iCorr <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">List</span> <span class="sy0">&lt;</span> Comment <span class="sy0">&gt;</span> liComments <span class="sy0">=</span> cuSource.<span class="me1">getCommentList</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>liComments <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sOldName <span class="sy0">=</span> tdClass.<span class="me1">getName</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getFullyQualifiedName</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">String</span> sText<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>Comment com<span class="sy0">:</span> liComments<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sText <span class="sy0">=</span> docOrig.<span class="me1">get</span><span class="br0">&#40;</span>com.<span class="me1">getStartPosition</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">-</span> iCorr, com.<span class="me1">getLength</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> iPos <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> iClassLen <span class="sy0">=</span> sClassInfo<span class="br0">&#91;</span>1<span class="br0">&#93;</span>.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> iLenDiff <span class="sy0">=</span> sOldName.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">-</span> iClassLen<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> iNextPos<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharacterType ctypePrev<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharacterType ctypeNext<span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>iPos <span class="sy0">=</span> sText.<span class="me1">indexOf</span><span class="br0">&#40;</span>sOldName, iPos<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">&gt;=</span> 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>iPos <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctypePrev <span class="sy0">=</span> StringUtil.<span class="me1">getCharacterType</span><span class="br0">&#40;</span><span class="st0">&quot;&quot;</span> <span class="sy0">+</span> sText.<span class="me1">charAt</span><span class="br0">&#40;</span>iPos <span class="sy0">-</span> 1<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctypePrev <span class="sy0">=</span> CharacterType.<span class="me1">OnlySpecial</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iNextPos <span class="sy0">=</span> iPos <span class="sy0">+</span> sOldName.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>iNextPos <span class="sy0">&lt;=</span> sText.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">-</span> <span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctypeNext <span class="sy0">=</span> StringUtil.<span class="me1">getCharacterType</span><span class="br0">&#40;</span><span class="st0">&quot;&quot;</span> <span class="sy0">+</span> sText.<span class="me1">charAt</span><span class="br0">&#40;</span>iNextPos<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctypeNext <span class="sy0">=</span> CharacterType.<span class="me1">OnlySpecial</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//don't replace word parts e.g. ContactsWorkScreen should not be replaced with Contacts</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>ctypePrev <span class="sy0">==</span> CharacterType.<span class="me1">OnlySpecial</span> <span class="sy0">||</span> ctypePrev <span class="sy0">==</span> CharacterType.<span class="me1">OnlyWhitespace</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="br0">&#40;</span>ctypeNext <span class="sy0">==</span> CharacterType.<span class="me1">OnlySpecial</span> <span class="sy0">||</span> ctypeNext <span class="sy0">==</span> CharacterType.<span class="me1">OnlyWhitespace</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; docOrig.<span class="me1">replace</span><span class="br0">&#40;</span>com.<span class="me1">getStartPosition</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">+</span> iPos <span class="sy0">-</span> iCorr, sOldName.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, sClassInfo<span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iCorr <span class="sy0">+=</span> iLenDiff<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iPos <span class="sy0">+=</span> iClassLen<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iPos <span class="sy0">=</span> iNextPos<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Update</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//----------------------------------------------------</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; load<span class="br0">&#40;</span>docOrig.<span class="me1">get</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; bChanged <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Stores the changed source into the given file.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param pFile the target file for the source<br />
&nbsp; &nbsp; &nbsp;* @throws Exception if an error occurs during saving<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> saveAs<span class="br0">&#40;</span><span class="kw3">File</span> pFile<span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; apply<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; JavaSource source <span class="sy0">=</span> JavaSource.<span class="me1">get</span><span class="br0">&#40;</span>pFile.<span class="me1">getAbsolutePath</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>source <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">synchronized</span><span class="br0">&#40;</span>source<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileUtil.<span class="me1">save</span><span class="br0">&#40;</span>pFile, docOrig.<span class="me1">get</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getBytes</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; source.<span class="me1">reload</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileUtil.<span class="me1">save</span><span class="br0">&#40;</span>pFile, docOrig.<span class="me1">get</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getBytes</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Stores the changed source into the given stream.<br />
&nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp;* @param pStream the target stream for the source<br />
&nbsp; &nbsp; &nbsp;* @throws Exception if an error occurs during saving<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> saveAs<span class="br0">&#40;</span><span class="kw3">OutputStream</span> pStream<span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; apply<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; pStream.<span class="me1">write</span><span class="br0">&#40;</span>docOrig.<span class="me1">get</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getBytes</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pStream.<span class="me1">flush</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="co3">/**<br />
&nbsp; &nbsp; &nbsp;* Returns the modified source code.<br />
&nbsp; &nbsp; &nbsp;* &nbsp;<br />
&nbsp; &nbsp; &nbsp;* @return the modified source code<br />
&nbsp; &nbsp; &nbsp;* @throws Exception if the source modification fails<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span class="kw1">protected</span> <span class="kw3">String</span> getSource<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw1">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; apply<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> docOrig.<span class="me1">get</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p><span class="br0">&#125;</span> <span class="co1">// SimpleSourceFile</span></div>
</div>
<p>Important imports:</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;"><span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.AST</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.ASTParser</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.Comment</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.CompilationUnit</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.ImportDeclaration</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.MethodDeclaration</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.PackageDeclaration</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.SimpleName</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.SimpleType</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.TypeDeclaration</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.rewrite.ASTRewrite</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jdt.core.dom.rewrite.ListRewrite</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.jface.text.Document</span><span class="sy0">;</span><br />
<span class="kw1">import</span> <span class="co2">org.eclipse.text.edits.TextEdit</span><span class="sy0">;</span></div>
</div>
<p>The class contains references to other classes like CommonUtil, FileUtil, StringUtil. These classes are included in <a href="http://sourceforge.net/projects/jvx/">JVx</a>. There are two classes (JavaSource, ClassUtil) that are not free, but you should find out how it works without these classes.</p>
<p>If you'll set a new superclass, the superclass and its import, if available, will be updated. If you'll set a new classname, all constructors will be updated.</p>
<p>And once again: The best documentation is the source code <img src='https://blog.sibvisions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://blog.sibvisions.com/2012/12/03/source-code-modification-with-eclipse-ast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
