Search in sources :

Example 1 with FolderHelper

use of org.talend.core.repository.model.FolderHelper in project tdq-studio-se by Talend.

the class WorkbenchUtils method isTDQOrMetadataRootFolder.

/**
 * if it is TDQ_Data Profiling,TDQ_Libraries or metadata.
 *
 * @param folderItem
 * @return
 */
public static boolean isTDQOrMetadataRootFolder(FolderItem folderItem, org.talend.core.model.properties.Project newProject) {
    FolderHelper folderHelper = LocalFolderHelper.createInstance(newProject, ProxyRepositoryFactory.getInstance().getRepositoryContext().getUser());
    String path = folderHelper.getFullFolderPath(folderItem);
    if (path != null && (path.startsWith(RepositoryNodeHelper.PREFIX_TDQ) || path.startsWith(EResourceConstant.METADATA.getName()))) {
        return true;
    }
    return false;
}
Also used : FolderHelper(org.talend.core.repository.model.FolderHelper) LocalFolderHelper(org.talend.repository.localprovider.model.LocalFolderHelper)

Example 2 with FolderHelper

use of org.talend.core.repository.model.FolderHelper in project tdq-studio-se by Talend.

the class RepositoryNodeBuilder method getFolderHelper.

/**
 * create a Local folder Helper
 *
 * @return Local Folder helper
 *
 * @deprecated use {@link AbstractEMFRepositoryFactory#getFolderHelper()} instead.
 */
@Deprecated
public FolderHelper getFolderHelper() {
    RepositoryContext repositoryContext = (RepositoryContext) CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
    Project project = null;
    FolderHelper folderHelper = null;
    if (repositoryContext != null) {
        project = repositoryContext.getProject();
        if (project != null) {
            folderHelper = LocalFolderHelper.createInstance(project.getEmfProject(), repositoryContext.getUser());
        }
    }
    return folderHelper;
}
Also used : Project(org.talend.core.model.general.Project) RepositoryContext(org.talend.core.context.RepositoryContext) LocalFolderHelper(org.talend.repository.localprovider.model.LocalFolderHelper) FolderHelper(org.talend.core.repository.model.FolderHelper)

Example 3 with FolderHelper

use of org.talend.core.repository.model.FolderHelper in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method createRealDataProfilingNode.

/**
 * create the real RepositoryNode for DataProfiling.
 *
 * @return
 */
public static RepositoryNode createRealDataProfilingNode(IProject project) {
    RepositoryNode node = null;
    RepositoryNodeBuilder instance = RepositoryNodeBuilder.getInstance();
    FolderHelper folderHelper = instance.getFolderHelper();
    IFolder iFolder = project.getFolder(Path.fromPortableString(ERepositoryObjectType.TDQ_DATA_PROFILING.getFolder()));
    IRepositoryViewObject viewObject = null;
    if (folderHelper != null) {
        IPath relativePath = iFolder.getFullPath().makeRelativeTo((project).getFullPath());
        FolderItem folder2 = folderHelper.getFolder(relativePath);
        if (folder2 != null && relativePath != null) {
            viewObject = new Folder(folder2.getProperty(), instance.retrieveRepObjectTypeByPath(relativePath.toOSString()));
        }
    } else {
        viewObject = new Folder(iFolder.getName(), iFolder.getName());
    }
    node = new RepositoryNode(viewObject, null, ENodeType.SYSTEM_FOLDER);
    viewObject.setRepositoryNode(node);
    return node;
}
Also used : FolderHelper(org.talend.core.repository.model.FolderHelper) FolderItem(org.talend.core.model.properties.FolderItem) IPath(org.eclipse.core.runtime.IPath) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Folder(org.talend.core.model.repository.Folder) IFolder(org.eclipse.core.resources.IFolder) RepositoryNodeBuilder(org.talend.dataprofiler.core.ui.views.provider.RepositoryNodeBuilder) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

FolderHelper (org.talend.core.repository.model.FolderHelper)3 LocalFolderHelper (org.talend.repository.localprovider.model.LocalFolderHelper)2 IFolder (org.eclipse.core.resources.IFolder)1 IPath (org.eclipse.core.runtime.IPath)1 RepositoryContext (org.talend.core.context.RepositoryContext)1 Project (org.talend.core.model.general.Project)1 FolderItem (org.talend.core.model.properties.FolderItem)1 Folder (org.talend.core.model.repository.Folder)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 RepositoryNodeBuilder (org.talend.dataprofiler.core.ui.views.provider.RepositoryNodeBuilder)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1