use of org.eclipse.wst.common.project.facet.core.IProjectFacet in project liferay-ide by liferay.
the class ProjectCoreBase method createProject.
public IProject createProject(NewLiferayPluginProjectOp op, String projectName) {
Status status = op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
assertNotNull(status);
assertEquals(status.toString(), Status.createOkStatus().message().toLowerCase(), status.message().toLowerCase());
if (projectName == null || op.getProjectProvider().content().getShortName().equalsIgnoreCase("ant")) {
projectName = op.getFinalProjectName().content();
}
// if( op.getProjectProvider().content().getShortName().equalsIgnoreCase( "maven" ) )
// {
// if( op.getPluginType().content().equals( PluginType.ext ) )
// {
// projectName = projectName + "-ext";
// }
// else if( op.getPluginType().content().equals( PluginType.servicebuilder ) )
// {
// projectName = projectName + "-portlet";
// }
// }
final IProject newLiferayPluginProject = project(projectName);
assertNotNull(newLiferayPluginProject);
assertEquals(true, newLiferayPluginProject.exists());
final IFacetedProject facetedProject = ProjectUtil.getFacetedProject(newLiferayPluginProject);
assertNotNull(facetedProject);
final IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(facetedProject);
assertNotNull(liferayFacet);
final PluginType pluginTypeValue = op.getPluginType().content(true);
if (pluginTypeValue.equals(PluginType.servicebuilder)) {
assertEquals("liferay.portlet", liferayFacet.getId());
} else {
assertEquals("liferay." + pluginTypeValue, liferayFacet.getId());
}
return newLiferayPluginProject;
}
use of org.eclipse.wst.common.project.facet.core.IProjectFacet in project liferay-ide by liferay.
the class LiferayPublishHelper method prePublishModule.
public static boolean prePublishModule(ServerBehaviourDelegate delegate, int kind, int deltaKind, IModule[] moduleTree, IModuleResourceDelta[] resourceDelta, IProgressMonitor monitor) {
boolean retval = true;
if (ListUtil.isNotEmpty(moduleTree) && moduleTree[0].getProject() != null) {
IProject project = moduleTree[0].getProject();
IFacetedProject facetedProject = ServerUtil.getFacetedProject(project);
if (facetedProject != null) {
IProjectFacet liferayFacet = ServerUtil.getLiferayFacet(facetedProject);
if (liferayFacet != null) {
String facetId = liferayFacet.getId();
IRuntime runtime = null;
try {
runtime = delegate.getServer().getRuntime();
if (runtime != null) {
IPluginPublisher pluginPublisher = LiferayServerCore.getPluginPublisher(facetId, runtime.getRuntimeType().getId());
if (pluginPublisher != null) {
retval = pluginPublisher.prePublishModule(delegate, kind, deltaKind, moduleTree, resourceDelta, monitor);
}
}
} catch (Exception e) {
// $NON-NLS-1$
LiferayServerCore.logError("Plugin publisher failed", e);
}
}
}
}
return retval;
}
use of org.eclipse.wst.common.project.facet.core.IProjectFacet in project liferay-ide by liferay.
the class LiferayTomcatUtil method canAddModule.
public static IStatus canAddModule(IModule module, IServer currentServer) {
IProject project = module.getProject();
if (project != null) {
IFacetedProject facetedProject = ProjectUtil.getFacetedProject(project);
if (facetedProject != null) {
IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(facetedProject);
if (liferayFacet != null) {
String facetId = liferayFacet.getId();
IRuntime runtime = null;
try {
runtime = ServerUtil.getRuntime(project);
} catch (CoreException e) {
}
if (runtime != null) {
IPluginPublisher pluginPublisher = LiferayServerCore.getPluginPublisher(facetId, runtime.getRuntimeType().getId());
if (pluginPublisher != null) {
IStatus status = pluginPublisher.canPublishModule(currentServer, module);
if (!status.isOK()) {
return status;
}
}
}
}
}
}
return Status.OK_STATUS;
}
Aggregations