Search in sources :

Example 1 with IChildModuleReference

use of org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference in project webtools.sourceediting by eclipse.

the class FlatComponentDeployable method getExportModelChildren.

public IChildModuleReference[] getExportModelChildren() throws CoreException {
    IFlatVirtualComponent em = getFlatComponent();
    IChildModuleReference[] children = em.getChildModules();
    return children;
}
Also used : IFlatVirtualComponent(org.eclipse.wst.common.componentcore.internal.flat.IFlatVirtualComponent) IChildModuleReference(org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference)

Example 2 with IChildModuleReference

use of org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference in project webtools.sourceediting by eclipse.

the class FlatComponentDeployable method getURI.

/**
 * Returns the URI of the given contained CHILD module.
 *
 * SOFT requirements (NOT API!!) in use by some adopters
 * If the passed in module is equal to this module, return our own deployed name
 *
 * @param module a module
 * @return the URI of the given module, or <code>null</code> if the URI could
 *    not be found
 */
public String getURI(IModule module) {
    ProjectModule md = (ProjectModule) module.loadAdapter(ProjectModule.class, new NullProgressMonitor());
    if (md == this) {
        // guess my own name
        return VirtualReferenceUtilities.INSTANCE.getDefaultProjectArchiveName(this.component);
    }
    try {
        FlatComponentDeployable cd = (FlatComponentDeployable) module.loadAdapter(FlatComponentDeployable.class, new NullProgressMonitor());
        if (cd != null) {
            IFlatVirtualComponent em = getFlatComponent();
            IChildModuleReference[] children = em.getChildModules();
            for (int i = 0; i < children.length; i++) {
                IModule child = gatherModuleReference(component, children[i]);
                if (child != null && child.getId().equals(module.getId()))
                    return children[i].getRelativeURI().toString();
            }
        }
    } catch (CoreException ce) {
    }
    return null;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProjectModule(org.eclipse.wst.server.core.util.ProjectModule) IFlatVirtualComponent(org.eclipse.wst.common.componentcore.internal.flat.IFlatVirtualComponent) IModule(org.eclipse.wst.server.core.IModule) CoreException(org.eclipse.core.runtime.CoreException) IChildModuleReference(org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference)

Example 3 with IChildModuleReference

use of org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference in project webtools.sourceediting by eclipse.

the class FlatComponentDeployable method getModules.

public IModule[] getModules() {
    // Legacy, here in case the old modules are used
    if (component.isBinary())
        return new IModule[] {};
    try {
        List<IModule> modules = new ArrayList<IModule>();
        IChildModuleReference[] children = getExportModelChildren();
        for (int i = 0; i < children.length; i++) {
            IModule child = gatherModuleReference(component, children[i]);
            if (child != null)
                modules.add(child);
        }
        return modules.toArray(new IModule[modules.size()]);
    } catch (CoreException ce) {
    }
    return new IModule[] {};
}
Also used : IModule(org.eclipse.wst.server.core.IModule) CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) IChildModuleReference(org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference)

Aggregations

IChildModuleReference (org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference)3 CoreException (org.eclipse.core.runtime.CoreException)2 IFlatVirtualComponent (org.eclipse.wst.common.componentcore.internal.flat.IFlatVirtualComponent)2 IModule (org.eclipse.wst.server.core.IModule)2 ArrayList (java.util.ArrayList)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 ProjectModule (org.eclipse.wst.server.core.util.ProjectModule)1