public final void initializeValidationData(final IProgressMonitor monitor) { monitor.beginTask("", 1); //$NON-NLS-1$ fValidationState= BufferValidationState.create(fFile); monitor.worked(1); }
@Override public void dispose() { if (fValidationState != null) { fValidationState.dispose(); } }
protected IDocument getDocument() { ITextFileBuffer buffer= getBuffer(fFile); if (buffer == null) return null; return buffer.getDocument(); }
public RefactoringStatus isValid(boolean needsSaving) throws CoreException { return isValid(needsSaving, false); }
protected BufferValidationState(IFile file) { fFile= file; fExisted= file.exists(); fDerived= file.isDerived(); fWasDirty= isDirty(fFile); String encoding; try { encoding= file.getCharset(true); } catch (CoreException e) { encoding= null; } fEncoding= encoding; }
/** * Does the text file change need saving? * <p> * The implementation of this method returns <code>true</code> if the * <code>FORCE_SAVE</code> flag is enabled, or the underlying file is not * dirty and <code>KEEP_SAVE_STATE</code> is enabled. * </p> * * @return <code>true</code> if it needs saving according to its dirty * state and the save mode flags, <code>false</code> otherwise * @since 3.3 */ protected boolean needsSaving() { if ((fSaveMode & FORCE_SAVE) != 0) { return true; } if ((fSaveMode & KEEP_SAVE_STATE) != 0) { return fValidationState == null || !fValidationState.wasDirty(); } return false; } }
if (fValidationState == null || !fValidationState.wasDerived()) throw Changes.asCoreException(e); else return new NullChange(); } catch (MalformedTreeException e) { if (fValidationState == null || !fValidationState.wasDerived()) throw Changes.asCoreException(e); else return new NullChange(); } catch (CoreException e) { if (fValidationState == null || !fValidationState.wasDerived()) throw e; else
public RefactoringStatus isValid(boolean needsSaving) throws CoreException { return isValid(needsSaving, false); }
protected BufferValidationState(IFile file) { fFile= file; fExisted= file.exists(); fDerived= file.isDerived(); fWasDirty= isDirty(fFile); String encoding; try { encoding= file.getCharset(true); } catch (CoreException e) { encoding= null; } fEncoding= encoding; }
/** * Does the text file change need saving? * <p> * The implementation of this method returns <code>true</code> if the * <code>FORCE_SAVE</code> flag is enabled, or the underlying file is not * dirty and <code>KEEP_SAVE_STATE</code> is enabled. * </p> * * @return <code>true</code> if it needs saving according to its dirty * state and the save mode flags, <code>false</code> otherwise * @since 3.3 */ protected boolean needsSaving() { if ((fSaveMode & FORCE_SAVE) != 0) { return true; } if ((fSaveMode & KEEP_SAVE_STATE) != 0) { return fValidationState == null || !fValidationState.wasDirty(); } return false; } }
if (fValidationState == null || !fValidationState.wasDerived()) throw Changes.asCoreException(e); else return new NullChange(); } catch (MalformedTreeException e) { if (fValidationState == null || !fValidationState.wasDerived()) throw Changes.asCoreException(e); else return new NullChange(); } catch (CoreException e) { if (fValidationState == null || !fValidationState.wasDerived()) throw e; else
public RefactoringStatus isValid(boolean needsSaving) throws CoreException { return isValid(needsSaving, false); }
/** * {@inheritDoc} */ public void initializeValidationData(IProgressMonitor monitor) { try { monitor.beginTask("", 1); //$NON-NLS-1$ fValidationState= BufferValidationState.create(fFile); } finally { monitor.done(); } }
@Override public final void dispose() { if (fValidationState != null) { fValidationState.dispose(); } }
protected IDocument getDocument() { ITextFileBuffer buffer= getBuffer(fFile); if (buffer == null) return null; return buffer.getDocument(); }
protected BufferValidationState(IFile file) { fFile= file; fExisted= file.exists(); fDerived= file.isDerived(); fWasDirty= isDirty(fFile); String encoding; try { encoding= file.getCharset(true); } catch (CoreException e) { encoding= null; } fEncoding= encoding; }
/** * Does the text file change need saving? * <p> * The implementation of this method returns <code>true</code> if the * <code>FORCE_SAVE</code> flag is enabled, or the underlying file is not * dirty and <code>KEEP_SAVE_STATE</code> is enabled. * </p> * * @return <code>true</code> if it needs saving according to its dirty * state and the save mode flags, <code>false</code> otherwise * @since 3.3 */ protected boolean needsSaving() { if ((fSaveMode & FORCE_SAVE) != 0) { return true; } if ((fSaveMode & KEEP_SAVE_STATE) != 0) { return fValidationState == null || !fValidationState.wasDirty(); } return false; } }
if (! fValidationState.wasDerived()) throw Changes.asCoreException(e); else return new NullChange(); } catch (MalformedTreeException e) { if (! fValidationState.wasDerived()) throw Changes.asCoreException(e); else return new NullChange(); } catch (CoreException e) { if (! fValidationState.wasDerived()) throw e; else
@Override public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException { if (pm == null) pm= new NullProgressMonitor(); pm.beginTask("", 1); //$NON-NLS-1$ try { if (fValidationState == null) throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), "UndoTextFileChange has not been initialialized")); //$NON-NLS-1$ ITextFileBuffer buffer= FileBuffers.getTextFileBufferManager().getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE); fDirty= buffer != null && buffer.isDirty(); return fValidationState.isValid(needsSaving(), true); } finally { pm.done(); } }
@Override public void initializeValidationData(IProgressMonitor pm) { if (pm == null) pm= new NullProgressMonitor(); pm.beginTask("", 1); //$NON-NLS-1$ try { fValidationState= BufferValidationState.create(fFile); } finally { pm.done(); } }