use of org.eclipse.wst.server.core.util.ProjectModule in project webtools.servertools by eclipse.
the class WarModuleAssembler method assemble.
public IPath assemble(IProgressMonitor monitor) throws CoreException {
IPath parent = copyModule(fModule, monitor);
IWebModule webModule = (IWebModule) fModule.loadAdapter(IWebModule.class, monitor);
IModule[] childModules = webModule.getModules();
for (int i = 0; i < childModules.length; i++) {
IModule module = childModules[i];
String uri = webModule.getURI(module);
if (uri == null) {
// The bad memories of WTP 1.0
// $NON-NLS-1$
IStatus status = new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, "unable to assemble module null uri", null);
throw new CoreException(status);
}
IJ2EEModule jeeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, monitor);
if (jeeModule != null && jeeModule.isBinary()) {
// Binary module
ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
IModuleResource[] resources = pm.members();
publishHelper.publishToPath(resources, parent.append(uri), monitor);
} else {
// Project module
packModule(module, uri, parent);
}
}
return parent;
}
use of org.eclipse.wst.server.core.util.ProjectModule in project webtools.servertools by eclipse.
the class ModuleHelper method getModuleFile.
public static IModuleFile getModuleFile(IModule module, IPath path) throws CoreException {
ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
IModuleResource[] mr = pm.members();
int size = mr.length;
for (int i = 0; i < size; i++) {
if (mr[i].getModuleRelativePath().equals(path)) {
if (mr[i] instanceof IModuleFile)
return (IModuleFile) mr[i];
return null;
} else if (mr[i].getModuleRelativePath().isPrefixOf(path))
return getModuleFile((IModuleFolder) mr[i], path);
}
return null;
}
use of org.eclipse.wst.server.core.util.ProjectModule in project webtools.servertools by eclipse.
the class ModuleHelper method countFilesInModule.
public static int countFilesInModule(IModule module) throws CoreException {
ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
IModuleResource[] mr = pm.members();
int count = 0;
int size = mr.length;
for (int i = 0; i < size; i++) {
if (mr[i] instanceof IModuleFolder)
count += countFilesInFolder((IModuleFolder) mr[i]);
else
count++;
}
return count;
}
use of org.eclipse.wst.server.core.util.ProjectModule in project webtools.servertools by eclipse.
the class ModuleHelper method getModuleFile.
public static IModuleFile getModuleFile(IModule module, IPath path) throws CoreException {
ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
IModuleResource[] mr = pm.members();
for (IModuleResource m : mr) {
if (m.getModuleRelativePath().append(m.getName()).equals(path)) {
if (m instanceof IModuleFile)
return (IModuleFile) m;
return null;
} else if (m.getModuleRelativePath().isPrefixOf(path) && m instanceof IModuleFolder) {
IModuleFile mf2 = getModuleFile((IModuleFolder) m, path);
if (mf2 != null)
return mf2;
}
}
return null;
}
use of org.eclipse.wst.server.core.util.ProjectModule in project webtools.servertools by eclipse.
the class ModuleHelper method getModuleFolder.
public static IModuleFolder getModuleFolder(IModule module, IPath path) throws CoreException {
ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
IModuleResource[] mr = pm.members();
for (IModuleResource m : mr) {
if (m.getModuleRelativePath().append(m.getName()).equals(path)) {
if (m instanceof IModuleFolder)
return (IModuleFolder) m;
return null;
} else if (m.getModuleRelativePath().isPrefixOf(path) && m instanceof IModuleFolder) {
IModuleFolder mf2 = getModuleFolder((IModuleFolder) m, path);
if (mf2 != null)
return mf2;
}
}
return null;
}
Aggregations