Search in sources :

Example 1 with NullSourceEditingTextTools

use of org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools 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

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 BadLocationException (org.eclipse.jface.text.BadLocationException)1 Point (org.eclipse.swt.graphics.Point)1 IEditorPart (org.eclipse.ui.IEditorPart)1 PartInitException (org.eclipse.ui.PartInitException)1 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)1 ExtendedConfigurationBuilder (org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)1 ISourceEditingTextTools (org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools)1 NullSourceEditingTextTools (org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools)1