use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class NewLiferayPluginProjectOpBase method testIncludeSampleCodeServiceBuilder.
@Test
public void testIncludeSampleCodeServiceBuilder() throws Exception {
if (shouldSkipBundleTests())
return;
// test service-builder project
NewLiferayPluginProjectOp op = newProjectOp("test-include-sample-code-service-builder");
op.setIncludeSampleCode(true);
op.setPluginType(PluginType.servicebuilder);
IProject project = createAntProject(op);
IWebProject webProject = LiferayCore.create(IWebProject.class, project);
IFile portletXml = webProject.getDescriptorFile(ILiferayConstants.PORTLET_XML_FILE);
IFile liferayPortletXml = webProject.getDescriptorFile(ILiferayConstants.LIFERAY_PORTLET_XML_FILE);
IFile liferayDisplayXml = webProject.getDescriptorFile(ILiferayConstants.LIFERAY_DISPLAY_XML_FILE);
IFile serviceXml = webProject.getDescriptorFile(ILiferayConstants.SERVICE_XML_FILE);
assertNotNull(portletXml);
assertNotNull(liferayPortletXml);
assertNotNull(liferayDisplayXml);
assertNotNull(serviceXml);
assertEquals(1, countElements(portletXml, "portlet"));
assertEquals(1, countElements(liferayPortletXml, "portlet"));
assertEquals(1, countElements(liferayDisplayXml, "category"));
assertEquals(1, countElements(serviceXml, "entity"));
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class NewLiferayPluginProjectOpBase method testDontIncludeSampleCode.
@Test
public void testDontIncludeSampleCode() throws Exception {
if (shouldSkipBundleTests())
return;
// test portlet project
NewLiferayPluginProjectOp op = newProjectOp("test-dont-include-sample-code-portlet");
op.setIncludeSampleCode(false);
op.setPluginType(PluginType.portlet);
IProject project = createAntProject(op);
IWebProject webProject = LiferayCore.create(IWebProject.class, project);
IFile portletXml = webProject.getDescriptorFile(ILiferayConstants.PORTLET_XML_FILE);
IFile liferayPortletXml = webProject.getDescriptorFile(ILiferayConstants.LIFERAY_PORTLET_XML_FILE);
IFile liferayDisplayXml = webProject.getDescriptorFile(ILiferayConstants.LIFERAY_DISPLAY_XML_FILE);
assertNotNull(portletXml);
assertNotNull(liferayPortletXml);
assertNotNull(liferayDisplayXml);
assertEquals(0, countElements(portletXml, "portlet"));
assertEquals(0, countElements(liferayPortletXml, "portlet"));
assertEquals(0, countElements(liferayDisplayXml, "category"));
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class NewLiferayPluginProjectOpBase method testIncludeSampleCode.
@Test
public void testIncludeSampleCode() throws Exception {
if (shouldSkipBundleTests())
return;
// test portlet project
NewLiferayPluginProjectOp op = newProjectOp("test-include-sample-code-portlet");
op.setIncludeSampleCode(true);
op.setPluginType(PluginType.portlet);
IProject project = createAntProject(op);
IWebProject webProject = LiferayCore.create(IWebProject.class, project);
IFile portletXml = webProject.getDescriptorFile(ILiferayConstants.PORTLET_XML_FILE);
IFile liferayPortletXml = webProject.getDescriptorFile(ILiferayConstants.LIFERAY_PORTLET_XML_FILE);
IFile liferayDisplayXml = webProject.getDescriptorFile(ILiferayConstants.LIFERAY_DISPLAY_XML_FILE);
assertNotNull(portletXml);
assertNotNull(liferayPortletXml);
assertNotNull(liferayDisplayXml);
assertEquals(1, countElements(portletXml, "portlet"));
assertEquals(1, countElements(liferayPortletXml, "portlet"));
assertEquals(1, countElements(liferayDisplayXml, "category"));
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class LiferayDataModelWizardPage method handleFileBrowseButton.
protected void handleFileBrowseButton(final Text text, String title, String message) {
ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
ViewerFilter filter = getContainerDialogViewerFilter();
ITreeContentProvider contentProvider = new WorkbenchContentProvider();
IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), decoratorManager.getLabelDecorator());
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
dialog.setValidator(validator);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.addFilter(filter);
final IWebProject lrproject = LiferayCore.create(IWebProject.class, CoreUtil.getProject(getDataModel().getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME)));
if (lrproject != null) {
final IFolder defaultDocroot = lrproject.getDefaultDocrootFolder();
if (defaultDocroot != null) {
dialog.setInput(defaultDocroot);
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IFile) {
IFile file = (IFile) element;
final IPath relativePath = file.getFullPath().makeRelativeTo(defaultDocroot.getFullPath());
text.setText("/" + relativePath.toPortableString());
// dealWithSelectedContainerResource(container);
}
} catch (Exception ex) {
// Do nothing
}
}
}
}
}
use of com.liferay.ide.core.IWebProject in project liferay-ide by liferay.
the class RemoteServerBehavior method shouldPublishModuleFull.
protected boolean shouldPublishModuleFull(IModuleResourceDelta[] deltas) {
boolean retval = false;
if (ListUtil.isNotEmpty(deltas)) {
for (IModuleResourceDelta delta : deltas) {
if (shouldPublishModuleFull(delta.getAffectedChildren())) {
retval = true;
break;
} else {
final IModuleResource resource = delta.getModuleResource();
final IFile resourceFile = (IFile) resource.getAdapter(IFile.class);
if (resourceFile != null) {
final IWebProject lrproject = LiferayCore.create(IWebProject.class, resourceFile.getProject());
if (lrproject != null) {
final IPath docrootPath = lrproject.getDefaultDocrootFolder().getFullPath();
if (lrproject.findDocrootResource(resourceFile.getFullPath().makeRelativeTo(docrootPath)) != null) {
if (resource.getName().equals("web.xml") || resource.getName().equals(ILiferayConstants.LIFERAY_PLUGIN_PACKAGE_PROPERTIES_FILE)) {
break;
} else if (resource.getName().equals("portlet.xml")) {
break;
}
}
}
}
}
}
}
return retval;
}
Aggregations