private SourceViewer createViewer(Composite parent) { SourceViewer viewer = new SourceViewer(parent, null, SWT.NONE); SourceViewerConfiguration configuration = new AntSourceViewerConfiguration(); viewer.configure(configuration); viewer.setEditable(false); Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); viewer.getTextWidget().setFont(font); return viewer; }
protected void configureSourceViewer(SourceViewer sourceViewer) { IEditorInput editorInput = getEditorInput(sourceViewer); SourceViewerConfiguration sourceViewerConfiguration = createSourceViewerConfiguration(sourceViewer, editorInput); sourceViewer.unconfigure(); sourceViewer.configure(sourceViewerConfiguration); if (sourceViewer.getDocument() instanceof IXtextDocument) { IXtextDocument xtextDocument = (IXtextDocument) sourceViewer.getDocument(); if (!xtextDocument.readOnly(TEST_EXISTING_XTEXT_RESOURCE)) { String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer); for (String contentType : configuredContentTypes) { sourceViewer.removeTextHovers(contentType); } sourceViewer.setHyperlinkDetectors(null, sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer)); } } }
@Override public void setDocument(IDocument document) { setDocument(document, null, -1, -1); }
SimpleTextViewer(Composite parent) { fSourceViewer= new SourceViewer(parent, null, SWT.H_SCROLL | SWT.V_SCROLL); fSourceViewer.setEditable(false); }
@Override public void widgetSelected(SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); }
@Override public void run() { ISourceViewer viewer= fEditor.getViewer(); if (viewer instanceof SourceViewer) { SourceViewer sourceViewer= (SourceViewer) viewer; if (sourceViewer.canDoOperation(JavaSourceViewer.ANNOTATE_CLASS_FILE)) sourceViewer.doOperation(JavaSourceViewer.ANNOTATE_CLASS_FILE); } } }
private void createSourceViewer(Composite c) { IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); fSourceViewer= new JavaSourceViewer(c, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, store); fSourceViewer.configure(new JavaSourceViewerConfiguration(getJavaTextTools().getColorManager(), store, null, null)); fSourceViewer.setEditable(false); fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); Document document= new Document(); getJavaTextTools().setupJavaDocumentPartitioner(document); fSourceViewer.setDocument(document); }
private void createSourceViewer(final Composite c) { final IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); fSourceViewer= new JavaSourceViewer(c, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, store); fSourceViewer.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); fSourceViewer.setEditable(false); fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); }
@Override public void createControl(Composite parent) { super.createControl(parent); final SourceViewer viewer= getSourceViewer(); viewer.unconfigure(); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); viewer.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); viewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); }
private void updateSourceViewer(ITextFileBufferManager manager, IFile sourceFile) { IDocument document = manager.getTextFileBuffer(sourceFile.getFullPath(), LocationKind.IFILE).getDocument(); TreeItem item = fInputViewer.getTree().getSelection()[0]; IPluginModelBase model = ((ModelChange) item.getParentItem().getData()).getParentModel(); if (fSourceViewer.getDocument() != null) fSourceViewer.unconfigure(); if (sourceFile.getFileExtension().equalsIgnoreCase("xml")) { //$NON-NLS-1$ fSourceViewer.configure(fXMLConfig); fXMLSetupParticipant.setup(document); } else { fSourceViewer.configure(fManifestConfig); fManifestSetupParticipant.setup(document); } fSourceViewer.setDocument(document); updatePropertiesLabel(model); }
/** * {@inheritDoc} */ public void createControl(Composite parent) { fPane= new CreateTextFilePreviewer(parent, SWT.BORDER | SWT.FLAT); Dialog.applyDialogFont(fPane); fSourceViewer= new SourceViewer(fPane, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); fSourceViewer.setEditable(false); fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fPane.setContent(fSourceViewer.getControl()); }
public void configure(SourceViewerConfiguration configuration) { if (isConfigured ) getSourceViewer().unconfigure(); isConfigured = true; getSourceViewer().configure(configuration); }
/** * @return widget */ public StyledText getTextWidget() { return sourceViewer.getTextWidget(); }
@Override protected void internalCreatePartControl(Composite parent) { IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); fViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store); fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false); fKindToViewerConfiguration.put(SimpleJavaSourceViewerConfiguration.STANDARD, fViewerConfiguration); fViewer.configure(fViewerConfiguration); fViewer.setEditable(false); setViewerFont(); JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); store.addPropertyChangeListener(fPropertyChangeListener); getViewSite().setSelectionProvider(fViewer); }
@Override protected ISourceViewer createSourceViewer(Composite parent, org.eclipse.jface.text.source.IVerticalRuler ruler, int styles) { SourceViewer sourceViewer = new SourceViewer(parent, ruler, styles); sourceViewer.setEditable(false); mPainter = new AnnotationPainter(sourceViewer, new AnnotationAccess()); sourceViewer.addPainter(mPainter); return sourceViewer; }
/** * @return document */ public IDocument getDocument() { return sourceViewer.getDocument(); }
/** * Creates the source viewer to be used by this editor. * Subclasses may re-implement this method. * * @param parent the parent control * @param ruler the vertical ruler * @param styles style bits, <code>SWT.WRAP</code> is currently not supported * @return the source viewer */ protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { return new SourceViewer(parent, ruler, styles); }
SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) { SourceViewer viewer = null; String contentTypeID = ContentTypeIdForXML.ContentTypeID_XML; viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$ IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID); IDocument document = scratchModel.getStructuredDocument(); viewer.configure(viewerConfiguration); viewer.setDocument(document); return viewer; }
public void setInformation(String content) { if (content == null) { fViewer.setInput(null); return; } IDocument doc= new Document(content); fViewer.setInput(doc); // ensure that we can scroll enough ensureScrollable(); fViewer.getTextWidget().setHorizontalPixel(fHorizontalScrollPixel); }
public void configure(SourceViewerConfiguration configuration) { if (isConfigured ) unconfigure(); isConfigured = true; super.configure(configuration); }