aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhbehrens2008-11-26 04:30:46 (EST)
committersefftinge2008-11-26 04:30:46 (EST)
commit7638e6cf1e3eaab6fa7b882998be40385f607735 (patch)
tree2998b2da468642fcc0f8f18e5a368223f3f15b31
parentb322a507cbd7a0b61117e5ba80fb4ad1a7044a9e (diff)
downloadorg.eclipse.xtext-7638e6cf1e3eaab6fa7b882998be40385f607735.zip
org.eclipse.xtext-7638e6cf1e3eaab6fa7b882998be40385f607735.tar.gz
org.eclipse.xtext-7638e6cf1e3eaab6fa7b882998be40385f607735.tar.bz2
Redesign of ILinkingService (patch from Sebastian)
-rw-r--r--devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/GenReferenceGrammarUiConfig.java8
-rw-r--r--devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ReferenceGrammarGenProposalProvider.java3
-rw-r--r--devtools/org.eclipse.xtext.reference/src/org/eclipse/xtext/reference/ReferenceGrammarChecks.chk7
-rw-r--r--plugins/org.eclipse.xtext.ui.common/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractLinkingCandidatesService.java15
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractProposalProvider.java30
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/DefaultContentAssistProcessor.java18
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ILinkingCandidatesService.java27
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ProposalProviderInvokerSwitch.java3
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/impl/DefaultLinkingCandidatesService.java57
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/crossrefs/CrossRefTest.java37
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/plugin.xml52
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarUiConfig.java1
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenTreeTestLanguageUiConfig.java24
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/TreeTestLanguageGenProposalProvider.java94
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/testlanguages/TreeTestLanguageUiConfig.java19
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/GenerateAllTestGrammarsWithUiConfig.java149
-rw-r--r--tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.tokens6
-rw-r--r--tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageLexer.java22
-rw-r--r--tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageParser.java10
-rw-r--r--tests/org.eclipse.xtext.ui.core.tests/src/org/eclipse/xtext/ui/core/FooChecks.chk7
21 files changed, 438 insertions, 152 deletions
diff --git a/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/GenReferenceGrammarUiConfig.java b/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/GenReferenceGrammarUiConfig.java
index 8a17559..ffacde7 100644
--- a/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/GenReferenceGrammarUiConfig.java
+++ b/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/GenReferenceGrammarUiConfig.java
@@ -14,10 +14,10 @@ public class GenReferenceGrammarUiConfig extends AbstractServiceRegistrationFact
public Set<IServiceRegistration> registrations() {
return scope(org.eclipse.xtext.reference.IReferenceGrammar.SCOPE)
- .with(org.eclipse.xtext.ui.common.editor.codecompletion.IProposalProvider.class, org.eclipse.xtext.reference.ReferenceGrammarGenProposalProvider.class)
- .with(org.eclipse.jface.text.contentassist.IContentAssistant.class, org.eclipse.jface.text.contentassist.ContentAssistant.class)
- .with(org.eclipse.jface.text.contentassist.IContentAssistProcessor.class, org.eclipse.xtext.ui.common.editor.codecompletion.DefaultContentAssistProcessor.class)
-
+ .with(org.eclipse.xtext.ui.common.editor.codecompletion.IProposalProvider.class, org.eclipse.xtext.reference.ReferenceGrammarGenProposalProvider.class)
+ .with(org.eclipse.jface.text.contentassist.IContentAssistant.class, org.eclipse.jface.text.contentassist.ContentAssistant.class)
+ .with(org.eclipse.jface.text.contentassist.IContentAssistProcessor.class, org.eclipse.xtext.ui.common.editor.codecompletion.DefaultContentAssistProcessor.class)
+ .with(org.eclipse.xtext.ui.common.editor.codecompletion.ILinkingCandidatesService.class, org.eclipse.xtext.ui.common.editor.codecompletion.impl.DefaultLinkingCandidatesService.class)
.registrations();
}
diff --git a/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ReferenceGrammarGenProposalProvider.java b/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ReferenceGrammarGenProposalProvider.java
index bc840df..3c9cf96 100644
--- a/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ReferenceGrammarGenProposalProvider.java
+++ b/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ReferenceGrammarGenProposalProvider.java
@@ -218,7 +218,6 @@ public class ReferenceGrammarGenProposalProvider extends AbstractProposalProvid
return Collections.singletonList(createCompletionProposal(assignment,model,"CustomTypeParserRuleName", offset));
}
-
public List<? extends ICompletionProposal> completeReferenceModelCustomType(RuleCall ruleCall, EObject model, String prefix,
IDocument doc, int offset) {
if (logger.isDebugEnabled()) {
@@ -227,7 +226,6 @@ public class ReferenceGrammarGenProposalProvider extends AbstractProposalProvid
}
return Collections.emptyList();
}
-
@Override
protected String getDefaultImageFilePath() {
return "icons/editor.gif";
@@ -237,5 +235,4 @@ public class ReferenceGrammarGenProposalProvider extends AbstractProposalProvid
protected String getPluginId() {
return UI_PLUGIN_ID;
}
-
}
diff --git a/devtools/org.eclipse.xtext.reference/src/org/eclipse/xtext/reference/ReferenceGrammarChecks.chk b/devtools/org.eclipse.xtext.reference/src/org/eclipse/xtext/reference/ReferenceGrammarChecks.chk
new file mode 100644
index 0000000..035f18a
--- /dev/null
+++ b/devtools/org.eclipse.xtext.reference/src/org/eclipse/xtext/reference/ReferenceGrammarChecks.chk
@@ -0,0 +1,7 @@
+import ReferenceGrammar;
+/*
+ * this check file is used to specify constraints for the derived metamodels
+ * example:
+ * context Entity WARNING "Entity names should start with a capital" :
+ * name.toFirstUpper() == name;
+ */
diff --git a/plugins/org.eclipse.xtext.ui.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtext.ui.common/META-INF/MANIFEST.MF
index 4106d75..5106a98 100644
--- a/plugins/org.eclipse.xtext.ui.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.xtext.ui.common/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.xtext.ui.core,
org.eclipse.xtext.log4j;bundle-version="1.2.15"
Export-Package: org.eclipse.xtext.ui.common.editor.codecompletion,
+ org.eclipse.xtext.ui.common.editor.codecompletion.impl,
org.eclipse.xtext.ui.common.editor.folding,
org.eclipse.xtext.ui.common.editor.formatting,
org.eclipse.xtext.ui.common.editor.hover,
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractLinkingCandidatesService.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractLinkingCandidatesService.java
new file mode 100644
index 0000000..f020321
--- /dev/null
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractLinkingCandidatesService.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.xtext.ui.common.editor.codecompletion;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public abstract class AbstractLinkingCandidatesService implements ILinkingCandidatesService {
+
+}
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractProposalProvider.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractProposalProvider.java
index 3beacaf..08be1e7 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractProposalProvider.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/AbstractProposalProvider.java
@@ -9,6 +9,7 @@ import java.util.Map;
import org.apache.log4j.Logger;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.viewers.StyledString;
@@ -21,8 +22,7 @@ import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.LexerRule;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.RuleCall;
-import org.eclipse.xtext.crossref.ILinkingNameService;
-import org.eclipse.xtext.crossref.ILinkingService;
+import org.eclipse.xtext.crossref.impl.SimpleAttributeResolver;
import org.eclipse.xtext.parsetree.AbstractNode;
import org.eclipse.xtext.parsetree.CompositeNode;
import org.eclipse.xtext.parsetree.LeafNode;
@@ -48,10 +48,17 @@ public abstract class AbstractProposalProvider implements IProposalProvider {
protected final Logger logger = Logger.getLogger(getClass());
@Inject
- protected ILinkingService linkingService;
+ protected ILinkingCandidatesService linkingCandidatesService;
- @Inject
- protected ILinkingNameService linkingNameService;
+ protected SimpleAttributeResolver<String> nameResolver;
+
+ protected SimpleAttributeResolver<String> createNameResolver() {
+ return SimpleAttributeResolver.newResolver(String.class, "name");
+ }
+
+ public AbstractProposalProvider() {
+ nameResolver = createNameResolver();
+ }
/*
* (non-Javadoc)
@@ -178,16 +185,21 @@ public abstract class AbstractProposalProvider implements IProposalProvider {
List<ICompletionProposal> completionProposalList = new ArrayList<ICompletionProposal>();
- if (linkingService != null) {
- List<EObject> candidates = linkingService.getLinkCandidates(model, crossReference, prefix);
+ if (linkingCandidatesService != null) {
+ final EReference ref = GrammarUtil.getReference(crossReference, model.eClass());
+ final List<EObject> candidates = linkingCandidatesService.getLinkingCandidates(model, ref);
for (EObject candidate : candidates) {
- completionProposalList.add(createCompletionProposal(crossReference, model, linkingNameService.getText(
- candidate, crossReference), offset));
+ completionProposalList.add(createCompletionProposal(crossReference, model, getLabel(
+ candidate, ref, model), offset));
}
}
return completionProposalList;
}
+
+ protected String getLabel(EObject candidate, EReference ref, EObject context) {
+ return nameResolver.getValue(candidate);
+ }
/**
* @return a new <code>XtextCompletionProposal</code> for the given text and offset.
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/DefaultContentAssistProcessor.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/DefaultContentAssistProcessor.java
index 84223db..5126e7c 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/DefaultContentAssistProcessor.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/DefaultContentAssistProcessor.java
@@ -7,8 +7,6 @@ import java.util.Set;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.jface.text.IDocument;
@@ -190,29 +188,17 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
private boolean isLinked(AbstractNode lastCompleteNode) {
EObject semanticModel = NodeUtil.getNearestSemanticObject(lastCompleteNode);
CrossReference crossReference = (CrossReference) lastCompleteNode.getGrammarElement();
- EReference eReference = getReference(crossReference, semanticModel.eClass());
+ EReference eReference = GrammarUtil.getReference(crossReference, semanticModel.eClass());
List<EObject> referencedObjects = EcoreUtil2.getAllReferencedObjects(semanticModel, eReference);
if (referencedObjects.isEmpty())
return false;
else {
- List<EObject> linkCandidates = linkingService.getLinkedObjects(semanticModel, crossReference,
+ List<EObject> linkCandidates = linkingService.getLinkedObjects(semanticModel, eReference,
(LeafNode) lastCompleteNode);
return !linkCandidates.isEmpty() && referencedObjects.containsAll(linkCandidates);
}
}
- private EReference getReference(CrossReference ref, EClass class1) {
- EList<EReference> references = class1.getEAllReferences();
-
- String feature = GrammarUtil.containingAssignment(ref).getFeature();
-
- for (EReference reference : references) {
- if (!reference.isContainment() && reference.getName().equals(feature))
- return reference;
- }
- return null;
- }
-
}
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ILinkingCandidatesService.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ILinkingCandidatesService.java
new file mode 100644
index 0000000..bad3b79
--- /dev/null
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ILinkingCandidatesService.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.xtext.ui.common.editor.codecompletion;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public interface ILinkingCandidatesService {
+
+ /**
+ * Returns all EObjects, that can be referenced in the given context.
+ */
+ List<EObject> getLinkingCandidates(EObject context, EReference reference);
+
+
+
+}
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ProposalProviderInvokerSwitch.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ProposalProviderInvokerSwitch.java
index ad32773..7d99355 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ProposalProviderInvokerSwitch.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/ProposalProviderInvokerSwitch.java
@@ -28,6 +28,7 @@ import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.TypeRef;
+import org.eclipse.xtext.util.Strings;
import org.eclipse.xtext.util.XtextSwitch;
/**
@@ -254,7 +255,7 @@ public class ProposalProviderInvokerSwitch extends XtextSwitch<List<ICompletionP
}
private final String firstLetterCapitalized(String name) {
- return name.substring(0, 1).toUpperCase() + name.substring(1);
+ return Strings.toFirstUpper(name);
}
}
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/impl/DefaultLinkingCandidatesService.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/impl/DefaultLinkingCandidatesService.java
new file mode 100644
index 0000000..68dc521
--- /dev/null
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/codecompletion/impl/DefaultLinkingCandidatesService.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.xtext.ui.common.editor.codecompletion.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.xtext.EcoreUtil2;
+import org.eclipse.xtext.crossref.ILinkingScopeService;
+import org.eclipse.xtext.service.Inject;
+import org.eclipse.xtext.ui.common.editor.codecompletion.AbstractLinkingCandidatesService;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public class DefaultLinkingCandidatesService extends AbstractLinkingCandidatesService {
+
+ @Inject
+ private ILinkingScopeService scopeService;
+
+ public List<EObject> getLinkingCandidates(EObject context, EReference reference) {
+ List<EObject> candidates =scopeService.getObjectsInScope(context, reference);
+ List<EObject> result = new ArrayList<EObject>();
+ Iterator<EObject> iter = candidates.iterator();
+ final EClass requiredType = reference.getEReferenceType();
+ while (iter.hasNext()) {
+ final EObject candidate = iter.next();
+ if (EcoreUtil2.isAssignableFrom(requiredType, candidate))
+ result.add(candidate);
+ }
+ return result;
+ }
+
+ /**
+ * @return the scopeService
+ */
+ public ILinkingScopeService getScopeService() {
+ return scopeService;
+ }
+
+ /**
+ * @param scopeService the scopeService to set
+ */
+ public void setScopeService(ILinkingScopeService scopeService) {
+ this.scopeService = scopeService;
+ }
+
+}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/crossrefs/CrossRefTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/crossrefs/CrossRefTest.java
index 8990216..2d20bd3 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/crossrefs/CrossRefTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/crossrefs/CrossRefTest.java
@@ -1,17 +1,19 @@
package org.eclipse.xtext.crossrefs;
-import java.util.List;
-
import org.apache.log4j.Logger;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.CrossReference;
+import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.crossref.ILinkingService;
import org.eclipse.xtext.crossref.impl.XtextBuiltinLinkingService;
import org.eclipse.xtext.crossrefs.services.LangAGrammarAccess;
+import org.eclipse.xtext.parsetree.LeafNode;
+import org.eclipse.xtext.parsetree.NodeUtil;
+import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.service.ServiceRegistry;
import org.eclipse.xtext.tests.AbstractGeneratorTest;
@@ -33,8 +35,10 @@ public class CrossRefTest extends AbstractGeneratorTest {
assertWithXtend("types.first()", "types.first().extends.extends", model);
}
- public void testGetLinkCandidates01() throws Exception {
- EObject model = getModel("type TypeA extends TypeB type TypeB extends TypeA type AnotherType extends TypeA");
+ public void testGetLinkedObjects() throws Exception {
+ XtextResource r = getResourceFromString("type TypeA extends TypeB type TypeB extends TypeA type AnotherType extends TypeA");
+ EObject model = r.getParseResult().getRootASTElement();
+ LeafNode leaf = (LeafNode) NodeUtil.findLeafNodeAtOffset(r.getParseResult().getRootNode(), 6);
assertWithXtend("3", "types.size", model);
@@ -42,28 +46,9 @@ public class CrossRefTest extends AbstractGeneratorTest {
ParserRule prType = new LangAGrammarAccess().pr_Type();
Assignment asExtends = (Assignment) ((Group) prType.getAlternatives()).getAbstractTokens().get(1);
CrossReference xref = (CrossReference) asExtends.getTerminal();
+ EReference ref = GrammarUtil.getReference(xref, context.eClass());
- assertEquals(3, linkingService.doGetLinkedObjects(context, xref, "", false).size());
- assertEquals(2, linkingService.doGetLinkedObjects(context, xref, "Type", false).size());
- assertEquals(1, linkingService.doGetLinkedObjects(context, xref, "TypeA", false).size());
- assertEquals(0, linkingService.doGetLinkedObjects(context, xref, "TypeC", false).size());
+ assertEquals(1, linkingService.getLinkedObjects(context, ref, leaf).size());
}
- public void testGetLinkCandidates02() throws Exception {
- EObject model = getModel("type TypeA extends TypeB type TypeB extends TypeA type AnotherType extends TypeA");
-
- EObject context = (EObject) invokeWithXtend("types.first()", model);
- ParserRule prType = new LangAGrammarAccess().pr_Type();
- Assignment asExtends = (Assignment) ((Group) prType.getAlternatives()).getAbstractTokens().get(1);
- CrossReference xref = (CrossReference) asExtends.getTerminal();
-
- List<EObject> candidates = linkingService.getLinkCandidates(context, xref, "TypeA");
- assertEquals(1, candidates.size());
- EObject candidate = candidates.get(0);
- EStructuralFeature feature = candidate.eClass().getEStructuralFeature("name");
- assertNotNull(feature);
- Object name = candidate.eGet(feature);
- assertNotNull(name);
- assertEquals("TypeA", name);
- }
}
diff --git a/tests/org.eclipse.xtext.ui.common.tests/plugin.xml b/tests/org.eclipse.xtext.ui.common.tests/plugin.xml
new file mode 100644
index 0000000..ec4cd19
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/plugin.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.xtext.ui.core.editor.XtextEditor"
+ contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
+ default="true"
+ extensions="treetestlanguage"
+ id="org.eclipse.xtext.testlanguages.TreeTestLanguage"
+ name="TreeTestLanguage Editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.xtext.service.ui.serviceRegistrationFactory">
+ <serviceRegistrationFactory
+ class="org.eclipse.xtext.testlanguages.TreeTestLanguageUiConfig"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.xtext.service.ui.ServiceInjectingExecutableExtensionFactory:org.eclipse.xtext.ui.core.editor.preferences.LanguageRootPreferencePage/org.eclipse.xtext.testlanguages.TreeTestLanguage"
+ id="org.eclipse.xtext.testlanguages.TreeTestLanguage"
+ name="TreeTestLanguage">
+ <keywordReference
+ id="..ui.keyword_TreeTestLanguage">
+ </keywordReference>
+ </page>
+ <page
+ category="org.eclipse.xtext.testlanguages.TreeTestLanguage"
+ class="org.eclipse.xtext.service.ui.ServiceInjectingExecutableExtensionFactory:org.eclipse.xtext.ui.core.editor.preferences.EditorPreferencePage/org.eclipse.xtext.testlanguages.TreeTestLanguage"
+ id="org.eclipse.xtext.testlanguages.TreeTestLanguage.editor"
+ name="Editor">
+ <keywordReference
+ id="org.eclipse.xtext.keyword.editor">
+ </keywordReference>
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.keywords">
+ <keyword
+ id="..ui.keyword_TreeTestLanguage"
+ label="TreeTestLanguage">
+ </keyword>
+ <keyword
+ id="org.eclipse.xtext.testlanguages.TreeTestLanguage.tasktags"
+ label="Task Tags">
+ </keyword>
+ </extension>
+</plugin>
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarUiConfig.java b/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarUiConfig.java
index fbfc536..96cdc71 100644
--- a/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarUiConfig.java
+++ b/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarUiConfig.java
@@ -17,6 +17,7 @@ public class GenReferenceGrammarUiConfig extends AbstractServiceRegistrationFact
.with(org.eclipse.xtext.ui.common.editor.codecompletion.IProposalProvider.class, org.eclipse.xtext.testlanguages.ReferenceGrammarGenProposalProvider.class)
.with(org.eclipse.jface.text.contentassist.IContentAssistant.class, org.eclipse.jface.text.contentassist.ContentAssistant.class)
.with(org.eclipse.jface.text.contentassist.IContentAssistProcessor.class, org.eclipse.xtext.ui.common.editor.codecompletion.DefaultContentAssistProcessor.class)
+ .with(org.eclipse.xtext.ui.common.editor.codecompletion.ILinkingCandidatesService.class, org.eclipse.xtext.ui.common.editor.codecompletion.impl.DefaultLinkingCandidatesService.class)
.registrations();
}
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenTreeTestLanguageUiConfig.java b/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenTreeTestLanguageUiConfig.java
new file mode 100644
index 0000000..4cc6461
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/GenTreeTestLanguageUiConfig.java
@@ -0,0 +1,24 @@
+/*
+Generated with Xtext
+*/
+package org.eclipse.xtext.testlanguages;
+
+import java.util.Set;
+
+import org.eclipse.xtext.service.AbstractServiceRegistrationFactory;
+
+/**
+ * GENERATED! Manual modification goes to TreeTestLanguageUiConfig
+ */
+public class GenTreeTestLanguageUiConfig extends AbstractServiceRegistrationFactory {
+
+ public Set<IServiceRegistration> registrations() {
+ return scope(org.eclipse.xtext.testlanguages.ITreeTestLanguage.SCOPE)
+ .with(org.eclipse.xtext.ui.common.editor.codecompletion.IProposalProvider.class, org.eclipse.xtext.testlanguages.TreeTestLanguageGenProposalProvider.class)
+ .with(org.eclipse.jface.text.contentassist.IContentAssistant.class, org.eclipse.jface.text.contentassist.ContentAssistant.class)
+ .with(org.eclipse.jface.text.contentassist.IContentAssistProcessor.class, org.eclipse.xtext.ui.common.editor.codecompletion.DefaultContentAssistProcessor.class)
+ .with(org.eclipse.xtext.ui.common.editor.codecompletion.ILinkingCandidatesService.class, org.eclipse.xtext.ui.common.editor.codecompletion.impl.DefaultLinkingCandidatesService.class)
+ .registrations();
+ }
+
+}
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/TreeTestLanguageGenProposalProvider.java b/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/TreeTestLanguageGenProposalProvider.java
new file mode 100644
index 0000000..f8f1187
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/src-gen/org/eclipse/xtext/testlanguages/TreeTestLanguageGenProposalProvider.java
@@ -0,0 +1,94 @@
+/*
+Generated with Xtext
+*/
+package org.eclipse.xtext.testlanguages;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.xtext.Assignment;
+import org.eclipse.xtext.CrossReference;
+import org.eclipse.xtext.RuleCall;
+import org.eclipse.xtext.ui.common.editor.codecompletion.AbstractProposalProvider;
+import org.eclipse.xtext.ui.common.editor.codecompletion.IProposalProvider;
+
+/**
+ * Represents a generated, default implementation of interface {@link IProposalProvider}.
+ *
+ * In addition to the declared methods, the framework tries to call grammar dependent methods for assignments using reflection.
+ * The signature of such methods invoked reflectively follows the following pattern:
+ *
+ * public List<ICompletionProposal> complete[Typename][featureName](Assignment ele, EObject model, String prefix)
+ *
+ * <b>Example</b>
+ * Given the following grammar :
+ * <code>
+ * RuleA returns MyType :
+ * "myType" name=ID;
+ * </code>
+ *
+ * One could provide the following method in an implementation of this interface:
+ * <code>
+ * public List<ICompletionProposal> completeMyTypeName(Assignment ele, EObject model, String prefix, IDocument doc) {...}
+ * </code>
+ * Note that if you have generated Java classes for your domain model (meta model) you can alternatively declare the second parameter using
+ * a specific type:
+ * <code>
+ * public List<ICompletionProposal> completeMyTypeName(Assignment ele, MyType model, String prefix, IDocument doc) {...}
+ * </code>
+ *
+ */
+public class TreeTestLanguageGenProposalProvider extends AbstractProposalProvider {
+ // constants
+ private static final String UI_PLUGIN_ID = ".";
+
+
+ public List<? extends ICompletionProposal> completeModelChildren(Assignment assignment, EObject model, String prefix, IDocument doc,int offset) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("completeModelChildren feature '" + assignment.getFeature() + "' terminal '"
+ + assignment.getTerminal() + "' cardinality '" + assignment.getCardinality() + "' and prefix '"
+ + prefix.trim() + "'");
+ }
+ return Collections.emptyList();
+ }
+
+ public List<? extends ICompletionProposal> completeNodeName(Assignment assignment, EObject model, String prefix, IDocument doc,int offset) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("completeNodeName feature '" + assignment.getFeature() + "' terminal '"
+ + assignment.getTerminal() + "' cardinality '" + assignment.getCardinality() + "' and prefix '"
+ + prefix.trim() + "'");
+ }
+ return Collections.singletonList(createCompletionProposal(assignment,model,"NodeName", offset));
+ }
+
+ public List<? extends ICompletionProposal> completeNodeAttrib(Assignment assignment, EObject model, String prefix, IDocument doc,int offset) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("completeNodeAttrib feature '" + assignment.getFeature() + "' terminal '"
+ + assignment.getTerminal() + "' cardinality '" + assignment.getCardinality() + "' and prefix '"
+ + prefix.trim() + "'");
+ }
+ return Collections.singletonList(createCompletionProposal(assignment,model,"\"NodeAttrib\"", offset));
+ }
+
+ public List<? extends ICompletionProposal> completeNodeChildren(Assignment assignment, EObject model, String prefix, IDocument doc,int offset) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("completeNodeChildren feature '" + assignment.getFeature() + "' terminal '"
+ + assignment.getTerminal() + "' cardinality '" + assignment.getCardinality() + "' and prefix '"
+ + prefix.trim() + "'");
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ protected String getDefaultImageFilePath() {
+ return "icons/editor.gif";
+ }
+
+ @Override
+ protected String getPluginId() {
+ return UI_PLUGIN_ID;
+ }
+}
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/testlanguages/TreeTestLanguageUiConfig.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/testlanguages/TreeTestLanguageUiConfig.java
new file mode 100644
index 0000000..ae7906c
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/testlanguages/TreeTestLanguageUiConfig.java
@@ -0,0 +1,19 @@
+/*
+Generated with Xtext
+*/
+package org.eclipse.xtext.testlanguages;
+
+import java.util.Set;
+
+import org.eclipse.xtext.service.AbstractServiceRegistrationFactory;
+
+/**
+ * used to register components to be used within the IDE.
+ */
+public class TreeTestLanguageUiConfig extends org.eclipse.xtext.testlanguages.GenTreeTestLanguageUiConfig {
+
+ public Set<IServiceRegistration> registrations() {
+ return super.registrations();
+ }
+
+}
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/GenerateAllTestGrammarsWithUiConfig.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/GenerateAllTestGrammarsWithUiConfig.java
index d415238..a640471 100644
--- a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/GenerateAllTestGrammarsWithUiConfig.java
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/GenerateAllTestGrammarsWithUiConfig.java
@@ -1,74 +1,75 @@
-/*******************************************************************************
- * __ ___ _
- * \ \/ / |_ _____ __ |_
- * \ /| __/ _ \ \/ / __|
- * / \| |_ __/> <| |_
- * /_/\_\\__\___/_/\_\\__|
- *
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.ui.common;
-
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.xtext.GeneratorFacade;
-import org.eclipse.xtext.Grammar;
-import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.resource.XtextResourceSet;
-import org.eclipse.xtext.testlanguages.ReferenceGrammar;
-
-/**
- * Generates all required testgrammars with UI configuration for this test project.
- *
- * This code was copied from class <code>GenerateAllTestGrammars</code> within project
- * 'org.eclipse.xtext[.generator.]tests'.
- * <p/>
- * The duplication of this class was required because tests in this project rely on an existing UIConfig in
- * addition to the standalone RuntimeConfig.
- *
- * @author Michael Clay - Initial contribution and API
- */
-public class GenerateAllTestGrammarsWithUiConfig {
-
- private static final String RUNTIME_PATH = "../org.eclipse.xtext.generator.tests";
- private static final String UI_PATH = ".";
-
- private static Logger logger = Logger.getLogger(GenerateAllTestGrammarsWithUiConfig.class);
-
- private final static Class<?>[] testClasses = new Class[] { ReferenceGrammar.class };
- /**
- * @return the testclasses
- */
- public static Class<?>[] getTestClasses() {
- return testClasses;
- }
-
- public static void main(String[] args) throws Exception {
- try {
- XtextStandaloneSetup.doSetup();
- GeneratorFacade.cleanFolder(UI_PATH + "/src-gen");
- for (Class<?> clazz : testClasses) {
- String filename = "classpath:/" + clazz.getName().replace('.', '/')
- + ".xtext";
- logger.info("loading " + filename);
- ResourceSetImpl rs = new XtextResourceSet();
- URI uri = URI.createURI(filename);
- Resource resource = rs.createResource(uri);
- resource.load(null);
- Grammar grammarModel = (Grammar) resource.getContents()
- .iterator().next();
- GeneratorFacade.generate(grammarModel, RUNTIME_PATH, UI_PATH, clazz
- .getSimpleName().toLowerCase());
- }
- } catch (Exception e) {
- logger.error("Error while generating test grammars",e);
- }
- }
-
-}
+/*******************************************************************************
+ * __ ___ _
+ * \ \/ / |_ _____ __ |_
+ * \ /| __/ _ \ \/ / __|
+ * / \| |_ __/> <| |_
+ * /_/\_\\__\___/_/\_\\__|
+ *
+ * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.xtext.ui.common;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.xtext.GeneratorFacade;
+import org.eclipse.xtext.Grammar;
+import org.eclipse.xtext.XtextStandaloneSetup;
+import org.eclipse.xtext.resource.XtextResourceSet;
+import org.eclipse.xtext.testlanguages.ReferenceGrammar;
+import org.eclipse.xtext.testlanguages.TreeTestLanguage;
+
+/**
+ * Generates all required testgrammars with UI configuration for this test project.
+ *
+ * This code was copied from class <code>GenerateAllTestGrammars</code> within project
+ * 'org.eclipse.xtext[.generator.]tests'.
+ * <p/>
+ * The duplication of this class was required because tests in this project rely on an existing UIConfig in
+ * addition to the standalone RuntimeConfig.
+ *
+ * @author Michael Clay - Initial contribution and API
+ */
+public class GenerateAllTestGrammarsWithUiConfig {
+
+ private static final String RUNTIME_PATH = "../org.eclipse.xtext.generator.tests";
+ private static final String UI_PATH = ".";
+
+ private static Logger logger = Logger.getLogger(GenerateAllTestGrammarsWithUiConfig.class);
+
+ private final static Class<?>[] testClasses = new Class[] { ReferenceGrammar.class, TreeTestLanguage.class };
+ /**
+ * @return the testclasses
+ */
+ public static Class<?>[] getTestClasses() {
+ return testClasses;
+ }
+
+ public static void main(String[] args) throws Exception {
+ try {
+ XtextStandaloneSetup.doSetup();
+ GeneratorFacade.cleanFolder(UI_PATH + "/src-gen");
+ for (Class<?> clazz : testClasses) {
+ String filename = "classpath:/" + clazz.getName().replace('.', '/')
+ + ".xtext";
+ logger.info("loading " + filename);
+ ResourceSetImpl rs = new XtextResourceSet();
+ URI uri = URI.createURI(filename);
+ Resource resource = rs.createResource(uri);
+ resource.load(null);
+ Grammar grammarModel = (Grammar) resource.getContents()
+ .iterator().next();
+ GeneratorFacade.generate(grammarModel, RUNTIME_PATH, UI_PATH, clazz
+ .getSimpleName().toLowerCase());
+ }
+ } catch (Exception e) {
+ logger.error("Error while generating test grammars",e);
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.tokens b/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.tokens
index 515910c..7256094 100644
--- a/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.tokens
+++ b/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.tokens
@@ -1,8 +1,8 @@
+RULE_ML_COMMENT=7
RULE_ID=4
+RULE_WS=9
+RULE_INT=5
RULE_STRING=6
RULE_ANY_OTHER=10
-RULE_INT=5
-RULE_WS=9
RULE_SL_COMMENT=8
-RULE_ML_COMMENT=7
'stuff'=11
diff --git a/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageLexer.java b/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageLexer.java
index 396190f..4fc5966 100644
--- a/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageLexer.java
+++ b/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageLexer.java
@@ -1,4 +1,4 @@
-// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.g 2008-11-03 13:20:14
+// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.g 2008-11-24 19:32:02
package org.eclipse.xtext.ui.core.parser.internal;
@@ -13,16 +13,16 @@ import java.util.List;
import java.util.ArrayList;
public class InternalTestLanguageLexer extends Lexer {
+ public static final int RULE_ML_COMMENT=7;
public static final int RULE_ID=4;
- public static final int RULE_STRING=6;
- public static final int RULE_ANY_OTHER=10;
- public static final int RULE_INT=5;
- public static final int T11=11;
public static final int RULE_WS=9;
+ public static final int T11=11;
+ public static final int EOF=-1;
+ public static final int RULE_INT=5;
+ public static final int RULE_STRING=6;
public static final int Tokens=12;
+ public static final int RULE_ANY_OTHER=10;
public static final int RULE_SL_COMMENT=8;
- public static final int EOF=-1;
- public static final int RULE_ML_COMMENT=7;
public InternalTestLanguageLexer() {;}
public InternalTestLanguageLexer(CharStream input) {
super(input);
@@ -625,14 +625,14 @@ public class InternalTestLanguageLexer extends Lexer {
}
else if ( (LA12_0=='/') ) {
switch ( input.LA(2) ) {
- case '*':
+ case '/':
{
- alt12=5;
+ alt12=6;
}
break;
- case '/':
+ case '*':
{
- alt12=6;
+ alt12=5;
}
break;
default:
diff --git a/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageParser.java b/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageParser.java
index 0ea6cfb..e89e5bc 100644
--- a/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageParser.java
+++ b/tests/org.eclipse.xtext.ui.core.tests/src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguageParser.java
@@ -1,4 +1,4 @@
-// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.g 2008-11-03 13:20:14
+// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/ui/core/parser/internal/InternalTestLanguage.g 2008-11-24 19:32:02
package org.eclipse.xtext.ui.core.parser.internal;
@@ -22,14 +22,14 @@ public class InternalTestLanguageParser extends AbstractAntlrParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'stuff'"
};
+ public static final int RULE_ML_COMMENT=7;
public static final int RULE_ID=4;
+ public static final int RULE_WS=9;
+ public static final int EOF=-1;
+ public static final int RULE_INT=5;
public static final int RULE_STRING=6;
public static final int RULE_ANY_OTHER=10;
- public static final int RULE_INT=5;
- public static final int RULE_WS=9;
public static final int RULE_SL_COMMENT=8;
- public static final int EOF=-1;
- public static final int RULE_ML_COMMENT=7;
public InternalTestLanguageParser(TokenStream input) {
super(input);
diff --git a/tests/org.eclipse.xtext.ui.core.tests/src/org/eclipse/xtext/ui/core/FooChecks.chk b/tests/org.eclipse.xtext.ui.core.tests/src/org/eclipse/xtext/ui/core/FooChecks.chk
new file mode 100644
index 0000000..a5b7ffd
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.core.tests/src/org/eclipse/xtext/ui/core/FooChecks.chk
@@ -0,0 +1,7 @@
+import foo;
+/*
+ * this check file is used to specify constraints for the derived metamodels
+ * example:
+ * context Entity WARNING "Entity names should start with a capital" :
+ * name.toFirstUpper() == name;
+ */