Search in sources :

Example 1 with IVirtualContainer

use of org.eclipse.wst.common.componentcore.resources.IVirtualContainer in project webtools.sourceediting by eclipse.

the class ComponentDeployable method getMembers.

protected IModuleResource[] getMembers(IVirtualContainer cont, IPath path) throws CoreException {
    IVirtualResource[] res = cont.members();
    int size2 = res.length;
    List<IModuleFile> list = new ArrayList<IModuleFile>(size2);
    for (int j = 0; j < size2; j++) {
        if (res[j] instanceof IVirtualContainer) {
            IVirtualContainer cc = (IVirtualContainer) res[j];
            // Retrieve already existing module folder if applicable
            ModuleFolder mf = (ModuleFolder) getExistingModuleResource(members, path.append(new Path(cc.getName()).makeRelative()));
            if (mf == null) {
                mf = new ModuleFolder((IContainer) cc.getUnderlyingResource(), cc.getName(), path);
                ModuleFolder parent = (ModuleFolder) getExistingModuleResource(members, path);
                if (path.isEmpty())
                    members.add(mf);
                else {
                    if (parent == null)
                        parent = ensureParentExists(path, (IContainer) cc.getUnderlyingResource());
                    addMembersToModuleFolder(parent, new IModuleResource[] { mf });
                }
            }
            IModuleResource[] mr = getMembers(cc, path.append(cc.getName()));
            addMembersToModuleFolder(mf, mr);
        } else {
            IFile f = (IFile) res[j].getUnderlyingResource();
            IModuleFile mf = null;
            if (shouldAddComponentFile(f)) {
                mf = createModuleFile(f, path);
                list.add(mf);
            }
        }
    }
    IModuleResource[] mr = new IModuleResource[list.size()];
    list.toArray(mr);
    return mr;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IModuleResource(org.eclipse.wst.server.core.model.IModuleResource) IFile(org.eclipse.core.resources.IFile) IVirtualContainer(org.eclipse.wst.common.componentcore.resources.IVirtualContainer) ArrayList(java.util.ArrayList) IVirtualResource(org.eclipse.wst.common.componentcore.resources.IVirtualResource) IModuleFile(org.eclipse.wst.server.core.model.IModuleFile) IContainer(org.eclipse.core.resources.IContainer) ModuleFolder(org.eclipse.wst.server.core.util.ModuleFolder) IModuleFolder(org.eclipse.wst.server.core.model.IModuleFolder)

Aggregations

ArrayList (java.util.ArrayList)1 IContainer (org.eclipse.core.resources.IContainer)1 IFile (org.eclipse.core.resources.IFile)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 IVirtualContainer (org.eclipse.wst.common.componentcore.resources.IVirtualContainer)1 IVirtualResource (org.eclipse.wst.common.componentcore.resources.IVirtualResource)1 IModuleFile (org.eclipse.wst.server.core.model.IModuleFile)1 IModuleFolder (org.eclipse.wst.server.core.model.IModuleFolder)1 IModuleResource (org.eclipse.wst.server.core.model.IModuleResource)1 ModuleFolder (org.eclipse.wst.server.core.util.ModuleFolder)1