Package org.eclipse.jface.text

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


    IDocument document = getDocument(editor);
    String innerClassName = "anInnerClassName";
    String innerClassText = format("%nstatic class %s {}", innerClassName);
    int offset = document.get().indexOf("{") + 1;
    int len = 0;
    document.replace(offset, len, innerClassText);

    offset = document.get().indexOf(innerClassName);
    len = innerClassName.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
View Full Code Here


    IDocument document = getDocument(editor);
    String fieldName = "aFieldName";
    String methodText = format("private int %s = 1;", fieldName);
    int offset = document.get().indexOf("{") + 1;
    int len = 0;
    document.replace(offset, len, methodText);

    offset = document.get().indexOf(fieldName);
    len = fieldName.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
View Full Code Here

      int to= Math.min(document.getLength(), fFilterOffset + postfix.length());
      StringBuffer inDocument= new StringBuffer(document.get(fFilterOffset, to - fFilterOffset));
      truncatePostfix(inDocument, postfix);

      // 5: replace and reveal
      document.replace(fFilterOffset - prefix.length(), prefix.length() + inDocument.length(), prefix.toString() + postfix.toString());

      fContentAssistSubjectControlAdapter.setSelectedRange(fFilterOffset + postfix.length(), 0);
      fContentAssistSubjectControlAdapter.revealRange(fFilterOffset + postfix.length(), 0);
      fFilterOffset+= postfix.length();
      fLastCompletionOffset= fFilterOffset;
View Full Code Here

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

                        { // LdifContentRecord ||
                            // LdifChangeAddRecord
                            LdifAttrValLine newLine = LdifAttrValLine.create( newAttributeDescription, oldValue );
                            try
                            {
                                document.replace( line.getOffset(), line.getLength(), newLine.toFormattedString() );
                            }
                            catch ( BadLocationException e )
                            {
                                e.printStackTrace();
                            }
View Full Code Here

                        }
                    }

                    try
                    {
                        document.replace( line.getOffset(), line.getLength(), newLine.toFormattedString() );
                    }
                    catch ( BadLocationException e )
                    {
                        e.printStackTrace();
                    }
View Full Code Here

        int shift= start - oldReplaceOffset;
        int end= Math.max(getReplaceEndOffset(), offset + shift);

        // insert template string
        String templateString= templateBuffer.getString();
        document.replace(start, end - start, templateString);
      }

      // translate positions
      LinkedModeModel model= new LinkedModeModel();
      TemplateVariable[] variables= templateBuffer.getVariables();
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

                        { // LdifContentRecord ||
                          // LdifChangeAddRecord
                            LdifAttrValLine newLine = LdifAttrValLine.create( newAttributeDescription, oldValue );
                            try
                            {
                                document.replace( line.getOffset(), line.getLength(), newLine.toFormattedString( Utils
                                    .getLdifFormatParameters() ) );
                            }
                            catch ( BadLocationException e )
                            {
                                e.printStackTrace();
View Full Code Here

                        }
                    }

                    try
                    {
                        document.replace( line.getOffset(), line.getLength(), newLine.toFormattedString( Utils
                            .getLdifFormatParameters() ) );
                    }
                    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.