Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.IDocument.replace()


        IDocument doc = getEditor().getDocumentProvider().getDocument(getEditor().getEditorInput());
        try
        {
            // Repace the selection with the subroutine call
            doc.replace(selection.getOffset(), selection.getLength(), result[0]);

            int offset = -1;

            FindReplaceDocumentAdapter docFind = new FindReplaceDocumentAdapter(doc);
View Full Code Here


            offset = (regionEnd != null) ? regionEnd.getOffset() : doc.getLength();

            String lineSep = getLineSeparator(doc.get());

            // format and insert the new subroutine code
            doc.replace(offset, 0, lineSep + SourceFormatter.format(result[1], getLog()));
        }
        catch (CoreException e)
        {
            log(e.getStatus());
        }
View Full Code Here

      if(insert != null && insert.equals(Editor.SKIP)) {
        event.doit = false;
        moveCursor(1);
      } else if(insert != null) {
        insert = c + insert;
        document.replace(cursorOffset, selectionLength, insert);
        event.doit = false;
        moveCursor(1);
      }
    } catch(BadLocationException e) {
      // Don't care
View Full Code Here

           
            for (IMethod method : miss.getMisses()) {
              code += MethodStub.getMethodStub(method.getParent().getElementName(), method, method, indent, TextUtilities.getDefaultLineDelimiter(document), true);
            }
                     
            document.replace(miss.getInjectionOffset(), 0, code);
           
            UseStatementInjector injector = new UseStatementInjector(this);
            injector.inject(document, getTextViewer(), offset);
           
            //TODO: format code using new PDT formatter
View Full Code Here

            display.asyncExec(new Runnable() {

                @Override
                public void run() {
                    try {
                        document.replace(offset, 0, addMessage);
                    } catch (final BadLocationException e) {
                    }
                }
            });
            ErlLogger.debug("message %s", message);
View Full Code Here

                    target.setRedraw(false);
                }
                try {
                    if (!document.get(selection.getOffset(), selection.getLength())
                            .equals(newText)) {
                        document.replace(selection.getOffset(), selection.getLength(),
                                newText);
                    }
                } catch (final BadLocationException e) {
                    ErlLogger.warn(e);
                }
View Full Code Here

                                final IDocumentListener owner) {
                            if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
                                    && !level.fSecondPosition.isDeleted
                                    && level.fSecondPosition.offset == level.fFirstPosition.offset) {
                                try {
                                    document.replace(level.fSecondPosition.offset,
                                            level.fSecondPosition.length, ""); //$NON-NLS-1$
                                } catch (final BadLocationException e) {
                                    ErlLogger.error(e);
                                }
                            }
View Full Code Here

                if (target1 instanceof ITextViewer) {
                    final ITextViewer textViewer = (ITextViewer) target1;
                    try {
                        if (!document.get(selection.getOffset(), selection.getLength())
                                .equals(newText)) {
                            document.replace(selection.getOffset(),
                                    selection.getLength(), newText);
                            textViewer.setSelectedRange(selection.getOffset(),
                                    newText.length());
                        }
                    } catch (final BadLocationException e) {
View Full Code Here

    final int offset= selection.x;
    final int length= selection.y;

    boolean paired = false;
    try {
      document.replace(offset, length, new String(chars));
      LinkedModeModel model = new LinkedModeModel();
      LinkedPositionGroup group = new LinkedPositionGroup();
      group.addPosition(new LinkedPosition(document, offset + 1, 0, LinkedPositionGroup.NO_STOP));
      model.addGroup(group);
      model.forceInstall();
View Full Code Here

                                text += newAttrValLines[j].toFormattedString( Utils.getLdifFormatParameters() );
                            }
                            text += newSepLine.toFormattedString( Utils.getLdifFormatParameters() );
                            try
                            {
                                document.replace( modSpec.getOffset(), modSpec.getLength(), text );
                            }
                            catch ( BadLocationException e )
                            {
                                e.printStackTrace();
                            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.