use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.
the class CProjectGenerator method onCreateProject.
@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
baseFolder.createFile(FILE_NAME, getClass().getClassLoader().getResourceAsStream("files/default_c_content"));
}
use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.
the class CppProjectGenerator method onCreateProject.
@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
baseFolder.createFile(FILE_NAME, getClass().getClassLoader().getResourceAsStream("files/default_cpp_content"));
}
use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.
the class SubversionProjectImporterTest method setUp.
@Before
public void setUp() throws Exception {
// Bind components
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
Multibinder.newSetBinder(binder(), ProjectImporter.class).addBinding().to(SubversionProjectImporter.class);
Multibinder.newSetBinder(binder(), ProjectTypeDef.class).addBinding().to(SubversionProjectType.class);
Multibinder.newSetBinder(binder(), ValueProviderFactory.class).addBinding().to(SubversionValueProviderFactory.class);
bind(SshKeyProvider.class).toInstance(sshKeyProvider);
bind(ProfileDao.class).toInstance(userProfileDao);
bind(RepositoryUrlProvider.class).toInstance(repositoryUrlProvider);
}
});
// Init virtual file system
VirtualFileSystem virtualFileSystem = TestUtils.createVirtualFileSystem();
root = virtualFileSystem.getRoot();
// Create the test user
TestUtils.createTestUser(userProfileDao);
// Create the Subversion repository
repoRoot = TestUtils.createGreekTreeRepository();
projectImporter = injector.getInstance(SubversionProjectImporter.class);
}
use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.
the class MemoryVirtualFileSystemProviderTest method resetsVirtualFileSystemInProviderAfterClosingVirtualFileSystem.
@Test
public void resetsVirtualFileSystemInProviderAfterClosingVirtualFileSystem() throws Exception {
VirtualFileSystem fileSystem = fileSystemProvider.getVirtualFileSystem(true);
assertNotNull(fileSystem);
fileSystem.close();
assertNull(fileSystemProvider.getVirtualFileSystem(false));
}
use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.
the class JsonExampleCreateProjectHandler method onCreateProject.
@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
try (InputStream packageJson = getClass().getClassLoader().getResourceAsStream("files/default_package");
InputStream personJson = getClass().getClassLoader().getResourceAsStream("files/default_person")) {
FolderEntry myJsonFiles = baseFolder.createFolder("myJsonFiles");
baseFolder.createFile(FILE_NAME, packageJson);
myJsonFiles.createFile("person.json", personJson);
} catch (IOException ioEx) {
throw new ServerException(ioEx.getLocalizedMessage(), ioEx);
}
}
Aggregations