blob: acdbc75f6d493b50f61daaaa0019d9ddf3bcfd55 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Xtext - Migrating from Xtext 0.7.x to 1.0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="The website of Eclipse Xtext, an open-source framework for development of programming languages and domain-specific languages">
<meta name="author" content="Sven Efftinge">
<meta name="author" content="Miro Spoenemann">
<!-- styles -->
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src=""></script>
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="/Xtext/images/favicon.png">
<link href="/Xtext/css/bootstrap.css" rel="stylesheet" type='text/css'>
<link href="/Xtext/css/bootstrap-responsive.css" rel="stylesheet" type='text/css'>
<link href="/Xtext/css/shield-responsive.css" rel="stylesheet" type='text/css'>
<link href='/Xtext/css/fonts.css' rel='stylesheet' type='text/css'>
<link href="/Xtext/css/prettyPhoto.css" rel="stylesheet" media="screen" type='text/css'>
<link href="/Xtext/css/prettify.css" type="text/css" rel="stylesheet"/>
<link href="/Xtext/css/style.css" rel="stylesheet" type='text/css'>
<!-- cover flow -->
<link href="/Xtext/css/coverflow.css" rel="stylesheet" type='text/css'>
<!--[if lt IE 9]>
<link href="/css/iebugs.css" rel="stylesheet" type='text/css'>
<!-- Google Tag Manager -->
<noscript><iframe src="//"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!-- End Google Tag Manager -->
<header class="site-header">
<!-- Navbar -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse"> <span class="icon-bar"></span> <span
class="icon-bar"></span> <span class="icon-bar"></span>
</a> <a class="brand" href="/Xtext/index.html"></a>
<div class="nav-collapse collapse" style="height: 0px;">
<ul class="nav">
<!--li ><a href="/Xtext/news.html">News</a></li-->
<li ><a href="/Xtext/download.html">Download</a></li>
<li ><a href="/Xtext/documentation/index.html">Documentation</a></li>
<li ><a href="/Xtext/community.html">Community</a></li>
<li ><a href="" target="_blank">Trainings &amp; Support</a></li>
<!--div class="nav pull-right">
<li ><a><iframe src="" frameborder="0" scrolling="0" width="170px" height="20px"></iframe></a></li>
<!--/.nav-collapse -->
<!-- Navbar End -->
<div class="page-content">
function startSearch(event) {
if (event.keyCode == 13) {
var q = '' +;'' + q, "_self");
<div class="wrapper">
<div id="page">
<div class="inner">
<div id="maincontainer" class="container">
<span class="edit-on-github pull-right">
<a href="">Edit on Github</a>
<div class="span3" style="margin-left: 0px;">
<div class="search-bar">
<img src="/Xtext/images/search-gray.png"/>
<input type="search" id="google-search" onkeyup="startSearch(event);"/>
<ul id="nav-outline" style="margin-left: 0px;">
<li class="nav-part">Getting Started</li>
<!--li><a href="101_five_minutes.html">5 Minutes Tutorial</a>
<li><a href="102_domainmodelwalkthrough.html">15 Minutes Tutorial</a>
<li><a href="103_domainmodelnextsteps.html">15 Minutes Tutorial - Extended</a>
<li><a href="104_jvmdomainmodel.html">Five simple steps to your JVM language</a>
<!--li class="nav-part">Seven JVM Languages Built With Xbase</li>
<li><a href="201_sevenlang_introduction.html">Introduction</a>
<li><a href="202_scripting.html">Scripting Language</a>
<li><a href="203_builddsl.html">Build Language</a>
<li><a href="204_mongodb.html">DSL for MongoDB</a>
<li><a href="205_guice.html">DSL for Guice</a>
<li><a href="206_httprouting.html">Http Routing Language</a>
<li><a href="207_template.html">Template Language</a>
<li><a href="208_tortoise.html">Little Tortoise</a>
<li class="nav-part">Reference Documentation</li>
<li><a href="301_grammarlanguage.html">The Grammar Language</a>
<li><a href="302_configuration.html">Configuration</a>
<li><a href="303_runtime_concepts.html">Language Implementation</a>
<li><a href="305_xbase.html">Integration with Java</a>
<!--li><a href="306_mwe2.html">MWE2</a>
<!--li><a href="307_special_languages.html">Typical Language Configurations</a>
<li><a href="308_emf_integration.html">Integration with EMF</a>
<li><a href="310_eclipse_support.html">Eclipse Support</a>
<!--li><a href="320_idea_support.html">IntelliJ IDEA Support</a>
<li><a href="330_web_support.html">Web Editor Support</a>
<li><a href="350_continuous_integration.html">Continuous Integration</a>
<!--li class="nav-part">Appendix</li>
<li><a href="401_migrating_from_1_0_x.html">Migrating from Xtext 1.0.x to 2.0</a>
<li><a href="402_migrating_from_0_7.html">Migrating from Xtext 0.7.x to 1.0</a>
<li class="nav-part">Additional Resources
<li><a href="">API Documentation (JavaDoc)</a>
<div class="span8 doc-contents">
<h1 id="migrating-from-0_7">Migrating from Xtext 0.7.x to 1.0</h1>
<p>For the sake of completeness, here is how you migrate from Xtext 0.7.x to Xtext 1.0, so you might do a migration to 2.0 in two steps. Nevertheless, there have been so many new features and changes that it probably makes more sense to just copy the grammar and start with a new Xtext 2.0 project. The grammar language is fully backward compatible. </p>
<h2 id="migrating-step-by-step">Migrating Step By Step</h2>
<p>Once again, you should make sure that no old plug-ins are in your target platform. Some plug-ins from Xtext 0.7.x have been merged and do no longer exist. </p>
<p><em>Hint: The following steps try to use the Eclipse compiler to spot any source-incompatible changes while fixing them with only a few well described user actions. Doing these steps in another order causes most likely a higher effort.</em></p>
<h3 id="update-the-plug-in-dependencies-and-import-statements">Update the Plug-in Dependencies and Import Statements</h3>
<p>You should update the constraints from version <em>0.7.x</em> to <em>[1.0.0,2.0.0)</em> in your manifest files if you specified any concrete versions. Make sure that your <em>dsl.ui</em>-projects do not refer to the plug-in <em>org.eclipse.xtext.ui.common</em> or <em>org.eclipse.xtext.ui.core</em> but to <em>org.eclipse.xtext.ui</em> instead. The arguably easiest way is a global text-based search and replace across the manifest files. The bundle <em>org.eclipse.xtext.log4j</em> is obsolete as well. The generator will create <em>import-package</em> entries in the manifests later on.</p>
<p>The next step is to fix the import statements in your classes to match the refactored naming scheme in Xtext. Perform a global search for <code>import org.eclipse.xtext.ui.common.</code> and <code>org.eclipse.xtext.ui.core.</code> and replace the matches with <code>import org.eclipse.xtext.ui.</code>. This fixes most of the problems in the manually written code. </p>
<h3 id="rename-the-packages-in-the-dslui-plug-in">Rename the Packages in the dsl.ui-Plug-in</h3>
<p>We changed the naming pattern for artifacts in the <em>dsl.ui</em>-plug-in to match the OSGi conventions. The easiest way to update your existing projects is to apply a “Rename Package” refactoring on the packages in the <em>src</em>- and <em>src-gen</em> folder <em>before</em> you re-run the workflow that regenerates your language. Make sure you ticked “Rename subpackages” in the rename dialog. It is error-prone to enable the search in non-Java files as this will perform incompatible changes in the manifest files. Furthermore, it is important to perform the rename operation in the <em>src-gen</em> folder, too. This ensures that the references in your manually written code are properly updated.</p>
<h3 id="update-the-workflow">Update the Workflow</h3>
<p>The <em>JavaScopingFragment</em> does no longer exist. It has been superseded by the <a href="">ImportURIScopingFragment</a> in combination with the <a href="">SimpleNamesFragment</a>. Please replace </p>
<pre><code class="language-xml">&lt;fragment class=
<pre><code class="language-xml">&lt;fragment class=
&lt;fragment class=
<p>The <em>PackratParserFragment</em> has been abandoned as well. It is save to remove the reference to that one if it is activated in your workflow. After you’ve changed your workflow, it should be possible to regenerate your language without any errors in the console. It is ok to have compilation errors prior to executing the workflow.</p>
<h3 id="manifestmf-and-pluginxml">MANIFEST.MF and plugin.xml</h3>
<p>The previous rename package refactoring updated most of the entries in the <em>MANIFEST.MF</em> and and some entries in the <em>plugin.xml</em>. Others have to be fixed manually. The Eclipse compiler will point to many of the remaining problems in the manifest files but it is unlikely that it will spot the erroneous references in the <em>plugin.xml</em>.</p>
<li>In the generated UI plug-in’s <em>MANIFEST.MF</em>, remove the package exports of no longer existing packages and make sure the bundle activator points to the newly generated one (with <em>.ui.</em> in its package name). </li>
<li>It was already mentioned that the plug-ins <em>org.eclipse.xtext.ui.core</em> and <em>org.eclipse.xtext.ui.common</em> have been merged into a new single plug-in <em>org.eclipse.xtext.ui</em>. The same happened to the respective Java packages. Change eventually remaining bundle-dependencies in all manifests. </li>
<li>The plug-in <em>org.eclipse.xtext.log4j</em> no longer exists. We use a package import of <em>org.apache.log4j</em> instead. Also remove the buddy registration. </li>
<li>Due to renamed packages, you have to fix all references to classes therein in the <em>plugin.xml</em>. A comparison with the <em>plugin.xml_gen</em> will be a great help. If you haven’t added a lot manually, consider merging these into the generated version instead of going the other way around. Note that warnings in the <em>plugin.xml</em> can be considered to be real errors most of the time. Make sure the <em>MyDslExecutableExtensionFactory</em> has the <em>.ui.</em> package prefix. Classes from <em>org.eclipse.xtext.ui.common</em> and <em>org.eclipse.xtext.ui.core</em> are now usually somewhere in <em>org.eclipse.xtext.ui</em>. They are also referenced by the <em>MyDslExecutableExtensionFactory</em> and thus not covered by the validation of the <em>plugin.xml</em>. </li>
<li>A number of new features are being registered in the <em>plugin.xml</em>, e.g. <em>Find references</em>, <em>Quick Outline</em>, and <em>Quick Fixes</em>. You can enable them by manually copying the respective entries from <em>plugin.xml_gen</em> to <em>plugin.xml</em>. </li>
<li>To run MWE2 workflows later on, you must change the plug-in dependencies from <em>org.eclipse.emf.mwe.core</em> to <em>org.eclipse.emf.mwe2.launch</em> in your manifest. Optional resolution is fine. </li>
<h3 id="noteworthy-api-changes">Noteworthy API Changes</h3>
<p>The <em>src</em> folders are generated once, so existing code will not be overwritten but has to be updated manually. At least one new class has appeared in your <em>src</em>-folder of the <em>ui</em> plug-in. there will now be a <em>MyDslStandaloneSetup</em> inheriting form the generated <em>MyDslStandaloneSetupGenerated</em> to allow customization.</p>
<p>You will face a couple of compilation problems due to changes in the API. Here’s a list of the most prominent changes. It is usually only necessary to change your code, if you face any compilation problems.</p>
<li>The method <a href="">IScopeProvider.getScope(EObject,EClass)</a> has been removed. Use <code>getScope(EObject,EReference)</code> instead. </li>
<li>Renamed <em>DefaultScopeProvider</em> to <a href="">SimpleLocalScopeProvider</a>. There have been further significant changes in the scoping API that allow for optimized implementations. Consult the <a href="303_runtime_concepts.html#scoping">section on scoping</a> for details. </li>
<li>The return type of <a href="">AbstractInjectableValidator.getEPackages()</a> was changed from <code>List&lt;? extends EPackage&gt;</code> to <code>List&lt;EPackage&gt;</code>. </li>
<li>The parser interfaces now use <a href="">Reader</a> instead of <a href="">InputStream</a> to explicitly address encoding. Have a look at the <a href="303_runtime_concepts.html#encoding">section on encoding</a> for details. </li>
<li>The handling of <a href="">ILabelProvider</a> in various contexts has been refactored. The former base class <em>DefaultLabelProvider</em> no longer exists. Use the <a href="">DefaultEObjectLabelProvider</a> instead. See the <a href="310_eclipse_support.html#label-provider">section on label providers</a> for details. </li>
<li>We have introduced a couple of new packages to better separate concerns. Most classes should be easy to relocate. </li>
<li>The runtime and UI modules have separate base classes <a href="">DefaultRuntimeModule</a> and <a href="">DefaultUiModule</a> now. We use Guice’s module overrides to combine them with the newly introduced <a href="">SharedModule</a>. You have to add a constructor the your <em>MyDslUiModule</em> that takes an <a href="">AbstractUIPlugin</a> as argument and pass that one to the super constructor. <em>Hint: There is an Eclipse quick fix available for that one.</em></li>
<li>The interfaces <em>ILexicalHighlightigConfiguration</em> and <em>ISemanticHighlightingConfiguration</em> have been merged into <a href="">IHighlightingConfiguration</a>. </li>
<li>The <a href="">DefaultTemplateProposalProvider</a> takes an additional, injectable constructor parameter of type <a href="">ContextTypeIdHelper</a>. </li>
<li>The <a href="">HyperlinkHelper</a> uses field injection instead of constructor injection. The method <code>createHyperlinksByOffset(..)</code> should be overridden instead of the former <code>findCrossLinkedEObject</code>. </li>
<li>The API to skip a node in the outline has changed. Instead of returning the <em>HIDDEN_NODE</em> you’ll have to implement <code>boolean consumeNode(MyType)</code> and return <em>false</em>. <strong>Note: The outline has been re-implemented in Xtext 2.0</strong>. </li>
<li>The <em>Readonly*Storage</em> implementations have been removed. There is a new API to open editors for objects with a given URI. Please use the <a href="">IURIEditorOpener</a> to create an editor or the <a href="">IStorage2UriMapper</a> to obtain an <a href="">IStorage</a> for a given <a href="">URI</a>. </li>
<li>The interfaces <em>IStateAccess</em> and <em>IEObjectHandle</em> have been moved along with the <a href="">IUnitOfWork</a> to the package <em>org.eclipse.xtext.util.concurrent</em>. <strong>Note: IStateAccess was split into IReadAccess and IWriteAccess in Xtext 2.0.</strong></li>
<li>The <em>ValidationJobFactory</em> is gone. Please implement a custom <a href="">IResourceValidator</a> instead. </li>
<li>The grammar elements <a href="">Alternatives</a> and <a href="">Group</a> have a new common super type <a href="">CompoundElement</a>. The methods <code>getGroups()</code> and <code>getTokens()</code> have been refactored to <code>getElements()</code>. </li>
<li>Completion proposals take a <a href="">StyledString</a> instead of a plain string as display string. </li>
<li>The <a href="">AbstractLabelProvider</a> does no longer expose its <a href="">IImageHelper</a>. Use <code>convertToImage</code> instead or inject your own <a href="">IImageHelper</a>. </li>
<li>The implementation-classes from <em>org.eclipse.xtext.index</em> were superseded by the builder infrastructure. Use the <a href="">QualifiedNamesFragment</a> and the <a href="">ImportNamespacesScopingFragment</a> instead of the <em>ImportedNamespacesScopingFragment</em>. Please refer to the <a href="303_runtime_concepts.html#index-based">section about the builder infrastructure</a> for details. </li>
<li>All the Xtend-based fragments were removed. </li>
<li><a href="">ILinkingService.getLinkText</a> was removed. Have a look at the <a href="">LinkingHelper</a> and the <a href="">CrossReferenceSerializer</a> if you relied on this method. </li>
<li>The <em>SerializerUtil</em> was renamed to <a href="">Serializer</a>. There were other heavy refactorings that involved the serializer and its components like e.g. the <a href="">ITransientValueService</a> but it should be pretty straight forward to migrate existing client code. </li>
<li>The method-signatures of the <a href="">IFragmentProvider</a> have changed. The <a href="308_emf_integration.html#fragment-provider">documentation</a> will give a clue on how to update existing implementations. </li>
<li>Some static methods were removed from utility classes such as <a href="">EcoreUtil2</a> and <em>ParsetreeUtil</em> in favor of more sophisticated implementations. </li>
<footer class="site-footer">
<div id="extra">
<div class="inner">
<div class="container">
<div class="row">
<div class="span6">
<h3 class="footer-links-header">Quick Links</h3>
<ul class="footer-links clearfix">
<li><a href="">Privacy Policy</a></li>
<li><a href="">Terms of Use</a></li>
<li><a href="">Copyright Agent</a></li>
<li><a href="">Legal</a></li>
<ul class="footer-links clearfix">
<li><a href="">Eclipse Home</a></li>
<li><a href="">Market Place</a></li>
<li><a href="">Eclipse Live</a></li>
<li><a href="">Eclipse Planet</a></li>
<div class="span6">
<h3 class="footer-links-header"><a href="" style="color: white;">@Xtext</a> on Twitter</h3>
<a class="twitter-timeline" href="" data-widget-id="346625441290928128"
data-chrome="noheader nofooter transparent"
data-theme="dark">Tweets by @xtext</a>
!function(d,s,id) {
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)) {
<a href="#" class="scrollup fadeOutRight animated" style="display: none;">ScrollUp</a>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/Xtext/js/jquery-1.11.3.min.js"></script>
<script src="/Xtext/js/bootstrap.min.js"></script>
<script src="/Xtext/js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="/Xtext/js/jquery.prettyPhoto.js" type="text/javascript"></script>
<script src="/Xtext/js/twitter.js" type="text/javascript"></script>
<script src="/Xtext/js/prettify.js" type="text/javascript"></script>
<script src="/Xtext/js/lang-xtend.js" type="text/javascript"></script>
<script src="/Xtext/js/lang-common.js" type="text/javascript"></script>
<script src="/Xtext/js/custom.js" type="text/javascript"></script>
<script src="" async defer></script>
<!--script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([ '_setAccount', 'UA-2429174-3' ]);
_gaq.push([ '_trackPageview' ]);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl'
: 'http://www')
+ '';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
<script src="/Xtext/js/coverflow.min.js" type="text/javascript"></script>
$(function() {
active : 1,
visibleAside: 2,
overlap : 0.5,
scale : 0.9,
angle : 20,
trigger : {
"itemfocus" : true,
"swipe" : true,
"mousewheel" : false
$('#coverflow :hidden').toggle();
$(window).resize(function() {