use of org.eclipse.core.filebuffers.ITextFileBuffer in project eclipse.platform.text by eclipse.
the class FileBuffersForNonExistingWorkspaceFiles method testBug118199_fixed.
@Test
public void testBug118199_fixed() throws Exception {
IPath location = getPath();
IFile file = getProject().getWorkspace().getRoot().getFileForLocation(location);
if (file == null) {
// $NON-NLS-1$ //$NON-NLS-2$
throw new IOException("File '" + location + "' can not be found.");
}
IPath path = file.getFullPath();
assertFalse(file.exists());
fManager.connect(path, LocationKind.IFILE, null);
try {
ITextFileBuffer buffer = fManager.getTextFileBuffer(path, LocationKind.IFILE);
buffer.getDocument().set("test");
buffer.commit(null, false);
} finally {
fManager.disconnect(path, LocationKind.IFILE, null);
}
assertTrue(file.exists());
}
use of org.eclipse.core.filebuffers.ITextFileBuffer in project eclipse.platform.text by eclipse.
the class FileBuffersForNonExistingWorkspaceFiles method testBug118199.
@Test
public void testBug118199() throws Exception {
IFile file = getProject().getWorkspace().getRoot().getFile(getPath());
assertFalse(file.exists());
fManager.connect(getPath(), LocationKind.NORMALIZE, null);
try {
ITextFileBuffer buffer = fManager.getTextFileBuffer(getPath(), LocationKind.NORMALIZE);
buffer.getDocument().set("test");
buffer.commit(null, false);
} finally {
fManager.disconnect(getPath(), LocationKind.NORMALIZE, null);
}
assertFalse(file.exists());
}
use of org.eclipse.core.filebuffers.ITextFileBuffer in project eclipse.platform.text by eclipse.
the class FileStoreFileBufferFunctions method test1.
/*
* Tests getLocation.
*/
@Test
public void test1() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
ITextFileBuffer buffer = fManager.getFileStoreTextFileBuffer(fFileStore);
assertEquals(fFileStore, buffer.getFileStore());
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
use of org.eclipse.core.filebuffers.ITextFileBuffer in project eclipse.platform.text by eclipse.
the class FileStoreFileBufferFunctions method test9_1.
/*
* Test resetStateValidation.
*/
@Test
public void test9_1() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
ITextFileBuffer fileBuffer = fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
if (isStateValidationSupported())
assertFalse(fileBuffer.isStateValidated());
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
use of org.eclipse.core.filebuffers.ITextFileBuffer in project eclipse.platform.text by eclipse.
the class FileStoreFileBufferFunctions method testGetFileStoreFileBuffers.
@Test
public void testGetFileStoreFileBuffers() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
ITextFileBuffer buffer = fManager.getFileStoreTextFileBuffer(fFileStore);
assertNotNull(buffer);
IFileBuffer[] fileBuffers = fManager.getFileStoreFileBuffers();
assertNotNull(fileBuffers);
assertEquals(1, fileBuffers.length);
assertSame(buffer, fileBuffers[0]);
fileBuffers = fManager.getFileBuffers();
assertNotNull(fileBuffers);
assertEquals(0, fileBuffers.length);
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
Aggregations