use of org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor in project xtext-eclipse by eclipse.
the class AdvancedTemplatesPreferencePage method createViewer.
@Override
protected SourceViewer createViewer(Composite parent) {
EmbeddedEditor handle = configuration.getEmbeddedEditorFactory().newEditor(resourceProvider).readOnly().withParent(parent);
partialEditor = handle.createPartialEditor(true);
return handle.getViewer();
}
use of org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor in project statecharts by Yakindu.
the class StatechartDefinitionSection method createSpecificationEditor.
protected EmbeddedEditor createSpecificationEditor() {
EmbeddedEditor embeddedEditor = createEmbeddedEditor();
EmbeddedEditorModelAccess modelAccess = embeddedEditor.createPartialEditor();
String specification = ((Statechart) getContextObject()).getSpecification();
modelAccess.updateModel(specification != null ? specification : "");
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(embeddedEditor.getViewer().getControl());
initializeEmbeddedEditorWidget(embeddedEditor);
return embeddedEditor;
}
use of org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor in project xtext-xtend by eclipse.
the class XtendPreviewFactory method createNewPreview.
public XtendFormatterPreview createNewPreview(Composite composite, String previewContent) {
XtendFormatterPreview formatterPreview = new XtendFormatterPreview();
memberInjector.injectMembers(formatterPreview);
EmbeddedEditor embeddedEditor = editorFactory.newEditor(resourceProvider).withResourceValidator(IResourceValidator.NULL).readOnly().withParent(composite);
return formatterPreview.forEmbeddedEditor(embeddedEditor).withPreviewContent(previewContent);
}
use of org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor 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