use of org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder in project xtext-eclipse by eclipse.
the class EditTemplateDialog method createViewer.
protected SourceViewer createViewer(Composite parent) {
Builder editorBuilder = configuration.getEmbeddedEditorFactory().newEditor(resourceProvider);
editorBuilder.processIssuesBy(new IValidationIssueProcessor() {
@Override
public void processIssues(List<Issue> issues, IProgressMonitor monitor) {
IStatus result = Status.OK_STATUS;
StringBuilder messages = new StringBuilder();
for (Issue issue : issues) {
if (issue.getSeverity() == Severity.ERROR) {
if (messages.length() != 0)
messages.append('\n');
messages.append(issue.getMessage());
}
}
if (messages.length() != 0) {
result = createErrorStatus(messages.toString(), null);
}
final IStatus toBeUpdated = result;
getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
updateStatus(toBeUpdated);
}
});
}
});
EmbeddedEditor handle = editorBuilder.withParent(parent);
partialModelEditor = handle.createPartialEditor(getPrefix(), fTemplate.getPattern(), "", true);
return handle.getViewer();
}
Aggregations