Search in sources :

Example 1 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class LiferayHookModelTests method strutsActionPathPossibleValuesService.

/**
 * @throws Exception
 */
@Test
public void strutsActionPathPossibleValuesService() throws Exception {
    if (shouldSkipBundleTests())
        return;
    final NewLiferayPluginProjectOp op = newProjectOp("testPossibleValues");
    op.setPluginType(PluginType.hook);
    final IProject hookProject = createAntProject(op);
    final IFolder webappRoot = LiferayCore.create(IWebProject.class, hookProject).getDefaultDocrootFolder();
    assertNotNull(webappRoot);
    final IFile hookXml = webappRoot.getFile("WEB-INF/liferay-hook.xml");
    assertEquals(true, hookXml.exists());
    final XmlResourceStore store = new XmlResourceStore(hookXml.getContents()) {

        public <A> A adapt(Class<A> adapterType) {
            if (IProject.class.equals(adapterType)) {
                return adapterType.cast(hookProject);
            }
            return super.adapt(adapterType);
        }
    };
    final Hook hook = Hook6xx.TYPE.instantiate(new RootXmlResource(store));
    assertNotNull(hook);
    final StrutsAction strutsAction = hook.getStrutsActions().insert();
    final Value<String> strutsActionPath = strutsAction.getStrutsActionPath();
    final Set<String> values = strutsActionPath.service(StrutsActionPathPossibleValuesService.class).values();
    assertNotNull(values);
    assertTrue(values.size() > 10);
}
Also used : Hook(com.liferay.ide.hook.core.model.Hook) IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) XmlResourceStore(org.eclipse.sapphire.modeling.xml.XmlResourceStore) StrutsAction(com.liferay.ide.hook.core.model.StrutsAction) RootXmlResource(org.eclipse.sapphire.modeling.xml.RootXmlResource) IProject(org.eclipse.core.resources.IProject) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) StrutsActionPathPossibleValuesService(com.liferay.ide.hook.core.model.internal.StrutsActionPathPossibleValuesService) IFolder(org.eclipse.core.resources.IFolder) Test(org.junit.Test)

Example 2 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class LiferayPortletXmlTest method testLiferayScriptPossibleValuesService.

@Test
public void testLiferayScriptPossibleValuesService() throws Exception {
    if (shouldSkipBundleTests())
        return;
    NewLiferayPluginProjectOp newProjectOp = NewLiferayPluginProjectOp.TYPE.instantiate();
    newProjectOp.setProjectName("test-script");
    newProjectOp.setPluginType(PluginType.portlet);
    newProjectOp.setIncludeSampleCode(true);
    newProjectOp.setPortletFramework("mvc");
    newProjectOp.setPortletName("testPortlet");
    final IProject testProject = createAntProject(newProjectOp);
    LiferayPortletXml liferayPortletApp = op(testProject);
    for (LiferayPortlet liferayPortlet : liferayPortletApp.getPortlets()) {
        ElementList<PortletStyleElement> portletCsses = liferayPortlet.getHeaderPortletCsses();
        {
            for (PortletStyleElement portletCss : portletCsses) {
                final PossibleValuesService scriptService = portletCss.getValue().service(PossibleValuesService.class);
                assertEquals(true, scriptService.values().contains("/css/main.css"));
            }
        }
    }
}
Also used : PossibleValuesService(org.eclipse.sapphire.PossibleValuesService) LiferayPortletXml(com.liferay.ide.portlet.core.lfportlet.model.LiferayPortletXml) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) PortletStyleElement(com.liferay.ide.portlet.core.lfportlet.model.PortletStyleElement) LiferayPortlet(com.liferay.ide.portlet.core.lfportlet.model.LiferayPortlet) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 3 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class LiferayPortletXmlTest method testIconRelativePathService.

@Test
public void testIconRelativePathService() throws Exception {
    if (shouldSkipBundleTests())
        return;
    NewLiferayPluginProjectOp newProjectOp = NewLiferayPluginProjectOp.TYPE.instantiate();
    newProjectOp.setProjectName("test-path");
    newProjectOp.setPluginType(PluginType.portlet);
    newProjectOp.setIncludeSampleCode(true);
    newProjectOp.setPortletFramework("mvc");
    newProjectOp.setPortletName("testPortlet");
    final IProject testProject = createAntProject(newProjectOp);
    LiferayPortletXml liferayPortletApp = op(testProject);
    for (LiferayPortlet liferayPortlet : liferayPortletApp.getPortlets()) {
        final RelativePathService pathService = liferayPortlet.getIcon().service(RelativePathService.class);
        List<Path> iconPaths = pathService.roots();
        assertEquals(true, iconPaths.size() > 0);
    }
}
Also used : Path(org.eclipse.sapphire.modeling.Path) LiferayPortletXml(com.liferay.ide.portlet.core.lfportlet.model.LiferayPortletXml) RelativePathService(org.eclipse.sapphire.services.RelativePathService) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) LiferayPortlet(com.liferay.ide.portlet.core.lfportlet.model.LiferayPortlet) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 4 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class SDKLocationValidationService method initValidationService.

@Override
protected void initValidationService() {
    super.initValidationService();
    _listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        protected void handleTypedEvent(PropertyContentEvent event) {
            refresh();
        }
    };
    NewLiferayPluginProjectOp op = _op();
    op.property(NewLiferayPluginProjectOp.PROP_PROJECT_PROVIDER).attach(_listener);
    op.property(NewLiferayPluginProjectOp.PROP_PROJECT_NAME).attach(_listener);
    op.property(NewLiferayPluginProjectOp.PROP_PORTLET_FRAMEWORK).attach(_listener);
    op.property(NewLiferayPluginProjectOp.PROP_PLUGIN_TYPE).attach(_listener);
}
Also used : PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 5 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class SDKLocationValidationService method dispose.

@Override
public void dispose() {
    NewLiferayPluginProjectOp op = _op();
    op.property(NewLiferayPluginProjectOp.PROP_PROJECT_NAME).detach(_listener);
    op.property(NewLiferayPluginProjectOp.PROP_PORTLET_FRAMEWORK).detach(_listener);
    op.property(NewLiferayPluginProjectOp.PROP_PLUGIN_TYPE).detach(_listener);
    op.property(NewLiferayPluginProjectOp.PROP_PROJECT_PROVIDER).detach(_listener);
    super.dispose();
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Aggregations

NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)122 Test (org.junit.Test)61 IProject (org.eclipse.core.resources.IProject)48 IWebProject (com.liferay.ide.core.IWebProject)18 IFile (org.eclipse.core.resources.IFile)18 IPath (org.eclipse.core.runtime.IPath)14 IFolder (org.eclipse.core.resources.IFolder)13 SDK (com.liferay.ide.sdk.core.SDK)12 Status (org.eclipse.sapphire.modeling.Status)10 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)9 Path (org.eclipse.sapphire.modeling.Path)8 CoreException (org.eclipse.core.runtime.CoreException)7 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)6 HashSet (java.util.HashSet)5 PossibleValuesService (org.eclipse.sapphire.PossibleValuesService)5 ValidationService (org.eclipse.sapphire.services.ValidationService)5 IVirtualComponent (org.eclipse.wst.common.componentcore.resources.IVirtualComponent)5 NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)4 IStatus (org.eclipse.core.runtime.IStatus)4 LayoutTplDescriptorHelper (com.liferay.ide.layouttpl.core.operation.LayoutTplDescriptorHelper)3