aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-04-02 05:19:23 (EDT)
committersefftinge2009-04-02 05:19:23 (EDT)
commita9ff67032c759d0a597067a2b377e8199e56a7d5 (patch)
tree1471b18622bcf3b16c20459fab38bc72f4bef1c3
parent8b64acf599214ae544cfd2c8bae8ebad0e8c5ed1 (diff)
downloadorg.eclipse.xtext-a9ff67032c759d0a597067a2b377e8199e56a7d5.zip
org.eclipse.xtext-a9ff67032c759d0a597067a2b377e8199e56a7d5.tar.gz
org.eclipse.xtext-a9ff67032c759d0a597067a2b377e8199e56a7d5.tar.bz2
Fixed tests, added google.collect to psfs
-rw-r--r--develop/psf/extssh-withProxy/xtext-projectset.psf2
-rw-r--r--develop/psf/extssh/xtext-projectset.psf2
-rw-r--r--develop/psf/pserver/xtext-projectset.psf2
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessor.java210
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java65
5 files changed, 126 insertions, 155 deletions
diff --git a/develop/psf/extssh-withProxy/xtext-projectset.psf b/develop/psf/extssh-withProxy/xtext-projectset.psf
index cc517a2..8b39fd4 100644
--- a/develop/psf/extssh-withProxy/xtext-projectset.psf
+++ b/develop/psf/extssh-withProxy/xtext-projectset.psf
@@ -2,6 +2,7 @@
<psf version="2.0">
<provider id="org.eclipse.team.cvs.core.cvsnature">
<project reference="1.0,:extssh:proxy.eclipse.org:443:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/plugins/com.google.guice,com.google.guice"/>
+<project reference="1.0,:extssh:proxy.eclipse.org:443:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/plugins/com.google.collect,com.google.collect"/>
<project reference="1.0,:extssh:architecturware.cvs.sourceforge.net:/cvsroot/architecturware,xtext_external/de.itemis.xtext.antlr,de.itemis.xtext.antlr"/>
<project reference="1.0,:extssh:proxy.eclipse.org:443:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/develop,develop"/>
<project reference="1.0,:extssh:proxy.eclipse.org:443:/cvsroot/tools,org.eclipse.orbit/javax.xml,javax.xml,v1_3_4"/>
@@ -214,6 +215,7 @@
<item elementID="=org.antlr.runtime" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
<item elementID="=de.itemis.xtext.antlr" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
<item elementID="=com.google.guice" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
+<item elementID="=com.google.collect" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
</workingSets>
<workingSets editPageId="org.eclipse.jdt.ui.JavaWorkingSetPage" label="Xtext Core" name="Xtext Core">
<item elementID="=org.eclipse.xtext.generator.tests" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
diff --git a/develop/psf/extssh/xtext-projectset.psf b/develop/psf/extssh/xtext-projectset.psf
index fddfc09..2baa0d3 100644
--- a/develop/psf/extssh/xtext-projectset.psf
+++ b/develop/psf/extssh/xtext-projectset.psf
@@ -2,6 +2,7 @@
<psf version="2.0">
<provider id="org.eclipse.team.cvs.core.cvsnature">
<project reference="1.0,:extssh:dev.eclipse.org:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/plugins/com.google.guice,com.google.guice"/>
+<project reference="1.0,:extssh:dev.eclipse.org:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/plugins/com.google.collect,com.google.collect"/>
<project reference="1.0,:extssh:architecturware.cvs.sourceforge.net:/cvsroot/architecturware,xtext_external/de.itemis.xtext.antlr,de.itemis.xtext.antlr"/>
<project reference="1.0,:extssh:dev.eclipse.org:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/develop,develop"/>
<project reference="1.0,:extssh:dev.eclipse.org:/cvsroot/tools,org.eclipse.orbit/javax.xml,javax.xml,v1_3_4"/>
@@ -214,6 +215,7 @@
<item elementID="=org.antlr.runtime" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
<item elementID="=de.itemis.xtext.antlr" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
<item elementID="=com.google.guice" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
+<item elementID="=com.google.collect" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
</workingSets>
<workingSets editPageId="org.eclipse.jdt.ui.JavaWorkingSetPage" label="Xtext Core" name="Xtext Core">
<item elementID="=org.eclipse.xtext.generator.tests" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
diff --git a/develop/psf/pserver/xtext-projectset.psf b/develop/psf/pserver/xtext-projectset.psf
index 66ebbb7..0f3af56 100644
--- a/develop/psf/pserver/xtext-projectset.psf
+++ b/develop/psf/pserver/xtext-projectset.psf
@@ -2,6 +2,7 @@
<psf version="2.0">
<provider id="org.eclipse.team.cvs.core.cvsnature">
<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/plugins/com.google.guice,com.google.guice"/>
+<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/plugins/com.google.collect,com.google.collect"/>
<project reference="1.0,:pserver:anonymous@architecturware.cvs.sourceforge.net:/cvsroot/architecturware,xtext_external/de.itemis.xtext.antlr,de.itemis.xtext.antlr"/>
<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/modeling,org.eclipse.tmf/org.eclipse.xtext/develop,develop"/>
<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/tools,org.eclipse.orbit/javax.xml,javax.xml,v1_3_4"/>
@@ -214,6 +215,7 @@
<item elementID="=org.antlr.runtime" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
<item elementID="=de.itemis.xtext.antlr" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
<item elementID="=com.google.guice" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
+<item elementID="=com.google.collect" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
</workingSets>
<workingSets editPageId="org.eclipse.jdt.ui.JavaWorkingSetPage" label="Xtext Core" name="Xtext Core">
<item elementID="=org.eclipse.xtext.generator.tests" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/>
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessor.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessor.java
index e617ac5..72b4936 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessor.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessor.java
@@ -51,9 +51,8 @@ import com.google.common.collect.Iterables;
import com.google.inject.Inject;
/**
- * The default implementation of interface {@link IContentAssistProcessor}
- * provided with Xtext.
- *
+ * The default implementation of interface {@link IContentAssistProcessor} provided with Xtext.
+ *
* @author Michael Clay - Initial contribution and API
* @author Heiko Behrens
* @author Jan K&ouml;hnlein
@@ -67,21 +66,17 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
protected IContentAssistCalculator contentAssistCalculator;
@Inject
protected IProposalProvider proposalProvider;
-
/**
- * Computes the possible grammar elements following the one at the given
- * offset and calls the respective methods on the proposal provider.
+ * Computes the possible grammar elements following the one at the given offset and calls the respective methods on
+ * the proposal provider.
*/
public ICompletionProposal[] computeCompletionProposals(final ITextViewer viewer, final int offset) {
IXtextDocument document = (IXtextDocument) viewer.getDocument();
return document.readOnly(new ContentAssistProcessorUow(offset, viewer));
}
-
/*
* (non-Javadoc)
- *
- * @seeorg.eclipse.jface.text.contentassist.IContentAssistProcessor#
- * getCompletionProposalAutoActivationCharacters()
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
*/
public char[] getCompletionProposalAutoActivationCharacters() {
return null;
@@ -89,10 +84,7 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
/*
* (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage
- * ()
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
*/
public String getErrorMessage() {
return null;
@@ -100,9 +92,7 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
/*
* (non-Javadoc)
- *
- * @seeorg.eclipse.jface.text.contentassist.IContentAssistProcessor#
- * computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
*/
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
return null;
@@ -110,9 +100,7 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
/*
* (non-Javadoc)
- *
- * @seeorg.eclipse.jface.text.contentassist.IContentAssistProcessor#
- * getContextInformationAutoActivationCharacters()
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
*/
public char[] getContextInformationAutoActivationCharacters() {
return null;
@@ -120,90 +108,80 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
/*
* (non-Javadoc)
- *
- * @seeorg.eclipse.jface.text.contentassist.IContentAssistProcessor#
- * getContextInformationValidator()
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
*/
public IContextInformationValidator getContextInformationValidator() {
return new ContextInformationValidator(this);
}
-
- protected List<ICompletionProposal> collectCompletionProposals(List<AbstractElement> computeProposalElements,
- IContentAssistContext contentAssistContext) {
+
+ protected List<ICompletionProposal> collectCompletionProposals(List<AbstractElement> computeProposalElements, IContentAssistContext contentAssistContext) {
List<ICompletionProposal> completionProposalList = new ArrayList<ICompletionProposal>();
for (AbstractElement computeProposalElement : computeProposalElements) {
List<? extends ICompletionProposal> proposals;
- switch (computeProposalElement.eClass().getClassifierID()) {
- case XtextPackage.KEYWORD:
- proposals = proposalProvider.completeKeyword((Keyword) computeProposalElement, contentAssistContext);
- addAllIfNotNull(completionProposalList, proposals);
- break;
- case XtextPackage.RULE_CALL:
- proposals = proposalProvider.completeRuleCall((RuleCall) computeProposalElement, contentAssistContext);
- addAllIfNotNull(completionProposalList, proposals);
- break;
- case XtextPackage.ASSIGNMENT:
- proposals = proposalProvider.completeAssignment((Assignment) computeProposalElement,
- contentAssistContext);
- addAllIfNotNull(completionProposalList, proposals);
- break;
+ switch(computeProposalElement.eClass().getClassifierID()) {
+ case XtextPackage.KEYWORD:
+ proposals = proposalProvider.completeKeyword((Keyword) computeProposalElement, contentAssistContext);
+ addAllIfNotNull(completionProposalList,proposals);
+ break;
+ case XtextPackage.RULE_CALL:
+ proposals = proposalProvider.completeRuleCall((RuleCall) computeProposalElement, contentAssistContext);
+ addAllIfNotNull(completionProposalList,proposals);
+ break;
+ case XtextPackage.ASSIGNMENT:
+ proposals = proposalProvider.completeAssignment((Assignment) computeProposalElement, contentAssistContext);
+ addAllIfNotNull(completionProposalList,proposals);
+ break;
}
}
return completionProposalList;
}
- private <T> void addAllIfNotNull(List<T> completionProposalList, List<? extends T> proposals) {
+ private <T> void addAllIfNotNull(List<T> completionProposalList,
+ List<? extends T> proposals) {
if (proposals != null)
Iterables.addAll(completionProposalList, Iterables.filter(proposals, Predicates.notNull()));
}
-
+
protected List<TemplateContextType> collectTemplateContextTypes(List<AbstractElement> computeProposalElements,
IContentAssistContext contentAssistContext) {
List<TemplateContextType> templateContextTypes = new ArrayList<TemplateContextType>();
for (AbstractElement computeProposalElement : computeProposalElements) {
TemplateContextType templateContextType;
switch (computeProposalElement.eClass().getClassifierID()) {
- case XtextPackage.KEYWORD:
- templateContextType = proposalProvider.getTemplateContextType((Keyword) computeProposalElement,
- contentAssistContext);
- addIfNotNull(templateContextTypes, templateContextType);
- break;
- case XtextPackage.RULE_CALL:
- templateContextType = proposalProvider.getTemplateContextType((RuleCall) computeProposalElement,
- contentAssistContext);
- addIfNotNull(templateContextTypes, templateContextType);
- break;
- case XtextPackage.ASSIGNMENT:
- // TODO: change interface
- // templateContextType =
- // proposalProvider.getTemplateContextType((Assignment)computeProposalElement,
- // contentAssistContext);
- // addIfNotNull(templateContextTypes, templateContextType);
- break;
+ case XtextPackage.KEYWORD:
+ templateContextType = proposalProvider.getTemplateContextType((Keyword) computeProposalElement,
+ contentAssistContext);
+ addIfNotNull(templateContextTypes, templateContextType);
+ break;
+ case XtextPackage.RULE_CALL:
+ templateContextType = proposalProvider.getTemplateContextType((RuleCall) computeProposalElement,
+ contentAssistContext);
+ addIfNotNull(templateContextTypes, templateContextType);
+ break;
+ case XtextPackage.ASSIGNMENT:
+ // TODO: change interface
+ // templateContextType =
+ // proposalProvider.getTemplateContextType((Assignment)computeProposalElement, contentAssistContext);
+ // addIfNotNull(templateContextTypes, templateContextType);
+ break;
}
}
return templateContextTypes;
}
-
+
private <T> void addIfNotNull(List<T> result, T obj) {
if (obj != null)
result.add(obj);
}
-
+
/**
* Adds templates to the list of proposals,
- *
- * @param viewer
- * the viewer whose document is used to compute the proposals
- * @param offset
- * an offset within the document for which completions should be
- * computed
- * @param contentAssistContext
- * the current context of the content assist proposal request
- * @param templateContextType
- * within which templates are resolved
- * @param completionProposalList
- * list of proposal to add to
+ *
+ * @param viewer the viewer whose document is used to compute the proposals
+ * @param offset an offset within the document for which completions should be computed
+ * @param contentAssistContext the current context of the content assist proposal request
+ * @param templateContextType within which templates are resolved
+ * @param completionProposalList list of proposal to add to
*/
protected void addTemplates(ITextViewer viewer, int offset, IContentAssistContext contentAssistContext,
TemplateContextType templateContextType, List<ICompletionProposal> completionProposalList) {
@@ -214,18 +192,12 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
viewer, offset)));
}
}
-
/**
- * Creates a new <code>IContentAssistContext</code> with all required
- * informations for the current CA request.
- *
- * @param resource
- * the underlying EMF resource to read (parse) from
- * @param viewer
- * the viewer whose document is used to compute the proposals
- * @param offset
- * the offset within the resource for which the context should be
- * created
+ * Creates a new <code>IContentAssistContext</code> with all required informations for the current CA request.
+ *
+ * @param resource the underlying EMF resource to read (parse) from
+ * @param viewer the viewer whose document is used to compute the proposals
+ * @param offset the offset within the resource for which the context should be created
* @return a list of applicable <code>IContentAssistContext</code>
*/
protected List<IContentAssistContext> createContextList(XtextResource resource, String text, final int offset) {
@@ -234,32 +206,30 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
Assert.isNotNull(parseResult);
CompositeNode rootNode = parseResult.getRootNode();
AbstractNode referenceNode = getLastCompleteNodeByOffset(rootNode, offset);
- AbstractNode nodeAtOffset = getCurrentOrFollowingNodeByOffset(rootNode, offset);
+ AbstractNode nodeAtOffset = getCurrentOrFollowingNodeByOffset(rootNode, offset);
- if (referenceNode.getOffset() + referenceNode.getLength() == offset) {
- AbstractNode precedingReferenceNode = getLastCompleteNodeByOffset(rootNode, max(0, referenceNode
- .getOffset()));
+ if (referenceNode.getOffset()+referenceNode.getLength() == offset) {
+ AbstractNode precedingReferenceNode = getLastCompleteNodeByOffset(rootNode,max(0, referenceNode.getOffset()));
String matchingString = computeMatchString(referenceNode);
result.add(newContentAssistContext(matchingString, offset, rootNode, precedingReferenceNode));
- if (referenceNode.getGrammarElement() instanceof Keyword
- || referenceNode.getGrammarElement() instanceof CrossReference
- || (referenceNode.getGrammarElement() instanceof RuleCall && ((RuleCall) referenceNode
- .getGrammarElement()).getRule() instanceof TerminalRule)) {
+ if (referenceNode.getGrammarElement() instanceof Keyword ||
+ referenceNode.getGrammarElement() instanceof CrossReference ||
+ (referenceNode.getGrammarElement() instanceof RuleCall &&
+ ((RuleCall)referenceNode.getGrammarElement()).getRule() instanceof TerminalRule)) {
result.add(newContentAssistContext("", offset, rootNode, referenceNode));
}
} else if (referenceNode == nodeAtOffset) {
- AbstractNode precedingReferenceNode = getLastCompleteNodeByOffset(rootNode, max(0, referenceNode
- .getOffset()));
- String matchingString = calculateMatchString(nodeAtOffset, text, offset);
+ AbstractNode precedingReferenceNode = getLastCompleteNodeByOffset(rootNode,max(0, referenceNode.getOffset()));
+ String matchingString = calculateMatchString(nodeAtOffset,text, offset);
result.add(newContentAssistContext(matchingString, offset, rootNode, precedingReferenceNode));
} else {
- String matchingString = calculateMatchString(nodeAtOffset, text, offset);
+ String matchingString = calculateMatchString(nodeAtOffset,text, offset);
result.add(newContentAssistContext(matchingString, offset, rootNode, referenceNode));
}
-
+
return result;
}
-
+
protected String computeMatchString(AbstractNode node) {
if (node instanceof LeafNode) {
return ((LeafNode) node).getText();
@@ -268,19 +238,19 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
doComputeMatchString((CompositeNode) node, result);
return result.toString();
}
-
+
protected void doComputeMatchString(CompositeNode node, StringBuilder result) {
List<LeafNode> hiddens = new ArrayList<LeafNode>(2);
- for (AbstractNode child : node.getChildren()) {
+ for (AbstractNode child: node.getChildren()) {
if (child instanceof CompositeNode) {
doComputeMatchString((CompositeNode) child, result);
} else {
if (((LeafNode) child).isHidden()) {
if (result.length() != 0)
- hiddens.add((LeafNode) child);
+ hiddens.add((LeafNode)child);
} else {
Iterator<LeafNode> iter = hiddens.iterator();
- while (iter.hasNext()) {
+ while(iter.hasNext()) {
result.append(iter.next().getText());
iter.remove();
}
@@ -289,36 +259,31 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
}
}
}
-
+
/**
- * Calculates the match string of the based on the specified location within
- * the given text.
- *
- * @param caretNode
- * the node at the current caret position
- * @param text
- * the text to compute the matching string
- * @param offset
- * an offset within the document for which the matchstring should
- * be computed
+ * Calculates the match string of the based on the specified location within the given text.
+ *
+ * @param caretNode the node at the current caret position
+ * @param text the text to compute the matching string
+ * @param offset an offset within the document for which the matchstring should be computed
* @return a matching string
*/
protected String calculateMatchString(AbstractNode caretNode, String text, int offset) {
StringBuilder matchString = new StringBuilder();
char c = ' ';
- while (offset > caretNode.getOffset() && !Character.isWhitespace(c = text.charAt(--offset))) {
+ while (offset>caretNode.getOffset() && !Character.isWhitespace(c = text.charAt(--offset))) {
matchString.insert(0, c);
}
return matchString.toString();
}
-
- private ContentAssistContext newContentAssistContext(String matchingString, final int offset,
- CompositeNode rootNode, AbstractNode referenceNode) {
+
+ private ContentAssistContext newContentAssistContext(String matchingString, final int offset, CompositeNode rootNode,
+ AbstractNode referenceNode) {
EObject model = NodeUtil.getNearestSemanticObject(referenceNode);
AbstractNode node = getCurrentOrFollowingNodeByOffset(rootNode, offset);
return new ContentAssistContext(model, offset, matchingString, node, referenceNode, rootNode);
}
-
+
private final class ContentAssistProcessorUow implements UnitOfWork<ICompletionProposal[]> {
private final int offset;
private final ITextViewer viewer;
@@ -330,17 +295,17 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
public ICompletionProposal[] exec(XtextResource resource) throws Exception {
List<ICompletionProposal> completionProposalList = new ArrayList<ICompletionProposal>();
- List<IContentAssistContext> contextList = createContextList(resource, viewer.getTextWidget().getText(),
- offset);
+ List<IContentAssistContext> contextList = createContextList(
+ resource, viewer.getTextWidget().getText(), offset);
for (IContentAssistContext contentAssistContext : contextList) {
List<AbstractElement> computedElements = contentAssistCalculator
.computeProposalElements(contentAssistContext);
- completionProposalList.addAll(collectCompletionProposals(computedElements, contentAssistContext));
+ completionProposalList.addAll(collectCompletionProposals(computedElements,contentAssistContext));
for (TemplateContextType templateContextType : collectTemplateContextTypes(computedElements,
contentAssistContext)) {
addTemplates(viewer, offset, contentAssistContext, templateContextType, completionProposalList);
}
- proposalProvider.filter(completionProposalList, contentAssistContext);
+ proposalProvider.filter(completionProposalList,contentAssistContext);
}
proposalProvider.sort(completionProposalList);
return completionProposalList.toArray(new ICompletionProposal[completionProposalList.size()]);
@@ -348,3 +313,4 @@ public class DefaultContentAssistProcessor implements IContentAssistProcessor {
}
}
+
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java
index c2f2784..b573bb3 100644
--- a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java
@@ -274,7 +274,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
.appendNl("")
.appendNl(" MyRule : 'foo' name=ID; ")
.assertTextAtCursorPosition(" MyRule",
- "ParserRule_Name",
+ "ParserRule_Name",
"terminal",
"as",
"generate",
@@ -367,36 +367,36 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
.append("terminal Other_Id").assertText(":","returns");
}
-//TODO /**
-// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
-// * @throws Exception
-// */
-// public void testCompleteTypeRefReturnForEnumRule() throws Exception {
-// doTestCompleteTypeRefSetup()
-// .appendNl("enum NewEnum returns ").assertText(
-// "Class", "Import","Model","NewEnum"
-// );
-// }
-// /**
-// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
-// * @throws Exception
-// */
-// public void testCompleteTypeRefReturnForParserRule() throws Exception {
-// doTestCompleteTypeRefSetup()
-// .appendNl("NewType returns ").assertText(
-// "Class", "Import","Model","NewType"
-// );
-// }
-// /**
-// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
-// * @throws Exception
-// */
-// public void testCompleteTypeRefReturnForTerminalRule() throws Exception {
-// doTestCompleteTypeRefSetup()
-// .appendNl("terminal NewType returns ").assertText(
-// "Class", "Import","Model"
-// );
-// }
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
+ * @throws Exception
+ */
+ public void testCompleteTypeRefReturnForEnumRule() throws Exception {
+ doTestCompleteTypeRefSetup()
+ .appendNl("enum NewEnum returns").assertText(
+ "Class", "Import","Model","NewEnum"
+ );
+ }
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
+ * @throws Exception
+ */
+ public void testCompleteTypeRefReturnForParserRule() throws Exception {
+ doTestCompleteTypeRefSetup()
+ .appendNl("NewType returns").assertText(
+ "Class", "Import","Model","NewType"
+ );
+ }
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
+ * @throws Exception
+ */
+ public void testCompleteTypeRefReturnForTerminalRule() throws Exception {
+ doTestCompleteTypeRefSetup()
+ .appendNl("terminal NewType returns").assertText(
+ "Class", "Import","Model"
+ );
+ }
public void testKeywordWithBackslashes() throws Exception {
newBuilder(getKeywordsLangSetup()).assertText("foo\\bar", "foo\\", "\\bar", "\\");
@@ -446,7 +446,6 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
private ContentAssistProcessorTestBuilder doTestCompleteTypeRefSetup() throws Exception {
return newBuilder(getXtextSetup())
.appendNl("grammar org.xtext.example.MyDsl1 with org.eclipse.xtext.common.Terminals")
- .appendNl("import \"http://www.eclipse.org/emf/2003/Change\"")
.appendNl("generate myDsl1 \"http://www.xtext.org/example/MyDsl1\"")
.appendNl("Model :")
.appendNl("(imports+=Import)*")
@@ -455,6 +454,6 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
.appendNl("'import' importURI=STRING;")
.appendNl("Class :")
.appendNl("'class' name=ID ('extends' references=[Class])?;");
-}
+ }
} \ No newline at end of file