Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2003-09-16 08:46:46 +0000
committerKai Maetzel2003-09-16 08:46:46 +0000
commit3762774f50810ccc1b7dbb63241156541368868c (patch)
tree745f5ccdaaeaa6708e6aece8a35dfdecfaf4cfe5 /org.eclipse.core.filebuffers
parentf7048a35fe3774d2466d8f2acce18029a07d8a74 (diff)
downloadeclipse.platform.text-3762774f50810ccc1b7dbb63241156541368868c.tar.gz
eclipse.platform.text-3762774f50810ccc1b7dbb63241156541368868c.tar.xz
eclipse.platform.text-3762774f50810ccc1b7dbb63241156541368868c.zip
bug fixing
Diffstat (limited to 'org.eclipse.core.filebuffers')
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffer.java19
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBuffer.java29
2 files changed, 22 insertions, 26 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffer.java
index 800b3ccee..493cf358d 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffer.java
@@ -125,11 +125,10 @@ public abstract class FileBuffer implements IFileBuffer {
switch (delta.getKind()) {
case IResourceDelta.CHANGED:
if ((IResourceDelta.CONTENT & delta.getFlags()) != 0) {
- if (!isDisposed() && !fCanBeSaved && fFile.isSynchronized(IFile.DEPTH_ZERO)) {
+ if (!isDisposed() && !fCanBeSaved && !isSynchronized()) {
fileChange= new SafeFileChange() {
protected void execute() throws Exception {
- if (fSynchronizationStamp != fFile.getModificationStamp())
- handleFileContentChanged();
+ handleFileContentChanged();
}
};
}
@@ -250,7 +249,19 @@ public abstract class FileBuffer implements IFileBuffer {
*/
public void commit(IProgressMonitor monitor, boolean overwrite) throws CoreException {
if (!isDisposed() && fCanBeSaved) {
- commitFileBufferContent(monitor, overwrite);
+
+ fManager.fireStateChanging(this);
+
+ try {
+ commitFileBufferContent(monitor, overwrite);
+ } catch (CoreException x) {
+ fManager.fireStateChangeFailed(this);
+ throw x;
+ } catch (RuntimeException x) {
+ fManager.fireStateChangeFailed(this);
+ throw x;
+ }
+
fCanBeSaved= false;
addFileBufferContentListeners();
fManager.fireDirtyStateChanged(this, fCanBeSaved);
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBuffer.java
index 78d1c0452..edc018868 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBuffer.java
@@ -218,30 +218,15 @@ public class TextFileBuffer extends FileBuffer implements ITextFileBuffer {
if (!overwrite)
checkSynchronizationState();
-
- fManager.fireStateChanging(this);
-
- try {
+
- // here the file synchronizer should actually be removed and afterwards added again. However,
- // we are already inside an operation, so the delta is sent AFTER we have added the listener
- fFile.setContents(stream, overwrite, true, monitor);
- // set synchronization stamp to know whether the file synchronizer must become active
- fSynchronizationStamp= fFile.getModificationStamp();
-
- } catch (CoreException x) {
- fManager.fireStateChangeFailed(this);
- throw x;
- } catch (RuntimeException x) {
- fManager.fireStateChangeFailed(this);
- throw x;
- }
-
- // If here, the editor state will be flipped to "not dirty".
- // Thus, the state changing flag will be reset and we don't have to do
- // it manually
+ // here the file synchronizer should actually be removed and afterwards added again. However,
+ // we are already inside an operation, so the delta is sent AFTER we have added the listener
+ fFile.setContents(stream, overwrite, true, monitor);
+ // set synchronization stamp to know whether the file synchronizer must become active
+ fSynchronizationStamp= fFile.getModificationStamp();
- // if there is an annotation model update it here
+ // TODO if there is an annotation model update it here
} else {

Back to the top