Search in sources :

Example 6 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method configureOutlinePresenter.

private IInformationPresenter configureOutlinePresenter(ISourceViewer sourceViewer, SourceViewerConfiguration config) {
    InformationPresenter presenter = null;
    // Get the quick outline configuration
    AbstractQuickOutlineConfiguration cfg = null;
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] ids = getConfigurationPoints();
    for (int i = 0; cfg == null && i < ids.length; i++) {
        cfg = (AbstractQuickOutlineConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.QUICKOUTLINECONFIGURATION, ids[i]);
    }
    if (cfg != null) {
        presenter = new InformationPresenter(getOutlinePresenterControlCreator(cfg));
        presenter.setDocumentPartitioning(config.getConfiguredDocumentPartitioning(sourceViewer));
        presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
        IInformationProvider provider = new SourceInfoProvider(this);
        String[] contentTypes = config.getConfiguredContentTypes(sourceViewer);
        for (int i = 0; i < contentTypes.length; i++) {
            presenter.setInformationProvider(provider, contentTypes[i]);
        }
        presenter.setSizeConstraints(50, 20, true, false);
    }
    return presenter;
}
Also used : AbstractQuickOutlineConfiguration(org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration) IInformationProvider(org.eclipse.jface.text.information.IInformationProvider) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter) Point(org.eclipse.swt.graphics.Point) SourceInfoProvider(org.eclipse.wst.sse.ui.internal.text.SourceInfoProvider) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 7 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method createShowInTargetIds.

/**
 * Loads the Show In Target IDs from the Extended Configuration extension
 * point.
 *
 * @return
 */
private String[] createShowInTargetIds() {
    List allIds = new ArrayList(0);
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] configurationIds = getConfigurationPoints();
    for (int i = 0; i < configurationIds.length; i++) {
        // $NON-NLS-1$
        String[] definitions = builder.getDefinitions("showintarget", configurationIds[i]);
        for (int j = 0; j < definitions.length; j++) {
            String someIds = definitions[j];
            if (someIds != null && someIds.length() > 0) {
                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);
                    }
                }
            }
        }
    }
    if (!allIds.contains(IPageLayout.ID_RES_NAV)) {
        allIds.add(IPageLayout.ID_RES_NAV);
    }
    if (!allIds.contains(IPageLayout.ID_PROJECT_EXPLORER)) {
        allIds.add(IPageLayout.ID_PROJECT_EXPLORER);
    }
    if (!allIds.contains(IPageLayout.ID_OUTLINE)) {
        allIds.add(IPageLayout.ID_OUTLINE);
    }
    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)

Example 8 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method createSourceViewerConfiguration.

private ConfigurationAndTarget createSourceViewerConfiguration() {
    ConfigurationAndTarget cat = null;
    StructuredTextViewerConfiguration cfg = null;
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] ids = getConfigurationPoints();
    for (int i = 0; cfg == null && i < ids.length; i++) {
        cfg = (StructuredTextViewerConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.SOURCEVIEWERCONFIGURATION, ids[i]);
        cat = new ConfigurationAndTarget(ids[i], cfg);
    }
    if (cfg == null) {
        cfg = new StructuredTextViewerConfiguration();
        // $NON-NLS-1$
        String targetid = getClass().getName() + "#default";
        cat = new ConfigurationAndTarget(targetid, cfg);
    }
    return cat;
}
Also used : Point(org.eclipse.swt.graphics.Point) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 9 with ExtendedConfigurationBuilder

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

the class DebugTextEditor method createShowInTargetIds.

/**
 * Loads the Show In Target IDs from the Extended Configuration extension
 * point.
 *
 * @return
 */
protected String[] createShowInTargetIds() {
    List allIds = new ArrayList(0);
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] configurationIds = getConfigurationPoints();
    for (int i = 0; i < configurationIds.length; i++) {
        // $NON-NLS-1$
        String[] definitions = builder.getDefinitions("showintarget", configurationIds[i]);
        for (int j = 0; j < definitions.length; j++) {
            String someIds = definitions[j];
            if (someIds != null && someIds.length() > 0) {
                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);
                    }
                }
            }
        }
    }
    if (!allIds.contains(IPageLayout.ID_RES_NAV)) {
        allIds.add(IPageLayout.ID_RES_NAV);
    }
    return (String[]) allIds.toArray(new String[0]);
}
Also used : ArrayList(java.util.ArrayList) IShowInTargetList(org.eclipse.ui.part.IShowInTargetList) List(java.util.List) ArrayList(java.util.ArrayList) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)

Example 10 with ExtendedConfigurationBuilder

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

the class StructuredTextEditor method createSourceEditingTextTools.

/**
 * @return
 */
private ISourceEditingTextTools createSourceEditingTextTools() {
    ISourceEditingTextTools tools = null;
    ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
    String[] ids = getConfigurationPoints();
    for (int i = 0; tools == null && i < ids.length; i++) {
        tools = (ISourceEditingTextTools) builder.getConfiguration(NullSourceEditingTextTools.ID, ids[i]);
    }
    if (tools == null) {
        tools = NullSourceEditingTextTools.getInstance();
        ((NullSourceEditingTextTools) tools).setTextEditor(this);
    }
    // $NON-NLS-1$
    Method method = null;
    try {
        // $NON-NLS-1$
        method = tools.getClass().getMethod("setTextEditor", new Class[] { StructuredTextEditor.class });
    } catch (NoSuchMethodException e) {
    }
    if (method == null) {
        try {
            // $NON-NLS-1$
            method = tools.getClass().getMethod("setTextEditor", new Class[] { ITextEditor.class });
        } catch (NoSuchMethodException e) {
        }
    }
    if (method == null) {
        try {
            // $NON-NLS-1$
            method = tools.getClass().getMethod("setTextEditor", new Class[] { IEditorPart.class });
        } catch (NoSuchMethodException e) {
        }
    }
    if (method != null) {
        if (!method.isAccessible()) {
            method.setAccessible(true);
        }
        try {
            method.invoke(tools, new Object[] { this });
        } catch (Exception e) {
            // $NON-NLS-1$
            Logger.logException("Problem creating ISourceEditingTextTools implementation", e);
        }
    }
    return tools;
}
Also used : NullSourceEditingTextTools(org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools) ITextEditor(org.eclipse.ui.texteditor.ITextEditor) Method(java.lang.reflect.Method) IEditorPart(org.eclipse.ui.IEditorPart) Point(org.eclipse.swt.graphics.Point) BadLocationException(org.eclipse.jface.text.BadLocationException) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) ExecutionException(org.eclipse.core.commands.ExecutionException) ExtendedConfigurationBuilder(org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder) ISourceEditingTextTools(org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools)

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