Search in sources :

Example 66 with IFolder

use of org.eclipse.core.resources.IFolder in project tdi-studio-se by Talend.

the class JobScriptsManager method addNodeToResource.

protected void addNodeToResource(IResource[] resources, List<IResource> sourceFile) throws CoreException {
    for (IResource resource : resources) {
        if (resource instanceof IFolder) {
            IFolder folder = (IFolder) resource;
            addNodeToResource(folder.members(), sourceFile);
        }
        if (resource instanceof IFile) {
            sourceFile.add(resource);
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IResource(org.eclipse.core.resources.IResource) IFolder(org.eclipse.core.resources.IFolder)

Example 67 with IFolder

use of org.eclipse.core.resources.IFolder in project tdi-studio-se by Talend.

the class UserComponentsProviderTest method test_preComponentsLoad_oldComponentsInProject_Zip.

@Test
public void test_preComponentsLoad_oldComponentsInProject_Zip() throws Exception {
    File testDataFile = getTestDataFile(PATH_OLD_COMPONENT);
    Assert.assertTrue(testDataFile.exists());
    final Project currentProject = ProjectManager.getInstance().getCurrentProject();
    final IProject project = ResourceUtils.getProject(currentProject);
    final IFolder projectComponentsFolder = project.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS));
    Assert.assertTrue(projectComponentsFolder.exists());
    FilesUtils.copyFile(testDataFile, new File(projectComponentsFolder.getLocation().toFile(), testDataFile.getName()));
    UserComponentsProviderTestClass provider = new UserComponentsProviderTestClass() {

        protected File getExternalComponentsLocation() {
            return workFolder;
        }
    };
    provider.preComponentsLoad();
    testEmpty(provider);
}
Also used : Project(org.talend.core.model.general.Project) IProject(org.eclipse.core.resources.IProject) File(java.io.File) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder) Test(org.junit.Test)

Example 68 with IFolder

use of org.eclipse.core.resources.IFolder in project tdi-studio-se by Talend.

the class UserComponentsProviderTest method test_preComponentsLoad_oldComponentsInProject_Folder.

@Test
public void test_preComponentsLoad_oldComponentsInProject_Folder() throws Exception {
    final String componentName = "tHTMLInput";
    File testDataFile = getTestDataFile(PATH_OLD_COMPONENT);
    Assert.assertTrue(testDataFile.exists());
    final Project currentProject = ProjectManager.getInstance().getCurrentProject();
    final IProject project = ResourceUtils.getProject(currentProject);
    final IFolder projectComponentsFolder = project.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS));
    Assert.assertTrue(projectComponentsFolder.exists());
    FilesUtils.unzip(testDataFile.getAbsolutePath(), projectComponentsFolder.getLocation().toFile().getAbsolutePath());
    UserComponentsProviderTestClass provider = new UserComponentsProviderTestClass() {

        protected File getExternalComponentsLocation() {
            return workFolder;
        }
    };
    provider.preComponentsLoad();
    File installationFolder = provider.getInstallationFolder();
    Assert.assertTrue(installationFolder.exists());
    Assert.assertEquals(1, installationFolder.list().length);
    File compFolder = new File(installationFolder, componentName);
    Assert.assertTrue(compFolder.exists());
    Assert.assertTrue(new File(compFolder, componentName + "_java.xml").exists());
}
Also used : Project(org.talend.core.model.general.Project) IProject(org.eclipse.core.resources.IProject) File(java.io.File) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder) Test(org.junit.Test)

Example 69 with IFolder

use of org.eclipse.core.resources.IFolder in project tdi-studio-se by Talend.

the class Log4jPrefsSettingManager method isLog4jPrefsExist.

public boolean isLog4jPrefsExist() {
    try {
        IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
        IFolder prefSettingFolder = ResourceUtils.getFolder(project, RepositoryConstants.SETTING_DIRECTORY, false);
        IFile presLog4jFile = prefSettingFolder.getFile(Log4jPrefsConstants.LOG4J_RESOURCES + Log4jPrefsConstants.LOG4j_PREFS_SUFFIX);
        if (presLog4jFile.exists()) {
            return true;
        }
    } catch (PersistenceException e) {
        e.printStackTrace();
    }
    return false;
}
Also used : IFile(org.eclipse.core.resources.IFile) PersistenceException(org.talend.commons.exception.PersistenceException) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder)

Example 70 with IFolder

use of org.eclipse.core.resources.IFolder in project tdi-studio-se by Talend.

the class TalendProcessJavaProjectTest method testGetSrcSubFolder.

/**
     * Test method for
     * {@link org.talend.designer.runprocess.java.TalendProcessJavaProject#getSrcSubFolder(org.eclipse.core.runtime.IProgressMonitor, java.lang.String)}
     * .
     */
@Test
public void testGetSrcSubFolder() {
    IFolder srcFolder = talendJavaProject.getSrcFolder();
    Assert.assertNotNull(srcFolder);
    Assert.assertTrue(srcFolder.exists());
    IFolder testFolder = talendJavaProject.getSrcSubFolder(null, "test1");
    Assert.assertNotNull(srcFolder);
    Assert.assertTrue(testFolder.exists());
    Assert.assertTrue(testFolder.getLocation().toFile().exists());
    Assert.assertEquals("test1", testFolder.getName());
    Assert.assertEquals(MavenSystemFolders.JAVA.getPath() + "/test1", testFolder.getProjectRelativePath().toString());
}
Also used : IFolder(org.eclipse.core.resources.IFolder) Test(org.junit.Test)

Aggregations

IFolder (org.eclipse.core.resources.IFolder)299 IFile (org.eclipse.core.resources.IFile)129 IPath (org.eclipse.core.runtime.IPath)90 IProject (org.eclipse.core.resources.IProject)77 CoreException (org.eclipse.core.runtime.CoreException)72 IResource (org.eclipse.core.resources.IResource)66 Path (org.eclipse.core.runtime.Path)47 IContainer (org.eclipse.core.resources.IContainer)45 File (java.io.File)43 Test (org.junit.Test)36 ArrayList (java.util.ArrayList)31 IOException (java.io.IOException)28 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)26 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)23 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)19 InputStream (java.io.InputStream)18 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)17 IRunProcessService (org.talend.designer.runprocess.IRunProcessService)17 PersistenceException (org.talend.commons.exception.PersistenceException)16 ByteArrayInputStream (java.io.ByteArrayInputStream)15