1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Patch from Anton Leherbauer, Background color of templates, bug 105614.

This commit is contained in:
Markus Schorn 2006-05-09 16:07:38 +00:00
parent 4f434d0f92
commit 018ce2f78c

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2005 QNX Software Systems and others.
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Wind River Systems, Inc. - Bug fixes
*******************************************************************************/
package org.eclipse.cdt.internal.ui.preferences;
@ -69,14 +70,15 @@ public class CTemplatePreferencePage extends TemplatePreferencePage {
* @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#createViewer(org.eclipse.swt.widgets.Composite)
*/
protected SourceViewer createViewer(Composite parent) {
SourceViewer viewer= new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
PreviewSourceViewer viewer= new PreviewSourceViewer(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
viewer.setPreferenceStore(CUIPlugin.getDefault().getCombinedPreferenceStore());
CTextTools tools= CUIPlugin.getDefault().getTextTools();
CSourceViewerConfiguration configuration = new CSourceViewerConfiguration(tools, null);
IDocument document = new Document();
tools.setupCDocument(document);
viewer.configure(new CSourceViewerConfiguration(tools, null));
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
viewer.getTextWidget().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
Font font= JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
viewer.getTextWidget().setFont(font);
@ -91,6 +93,7 @@ public class CTemplatePreferencePage extends TemplatePreferencePage {
e.result = PreferencesMessages.getString("TemplatePreferencePage.preview"); //$NON-NLS-1$
}});
CSourcePreviewerUpdater.registerPreviewer(viewer, configuration, CUIPlugin.getDefault().getCombinedPreferenceStore());
return viewer;
}