Search in sources :

Example 21 with IVirtualComponent

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

the class FacetModuleCoreSupportDelegate method getReferenced.

static IProject[] getReferenced(IProject current) {
    if (!ModuleCoreNature.isFlexibleProject(current))
        return new IProject[0];
    Set projects = new HashSet();
    IVirtualReference[] references = ComponentCore.createComponent(current).getReferences();
    if (references != null) {
        for (int i = 0; i < references.length; i++) {
            IVirtualComponent referencedComponent = references[i].getReferencedComponent();
            if (referencedComponent == null)
                continue;
            IProject project = referencedComponent.getProject();
            if (project == null || project.equals(current))
                continue;
            projects.add(project);
        }
    }
    return (IProject[]) projects.toArray(new IProject[projects.size()]);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) IVirtualReference(org.eclipse.wst.common.componentcore.resources.IVirtualReference) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) IProject(org.eclipse.core.resources.IProject) HashSet(java.util.HashSet)

Example 22 with IVirtualComponent

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

the class SimpleWebFacetInstallDelegate method execute.

@Override
public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
    if (monitor != null)
        // $NON-NLS-1$
        monitor.beginTask("", 1);
    try {
        IDataModel model = (IDataModel) config;
        addNatures(project);
        final IVirtualComponent c = ComponentCore.createComponent(project, false);
        c.create(0, null);
        final IWorkspace ws = ResourcesPlugin.getWorkspace();
        final IPath pjpath = project.getFullPath();
        final IPath contentdir = setContentPropertyIfNeeded(model, pjpath, project);
        mkdirs(ws.getRoot().getFolder(contentdir));
        final IVirtualFolder webroot = c.getRootFolder();
        if (webroot.getProjectRelativePath().equals(new Path("/"))) {
            // $NON-NLS-1$
            // $NON-NLS-1$
            webroot.createLink(new Path("/" + model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTENT_DIR)), 0, null);
        }
        ComponentUtilities.setServerContextRoot(project, model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTEXT_ROOT));
        try {
            ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
        } catch (ExecutionException e) {
            WSTWebPlugin.logError(e);
        }
    } finally {
        if (monitor != null)
            monitor.done();
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IWorkspace(org.eclipse.core.resources.IWorkspace) IVirtualFolder(org.eclipse.wst.common.componentcore.resources.IVirtualFolder) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) ExecutionException(org.eclipse.core.commands.ExecutionException) IDataModelOperation(org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation)

Example 23 with IVirtualComponent

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

the class ComponentDeployable method addUtilMembers.

protected void addUtilMembers(IVirtualComponent vc) {
    ArtifactEdit edit = null;
    try {
        edit = getComponentArtifactEditForRead();
        IVirtualReference[] components = vc.getReferences();
        for (int i = 0; i < components.length; i++) {
            IVirtualReference reference = components[i];
            IVirtualComponent virtualComp = reference.getReferencedComponent();
            if (shouldIncludeUtilityComponent(virtualComp, components, edit)) {
                addUtilMember(vc, reference, reference.getRuntimePath());
            }
        }
    } finally {
        if (edit != null)
            edit.dispose();
    }
}
Also used : IVirtualReference(org.eclipse.wst.common.componentcore.resources.IVirtualReference) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) ArtifactEdit(org.eclipse.wst.common.componentcore.ArtifactEdit)

Example 24 with IVirtualComponent

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

the class ComponentDeployable method getModules.

public IModule[] getModules() {
    List<IModule> modules = new ArrayList<IModule>();
    if (component != null) {
        IVirtualReference[] components = getReferences(component);
        for (int i = 0; i < components.length; i++) {
            IVirtualReference reference = components[i];
            if (reference != null && reference.getDependencyType() == IVirtualReference.DEPENDENCY_TYPE_USES) {
                IVirtualComponent virtualComp = reference.getReferencedComponent();
                IModule module = gatherModuleReference(component, virtualComp);
                if (module != null && !modules.contains(module))
                    modules.add(module);
            }
        }
    }
    return modules.toArray(new IModule[modules.size()]);
}
Also used : IModule(org.eclipse.wst.server.core.IModule) ArrayList(java.util.ArrayList) IVirtualReference(org.eclipse.wst.common.componentcore.resources.IVirtualReference) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent)

Example 25 with IVirtualComponent

use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project mdw-designer by CenturyLinkCloud.

the class WorkflowProject method getEarContentFolder.

public IFolder getEarContentFolder() {
    if (isCloudProject()) {
        return getSourceProject().getFolder(new Path("deploy/ear"));
    } else // ear project
    {
        IVirtualComponent earComponent = ComponentCore.createComponent(getEarProject());
        if (earComponent == null)
            return null;
        IVirtualFolder earRootFolder = earComponent.getRootFolder();
        return (IFolder) earRootFolder.getUnderlyingFolder();
    }
}
Also used : Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IVirtualFolder(org.eclipse.wst.common.componentcore.resources.IVirtualFolder) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

IVirtualComponent (org.eclipse.wst.common.componentcore.resources.IVirtualComponent)39 IPath (org.eclipse.core.runtime.IPath)24 IVirtualFolder (org.eclipse.wst.common.componentcore.resources.IVirtualFolder)12 IVirtualReference (org.eclipse.wst.common.componentcore.resources.IVirtualReference)11 IProject (org.eclipse.core.resources.IProject)9 ArrayList (java.util.ArrayList)8 IContainer (org.eclipse.core.resources.IContainer)7 IFile (org.eclipse.core.resources.IFile)6 IFolder (org.eclipse.core.resources.IFolder)6 Path (org.eclipse.core.runtime.Path)6 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)5 CoreException (org.eclipse.core.runtime.CoreException)5 IVirtualResource (org.eclipse.wst.common.componentcore.resources.IVirtualResource)5 Test (org.junit.Test)5 JavaModelException (org.eclipse.jdt.core.JavaModelException)4 List (java.util.List)3 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)3 IJavaProject (org.eclipse.jdt.core.IJavaProject)3 IOException (java.io.IOException)2 ExecutionException (org.eclipse.core.commands.ExecutionException)2