Package org.eclipse.wst.sse.ui.internal.provisional.extensions

Examples of org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools


    // create IBreakpointProvider[] to return
    IBreakpointProvider[] providers = new IBreakpointProvider[s.size()];
    Iterator itr = s.iterator();
    int i = 0;
    ISourceEditingTextTools tools = null;
    if (editorpart != null && itr.hasNext())
      tools = (ISourceEditingTextTools) editorpart.getAdapter(ISourceEditingTextTools.class);
    while (itr.hasNext()) {
      providers[i] = (IBreakpointProvider) itr.next();
      providers[i].setSourceEditingTextTools(tools);
View Full Code Here


      public void run() {
        ITextEditor editor = getTextEditor();

        // figure out current offset
        int offset = -1;
        ISourceEditingTextTools textTools = (ISourceEditingTextTools) getTextEditor().getAdapter(ISourceEditingTextTools.class);
        if (textTools != null) {
          offset = textTools.getCaretOffset();
        }
        else if (editor instanceof IExtendedSimpleEditor) {
          offset = ((IExtendedSimpleEditor) editor).getCaretPosition();
        }
        else {
View Full Code Here

  /**
   * @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);
    }
    Method method = null; //$NON-NLS-1$
    try {
      method = tools.getClass().getMethod("setTextEditor", new Class[]{StructuredTextEditor.class}); //$NON-NLS-1$
    }
    catch (NoSuchMethodException e) {
    }
    if (method == null) {
      try {
        method = tools.getClass().getMethod("setTextEditor", new Class[]{ITextEditor.class}); //$NON-NLS-1$
      }
      catch (NoSuchMethodException e) {
      }
    }
    if (method == null) {
      try {
        method = tools.getClass().getMethod("setTextEditor", new Class[]{IEditorPart.class}); //$NON-NLS-1$
      }
      catch (NoSuchMethodException e) {
      }
    }
    if (method != null) {
View Full Code Here

      IExtendedSimpleEditor simpleEditor = null;
      if (editor instanceof IExtendedSimpleEditor) {
        simpleEditor = (IExtendedSimpleEditor) editor;
      }
      if (editor != null && simpleEditor == null) {
        final ISourceEditingTextTools tools = (ISourceEditingTextTools) editor.getAdapter(ISourceEditingTextTools.class);
        if (tools != null) {
          simpleEditor = new IExtendedSimpleEditor() {
            public int getCaretPosition() {
              return tools.getCaretOffset();
            }

            public IDocument getDocument() {
              return tools.getDocument();
            }

            public IEditorPart getEditorPart() {
              return tools.getEditorPart();
            }

            public Point getSelectionRange() {
              ITextSelection selection = tools.getSelection();
              return new Point(selection.getOffset(), selection.getOffset() + selection.getLength());
            }

          };
        }
View Full Code Here

  /**
   * @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);
    }
    Method method = null; //$NON-NLS-1$
    try {
      method = tools.getClass().getMethod("setTextEditor", new Class[]{StructuredTextEditor.class}); //$NON-NLS-1$
    }
    catch (NoSuchMethodException e) {
    }
    if (method == null) {
      try {
        method = tools.getClass().getMethod("setTextEditor", new Class[]{ITextEditor.class}); //$NON-NLS-1$
      }
      catch (NoSuchMethodException e) {
      }
    }
    if (method == null) {
      try {
        method = tools.getClass().getMethod("setTextEditor", new Class[]{IEditorPart.class}); //$NON-NLS-1$
      }
      catch (NoSuchMethodException e) {
      }
    }
    if (method != null) {
View Full Code Here

    String contentType = getContentType(document);
    IBreakpointProvider[] providers = BreakpointProviderBuilder.getInstance().getBreakpointProviders(editor, contentType, getFileExtension(input));

    int pos = -1;
    ISourceEditingTextTools tools = (ISourceEditingTextTools) editor.getAdapter(ISourceEditingTextTools.class);
    if (tools != null) {
      pos = tools.getCaretOffset();
    }

    final int n = providers.length;
    List errors = new ArrayList(0);
    for (int i = 0; i < n; i++) {
View Full Code Here

    ITextSelection textSelection = null;
    IDocument doc = null;
    ISelection selection = null;

    ISourceEditingTextTools tools = (ISourceEditingTextTools) targetEditor.getAdapter(ISourceEditingTextTools.class);
    if (tools != null) {
      doc = tools.getDocument();
      selection = tools.getSelection();
    }

    ITextEditor textEditor = null;
    if (targetEditor instanceof ITextEditor) {
      textEditor = (ITextEditor) targetEditor;
    }
    if (textEditor == null) {
      textEditor = (ITextEditor) ((IAdaptable) targetEditor).getAdapter(ITextEditor.class);
    }
    if (textEditor == null && tools != null && tools.getEditorPart() instanceof ITextEditor) {
      textEditor = (ITextEditor) tools.getEditorPart();
    }
    if (textEditor == null && tools != null && tools.getEditorPart() != null) {
      textEditor = (ITextEditor) tools.getEditorPart().getAdapter(ITextEditor.class);
    }

    if (selection == null && textEditor != null) {
      selection = textEditor.getSelectionProvider().getSelection();
    }
View Full Code Here

        this.sourceEditor = sourceEditor;
        this.rootModelElement = null;
        this.xmlNodeToModelElementsMap = new IdentityHashMap<Node,Object>();
        this.sourceEditorService = new XmlSourceEditorService();
       
        final ISourceEditingTextTools sourceEditingTextTools = (ISourceEditingTextTools) this.sourceEditor.getAdapter( ISourceEditingTextTools.class );
        final IDOMSourceEditingTextTools domSourceEditingTextTools = (IDOMSourceEditingTextTools) sourceEditingTextTools;
       
        setDomDocument( domSourceEditingTextTools.getDOMDocument() );
       
        this.xmlNodeListener = new INodeAdapter()
View Full Code Here

    IBreakpointProvider[] providers = BreakpointProviderBuilder
        .getInstance().getBreakpointProviders(editor, contentType,
            getFileExtension(input));

    int pos = -1;
    ISourceEditingTextTools tools = (ISourceEditingTextTools) editor
        .getAdapter(ISourceEditingTextTools.class);
    if (tools != null) {
      pos = tools.getCaretOffset();
    }

    final int n = providers.length;
    List errors = new ArrayList(0);
    for (int i = 0; i < n; i++) {
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.