@Override public Change perform(IProgressMonitor pm) throws CoreException { try { UndoEdit redo= performEdits(); Change result= new UndoDocumentChange(getName(), fDocument, redo); return result; } catch (MalformedTreeException e) { throw Changes.asCoreException(e); } catch (BadLocationException e) { throw Changes.asCoreException(e); } }
@Override public Change perform(IProgressMonitor pm) throws CoreException { try { UndoEdit redo= performEdits(); Change result= new UndoDocumentChange(getName(), fDocument, redo); return result; } catch (MalformedTreeException e) { throw Changes.asCoreException(e); } catch (BadLocationException e) { throw Changes.asCoreException(e); } }
/** * {@inheritDoc} */ public Change perform(IProgressMonitor pm) throws CoreException { try { UndoEdit redo= fUndo.apply(fDocument, TextEdit.CREATE_UNDO); Change result= new UndoDocumentChange(getName(), fDocument, redo); return result; } catch (BadLocationException e) { throw Changes.asCoreException(e); } } }
public static boolean set(IDocument document, ContentStamp s) throws CoreException { if (!(s instanceof ContentStampImpl)) return false; ContentStampImpl stamp= (ContentStampImpl)s; if (document instanceof IDocumentExtension4 && stamp.isDocumentStamp()) { try { ((IDocumentExtension4)document).replace(0, 0, "", stamp.getValue()); //$NON-NLS-1$ return true; } catch (BadLocationException e) { throw Changes.asCoreException(e); } } return false; } }
public static boolean set(IDocument document, ContentStamp s) throws CoreException { if (!(s instanceof ContentStampImpl)) return false; ContentStampImpl stamp= (ContentStampImpl)s; if (document instanceof IDocumentExtension4 && stamp.isDocumentStamp()) { try { ((IDocumentExtension4)document).replace(0, 0, "", stamp.getValue()); //$NON-NLS-1$ return true; } catch (BadLocationException e) { throw Changes.asCoreException(e); } } return false; } }
public static boolean set(IDocument document, ContentStamp s) throws CoreException { if (!(s instanceof ContentStampImpl)) return false; ContentStampImpl stamp= (ContentStampImpl)s; if (document instanceof IDocumentExtension4 && stamp.isDocumentStamp()) { try { ((IDocumentExtension4)document).replace(0, 0, "", stamp.getValue()); //$NON-NLS-1$ return true; } catch (BadLocationException e) { throw Changes.asCoreException(e); } } return false; } }
@Override public Change perform(IProgressMonitor pm) throws CoreException { pm.beginTask("", 3); //$NON-NLS-1$ IDocument document= null; try { document= acquireDocument(new SubProgressMonitor(pm, 1)); UndoEdit undo= performEdits(document); commit(document, new SubProgressMonitor(pm, 1)); return createUndoChange(undo); } catch (BadLocationException e) { throw Changes.asCoreException(e); } catch (MalformedTreeException e) { throw Changes.asCoreException(e); } finally { releaseDocument(document, new SubProgressMonitor(pm, 1)); pm.done(); } }
@Override public Change perform(IProgressMonitor pm) throws CoreException { pm.beginTask("", 3); //$NON-NLS-1$ IDocument document= null; try { document= acquireDocument(new SubProgressMonitor(pm, 1)); UndoEdit undo= performEdits(document); commit(document, new SubProgressMonitor(pm, 1)); return createUndoChange(undo); } catch (BadLocationException e) { throw Changes.asCoreException(e); } catch (MalformedTreeException e) { throw Changes.asCoreException(e); } finally { releaseDocument(document, new SubProgressMonitor(pm, 1)); pm.done(); } }
@Override public final Change perform(final IProgressMonitor monitor) throws CoreException { monitor.beginTask("", 3); //$NON-NLS-1$ IDocument document= null; try { document= acquireDocument(new SubProgressMonitor(monitor, 1)); final LinkedList<UndoEdit> undoList= new LinkedList<>(); performChanges(document, undoList, false); if (needsSaving()) fBuffer.commit(new SubProgressMonitor(monitor, 1), false); return new MultiStateUndoChange(getName(), fFile, undoList.toArray(new UndoEdit[undoList.size()]), fContentStamp, fSaveMode); } catch (BadLocationException exception) { throw Changes.asCoreException(exception); } finally { if (document != null) { releaseDocument(document, new SubProgressMonitor(monitor, 1)); } monitor.done(); } }
@Override public final Change perform(final IProgressMonitor monitor) throws CoreException { monitor.beginTask("", 3); //$NON-NLS-1$ IDocument document= null; try { document= acquireDocument(new SubProgressMonitor(monitor, 1)); final LinkedList<UndoEdit> undoList= new LinkedList<>(); performChanges(document, undoList, false); if (needsSaving()) fBuffer.commit(new SubProgressMonitor(monitor, 1), false); return new MultiStateUndoChange(getName(), fFile, undoList.toArray(new UndoEdit[undoList.size()]), fContentStamp, fSaveMode); } catch (BadLocationException exception) { throw Changes.asCoreException(exception); } finally { if (document != null) { releaseDocument(document, new SubProgressMonitor(monitor, 1)); } monitor.done(); } }
public final Change perform(final IProgressMonitor monitor) throws CoreException { monitor.beginTask("", 3); //$NON-NLS-1$ IDocument document= null; DocumentRewriteSession session= null; try { document= acquireDocument(new SubProgressMonitor(monitor, 1)); if (document instanceof IDocumentExtension4) session= ((IDocumentExtension4) document).startRewriteSession(DocumentRewriteSessionType.UNRESTRICTED); final LinkedList undoList= new LinkedList(); performChanges(document, undoList, false); if (needsSaving()) fBuffer.commit(new SubProgressMonitor(monitor, 1), false); return new MultiStateUndoChange(getName(), fFile, (UndoEdit[]) undoList.toArray(new UndoEdit[undoList.size()]), fContentStamp, fSaveMode); } catch (BadLocationException exception) { throw Changes.asCoreException(exception); } finally { if (document != null) { try { if (session != null) ((IDocumentExtension4) document).stopRewriteSession(session); } finally { releaseDocument(document, new SubProgressMonitor(monitor, 1)); } } monitor.done(); } }
throw Changes.asCoreException(exception); } finally { if (document != null) {
throw Changes.asCoreException(exception); } finally { if (document != null) {
return createUndoChange(undo); } catch (BadLocationException e) { throw Changes.asCoreException(e); } finally { if (document != null) {
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); } }
throw Changes.asCoreException(e);
throw Changes.asCoreException(e);
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); } }