org.eclipse.xtext.ui.editor.autoedit.MultiLineTerminalsEditStrategy Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.autoedit.MultiLineTerminalsEditStrategy. 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: MultiLineTerminalsEditStrategyTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 	See bug 403812
 * 	Closing terminal is already included, so that the command must not contain a new closing brace
 */
@Test public void testFindStopTerminal() throws Exception {
	MultiLineTerminalsEditStrategy strategy = new MultiLineTerminalsEditStrategy("{", "\t","}",true);
	DocumentCommand command= DocumentCommandTest.getDocumentCommandTest(17);
	strategy.customizeDocumentCommand(getDocument("Hello {\n  Thomas{\n   Birthday\n  }//\n}!"),command);
	assertEquals("",command.text.trim());
}
 
Example #2
Source File: MultiLineTerminalsEditStrategyTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * See bug 403812
 * Closing terminal is not available, so that the command has to contain a new closing brace
 */
@Test public void testFindStopTerminal_2() throws Exception {
	MultiLineTerminalsEditStrategy strategy = new MultiLineTerminalsEditStrategy("{", "\t","}",true);
	DocumentCommand command= DocumentCommandTest.getDocumentCommandTest(17);
	strategy.customizeDocumentCommand(getDocument("Hello {\n  Thomas{\n   Birthday\n  //\n}!"),command);
	assertEquals("}",command.text.trim());
}
 
Example #3
Source File: MultiLineTerminalsEditStrategyTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * See bug 403812
 * If all partitions after the inner closing brace are of type __sl_comment there should be
 * a new closing brace as well.
 */
@Test public void testFindStopTerminal_3() throws Exception {
	MultiLineTerminalsEditStrategy strategy = new MultiLineTerminalsEditStrategy("{", "\t","}",true);
	DocumentCommand command= DocumentCommandTest.getDocumentCommandTest(17);
	strategy.customizeDocumentCommand(getDocument("Hello {\n  Thomas{\n   Birthday\n }//}!"),command);
	assertEquals("}",command.text.trim());
}
 
Example #4
Source File: XtextAutoEditStrategy.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected MultiLineTerminalsEditStrategy createColonSemicolonStrategy() {
	MultiLineTerminalsEditStrategy configure = multiLineTerminals.newInstance(":", null, ";", false);
	// the following is a cheap but working hack, which replaces any double colons '::' by whitespace '  ' temporarily.
	configure.setDocumentUtil(new DocumentUtil() {
		@Override
		protected String preProcessSearchString(String string) {
			return string.replace("::", "  ");
		}
	});
	return configure;
}
 
Example #5
Source File: AutoEditStrategyProvider.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public MultiLineTerminalsEditStrategy newInstance(String leftTerminal, String indentationString, String rightTerminal) {
	indentationString = indentationString == null ? indentationInformation.getIndentString()
			: indentationString;
	MultiLineTerminalsEditStrategyInRichString strategy = new MultiLineTerminalsEditStrategyInRichString(leftTerminal, indentationString, rightTerminal);
	injector.injectMembers(strategy);
	return strategy;
}