Editor for modelled STS variables for easier debugging
[simantics/platform.git] / bundles / org.simantics.tests.modelled.ui / src / org / simantics / tests / modelled / ui / STSVariableViewerEditor.java
1 package org.simantics.tests.modelled.ui;
2
3 import org.eclipse.core.runtime.CoreException;
4 import org.eclipse.core.runtime.IProgressMonitor;
5 import org.eclipse.jface.operation.IRunnableContext;
6 import org.eclipse.jface.text.Document;
7 import org.eclipse.jface.text.IDocument;
8 import org.eclipse.jface.text.source.IAnnotationModel;
9 import org.eclipse.ui.editors.text.TextEditor;
10 import org.eclipse.ui.texteditor.AbstractDocumentProvider;
11 import org.simantics.tests.modelled.ui.STSVariableViewerAdapter.STSVariableViewerEditorInput;
12
13 public class STSVariableViewerEditor extends TextEditor {
14
15     public STSVariableViewerEditor() {
16         setDocumentProvider(new STSVariableViewerDocumentProvider());
17     }
18
19     private static class STSVariableViewerDocumentProvider extends AbstractDocumentProvider {
20
21         @Override
22         protected IDocument createDocument(Object element) throws CoreException {
23             STSVariableViewerEditorInput input = (STSVariableViewerEditorInput) element;
24             return new Document(input.getContents());
25         }
26
27         @Override
28         protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
29             return null;
30         }
31
32         @Override
33         protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
34         }
35
36         @Override
37         protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
38             return null;
39         }
40
41     }
42 }