1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="2" MadCap:lastHeight="120" MadCap:lastWidth="624" MadCap:disableMasterStylesheet="true" MadCap:tocPath="Community|Working With Source Code|Sharpen" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem">
<head><title>Doing a Sharpen Conversion</title>
<script type="text/javascript">/* <![CDATA[ */
window.onload = function(){
var pathToFlash = $('html').attr('MadCap:PathToHelpSystem') + 'Content/Resources/Code/ZeroClipboard.swf';
ZeroClipboard.setMoviePath(pathToFlash);
function bindToClipBord(element,content){
var clip = new ZeroClipboard.Client();
clip.setText(content);
clip.glue(element);
};
if(location.protocol==='file:'){
$('.copylink-marker').remove();
} else{
$('.copylink-marker').each(function(){
var text = $(this).parent().parent().children('.prettyprint').html();
$(this).hover(function(){
bindToClipBord(this,text);
},
function(){});
});
}
prettyPrint();
};
/* ]]> */</script>
<link href="../../../SkinSupport/MadCap.css" rel="stylesheet" />
<link href="../../../Resources/Stylesheets/OnlineStyle.css" rel="stylesheet" />
<script src="../../../SkinSupport/MadCapAll.js">
</script>
<script src="../../../Resources/Code/prettify.js">
</script>
<script src="../../../Resources/Code/lang-vb.js">
</script>
<script src="../../../Resources/Code/jquery.min.js">
</script>
<script src="../../../Resources/Code/ZeroClipboard.js">
</script>
</head>
<body>
<p class="MCWebHelpFramesetLink" style="display: none;"><a href="../../../../index_CSH.html#community/working_with_source/sharpen/example_conversion.htm" style="">Open topic with navigation</a>
</p>
<div class="MCBreadcrumbsBox"><span class="MCBreadcrumbsPrefix">You are here: </span><a class="MCBreadcrumbsLink" href="../../../community.htm">Community</a><span class="MCBreadcrumbsDivider"> > </span><a class="MCBreadcrumbsLink" href="../../working_with_source_code.htm">Working With Source Code</a><span class="MCBreadcrumbsDivider"> > </span><a class="MCBreadcrumbsLink" href="../sharpen.htm">Sharpen</a><span class="MCBreadcrumbsDivider"> > </span><span class="MCBreadcrumbs">Doing a Sharpen Conversion</span>
</div>
<p>
<script type="text/javascript">/*<![CDATA[*/document.write('<a href="' + location.href +'">');
document.write("Direct Link");
document.write('</a>');/*]]>*/</script>
</p>
<p>
</p>
<h1>Doing a Sharpen Conversion</h1>
<p>Ensure that you've installed sharpen to an existing eclipse installation as explained <a href="how_to_setup_sharpen.htm">here</a>. </p>
<p>Use Ant scripts to run <span class="MCTextPopup"><a href="javascript:void(0);" class="MCTextPopupSpot" onclick="FMCTextPopup( event, this ); return false;">Sharpen<img style="border: none;margin-left: 5px;" src="../../../SkinSupport/ExpandingClosed.gif" MadCap:altsrc="../../../SkinSupport/ExpandingOpen.gif" class="MCExpandingIcon" onload="if ( typeof( FMCPreloadImage ) == 'function' ) { FMCPreloadImage( '../../../SkinSupport/ExpandingOpen.gif' ); }" /></a><span class="MCTextPopupBody" style="display: none; ">Sharpen is a tool to translate Java source code to C# source code</span></span> and translate your Java code to C#. The best way for this is to define an Ant macro which you then can reuse. This task takes two arguments. The first argument is the path to a valid Eclipse workspace which contains the project to translate. The second parameter is the project in the workspace which you want to translate.</p>
<div class="codesnippet" MadCap:conditions="">
<pre class="prettyprint" xml:space="preserve"><macrodef name="sharpen">
<attribute name="workspace"/>
<attribute name="resource"/>
<element name="args" optional="yes"/>
<sequential>
<java taskname="sharpen"
fork="true"
classname="org.eclipse.core.launcher.Main"
failonerror="true" timeout="1800000">
<classpath>
<fileset dir="${eclipse.home}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar"/>
</fileset>
</classpath>
<arg value="-clean"/>
<arg value="-data"/>
<arg file="@{workspace}"/>
<arg value="-application"/>
<arg value="sharpen.core.application"/>
<arg value="@{resource}"/>
<args/>
</java>
</sequential>
</macrodef></pre>
<div class="codesnippet-meta">sharpen-install.xml: The sharpen task
<div class="codedownload"><a href="../../../CodeExamples/sharpen/Example-db4odoc-sharpen-.zip" class="codedownload" MadCap:conditions="Primary.Online">Download Code</a></div><div class="codedownload copylink-marker" MadCap:conditions="Primary.Online"><a href="#copy">Copy Code</a></div></div>
</div>
<p>Now you can use this task to sharpen your project. First ensure that your project is in a valid Eclipse workspace. Then you specify the workspace and the sources of the project:</p>
<div class="codesnippet" MadCap:conditions="">
<pre class="prettyprint" xml:space="preserve"><target name="sharpen">
<sharpen
workspace="C:\temp\sharpenExamples\"
resource="example/src">
<args>
<arg value="@sharpen-config"/>
</args>
</sharpen>
</target></pre>
<div class="codesnippet-meta">sharpen-example.xml: Sharpen a example project
<div class="codedownload"><a href="../../../CodeExamples/sharpen/Example-db4odoc-sharpen-.zip" class="codedownload" MadCap:conditions="Primary.Online">Download Code</a></div><div class="codedownload copylink-marker" MadCap:conditions="Primary.Online"><a href="#copy">Copy Code</a></div></div>
</div>
<p>Additionally you can pass the sharpen configuration as a file-name. When you add a '@' in front of the file-name sharpen will read that file and use all configuration flags of that. For example:</p>
<pre class="prettyprint">-pascalCase+
-nativeTypeSystem
-nativeInterfaces</pre>
<p>You can find a list of all Sharpen <a href="sharpen_command-line_arguments.htm">configuration flags here</a> and a list of all <a href="sharpen_annotations.htm">Sharpen annotations here</a>. </p>
<p MadCap:conditions="Primary.Online">The example Ant scripts can be downloaded <a href="../../../CodeExamples/sharpen/Example-db4odoc-sharpen-.zip">here</a>.</p>
<script type="text/javascript" src="../../../SkinSupport/MadCapBodyEnd.js">
</script>
</body>
</html>
|