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;
}
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());
}
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());
}
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();
}
Aggregations