Search in sources :

Example 1 with EmbeddedEditor

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();
}
Also used : EmbeddedEditor(org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor)

Example 2 with EmbeddedEditor

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;
}
Also used : EmbeddedEditor(org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor) Statechart(org.yakindu.sct.model.sgraph.Statechart) EmbeddedEditorModelAccess(org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorModelAccess)

Example 3 with 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);
}
Also used : EmbeddedEditor(org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor)

Example 4 with EmbeddedEditor

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();
}
Also used : IValidationIssueProcessor(org.eclipse.xtext.ui.editor.validation.IValidationIssueProcessor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) Issue(org.eclipse.xtext.validation.Issue) Builder(org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder) EmbeddedEditor(org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor)

Aggregations

EmbeddedEditor (org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Builder (org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder)1 EmbeddedEditorModelAccess (org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorModelAccess)1 IValidationIssueProcessor (org.eclipse.xtext.ui.editor.validation.IValidationIssueProcessor)1 Issue (org.eclipse.xtext.validation.Issue)1 Statechart (org.yakindu.sct.model.sgraph.Statechart)1