Java Code Examples for org.eclipse.jface.text.source.SourceViewer#getControl()
The following examples show how to use
org.eclipse.jface.text.source.SourceViewer#getControl() .
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: EditTemplateDialog.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
private SourceViewer createEditor(Composite parent) { SourceViewer viewer= createViewer(parent); int numberOfLines= viewer.getDocument().getNumberOfLines(); if (numberOfLines < 7) { numberOfLines= 7; } else if (numberOfLines > 14) { numberOfLines= 14; } Control control= viewer.getControl(); GridData data= new GridData(GridData.FILL_BOTH); data.widthHint= convertWidthInCharsToPixels(80); data.heightHint= convertHeightInCharsToPixels(numberOfLines); control.setLayoutData(data); return viewer; }
Example 2
Source File: TypeScriptTemplatePreferencePage.java From typescript.java with MIT License | 6 votes |
protected SourceViewer createViewer(Composite parent) { IDocument document= new Document(); JavaScriptTextTools tools= JSDTTypeScriptUIPlugin.getDefault().getJavaTextTools(); tools.setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING); IPreferenceStore store= JSDTTypeScriptUIPlugin.getDefault().getCombinedPreferenceStore(); SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaScriptPartitions.JAVA_PARTITIONING, false); viewer.configure(configuration); viewer.setEditable(false); viewer.setDocument(document); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new TypeScriptSourcePreviewerUpdater(viewer, configuration, store); Control control= viewer.getControl(); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); return viewer; }
Example 3
Source File: GamlEditTemplateDialog.java From gama with GNU General Public License v3.0 | 6 votes |
private SourceViewer createEditor(final Composite parent) { final SourceViewer viewer = createViewer(parent); int numberOfLines = viewer.getDocument().getNumberOfLines(); if (numberOfLines < 7) { numberOfLines = 7; } else if (numberOfLines > 14) { numberOfLines = 14; } final Control control = viewer.getControl(); final GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = convertWidthInCharsToPixels(80); data.heightHint = convertHeightInCharsToPixels(numberOfLines); control.setLayoutData(data); return viewer; }
Example 4
Source File: JavaTemplatePreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected SourceViewer createViewer(Composite parent) { IDocument document= new Document(); JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools(); tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false); viewer.configure(configuration); viewer.setEditable(false); viewer.setDocument(document); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new JavaSourcePreviewerUpdater(viewer, configuration, store); Control control= viewer.getControl(); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); return viewer; }
Example 5
Source File: SyntaxColoringPreferencePage.java From editorconfig-eclipse with Apache License 2.0 | 6 votes |
private Control createPreviewer(Composite parent) { IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { fOverlayStore, EditorConfigUIPlugin.getDefault().getCombinedPreferenceStore() }); fPreviewViewer = new SourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fColorManager = new EditorConfigColorManager(false); EditorConfigSourceViewerConfiguration configuration = new EditorConfigSourceViewerConfiguration(fColorManager, store, null, IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING); fPreviewViewer.configure(configuration); Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_CONFIG_EDITOR_TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); new SourcePreviewerUpdater(fPreviewViewer, configuration, store); fPreviewViewer.setEditable(false); String content = loadPreviewContentFromFile("EditorConfigEditorColorSettingPreviewCode.txt"); //$NON-NLS-1$ IDocument document = new Document(content); EditorConfigDocumentSetupParticipant.setupDocument(document); fPreviewViewer.setDocument(document); return fPreviewViewer.getControl(); }