Oxygene includes Oxidizer, a powerful tool that can convert code from C#, Java, Objective-C and Delphi to Oxygene. This makes it easy to reuse code snippets or even whole classes found online, or to convert pieces of code from an existing project to Oxygene.
As of version 7, Oxidizer also supports converting Objective-C code to RemObjects C#.
Oxidizer in integrated into the IDE and can be invoked in one of two ways:
- Paste as Oxygene lets you paste code from your clipboard straight into your current code file, and converts it on the fly.
- Import as Oxygene lets you select one or more code files from disk and import them into your project as new files.
For platform-specific code written in C# (for .NET), the Java language (for, well, Java), and Objective-C (for Cocoa), chances are the converted code will work right away, as Oxygene of course uses the exact same classes and APIs as those languages, on the respective platform.
However, Oxidizer can also be useful for converting code between different platforms. For example, you might have an algorithm implemented in Java and want to use that in your .NET project. Using Paste Java as Oxygene will convert the algorithm into proper Oxygene code, you just might have to replace any Java-specific APIs the code used with their .NET equivalent.
Oxidizer is also useful for migrating Delphi code to Oxygene. As in the previous example, Oxidizer will not magically get rid of the Delphi RTL or VCL APIs your code uses, but it will adjust the core language syntax for the minor language differences between Delphi and Oxygene. (The ShineOn library might help with the RTL/VCL APIs, though in general we'd recommend adjusting the code to use the proper platform-specific APIs, or Sugar.)
Reporting Conversion Issues
While Oxidizer's support is extensive, it is always possible that there will be some code constructs it does not handle yet. If you encounter any problems, we would appreciate bug reports: simply paste the original code (and ideally the wrong result produced by Oxidizer) into a mail and send it to firstname.lastname@example.org.