Search in sources :

Example 1 with ExtendedConfigurationBuilder

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

the class DocumentRegionProcessor method getFoldingStrategy.

/**
 * <p>Get the folding strategy for this processor. Retrieved from the
 * extended configuration builder.  The processor chosen is set by the plugin.</p>
 *
 * <p>EX:<br />
 * <code>&lt;extension point="org.eclipse.wst.sse.ui.editorConfiguration"&gt;<br />
 *  &lt;provisionalConfiguration<br />
 *			type="foldingstrategy"<br />
 *			class="org.eclipse.wst.xml.ui.internal.projection.XMLFoldingStrategy"<br />
 *			target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xmlsource" /&gt;<br />
 *	&lt;/extension&gt;</code></p>
 *
 * <p>The type must be equal to <code>AbstractFoldingStrategy.ID</code> (AKA: foldingstrategy)
 * and the class must extend <code>org.eclipse.wst.sse.ui.internal.projection.AbstractFoldingStrategy</code>
 * and the target must be a structured editor content type ID</p>
 *
 * @return the requested folding strategy or null if none can be found
 */
protected IReconcilingStrategy getFoldingStrategy() {
    if (fFoldingStrategy == null && getDocument() != null) {
        String contentTypeId = getContentType(getDocument());
        if (contentTypeId == null) {
            contentTypeId = IContentTypeManager.CT_TEXT;
        }
        ITextViewer viewer = getTextViewer();
        if (viewer instanceof ProjectionViewer) {
            ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
            IContentType type = Platform.getContentTypeManager().getContentType(contentTypeId);
            while (fFoldingStrategy == null && type != null) {
                fFoldingStrategy = (AbstractStructuredFoldingStrategy) builder.getConfiguration(AbstractStructuredFoldingStrategy.ID, type.getId());
                type = type.getBaseType();
            }
            if (fFoldingStrategy != null) {
                fFoldingStrategy.setViewer((ProjectionViewer) viewer);
                fFoldingStrategy.setDocument(getDocument());
            }
        }
    }
    return fFoldingStrategy;
}
Also used : IContentType(org.eclipse.core.runtime.content.IContentType) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer) ITextViewer(org.eclipse.jface.text.ITextViewer) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 2 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method createPropertySheetConfiguration.

protected PropertySheetConfiguration createPropertySheetConfiguration() {
    PropertySheetConfiguration cfg = null;
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] ids = getConfigurationPoints();
    for (int i = 0; cfg == null && i < ids.length; i++) {
        cfg = (PropertySheetConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.PROPERTYSHEETCONFIGURATION, ids[i]);
    }
    return cfg;
}
Also used : PropertySheetConfiguration(org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration) Point(org.eclipse.swt.graphics.Point) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 3 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method createContentOutlineConfiguration.

private ContentOutlineConfiguration createContentOutlineConfiguration() {
    ContentOutlineConfiguration cfg = null;
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] ids = getConfigurationPoints();
    for (int i = 0; cfg == null && i < ids.length; i++) {
        cfg = (ContentOutlineConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.CONTENTOUTLINECONFIGURATION, ids[i]);
    }
    return cfg;
}
Also used : ContentOutlineConfiguration(org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration) Point(org.eclipse.swt.graphics.Point) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 4 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method getDefinitions.

private String[] getDefinitions(String[] ids) {
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] definitions = null;
    /* Iterate through the configuration ids until one is found that has
		 * an activecontexts definition
		 */
    for (int i = 0; i < ids.length; i++) {
        // $NON-NLS-1$
        definitions = builder.getDefinitions("activecontexts", ids[i]);
        if (definitions != null && definitions.length > 0)
            return definitions;
    }
    return null;
}
Also used : Point(org.eclipse.swt.graphics.Point) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 5 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method collectContextMenuPreferencePages.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
	 */
protected String[] collectContextMenuPreferencePages() {
    List allIds = new ArrayList(0);
    // get contributed preference pages
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] configurationIds = getConfigurationPoints();
    for (int i = 0; i < configurationIds.length; i++) {
        // $NON-NLS-1$
        String[] definitions = builder.getDefinitions("preferencepages", configurationIds[i]);
        for (int j = 0; j < definitions.length; j++) {
            String someIds = definitions[j];
            if (someIds != null && someIds.length() > 0) {
                // supports multiple comma-delimited page IDs in one
                // element
                String[] ids = StringUtils.unpack(someIds);
                for (int k = 0; k < ids.length; k++) {
                    // trim, just to keep things clean
                    String id = ids[k].trim();
                    if (!allIds.contains(id)) {
                        allIds.add(id);
                    }
                }
            }
        }
    }
    // add pages contributed by super
    String[] superPages = super.collectContextMenuPreferencePages();
    for (int m = 0; m < superPages.length; m++) {
        // trim, just to keep things clean
        String id = superPages[m].trim();
        if (!allIds.contains(id)) {
            allIds.add(id);
        }
    }
    return (String[]) allIds.toArray(new String[0]);
}
Also used : ArrayList(java.util.ArrayList) IShowInTargetList(org.eclipse.ui.part.IShowInTargetList) ListenerList(org.eclipse.core.runtime.ListenerList) ArrayList(java.util.ArrayList) List(java.util.List) Point(org.eclipse.swt.graphics.Point) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Aggregations

ExtendedConfigurationBuilder (org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)12 Point (org.eclipse.swt.graphics.Point)9 List (java.util.List)4 ArrayList (java.util.ArrayList)3 IShowInTargetList (org.eclipse.ui.part.IShowInTargetList)3 ListenerList (org.eclipse.core.runtime.ListenerList)2 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IContentType (org.eclipse.core.runtime.content.IContentType)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 ITextHover (org.eclipse.jface.text.ITextHover)1 ITextViewer (org.eclipse.jface.text.ITextViewer)1 IInformationPresenter (org.eclipse.jface.text.information.IInformationPresenter)1 IInformationProvider (org.eclipse.jface.text.information.IInformationProvider)1 InformationPresenter (org.eclipse.jface.text.information.InformationPresenter)1 DefaultCharacterPairMatcher (org.eclipse.jface.text.source.DefaultCharacterPairMatcher)1 ICharacterPairMatcher (org.eclipse.jface.text.source.ICharacterPairMatcher)1 ProjectionViewer (org.eclipse.jface.text.source.projection.ProjectionViewer)1