use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.
the class TestViewerConfiguration method setUpViewerConfiguration.
private void setUpViewerConfiguration() {
if (Display.getCurrent() != null) {
Shell shell = null;
Composite parent = null;
if (PlatformUI.isWorkbenchRunning()) {
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
} else {
shell = new Shell(Display.getCurrent());
}
parent = new Composite(shell, SWT.NONE);
// dummy viewer
fViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE);
fConfig = new StructuredTextViewerConfiguration();
} else {
fDisplayExists = false;
Logger.log(Logger.INFO, "Remember, viewer configuration tests are not run because workbench is not open (normal on build machine)");
}
}
use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.
the class NewTagTemplatesWizardPage 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 StructuredTextViewerConfigurationJSP();
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(ContentTypeIdForJSP.ContentTypeID_JSPTAG);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
viewer.setDocument(document);
return viewer;
}
use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.
the class JSPELContentAssistTest method getCompletionProposals.
/**
* use a viewer and document location to generate completion proposals for that location in the viewer
*
* @param filePath
* @param documentLocation
* @return
* @throws PartInitException
*/
private ICompletionProposal[] getCompletionProposals(String filePath, int documentLocation) throws PartInitException {
IFile file = getFile(filePath);
StructuredTextEditor editor = getEditor(file);
StructuredTextViewer viewer = editor.getTextViewer();
return getCompletionProposals(viewer, documentLocation);
}
use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.
the class JSPELContentAssistTest method getCompletionProposals.
/**
* use a viewer and document location to generate completion proposals for that location in the viewer
*
* @param file
* @param documentLocation
* @return
* @throws PartInitException
*/
private ICompletionProposal[] getCompletionProposals(IFile file, int documentLocation) throws PartInitException {
StructuredTextEditor editor = getEditor(file);
StructuredTextViewer viewer = editor.getTextViewer();
return getCompletionProposals(viewer, documentLocation);
}
use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.
the class JSPTemplatePreferencePage method doCreateViewer.
SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) {
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForJSP.ContentTypeID_JSP;
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;
}
Aggregations