mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Fixed an NPE (bug 248359, comment #22)
This commit is contained in:
parent
6d64bcb42a
commit
3bd59df377
1 changed files with 5 additions and 13 deletions
|
@ -82,7 +82,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
|||
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||
|
||||
import org.eclipse.cdt.internal.core.model.CommitWorkingCopyOperation;
|
||||
import org.eclipse.cdt.internal.core.model.IBufferFactory;
|
||||
import org.eclipse.cdt.internal.core.model.TranslationUnit;
|
||||
|
||||
|
@ -963,14 +962,8 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
|||
IDocument document= info.fTextFileBuffer.getDocument();
|
||||
IResource resource= info.fCopy.getResource();
|
||||
|
||||
boolean isSynchronized= resource.isSynchronized(IResource.DEPTH_ZERO);
|
||||
|
||||
// Make sure file gets save in commit() if the underlying file has been deleted
|
||||
if (!isSynchronized && isDeleted(element))
|
||||
info.fTextFileBuffer.setDirty(true);
|
||||
|
||||
if (resource instanceof IFile && !resource.exists()) {
|
||||
// Underlying resource has been deleted, just recreate file, ignore the rest
|
||||
// The underlying resource has been deleted, just recreate the file, ignore the rest
|
||||
createFileFromDocument(monitor, (IFile) resource, document);
|
||||
return;
|
||||
}
|
||||
|
@ -983,18 +976,17 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
|||
saveActionException = e;
|
||||
}
|
||||
|
||||
CommitWorkingCopyOperation op= new CommitWorkingCopyOperation(info.fCopy, isSynchronized || overwrite);
|
||||
op.runOperation(getSubProgressMonitor(monitor, 80));
|
||||
commitFileBuffer(monitor, info, overwrite);
|
||||
|
||||
if (saveActionException != null) {
|
||||
throw saveActionException;
|
||||
}
|
||||
} catch (CoreException x) {
|
||||
// inform about the failure
|
||||
// Inform about the failure
|
||||
fireElementStateChangeFailed(element);
|
||||
throw x;
|
||||
} catch (RuntimeException x) {
|
||||
// inform about the failure
|
||||
// Inform about the failure
|
||||
fireElementStateChangeFailed(element);
|
||||
throw x;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue