Search in sources :

Example 6 with LineStyleProvider

use of org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider in project webtools.sourceediting by eclipse.

the class TestXSLLineStyleProvider method testPrepareRegion.

@Test
public void testPrepareRegion() throws Exception {
    setUpTest("utils.xsl");
    LineStyleProvider provider = initializeProvider();
    ITypedRegion[] partitions = setupPartitions();
    assertTrue("No Partitions found.", partitions.length > 0);
    ArrayList holdStyleResults = new ArrayList();
    applyStyles(provider, partitions, holdStyleResults);
    assertFalse("No styles applied.", holdStyleResults.isEmpty());
    assertEquals("Unexpected StyleRange size", 241, holdStyleResults.size());
}
Also used : LineStyleProvider(org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider) ArrayList(java.util.ArrayList) ITypedRegion(org.eclipse.jface.text.ITypedRegion) Test(org.junit.Test) AbstractXSLUITest(org.eclipse.wst.xsl.ui.tests.AbstractXSLUITest)

Example 7 with LineStyleProvider

use of org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider in project webtools.sourceediting by eclipse.

the class NewXMLTemplatesWizardPage 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 StructuredTextViewerConfigurationXML();

        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(ContentTypeIdForXML.ContentTypeID_XML);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
}
Also used : StructuredTextViewerConfigurationXML(org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML) SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) SourceViewer(org.eclipse.jface.text.source.SourceViewer) LineStyleProvider(org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) StructuredTextViewerConfiguration(org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IDocument(org.eclipse.jface.text.IDocument)

Example 8 with LineStyleProvider

use of org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider 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;
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) SourceViewer(org.eclipse.jface.text.source.SourceViewer) LineStyleProvider(org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider) StructuredTextViewerConfigurationXSL(org.eclipse.wst.xsl.ui.internal.StructuredTextViewerConfigurationXSL) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) StructuredTextViewerConfiguration(org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IDocument(org.eclipse.jface.text.IDocument)

Example 9 with LineStyleProvider

use of org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider 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;
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) SourceViewer(org.eclipse.jface.text.source.SourceViewer) LineStyleProvider(org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) StructuredTextViewerConfiguration(org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IDocument(org.eclipse.jface.text.IDocument) StructuredTextViewerConfigurationDTD(org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD)

Example 10 with LineStyleProvider

use of org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider in project webtools.sourceediting by eclipse.

the class NewCSSTemplatesWizardPage 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 StructuredTextViewerConfigurationCSS();

        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(ContentTypeIdForCSS.ContentTypeID_CSS);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) SourceViewer(org.eclipse.jface.text.source.SourceViewer) LineStyleProvider(org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) StructuredTextViewerConfiguration(org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration) StructuredTextViewerConfigurationCSS(org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer) IDocument(org.eclipse.jface.text.IDocument)

Aggregations

LineStyleProvider (org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider)13 StructuredTextViewerConfiguration (org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration)10 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)8 SourceViewer (org.eclipse.jface.text.source.SourceViewer)8 SourceViewerConfiguration (org.eclipse.jface.text.source.SourceViewerConfiguration)8 StructuredTextViewer (org.eclipse.wst.sse.ui.internal.StructuredTextViewer)8 IDocument (org.eclipse.jface.text.IDocument)7 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)7 StructuredTextViewerConfigurationJSP (org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP)2 Point (org.eclipse.swt.graphics.Point)2 AbstractLineStyleProvider (org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider)2 CompatibleHighlighter (org.eclipse.wst.sse.ui.internal.provisional.style.CompatibleHighlighter)2 ReconcilerHighlighter (org.eclipse.wst.sse.ui.internal.provisional.style.ReconcilerHighlighter)2 StructuredTextViewerConfigurationXSL (org.eclipse.wst.xsl.ui.internal.StructuredTextViewerConfigurationXSL)2 ArrayList (java.util.ArrayList)1 ITypedRegion (org.eclipse.jface.text.ITypedRegion)1 IContentAssistant (org.eclipse.jface.text.contentassist.IContentAssistant)1 IContentAssistantExtension2 (org.eclipse.jface.text.contentassist.IContentAssistantExtension2)1 IContentAssistantExtension4 (org.eclipse.jface.text.contentassist.IContentAssistantExtension4)1 IHyperlinkDetector (org.eclipse.jface.text.hyperlink.IHyperlinkDetector)1