/** * {@inheritDoc} */ public String getCurrentContent(IProgressMonitor pm) throws CoreException { return getCurrentDocument(pm).get(); }
@Override public String getCurrentContent(IProgressMonitor pm) throws CoreException { return getCurrentDocument(pm).get(); }
@Override public String getCurrentContent(IProgressMonitor pm) throws CoreException { return getCurrentDocument(pm).get(); }
/** * Creates the text change for this proposal. * This method is only called once and only when no text change has been passed in * {@link #CUCorrectionProposal(String, ICompilationUnit, TextChange, int, Image)}. * * @return the created text change * @throws CoreException if the creation of the text change failed */ protected TextChange createTextChange() throws CoreException { TextChange change = fProposalCore.getNewChange(); // initialize text change IDocument document= change.getCurrentDocument(new NullProgressMonitor()); addEdits(document, change.getEdit()); return change; }
/** * Creates the text change for this proposal. * This method is only called once and only when no text change has been passed in * {see #CUCorrectionProposal(String, ICompilationUnit, TextChange, int, Image)}. * * @return the created text change * @throws CoreException if the creation of the text change failed */ public TextChange createTextChange() throws CoreException { TextChange change = getNewChange(); // initialize text change IDocument document= change.getCurrentDocument(new NullProgressMonitor()); addEdits(document, change.getEdit()); return change; }
private static void addChanges(TextChange textChange, NLSSubstitution[] substitutions) throws CoreException { PropertyFileDocumentModel model= new PropertyFileDocumentModel(textChange.getCurrentDocument(new NullProgressMonitor())); Map<String, NLSSubstitution> newKeyToSubstMap= getNewKeyToSubstitutionMap(substitutions); Map<String, NLSSubstitution> oldKeyToSubstMap= getOldKeyToSubstitutionMap(substitutions); addInsertEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); addRemoveEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); addReplaceEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); }
private static void addChanges(TextChange textChange, NLSSubstitution[] substitutions) throws CoreException { PropertyFileDocumentModel model= new PropertyFileDocumentModel(textChange.getCurrentDocument(new NullProgressMonitor())); Map newKeyToSubstMap= getNewKeyToSubstitutionMap(substitutions); Map oldKeyToSubstMap= getOldKeyToSubstitutionMap(substitutions); addInsertEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); addRemoveEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); addReplaceEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); }
private static void addChanges(TextChange textChange, NLSSubstitution[] substitutions) throws CoreException { PropertyFileDocumentModel model= new PropertyFileDocumentModel(textChange.getCurrentDocument(new NullProgressMonitor())); Map<String, NLSSubstitution> newKeyToSubstMap= getNewKeyToSubstitutionMap(substitutions); Map<String, NLSSubstitution> oldKeyToSubstMap= getOldKeyToSubstitutionMap(substitutions); addInsertEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); addRemoveEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); addReplaceEdits(textChange, substitutions, newKeyToSubstMap, oldKeyToSubstMap, model); }
IDocument currentContent= change.getCurrentDocument(monitor);
public static Change removeKeys(IPath propertyFilePath, List<String> keys) throws CoreException { String name= Messages.format(NLSMessages.NLSPropertyFileModifier_remove_from_property_file, BasicElementLabels.getPathLabel(propertyFilePath, false)); TextChange textChange= new TextFileChange(name, getPropertyFile(propertyFilePath)); textChange.setTextType("properties"); //$NON-NLS-1$ PropertyFileDocumentModel model= new PropertyFileDocumentModel(textChange.getCurrentDocument(new NullProgressMonitor())); for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) { String key= iterator.next(); TextEdit edit= model.remove(key); if (edit != null) { TextChangeCompatibility.addTextEdit(textChange, Messages.format(NLSMessages.NLSPropertyFileModifier_remove_entry, BasicElementLabels.getJavaElementName(key)), edit); } } return textChange; }
public static Change removeKeys(IPath propertyFilePath, List<String> keys) throws CoreException { String name= Messages.format(NLSMessages.NLSPropertyFileModifier_remove_from_property_file, BasicElementLabels.getPathLabel(propertyFilePath, false)); TextChange textChange= new TextFileChange(name, getPropertyFile(propertyFilePath)); textChange.setTextType("properties"); //$NON-NLS-1$ PropertyFileDocumentModel model= new PropertyFileDocumentModel(textChange.getCurrentDocument(new NullProgressMonitor())); for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) { String key= iterator.next(); TextEdit edit= model.remove(key); if (edit != null) { TextChangeCompatibility.addTextEdit(textChange, Messages.format(NLSMessages.NLSPropertyFileModifier_remove_entry, BasicElementLabels.getJavaElementName(key)), edit); } } return textChange; }
@Override public String getCurrentContent(IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm) throws CoreException { Assert.isNotNull(region); Assert.isTrue(surroundingLines >= 0); IDocument document= getCurrentDocument(pm); Assert.isTrue(document.getLength() >= region.getOffset() + region.getLength()); return getContent(document, region, expandRegionToFullLine, surroundingLines); }
@Override public String getCurrentContent(IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm) throws CoreException { Assert.isNotNull(region); Assert.isTrue(surroundingLines >= 0); IDocument document= getCurrentDocument(pm); Assert.isTrue(document.getLength() >= region.getOffset() + region.getLength()); return getContent(document, region, expandRegionToFullLine, surroundingLines); }
/** * {@inheritDoc} */ public String getCurrentContent(IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm) throws CoreException { Assert.isNotNull(region); Assert.isTrue(surroundingLines >= 0); IDocument document= getCurrentDocument(pm); Assert.isTrue(document.getLength() >= region.getOffset() + region.getLength()); return getContent(document, region, expandRegionToFullLine, surroundingLines); }
addEdits(change.getCurrentDocument(new NullProgressMonitor()), rootEdit); return change;
IDocument document= change.getCurrentDocument(new NullProgressMonitor()); addEdits(document, rootEdit); return change;
IDocument document= change.getCurrentDocument(new NullProgressMonitor()); addEdits(document, rootEdit); return change;
private PreviewAndRegion getPreviewDocument(TextEditBasedChangeGroup[] changes, IProgressMonitor pm) throws CoreException { IDocument document= new Document(getCurrentDocument(pm).get()); boolean trackChanges= getKeepPreviewEdits(); setKeepPreviewEdits(true); TextEditProcessor processor= changes == ALL_EDITS ? createTextEditProcessor(document, TextEdit.NONE, true) : createTextEditProcessor(document, TextEdit.NONE, changes); try { processor.performEdits(); return new PreviewAndRegion(document, getNewRegion(changes)); } catch (BadLocationException e) { throw Changes.asCoreException(e); } finally { setKeepPreviewEdits(trackChanges); } }
private PreviewAndRegion getPreviewDocument(TextEditBasedChangeGroup[] changes, IProgressMonitor pm) throws CoreException { IDocument document= new Document(getCurrentDocument(pm).get()); boolean trackChanges= getKeepPreviewEdits(); setKeepPreviewEdits(true); TextEditProcessor processor= changes == ALL_EDITS ? createTextEditProcessor(document, TextEdit.NONE, true) : createTextEditProcessor(document, TextEdit.NONE, changes); try { processor.performEdits(); return new PreviewAndRegion(document, getNewRegion(changes)); } catch (BadLocationException e) { throw Changes.asCoreException(e); } finally { setKeepPreviewEdits(trackChanges); } }
private PreviewAndRegion getPreviewDocument(TextEditBasedChangeGroup[] changes, IProgressMonitor pm) throws CoreException { IDocument document= new Document(getCurrentDocument(pm).get()); boolean trackChanges= getKeepPreviewEdits(); setKeepPreviewEdits(true); TextEditProcessor processor= changes == ALL_EDITS ? createTextEditProcessor(document, TextEdit.NONE, true) : createTextEditProcessor(document, TextEdit.NONE, changes); try { processor.performEdits(); return new PreviewAndRegion(document, getNewRegion(changes)); } catch (BadLocationException e) { throw Changes.asCoreException(e); } finally { setKeepPreviewEdits(trackChanges); } }