Search in sources :

Example 11 with StructuredTextViewer

use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.

the class TestViewerConfigurationCSS 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 StructuredTextViewerConfigurationCSS();
    } else {
        fDisplayExists = false;
        Logger.log(Logger.INFO, "Remember, viewer configuration tests are not run because workbench is not open (normal on build machine)");
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Composite(org.eclipse.swt.widgets.Composite) StructuredTextViewerConfigurationCSS(org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer)

Example 12 with StructuredTextViewer

use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method setSourceViewerConfiguration.

/**
 * Sets the editor's source viewer configuration which it uses to
 * configure it's internal source viewer. This method was overwritten so
 * that viewer configuration could be set after editor part was created.
 */
protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
    SourceViewerConfiguration oldSourceViewerConfiguration = getSourceViewerConfiguration();
    super.setSourceViewerConfiguration(config);
    StructuredTextViewer stv = getTextViewer();
    if (stv != null) {
        /*
			 * There should be no need to unconfigure before configure because
			 * configure will also unconfigure before configuring
			 */
        removeReconcilingListeners(oldSourceViewerConfiguration, stv);
        stv.unconfigure();
        setStatusLineMessage(null);
        stv.configure(config);
        addReconcilingListeners(config, stv);
    }
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer)

Example 13 with StructuredTextViewer

use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method endBusyStateInternal.

/**
 * Note this method can be called indirectly from background job operation
 * ... but expected to be gaurded there with ILock, plus, can be called
 * directly from timer thread, so the timer's run method guards with ILock
 * too.
 *
 * Set result[0] to 1 if the busy state was ended successfully
 */
private void endBusyStateInternal(byte[] result) {
    if (fBackgroundJobEnded) {
        result[0] = 1;
        showBusy(false);
        ISourceViewer viewer = getSourceViewer();
        if (viewer instanceof StructuredTextViewer) {
            ((StructuredTextViewer) viewer).endBackgroundUpdate();
        }
        fBusyState = false;
    } else {
    // we will only be in this branch for a back ground job that is
    // taking
    // longer than our normal time-out period (meaning we got notified
    // of
    // the timeout "inbetween" calls to 'begin' and
    // 'endBackgroundOperation'.
    // (which, remember, can only happen since there are many calls to
    // begin/end in a short period of time, and we only "reset" on the
    // 'ends').
    // In this event, there's really nothing to do, we're still in
    // "busy state"
    // and should start a new reset cycle once endBackgroundjob is
    // called.
    }
}
Also used : ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer)

Example 14 with StructuredTextViewer

use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method createSourceViewer.

/**
 * Creates the source viewer to be used by this editor
 */
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
    fAnnotationAccess = createAnnotationAccess();
    fOverviewRuler = createOverviewRuler(getSharedColors());
    StructuredTextViewer sourceViewer = createStructedTextViewer(parent, verticalRuler, styles);
    initSourceViewer(sourceViewer);
    return sourceViewer;
}
Also used : StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer)

Example 15 with StructuredTextViewer

use of org.eclipse.wst.sse.ui.internal.StructuredTextViewer in project webtools.sourceediting by eclipse.

the class TestViewerConfigurationHTML 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 StructuredTextViewerConfigurationHTML();
    } else {
        fDisplayExists = false;
        Logger.log(Logger.INFO, "Remember, viewer configuration tests are not run because workbench is not open (normal on build machine)");
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Composite(org.eclipse.swt.widgets.Composite) StructuredTextViewerConfigurationHTML(org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML) StructuredTextViewer(org.eclipse.wst.sse.ui.internal.StructuredTextViewer)

Aggregations

StructuredTextViewer (org.eclipse.wst.sse.ui.internal.StructuredTextViewer)62 StructuredTextEditor (org.eclipse.wst.sse.ui.StructuredTextEditor)21 IDocument (org.eclipse.jface.text.IDocument)19 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)18 IFile (org.eclipse.core.resources.IFile)14 SourceViewer (org.eclipse.jface.text.source.SourceViewer)14 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)14 Composite (org.eclipse.swt.widgets.Composite)13 Shell (org.eclipse.swt.widgets.Shell)13 SourceViewerConfiguration (org.eclipse.jface.text.source.SourceViewerConfiguration)12 StructuredTextViewerConfiguration (org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration)9 LineStyleProvider (org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider)8 ArrayList (java.util.ArrayList)7 BadLocationException (org.eclipse.jface.text.BadLocationException)6 Position (org.eclipse.jface.text.Position)6 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)6 List (java.util.List)5 Action (org.eclipse.jface.action.Action)4 IContributionManager (org.eclipse.jface.action.IContributionManager)4 Separator (org.eclipse.jface.action.Separator)4