Package org.eclipse.jface.text

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


                                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

    builder.append("}");

    String content = document.get();
    int offset = content.indexOf("{") + 1;
    int len = 0;
    document.replace(offset, len, builder.toString());

    content = document.get();
    offset = content.indexOf("Runnable", content.indexOf("Runnable") + 1);
    len = "Runnable".length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
View Full Code Here

    // errors to the class:

    String field = "private int aVeryUniqueFieldName = 0;";
    int offset = document.get().lastIndexOf('}') - 1;
    int len = 0;
    document.replace(offset, len, field);

    // Set the editor to select the field:
    offset = document.get().indexOf(field);
    len = field.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
View Full Code Here

    // Now delete the field statement from the source file, note that there
    // is no need to save the document (and we should not save the document,
    // other tests may depend on it):
    offset = document.get().indexOf(field);
    len = field.length();
    document.replace(offset, len, "");

    // Ask the tracker to save the data, the data should be appropriately
    // filtered
    tracker.saveData();
View Full Code Here

    final IDocument document = getDocument(editor);
    String importStatement = "import java.util.*;";
    int offset = document.get().indexOf(";") + 1; // Position after package
    // declaration
    int len = 0;
    document.replace(offset, len, importStatement);

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

    IDocument document = getDocument(editor);
    String staticName = "static";
    String methodText = staticName + " {}";
    int offset = document.get().indexOf("{") + 1;
    int len = 0;
    document.replace(offset, len, methodText);

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

    anonymous.append("  };");
    anonymous.append("}");

    int offset = document.get().indexOf("{") + 1;
    int len = 0;
    document.replace(offset, len, anonymous.toString());

    String content = document.get();
    offset = content.indexOf("run", content.indexOf("run") + 1);
    len = "run".length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
View Full Code Here

    IDocument document = getDocument(editor);
    String methodName = "aMethodName";
    String methodText = format("void %s() {}", methodName);
    int offset = document.get().indexOf("{") + 1;
    int length = 0;
    document.replace(offset, length, methodText);

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

    anonymous.append("  };");
    anonymous.append("}");

    int offset = document.get().indexOf("{") + 1;
    int len = 0;
    document.replace(offset, len, anonymous.toString());

    offset = document.get().indexOf("Runnable");
    len = "Runnable".length();
    ITextSelection selection = new TextSelection(offset, len);
    editor.getSelectionProvider().setSelection(selection);
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.