@Override protected TextEdit doCopy() { return new InsertEdit(this); }
/** * Creates text edits to insert the text of a new import. */ private ImportEdits placeNewImport(ImportEntry currentResultantImport, int position) { String declaration = this.declarationWriter.writeImportDeclaration(currentResultantImport.importName); return new ImportEdits( Collections.<TextEdit>emptySet(), Collections.<TextEdit>singleton(new InsertEdit(position, declaration))); }
/** * Creates text edits to insert the text of a new import. */ private ImportEdits placeNewImport(ImportEntry currentResultantImport, int position) { String declaration = this.declarationWriter.writeImportDeclaration(currentResultantImport.importName); return new ImportEdits( Collections.<TextEdit>emptySet(), Collections.<TextEdit>singleton(new InsertEdit(position, declaration))); }
/** * Creates text edits to insert the text of a new import. */ private ImportEdits placeNewImport(ImportEntry currentResultantImport, int position) { String declaration = this.declarationWriter.writeImportDeclaration(currentResultantImport.importName); return new ImportEdits( Collections.<TextEdit>emptySet(), Collections.<TextEdit>singleton(new InsertEdit(position, declaration))); }
protected void insertKey(IDocumentKey key, String name) { int offset = PropertiesUtil.getInsertOffset(fDocument); InsertEdit edit = new InsertEdit(offset, key.write()); fOperationTable.put(key, edit); if (fReadableNames != null) fReadableNames.put(edit, name); }
private TextEdit createAddTagChange(NLSElement element) { int offset= element.getTagPosition().getOffset(); //to be changed String text= ' ' + element.getTagText(); return new InsertEdit(offset, text); }
private TextEdit createAddTagChange(NLSElement element) { int offset= element.getTagPosition().getOffset(); //to be changed String text= ' ' + element.getTagText(); return new InsertEdit(offset, text); }
private void insertKey(IDocumentKey key, ArrayList<TextEdit> ops) { IDocument doc = getDocumentProvider().getDocument(getInput()); InsertEdit op = new InsertEdit(PropertiesUtil.getInsertOffset(doc), key.write()); fOperationTable.put(key, op); ops.add(op); }
private void insertKey(IDocumentKey key, ArrayList<TextEdit> ops) { IDocument doc = getDocumentProvider().getDocument(getInput()); InsertEdit op = new InsertEdit(PropertiesUtil.getInsertOffset(doc), key.write()); fOperationTable.put(key, op); ops.add(op); }
public InsertEdit insert(KeyValuePair keyValuePair) { KeyValuePairModell keyValuePairModell = new KeyValuePairModell(keyValuePair); int index = findInsertPosition(keyValuePairModell); KeyValuePairModell insertHere = (KeyValuePairModell) fKeyValuePairs.get(index); int offset = insertHere.fOffset - insertHere.fLeadingWhiteSpaces; String extra= ""; //$NON-NLS-1$ if (insertHere instanceof LastKeyValuePair && ((LastKeyValuePair)insertHere).needsNewLine()) { extra= fLineDelimiter; ((LastKeyValuePair)insertHere).resetNeedsNewLine(); } return new InsertEdit(offset, extra + keyValuePairModell.getEncodedText(fLineDelimiter)); }
@Override public boolean visit(MoveTargetEdit edit) { manageCopy(new InsertEdit(edit.getOffset(), edit.getSourceEdit().getContent())); return true; } }
@Override public boolean visit(CopyTargetEdit edit) { manageCopy(new InsertEdit(edit.getOffset(), edit.getSourceEdit().getContent())); return true; } @Override
@Override public boolean visit(MoveTargetEdit edit) { manageCopy(new InsertEdit(edit.getOffset(), edit.getSourceEdit().getContent())); return true; } }
@Override protected TextChange createTextChange() throws CoreException { init(fRefactoring); fRefactoringStatus = fRefactoring.checkFinalConditions(new NullProgressMonitor()); if (fRefactoringStatus.hasFatalError()) { TextFileChange dummyChange = new TextFileChange("fatal error", (IFile) getCompilationUnit().getResource()); //$NON-NLS-1$ dummyChange.setEdit(new InsertEdit(0, "")); //$NON-NLS-1$ return dummyChange; } return (TextChange) fRefactoring.createChange(new NullProgressMonitor()); }
@Override protected TextChange createTextChange() throws CoreException { init(fRefactoring); fRefactoringStatus= fRefactoring.checkFinalConditions(new NullProgressMonitor()); if (fRefactoringStatus.hasFatalError()) { TextFileChange dummyChange= new TextFileChange("fatal error", (IFile) getCompilationUnit().getResource()); //$NON-NLS-1$ dummyChange.setEdit(new InsertEdit(0, "")); //$NON-NLS-1$ return dummyChange; } return (TextChange) fRefactoring.createChange(new NullProgressMonitor()); }
@Override protected TextChange createTextChange() throws CoreException { init(fRefactoring); fRefactoringStatus= fRefactoring.checkFinalConditions(new NullProgressMonitor()); if (fRefactoringStatus.hasFatalError()) { TextFileChange dummyChange= new TextFileChange("fatal error", (IFile) getCompilationUnit().getResource()); //$NON-NLS-1$ dummyChange.setEdit(new InsertEdit(0, "")); //$NON-NLS-1$ return dummyChange; } return (TextChange) fRefactoring.createChange(new NullProgressMonitor()); }
private InsertEdit insertAsFirstChild(IDocumentNode node) { int offset = node.getParentNode().getOffset(); int length = getNextPosition(fDocument, offset, '>'); node.setLineIndent(node.getParentNode().getLineIndent() + 3); return new InsertEdit(offset+ length + 1, fSep + node.write(true)); }
private InsertEdit insertAfterSibling(IDocumentNode node) { IDocumentNode sibling = node.getPreviousSibling(); for (;;) { if (sibling == null) break; if (sibling.getOffset() > -1) { node.setLineIndent(sibling.getLineIndent()); return new InsertEdit(sibling.getOffset() + sibling.getLength(), fSep + node.write(true)); } sibling = sibling.getPreviousSibling(); } return null; }
private InsertEdit insertAfterSibling(IDocumentElementNode node) { IDocumentElementNode sibling = node.getPreviousSibling(); for (;;) { if (sibling == null) break; if (sibling.getOffset() > -1) { node.setLineIndent(sibling.getLineIndent()); return new InsertEdit(sibling.getOffset() + sibling.getLength(), fSep + node.write(true)); } sibling = sibling.getPreviousSibling(); } return null; }
private InsertEdit insertAsFirstChild(IDocumentElementNode node) { int offset = node.getParentNode().getOffset(); int length = getNextPosition(getDocumentProvider().getDocument(getInput()), offset, '>'); node.setLineIndent(node.getParentNode().getLineIndent() + 3); String sep = TextUtilities.getDefaultLineDelimiter(getDocumentProvider().getDocument(getInput())); return new InsertEdit(offset + length + 1, sep + node.write(true)); }