Search in sources :

Example 36 with IVirtualComponent

use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project liferay-ide by liferay.

the class FMLineBreakpoint method getTemplateName.

private static String getTemplateName(final IResource resource) {
    String retval = null;
    final IProject project = resource.getProject();
    if (project != null && CoreUtil.isLiferayProject(project)) {
        // if( "Servers".equals( project.getName() ) )
        // {
        // return new Path(resource.getName()).removeFileExtension().toPortableString();
        // }
        // get context root
        final IVirtualComponent c = ComponentCore.createComponent(project, true);
        final String contextRoot = c.getMetaProperties().getProperty("context-root") + "/";
        for (IContainer parentFolder : c.getRootFolder().getUnderlyingFolders()) {
            final IPath parentFullPath = parentFolder.getFullPath();
            final IPath fileFullPath = resource.getFullPath();
            if (parentFullPath.isPrefixOf(fileFullPath)) {
                final IPath relativePath = fileFullPath.makeRelativeTo(parentFullPath);
                final String relativePathValue = relativePath.toPortableString();
                // remove _diffs prefix since they are not in the deployed resource
                final String prefix = "_diffs/";
                if (relativePathValue.startsWith(prefix)) {
                    retval = contextRoot + relativePathValue.substring(prefix.length(), relativePathValue.length());
                } else {
                    retval = contextRoot + relativePathValue;
                }
                break;
            }
        }
    }
    return retval;
}
Also used : IPath(org.eclipse.core.runtime.IPath) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) IContainer(org.eclipse.core.resources.IContainer) IProject(org.eclipse.core.resources.IProject)

Example 37 with IVirtualComponent

use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project liferay-ide by liferay.

the class LiferayMavenProjectTests method testNewLiferayRemoteServiceBuilderProject.

@Test
public void testNewLiferayRemoteServiceBuilderProject() throws Exception {
    if (shouldSkipBundleTests())
        return;
    NewLiferayPluginProjectOp op = NewLiferayPluginProjectOp.TYPE.instantiate();
    op.setProjectName("servicebuilder");
    op.setProjectProvider("maven");
    op.setPluginType(PluginType.servicebuilder);
    createTestBundleProfile(op);
    final IProject project = base.createProject(op, op.getProjectName() + "-portlet");
    assertEquals(project.getName(), op.getProjectName() + "-portlet");
    assertNotNull(project);
    String pomContents = CoreUtil.readStreamToString(project.getFile("pom.xml").getContents());
    assertTrue(pomContents.contains("<artifactId>servicebuilder-portlet</artifactId>"));
    assertTrue(pomContents.contains("<artifactId>liferay-maven-plugin</artifactId>"));
    assertTrue(pomContents.contains("<name>servicebuilder Portlet</name>"));
    waitForJobsToComplete();
    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
    waitForJobsToComplete();
    IVirtualComponent projectComponent = ComponentCore.createComponent(project);
    assertEquals("servicebuilder-portlet", projectComponent.getDeployedName());
    final ILiferayProject liferayProject = LiferayCore.create(project);
    final IRemoteServerPublisher publisher = liferayProject.adapt(IRemoteServerPublisher.class);
    final IPath warPath = publisher.publishModuleFull(monitor);
    assertTrue(warPath.toFile().exists());
}
Also used : IPath(org.eclipse.core.runtime.IPath) ILiferayProject(com.liferay.ide.core.ILiferayProject) IRemoteServerPublisher(com.liferay.ide.server.remote.IRemoteServerPublisher) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 38 with IVirtualComponent

use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project liferay-ide by liferay.

the class LiferayMavenProjectTests method testNewLiferayThemeProject.

@Test
public void testNewLiferayThemeProject() throws Exception {
    NewLiferayPluginProjectOp op = NewLiferayPluginProjectOp.TYPE.instantiate();
    op.setProjectName("mytheme");
    op.setProjectProvider("maven");
    op.setPluginType(PluginType.theme);
    createTestBundleProfile(op);
    final IProject project = base.createProject(op);
    assertNotNull(project);
    String pomContents = CoreUtil.readStreamToString(project.getFile("pom.xml").getContents());
    assertTrue(pomContents.contains("<pluginType>theme</pluginType>"));
    assertTrue(pomContents.contains("<artifactId>liferay-maven-plugin</artifactId>"));
    waitForJobsToComplete();
    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
    waitForJobsToComplete();
    IVirtualComponent projectComponent = ComponentCore.createComponent(project);
    assertEquals("mytheme-theme", projectComponent.getDeployedName());
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 39 with IVirtualComponent

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

the class WorkflowProject method getWebContentFolder.

public IFolder getWebContentFolder() {
    IVirtualComponent webComponent = ComponentCore.createComponent(getWebProject());
    IVirtualFolder webRootFolder = webComponent.getRootFolder();
    return (IFolder) webRootFolder.getUnderlyingFolder();
}
Also used : 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