use of org.eclipse.jface.text.source.SourceViewer in project webtools.sourceediting by eclipse.
the class NewXSLFileTemplatesWizardPage method createViewer.
private SourceViewer createViewer(Composite parent) {
SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationXSL();
@Override
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return baseConfiguration.getConfiguredContentTypes(sourceViewer);
}
@Override
public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
// $NON-NLS-1$
viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
viewer.setDocument(document);
return viewer;
}
use of org.eclipse.jface.text.source.SourceViewer in project webtools.sourceediting by eclipse.
the class CSSTemplatePreferencePage method doCreateViewer.
SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) {
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForCSS.ContentTypeID_CSS;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
// $NON-NLS-1$
viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);
viewer.setDocument(document);
return viewer;
}
use of org.eclipse.jface.text.source.SourceViewer in project webtools.sourceediting by eclipse.
the class DTDTemplatePreferencePage method doCreateViewer.
SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) {
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForDTD.ContentTypeID_DTD;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
// $NON-NLS-1$
viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);
viewer.setDocument(document);
return viewer;
}
use of org.eclipse.jface.text.source.SourceViewer in project webtools.sourceediting by eclipse.
the class NewDTDTemplatesWizardPage method doCreateViewer.
private SourceViewer doCreateViewer(Composite parent) {
Label label = new Label(parent, SWT.NONE);
label.setText(DTDUIMessages.NewDTDTemplatesWizardPage_5);
GridData data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
SourceViewer viewer = createViewer(parent);
viewer.setEditable(false);
Control control = viewer.getControl();
data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 2;
data.heightHint = convertHeightInCharsToPixels(5);
// [261274] - source viewer was growing to fit the max line width of the template
data.widthHint = convertWidthInCharsToPixels(2);
control.setLayoutData(data);
return viewer;
}
use of org.eclipse.jface.text.source.SourceViewer in project webtools.sourceediting by eclipse.
the class NewDTDTemplatesWizardPage method createViewer.
/**
* Creates, configures and returns a source viewer to present the template
* pattern on the preference page. Clients may override to provide a
* custom source viewer featuring e.g. syntax coloring.
*
* @param parent
* the parent control
* @return a configured source viewer
*/
private SourceViewer createViewer(Composite parent) {
SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD();
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return baseConfiguration.getConfiguredContentTypes(sourceViewer);
}
public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
// $NON-NLS-1$
viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForDTD.ContentTypeID_DTD);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
viewer.setDocument(document);
return viewer;
}
Aggregations