Java Code Examples for org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor#getViewer()
The following examples show how to use
org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor#getViewer() .
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: GamlEditTemplateDialog.java From gama with GNU General Public License v3.0 | 6 votes |
protected SourceViewer createViewer(final Composite parent) { final Builder editorBuilder = configuration.getEmbeddedEditorFactory().newEditor(resourceProvider); editorBuilder.processIssuesBy((issues, monitor) -> { IStatus result = Status.OK_STATUS; final StringBuilder messages = new StringBuilder(); for (final 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(() -> updateStatus(toBeUpdated)); }); final EmbeddedEditor handle = editorBuilder.withParent(parent); partialModelEditor = handle.createPartialEditor(getPrefix(), data.getTemplate().getPattern(), "", true); return handle.getViewer(); }
Example 2
Source File: EditTemplateDialog.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
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(); }
Example 3
Source File: XtendFormatterPreview.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
public XtendFormatterPreview forEmbeddedEditor(EmbeddedEditor editorHandle) { if (this.editorHandle != null) { throw new IllegalStateException("This formatter preview is already binded to an embedet editor"); } this.editorHandle = editorHandle; this.modelAccess = editorHandle.createPartialEditor(); this.marginPainter = new MarginPainter(editorHandle.getViewer()); final RGB rgb = PreferenceConverter.getColor(preferenceStoreAccess.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); marginPainter.setMarginRulerColor(EditorUtils.colorFromRGB(rgb)); editorHandle.getViewer().addPainter(marginPainter); return this; }
Example 4
Source File: WizardPreviewProvider.java From n4js with Eclipse Public License 1.0 | 4 votes |
private void createEditor() { EmbeddedEditor editor = editorFactory.newEditor(this::createTempResource).withParent(this); editor.getViewer().getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Initialize the document editor.createPartialEditor(true); editorDocument = editor.getDocument(); sourceViewer = editor.getViewer(); configureSourceViewer(sourceViewer); // Clear content editorDocument.set(""); }
Example 5
Source File: AdvancedTemplatesPreferencePage.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override protected SourceViewer createViewer(Composite parent) { EmbeddedEditor handle = configuration.getEmbeddedEditorFactory().newEditor(resourceProvider).readOnly().withParent(parent); partialEditor = handle.createPartialEditor(true); return handle.getViewer(); }