org.eclipse.xtext.xbase.ui.highlighting.XbaseHighlightingConfiguration Java Examples

The following examples show how to use org.eclipse.xtext.xbase.ui.highlighting.XbaseHighlightingConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testBug455188_2() throws Exception {
	StringBuilder a = new StringBuilder();
	a.append("class Bar {");
	a.append("	def void setContents(String s, int i){}");
	a.append("}");
	
	classDefString = a.toString() + classDefString;
	
	StringBuilder b = new StringBuilder();
	
	b.append("{");
	b.append("	's'.contents = 1");
	b.append("} extension Bar = new Bar{} ");
	String model = b.toString();
	
	expectAbsolute(model.indexOf("contents"), 8, METHOD);
	expectAbsolute(model.indexOf("contents"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.indexOf("1"), 1, HighlightingStyles.NUMBER_ID);
	highlight(model);
}
 
Example #2
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testBug455188() throws Exception {
	StringBuilder a = new StringBuilder();
	a.append("class Bar {");
	a.append("	def String getProperty(){}");
	a.append("	def void setProperty(String s){}");
	a.append("}");
	
	classDefString = a.toString() + classDefString;
	
	StringBuilder b = new StringBuilder();
	
	b.append("{");
	b.append("	if(property != null){");
	b.append("		property = ''");
	b.append("	} ");
	b.append("} extension Bar = new Bar{} ");
	String model = b.toString();
	
	expectAbsolute(model.indexOf("property"), 8, METHOD);
	expectAbsolute(model.indexOf("property"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("property"), 8, METHOD);
	expectAbsolute(model.lastIndexOf("property"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #3
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testDeprecatedXtendField() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	addImport("com.google.inject.Inject");
	String model = "{} @Deprecated @Inject TestClassDeprecated clazz def baz(){ clazz.testMethodNotDeprecated() }";
	expectAbsolute(model.indexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("Deprecated"), 10,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.lastIndexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("Inject"), 6,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("clazz"), 5, XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.indexOf("clazz"), 5, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("clazz"), 5, XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.lastIndexOf("clazz"), 5,XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.indexOf("testMethodNotDeprecated"), 23, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.indexOf("testMethodNotDeprecated"), 23, XbaseHighlightingConfiguration.METHOD);
	highlight(model);
}
 
Example #4
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testBug455188_5() throws Exception {
	StringBuilder a = new StringBuilder();
	a.append("import java.util.List ");
	a.append("class Bar {");
	a.append("	def operator_add(List<String> l, String e){}");
	a.append("}");
	
	classDefString = a.toString() + classDefString;
	
	StringBuilder b = new StringBuilder();
	
	b.append("{");
	b.append("	val List<String> l = #[]");
	b.append(" l += ''");
	b.append("} extension Bar = new Bar{} ");
	String model = b.toString();

	notExpectAbsolute(model.indexOf("+="), 1, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #5
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testNotDeprecatedMethodAccess() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	addImport("com.google.inject.Inject");
	String model = "{} @Inject TestClassDeprecated clazz def baz(){ clazz.testMethodNotDeprecated() }";
	expectAbsolute(model.lastIndexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("Inject"), 6,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("clazz"), 5, XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.lastIndexOf("clazz"), 5, XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.indexOf("testMethodNotDeprecated"), 23, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.indexOf("testMethodNotDeprecated"), 23, XbaseHighlightingConfiguration.METHOD);
	highlight(model);
}
 
Example #6
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedParentClass() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	classDefString = "class Bar extends TestClassDeprecated";
	String model = "{}";
	expect(getPrefix().lastIndexOf("TestClassDeprecated"), 19, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #7
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedStaticFieldAccess() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	String model = "{TestClassDeprecated::DEPRECATED_CONSTANT}";
	expectAbsolute(model.lastIndexOf("TestClassDeprecated"), "TestClassDeprecated".length(), XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.STATIC_FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #8
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testQualifiedDeprecatedStaticFieldAccess() throws Exception {
	String model = "{org::eclipse::xtend::ide::tests::data::highlighting::TestClassDeprecated::DEPRECATED_CONSTANT}";
	expectDeprecatedPackageFragment(model, "org", 2);
	expectDeprecatedPackageFragment(model, "eclipse", 2);
	expectDeprecatedPackageFragment(model, "xtend", 2);
	expectDeprecatedPackageFragment(model, "ide", 2);
	expectDeprecatedPackageFragment(model, "tests", 2);
	expectDeprecatedPackageFragment(model, "data", 2);
	expectDeprecatedPackageFragment(model, "highlighting", 2);
	expectAbsolute(model.lastIndexOf("TestClassDeprecated"), "TestClassDeprecated".length(), XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.STATIC_FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #9
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testQualifiedDeprecatedStaticFieldAccessWithDot() throws Exception {
	String model = "{org.eclipse.xtend.ide.tests.data.highlighting.TestClassDeprecated::DEPRECATED_CONSTANT}";
	expectDeprecatedPackageFragment(model, "org", 1);
	expectDeprecatedPackageFragment(model, "eclipse", 1);
	expectDeprecatedPackageFragment(model, "xtend", 1);
	expectDeprecatedPackageFragment(model, "ide", 1);
	expectDeprecatedPackageFragment(model, "tests", 1);
	expectDeprecatedPackageFragment(model, "data", 1);
	expectDeprecatedPackageFragment(model, "highlighting", 1);
	expectAbsolute(model.lastIndexOf("TestClassDeprecated"), "TestClassDeprecated".length(), XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.STATIC_FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #10
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testQualifiedDeprecatedStaticFieldAccessWithInstanceAccess() throws Exception {
	String model = "{org.eclipse.xtend.ide.tests.data.highlighting.TestClassDeprecated.DEPRECATED_CONSTANT}";
	expectDeprecatedPackageFragment(model, "org", 1);
	expectDeprecatedPackageFragment(model, "eclipse", 1);
	expectDeprecatedPackageFragment(model, "xtend", 1);
	expectDeprecatedPackageFragment(model, "ide", 1);
	expectDeprecatedPackageFragment(model, "tests", 1);
	expectDeprecatedPackageFragment(model, "data", 1);
	expectDeprecatedPackageFragment(model, "highlighting", 1);
	expectAbsolute(model.lastIndexOf("TestClassDeprecated"), "TestClassDeprecated".length(), XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.STATIC_FIELD);
	expectAbsolute(model.lastIndexOf("DEPRECATED_CONSTANT"), 19, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #11
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedMethodAccess() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	addImport("com.google.inject.Inject");
	String model = "{} @Inject TestClassDeprecated clazz def baz(){ clazz.testMethodDeprecated() }";
	expectAbsolute(model.lastIndexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("Inject"), 6,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("clazz"), 5, XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.lastIndexOf("clazz"), 5, XbaseHighlightingConfiguration.FIELD);
	expectMethod(model.lastIndexOf("testMethodDeprecated") + getPrefixLength(), 20);
	expectAbsolute(model.lastIndexOf("testMethodDeprecated"), 20, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #12
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedContructor_439885() throws Exception {
	String model = "@Deprecated new(){}";
	expectAbsolute(model.lastIndexOf("@"), 1, XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("Deprecated"), 10,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("new"), 3, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #13
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedXtendClass() throws Exception {
	classDefString = "@Deprecated class Bar";
	String model = "{}";
	expect(getPrefix().lastIndexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expect(getPrefix().lastIndexOf("Deprecated"), 10, XbaseHighlightingConfiguration.ANNOTATION);
	expectClass(getPrefix().indexOf("Bar"), 3);
	expect(getPrefix().indexOf("Bar"), 3, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #14
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedStaticMethodAccess() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	String model = "{TestClassDeprecated::testMethodStaticDeprecated() }";
	expectAbsolute(model.lastIndexOf("TestClassDeprecated"), "TestClassDeprecated".length(), XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("testMethodStaticDeprecated"), 26, METHOD);
	expectAbsolute(model.lastIndexOf("testMethodStaticDeprecated"), 26, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("testMethodStaticDeprecated"), 26, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #15
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testNotDeprecatedStaticMethodAccess() throws Exception {
	addImport(DEPRECATED_TEST_CLASS);
	String model = "{TestClassDeprecated::testMethodStaticNotDeprecated() }";
	expectAbsolute(model.lastIndexOf("TestClassDeprecated"), "TestClassDeprecated".length(), XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("testMethodStaticNotDeprecated"), 29, METHOD);
	expectAbsolute(model.lastIndexOf("testMethodStaticNotDeprecated"), 29, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("testMethodStaticNotDeprecated"), 29, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #16
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeprecatedXtendFunction() throws Exception {
	String model = "{} @Deprecated def baz(){} def bar(){ baz()}";
	expectAbsolute(model.lastIndexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.indexOf("Deprecated"), 10,XbaseHighlightingConfiguration.ANNOTATION);
	int prefixLength = getPrefixLength();
	expectMethod(model.indexOf("baz") + prefixLength, 3);
	expectMethod(model.lastIndexOf("baz") + prefixLength, 3);
	expectMethod(model.indexOf("bar") + prefixLength, 3);
	expectAbsolute(model.indexOf("baz"), 3, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	expectAbsolute(model.lastIndexOf("baz"), 3, XbaseHighlightingConfiguration.DEPRECATED_MEMBERS);
	highlight(model);
}
 
Example #17
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testDeclaredStaticField() throws Exception {
	String model = "{} private static String foo def bar() {foo}";
	expectAbsolute(model.indexOf("foo"), 3,XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.indexOf("foo"), 3,XbaseHighlightingConfiguration.STATIC_FIELD);
	expectAbsolute(model.lastIndexOf("foo"), 3,XbaseHighlightingConfiguration.FIELD);
	expectAbsolute(model.lastIndexOf("foo"), 3,XbaseHighlightingConfiguration.STATIC_FIELD);
	highlight(model);
}
 
Example #18
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testBug455188_4() throws Exception {
	String model = "{ 1 + 2 } ";

	notExpectAbsolute(model.indexOf("+"), 1, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.indexOf("1"), 1, HighlightingStyles.NUMBER_ID);
	expectAbsolute(model.indexOf("2"), 1, HighlightingStyles.NUMBER_ID);
	highlight(model);
}
 
Example #19
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testStaticExtensionOperationWithNoImplicitArguments() throws Exception {
	addImport("java.util.List");
	String model = "def toUpperCase(List<String> it) { map [ toUpperCase ]}";
	expectAbsolute(model.lastIndexOf("map"), 3, METHOD);
	expectAbsolute(model.lastIndexOf("map"), 3, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("map"), 3, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	highlight(model);
}
 
Example #20
Source File: CheckAntlrTokenToAttributeIdMapper.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected String calculateId(final String tokenName, final int tokenType) {
  if ("'SeverityRange'".equals(tokenName)) {
    return XbaseHighlightingConfiguration.ANNOTATION;
  } else if ("'@'".equals(tokenName)) {
    return XbaseHighlightingConfiguration.ANNOTATION;
  } else {
    return super.calculateId(tokenName, tokenType);
  }
}
 
Example #21
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testStaticOperationInvocation() throws Exception {
	addImport("java.util.Collections");
	String model = "{ Collections::emptySet  }";
	expectAbsolute(model.lastIndexOf("emptySet"), 8, METHOD);
	expectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	notExpectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #22
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testQualifiedStaticOperationInvocation() throws Exception {
	String model = "{ java::util::Collections::emptySet  }";
	expectAbsolute(model.lastIndexOf("emptySet"), 8, METHOD);
	expectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	notExpectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #23
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testQualifiedStaticOperationInvocationWithDot() throws Exception {
	String model = "{ java.util.Collections::emptySet  }";
	expectAbsolute(model.lastIndexOf("emptySet"), 8, METHOD);
	expectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	notExpectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #24
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testQualifiedStaticOperationInvocationWithInstanceNotation() throws Exception {
	String model = "{ java.util.Collections.emptySet  }";
	expectAbsolute(model.lastIndexOf("emptySet"), 8, METHOD);
	expectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	notExpectAbsolute(model.lastIndexOf("emptySet"), 8, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #25
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testStaticExtensionOperationInvocation() throws Exception {
	String model = "{ 'FOO'.toFirstLower   }";
	expectAbsolute(model.lastIndexOf("toFirstLower"), 12, METHOD);
	expectAbsolute(model.lastIndexOf("toFirstLower"), 12, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("toFirstLower"), 12, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #26
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testNonStaticExtensionOperationInvocation() throws Exception {
	addImport("com.google.inject.Inject");
	addInject("extension StringBuilder");
	String model = "{ 'Foo'.append   }";
	expectAbsolute(model.lastIndexOf("append"), 6, METHOD);
	expectAbsolute(model.lastIndexOf("append"), 6, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	notExpectAbsolute(model.lastIndexOf("append"), 6, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	highlight(model);
}
 
Example #27
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testStaticImportedExtensionOperationInvocation() throws Exception {
	addImport("static extension java.util.Collections.*");
	String model = "{ newArrayList.shuffle   }";
	expectAbsolute(model.lastIndexOf("newArrayList"), 12, METHOD);
	expectAbsolute(model.lastIndexOf("newArrayList"), 12, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	notExpectAbsolute(model.lastIndexOf("newArrayList"), 12, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("shuffle"), 7, METHOD);
	expectAbsolute(model.lastIndexOf("shuffle"), 7, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("shuffle"), 7, XbaseHighlightingConfiguration.STATIC_METHOD_INVOCATION);
	highlight(model);
}
 
Example #28
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testLocalExtensionOperation() throws Exception {
	addImport("java.util.List");
	String model = "def void zonk(List<String> it) { zonk }";
	expectAbsolute(model.lastIndexOf("zonk"), 4, METHOD);
	expectAbsolute(model.lastIndexOf("zonk"), 4, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #29
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testBug377413(){
	addImport("java.util.List");
	String model = "def void bar(Foo it){ zonk = '42' } def setZonk(String x){} def void fooBar(List<String> it) { fooBar }";
	expectAbsolute(model.indexOf("zonk"),4, METHOD);
	notExpectAbsolute(model.indexOf("zonk"),4, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	expectAbsolute(model.lastIndexOf("fooBar"), 6, METHOD);
	expectAbsolute(model.lastIndexOf("fooBar"), 6, XbaseHighlightingConfiguration.EXTENSION_METHOD_INVOCATION);
	highlight(model);
}
 
Example #30
Source File: XtendHighlightingCalculatorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testAnnotaton() throws Exception {
	addImport("com.google.inject.Inject");
	String model = "{} @Inject extension StringBuilder";
	expectAbsolute(model.lastIndexOf("@"), 1,XbaseHighlightingConfiguration.ANNOTATION);
	expectAbsolute(model.lastIndexOf("Inject"), 6, XbaseHighlightingConfiguration.ANNOTATION);
	highlight(model);
}