org.eclipse.xtext.ui.editor.model.edit.ITextEditComposer Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.model.edit.ITextEditComposer. 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: XtextDocumentModifyTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private IXtextDocument createDocument(String model) throws Exception {
	resource = getResource(new StringInputStream(model));
	DocumentTokenSource tokenSource = new DocumentTokenSource();
	tokenSource.setLexer(new Provider<Lexer>(){
		@Override
		public Lexer get() {
			return new InternalXtextLexer();
		}});
	
	final XtextDocument document = new XtextDocument(tokenSource, get(ITextEditComposer.class), new OutdatedStateManager(), new OperationCanceledManager()) {
		@Override
		public <T> T internalModify(IUnitOfWork<T, XtextResource> work) {
			try {
				return work.exec((XtextResource) resource);
			}
			catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
	};
	document.set(model);
	return document;
}
 
Example #2
Source File: DocumentLockerTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private ITextEditComposer createTextEditComposer() {
	return new ITextEditComposer() {
		@Override
		public void beginRecording(Resource resource) {
		}

		@Override
		public TextEdit endRecording() {
			return null;
		}

		@Override
		public TextEdit getTextEdit() {
			return null;
		}
	};
}
 
Example #3
Source File: N4JSDocument.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates a new instance, delegates to {@link XtextDocument#XtextDocument(DocumentTokenSource, ITextEditComposer)}.
 */
@Inject
public N4JSDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
	super(tokenSource, composer);
}
 
Example #4
Source File: AbstractTextEditComposerTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ITextEditComposer createComposer() {
	return get(ITextEditComposer.class);
}
 
Example #5
Source File: ChangeSerializerComposerTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ITextEditComposer createComposer() {
	return get(ChangeSerializerTextEditComposer.class);
}
 
Example #6
Source File: DefaultTextEditComposerTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ITextEditComposer createComposer() {
	return get(ITextEditComposer.class);
}
 
Example #7
Source File: XtextDocument.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.8
 * @noreference This constructor is not intended to be referenced by clients. Only for testing
 */
public XtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer, OutdatedStateManager outdatedStateManager, OperationCanceledManager operationCanceledManager) {
	this(tokenSource, composer);
	this.outdatedStateManager = outdatedStateManager;
	this.operationCanceledManager = operationCanceledManager;
}
 
Example #8
Source File: XtextDocument.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public XtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
	this.tokenSource = tokenSource;
	tokenSource.computeDamageRegion(new DocumentEvent(this, 0, getLength(), this.get()));
	this.composer = composer;
}
 
Example #9
Source File: ResponsiveXtextDocument.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public ResponsiveXtextDocument(final DocumentTokenSource tokenSource, final ITextEditComposer composer) {
  super(tokenSource, composer);
}
 
Example #10
Source File: XtextGMFDocument.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public XtextGMFDocument(final DocumentTokenSource tokenSource, final ITextEditComposer composer) {
  super(tokenSource, composer);
}
 
Example #11
Source File: ParallelReadXtextDocument.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public ParallelReadXtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
	super(tokenSource, composer);
}
 
Example #12
Source File: TransactionalXtextDocument.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public TransactionalXtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
	super(tokenSource, composer);
}