Search in sources :

Example 36 with IWebProject

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"));
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 37 with IWebProject

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"));
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 38 with IWebProject

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"));
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 39 with IWebProject

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
                }
            }
        }
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) IFile(org.eclipse.core.resources.IFile) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) IPath(org.eclipse.core.runtime.IPath) IWebProject(com.liferay.ide.core.IWebProject) IDecoratorManager(org.eclipse.ui.IDecoratorManager) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) CoreException(org.eclipse.core.runtime.CoreException) JavaModelException(org.eclipse.jdt.core.JavaModelException) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) EObject(org.eclipse.emf.ecore.EObject) IFolder(org.eclipse.core.resources.IFolder)

Example 40 with IWebProject

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;
}
Also used : IModuleResource(org.eclipse.wst.server.core.model.IModuleResource) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) IWebProject(com.liferay.ide.core.IWebProject) IModuleResourceDelta(org.eclipse.wst.server.core.model.IModuleResourceDelta)

Aggregations

IWebProject (com.liferay.ide.core.IWebProject)46 IFolder (org.eclipse.core.resources.IFolder)31 IFile (org.eclipse.core.resources.IFile)27 IProject (org.eclipse.core.resources.IProject)25 IPath (org.eclipse.core.runtime.IPath)24 Path (org.eclipse.core.runtime.Path)20 CoreException (org.eclipse.core.runtime.CoreException)15 IResource (org.eclipse.core.resources.IResource)10 IStatus (org.eclipse.core.runtime.IStatus)6 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)5 IOException (java.io.IOException)5 Test (org.junit.Test)5 SDK (com.liferay.ide.sdk.core.SDK)4 Path (org.eclipse.sapphire.modeling.Path)4 CustomJspDir (com.liferay.ide.hook.core.model.CustomJspDir)3 InputStream (java.io.InputStream)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 HookDescriptorHelper (com.liferay.ide.hook.core.dd.HookDescriptorHelper)2 Hook (com.liferay.ide.hook.core.model.Hook)2 File (java.io.File)2