private static SourceViewerConfiguration createConfiguration(Input<?> input, IDocument document, EditingContext editingContext, AppMemento appMemento) { ThreadSynchronize threadSynchronize = null; MplPresentationReconciler reconciler = new MplPresentationReconciler(); ProposalComputer proposalComputer = new MplProposalComputer(document, editingContext); IAnnotationModel annotationModel = new AnnotationModel(); AnnotationPresenter annotationPresenter = new MplAnnotationPresenter(); HoverInformationProvider hoverInformationProvider = new MplHoverInformationProvider(); CompletionProposalPresenter proposalPresenter = MplGraphicalCompletionProposal::new; SearchProvider searchProvider = null; NavigationProvider navigationProvider = null; EditorOpener editorOpener = null; BehaviorContributor behaviorContributor = null; IContextInformationValidator contextInformationValidator = null; DefaultSourceViewerConfiguration result = new DefaultSourceViewerConfiguration( threadSynchronize, input, reconciler, appMemento, proposalComputer, annotationModel, annotationPresenter, hoverInformationProvider, proposalPresenter, searchProvider, navigationProvider, editorOpener, behaviorContributor, contextInformationValidator); result.getFeatures().add(Feature.SHOW_LINE_NUMBERS); return result; }
protected void setModel(XtextDocument document, String prefix, String editablePart, String suffix) { if (this.insertLineBreaks) { String delimiter = document.getDefaultLineDelimiter(); prefix = prefix + delimiter; suffix = delimiter + suffix; } String model = prefix + editablePart + suffix; document.set(model); XtextResource resource = createResource(model); document.setInput(resource); AnnotationModel annotationModel = new AnnotationModel(); if (document instanceof ISynchronizable) { Object lock = ((ISynchronizable) document).getLockObject(); if (lock == null) { lock = new Object(); ((ISynchronizable) document).setLockObject(lock); } ((ISynchronizable) annotationModel).setLockObject(lock); } this.viewer.setDocument(document, annotationModel, prefix.length(), editablePart.length()); }
@Override public void connect(Object element) throws CoreException { super.connect(element); if (getFileInfo(element) != null) return; CompilationUnitInfo info= fFakeCUMapForMissingInfo.get(element); if (info == null) { ICompilationUnit cu= createFakeCompiltationUnit(element, true); if (cu == null) return; info= new CompilationUnitInfo(); info.fCopy= cu; info.fElement= element; info.fModel= new AnnotationModel(); fFakeCUMapForMissingInfo.put(element, info); } info.fCount++; }
@Override protected IAnnotationModel createAnnotationModel(Object element) throws CoreException { if (element instanceof IFileEditorInput) { IFileEditorInput input = (IFileEditorInput) element; return new XtextResourceMarkerAnnotationModel(input.getFile(), issueResolutionProvider, issueUtil); } else if (element instanceof IURIEditorInput) { return new AnnotationModel(); } return super.createAnnotationModel(element); }
private void loadTransliteration(BTSLemmaEntry lemma) { // if (lemma == null) // { // if (embeddedEditor != null) // { // embeddedEditorModelAccess.updateModel("\r", // "", "\r"); //// embeddedEditor.getViewer().setDocument(null); // } // return; // } modelAnnotationMap = new HashMap<String, BTSModelAnnotation>(); relatingObjectsAnnotationMap = new HashMap<EObject, List<BTSModelAnnotation>>(); Document doc = new Document(); AnnotationModel tempAnnotationModel = new AnnotationModel(); lemmaAnnotationMap = new HashMap<String, List<Object>>(); lemmaEditorController.transformToDocument(textContent, doc, tempAnnotationModel, relatingObjects, relatingObjectsMap, lemmaAnnotationMap); String textString = doc.get(); // take care of empty input if (textString.length() == 0) { textString = "§§"; } embeddedEditorModelAccess.updateModel("\r", textString, "\r"); annotationModel = embeddedEditor.getViewer().getAnnotationModel(); loadAnnotations2Editor(annotationModel, tempAnnotationModel); processLemmaAnnotions(lemmaAnnotationMap); }
protected void createXtextSourceViewer() { sourceviewer = new XtextSourceViewerEx(styledText, preferenceStoreAccess.getPreferenceStore()); sourceviewer.configure(configuration); sourceviewer.setDocument(document, new AnnotationModel()); SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(sourceviewer, null, new DefaultMarkerAnnotationAccess(), getSharedColors()); configureSourceViewerDecorationSupport(support); }
public IAnnotationModel createAnnotationModel(IPath path) { IResource file = ResourcesPlugin.getWorkspace().getRoot().findMember(path); if (file instanceof IFile) { return new CommonAnnotationModel(file); } return new AnnotationModel(); }
public NSISConsole() { super(EclipseNSISPlugin.getResourceString("console.name"), TYPE, EclipseNSISPlugin.getImageManager().getImageDescriptor(EclipseNSISPlugin.getResourceString("nsis.icon")), true); //$NON-NLS-1$ //$NON-NLS-2$ getDocument().addDocumentListener(this); mOffset = getDocument().getLength(); mPreferenceStore = EclipseNSISPlugin.getDefault().getPreferenceStore(); mConsoleManager = ConsolePlugin.getDefault().getConsoleManager(); mAutoShowLevel = NSISPreferences.getInstance().getAutoShowConsole(); mPartitioner = new NSISConsolePartitioner(this); mPartitioner.connect(getDocument()); mPreferenceStore.addPropertyChangeListener(this); mErrorImage = EclipseNSISPlugin.getImageManager().getImage(EclipseNSISPlugin.getResourceString("error.icon")); //$NON-NLS-1$ mWarningImage = EclipseNSISPlugin.getImageManager().getImage(EclipseNSISPlugin.getResourceString("warning.icon")); //$NON-NLS-1$ mAnnotationModel = new AnnotationModel(); }
/** * Creates a new line number ruler column that is appropriately initialized. * * @return the created line number column */ private CompositeRuler createCompositeRuler( ) { CompositeRuler ruler = new CompositeRuler( ); ruler.setModel( new AnnotationModel( ) ); return ruler; }
public SourceViewerConfig(AnnotationModel annotationModel, Document document) { strategy = new CommentSpellingReconcileStrategy(annotationModel); strategy.setDocument(document); }
public CommentSpellingReconcileStrategy(AnnotationModel annotationModel) { this.fAnnotationModel = annotationModel; fSpellingContext = new SpellingContext(); fSpellingContext.setContentType(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT)); }
protected AnnotationModel createAnnotationModel() { return new AnnotationModel(); }
public void createPartControl(Composite parent) { int VERTICAL_RULER_WIDTH = 12; int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; ISharedTextColors sharedColors = EditorsPlugin.getDefault().getSharedTextColors(); IOverviewRuler overviewRuler = new OverviewRuler(null, VERTICAL_RULER_WIDTH, sharedColors); CompositeRuler ruler = new CompositeRuler(VERTICAL_RULER_WIDTH); _document = new Document(); _document.set(_docString); _annotationModel = new AnnotationModel(); _annotationModel.connect(_document); _sourceViewer = new SourceViewer(parent, ruler, overviewRuler, true, styles); _sourceViewer.configure(new SourceViewerConfiguration()); _sds = new SourceViewerDecorationSupport(_sourceViewer, overviewRuler, null, sharedColors); AnnotationPreference ap = new AnnotationPreference(); ap.setColorPreferenceKey(ANNO_KEY_COLOR); ap.setHighlightPreferenceKey(ANNO_KEY_HIGHLIGHT); ap.setVerticalRulerPreferenceKey(ANNO_KEY_VERTICAL); ap.setOverviewRulerPreferenceKey(ANNO_KEY_OVERVIEW); ap.setTextPreferenceKey(ANNO_KEY_TEXT); ap.setAnnotationType(ANNO_TYPE); _sds.setAnnotationPreference(ap); // _sds.install(EditorsPlugin.getDefault().getPreferenceStore()); _sourceViewer.setDocument(_document, _annotationModel); _sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); ruler.addDecorator(0, new LineNumberRulerColumn()); Annotation annotation = new Annotation(false); annotation.setType(ANNO_TYPE); Position position = new Position(0, 4); _annotationModel.addAnnotation(annotation, position); parent.layout(); }
protected XtextSourceViewer createXtextSourceViewer() { final XtextSourceViewer result = new XtextSourceViewerEx(getStyledText(), getPreferenceStoreAccess().getPreferenceStore()); result.configure(getXtextSourceViewerConfiguration()); result.setDocument(getXtextDocument(), new AnnotationModel()); return result; }
public IAnnotationModel createAnnotationModel(IPath path) { IResource file= ResourcesPlugin.getWorkspace().getRoot().findMember(path); if (file instanceof IFile) return new CompilationUnitAnnotationModel(file); return new AnnotationModel(); }
public AnnotationModel getAnnotationModel() { return mAnnotationModel; }
@Override protected IAnnotationModel createAnnotationModel(Object element) throws CoreException { return new AnnotationModel(); }