Search in sources :

Example 1 with LiferayDisplayDescriptorHelper

use of com.liferay.ide.portlet.core.dd.LiferayDisplayDescriptorHelper in project liferay-ide by liferay.

the class BasePortletFramework method postProjectCreated.

@Override
public IStatus postProjectCreated(IProject project, String frameworkName, String portletName, IProgressMonitor monitor) {
    IStatus status = Status.OK_STATUS;
    if (!CoreUtil.isNullOrEmpty(portletName)) {
        PortletDescriptorHelper portletDH = new PortletDescriptorHelper(project);
        status = portletDH.configurePortletXml(portletName);
        if (!status.isOK()) {
            return status;
        }
        LiferayPortletDescriptorHelper liferayPortletDH = new LiferayPortletDescriptorHelper(project);
        status = liferayPortletDH.configureLiferayPortletXml(portletName);
        if (!status.isOK()) {
            return status;
        }
        LiferayDisplayDescriptorHelper liferayDisplayDH = new LiferayDisplayDescriptorHelper(project);
        status = liferayDisplayDH.configureLiferayDisplayXml(portletName);
    }
    return status;
}
Also used : LiferayPortletDescriptorHelper(com.liferay.ide.portlet.core.dd.LiferayPortletDescriptorHelper) PortletDescriptorHelper(com.liferay.ide.portlet.core.dd.PortletDescriptorHelper) IStatus(org.eclipse.core.runtime.IStatus) LiferayDisplayDescriptorHelper(com.liferay.ide.portlet.core.dd.LiferayDisplayDescriptorHelper) LiferayPortletDescriptorHelper(com.liferay.ide.portlet.core.dd.LiferayPortletDescriptorHelper)

Example 2 with LiferayDisplayDescriptorHelper

use of com.liferay.ide.portlet.core.dd.LiferayDisplayDescriptorHelper in project liferay-ide by liferay.

the class NewPortletClassDataModelProvider method getCategories.

protected Properties getCategories() {
    if (categories == null) {
        ILiferayProject liferayProject = LiferayCore.create(getProject());
        if (liferayProject == null) {
            try {
                liferayProject = LiferayCore.create(getRuntime());
            } catch (CoreException ce) {
                PortletCore.logError(ce);
            }
        }
        ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
        if (portal != null) {
            categories = portal.getPortletCategories();
            IWorkspace workspace = ResourcesPlugin.getWorkspace();
            IProject[] workspaceProjects = workspace.getRoot().getProjects();
            for (IProject workspaceProject : workspaceProjects) {
                if (ProjectUtil.isPortletProject(workspaceProject)) {
                    LiferayDisplayDescriptorHelper liferayDisplayDH = new LiferayDisplayDescriptorHelper(workspaceProject);
                    String[] portletCategories = liferayDisplayDH.getAllPortletCategories();
                    if (ListUtil.isNotEmpty(portletCategories)) {
                        for (String portletCategory : portletCategories) {
                            if (_findExistingCategory(portletCategory) == null) {
                                categories.put(portletCategory, portletCategory);
                            }
                        }
                    }
                }
            }
        }
    }
    return categories;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ILiferayProject(com.liferay.ide.core.ILiferayProject) IWorkspace(org.eclipse.core.resources.IWorkspace) LiferayDisplayDescriptorHelper(com.liferay.ide.portlet.core.dd.LiferayDisplayDescriptorHelper) ILiferayPortal(com.liferay.ide.core.ILiferayPortal) IProject(org.eclipse.core.resources.IProject)

Aggregations

LiferayDisplayDescriptorHelper (com.liferay.ide.portlet.core.dd.LiferayDisplayDescriptorHelper)2 ILiferayPortal (com.liferay.ide.core.ILiferayPortal)1 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 LiferayPortletDescriptorHelper (com.liferay.ide.portlet.core.dd.LiferayPortletDescriptorHelper)1 PortletDescriptorHelper (com.liferay.ide.portlet.core.dd.PortletDescriptorHelper)1 IProject (org.eclipse.core.resources.IProject)1 IWorkspace (org.eclipse.core.resources.IWorkspace)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1