Search in sources :

Example 6 with NewLiferayProfile

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

the class LiferayMavenProjectTestCase method createTestBundleProfile.

protected void createTestBundleProfile(NewLiferayPluginProjectOp op) {
    NewLiferayProfile profile = op.getNewLiferayProfiles().insert();
    Set<String> vals = profile.getLiferayVersion().service(PossibleValuesService.class).values();
    Version greatest = new Version("6.2.2");
    for (final String val : vals) {
        try {
            final Version v = new Version(val);
            if (greatest == null) {
                greatest = v;
            } else {
                if (CoreUtil.compareVersions(greatest, v) < 0) {
                    greatest = v;
                    break;
                }
            }
        } catch (Exception e) {
        }
    }
    profile.setLiferayVersion(greatest.getMajor() + "." + greatest.getMicro() + "." + greatest.getMinor());
    profile.setId("test-bundle");
    profile.setRuntimeName(base.getRuntimeVersion());
    profile.setProfileLocation(ProfileLocation.projectPom);
    op.setActiveProfilesValue("test-bundle");
}
Also used : PossibleValuesService(org.eclipse.sapphire.PossibleValuesService) Version(org.osgi.framework.Version) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile)

Example 7 with NewLiferayProfile

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

the class NewLiferayProfileMarkerResolution method promptUser.

@Override
protected int promptUser(IProject project, NewLiferayPluginProjectOp op) {
    NewLiferayProfile newLiferayProfile = op.getNewLiferayProfiles().insert();
    Reference<DialogDef> dialogRef = DefinitionLoader.sdef(NewLiferayPluginProjectWizard.class).dialog("NewLiferayProfile");
    SapphireDialog dialog = new SapphireDialog(UIUtil.getActiveShell(), newLiferayProfile, dialogRef);
    dialog.setBlockOnOpen(true);
    int result = dialog.open();
    if (result == SapphireDialog.OK) {
        IDOMModel domModel = null;
        try {
            IFile pomFile = project.getFile(IMavenConstants.POM_FILE_NAME);
            domModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(pomFile);
            MavenUtil.createNewLiferayProfileNode(domModel.getDocument(), newLiferayProfile);
            domModel.save();
        } catch (Exception e) {
            LiferayMavenCore.logError("Unable to save new Liferay profiles to project pom.", e);
        } finally {
            if (domModel != null) {
                domModel.releaseFromEdit();
            }
        }
        NewLiferayProfileActionHandler.addToActiveProfiles(op, newLiferayProfile);
    } else {
        op.getNewLiferayProfiles().remove(newLiferayProfile);
    }
    return result;
}
Also used : DialogDef(org.eclipse.sapphire.ui.forms.DialogDef) IFile(org.eclipse.core.resources.IFile) IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile) NewLiferayPluginProjectWizard(com.liferay.ide.project.ui.wizard.NewLiferayPluginProjectWizard) SapphireDialog(org.eclipse.sapphire.ui.forms.swt.SapphireDialog)

Example 8 with NewLiferayProfile

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

the class ProjectCoreBase method setMavenProfile.

public NewLiferayPluginProjectOp setMavenProfile(NewLiferayPluginProjectOp op) throws Exception {
    NewLiferayProfile profile = op.getNewLiferayProfiles().insert();
    profile.setId("Liferay-v6.2-CE-(Tomcat-7)");
    profile.setLiferayVersion("6.2.2");
    profile.setRuntimeName(getRuntimeVersion());
    profile.setProfileLocation(ProfileLocation.projectPom);
    op.setActiveProfilesValue("Liferay-v6.2-CE-(Tomcat-7)");
    return op;
}
Also used : NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile)

Example 9 with NewLiferayProfile

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

the class NewLiferayProfileIdDefaultValueService method initDefaultValueService.

@Override
protected void initDefaultValueService() {
    super.initDefaultValueService();
    Listener listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        protected void handleTypedEvent(PropertyContentEvent event) {
            refresh();
        }
    };
    NewLiferayProfile profile = _newLiferayProfile();
    profile.getRuntimeName().attach(listener);
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile)

Example 10 with NewLiferayProfile

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

the class JSFPortletProjectTests method testUpdateLiferayPortletFileDTDVersion.

@Test
public void testUpdateLiferayPortletFileDTDVersion() throws Exception {
    NewLiferayPluginProjectOp op = NewLiferayPluginProjectOp.TYPE.instantiate();
    op.setProjectName("test-update-liferay-portlet-file");
    op.setProjectProvider("maven");
    op.setPortletFramework("jsf-2.x");
    op.setPortletFrameworkAdvanced("jsf");
    NewLiferayProfile profile = op.getNewLiferayProfiles().insert();
    profile.setLiferayVersion("6.1.0");
    profile.setId("test-bundle");
    profile.setRuntimeName("6.1.0");
    profile.setProfileLocation(ProfileLocation.projectPom);
    op.setActiveProfilesValue("test-bundle");
    final IProject newProject = base.createProject(op);
    assertNotNull(newProject);
    IWebProject webProject = LiferayCore.create(IWebProject.class, newProject);
    final IFile descriptorFile = webProject.getDescriptorFile("liferay-portlet.xml");
    assertNotNull(descriptorFile);
    assertTrue(descriptorFile.exists());
    String contents = CoreUtil.readStreamToString(descriptorFile.getContents());
    assertTrue(contents.contains("PUBLIC \"-//Liferay//DTD Portlet Application 6.1.0//EN\""));
    assertTrue(contents.contains("http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd"));
}
Also used : IFile(org.eclipse.core.resources.IFile) IWebProject(com.liferay.ide.core.IWebProject) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Aggregations

NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)12 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)4 IFile (org.eclipse.core.resources.IFile)3 Properties (java.util.Properties)2 IProject (org.eclipse.core.resources.IProject)2 CoreException (org.eclipse.core.runtime.CoreException)2 FilteredListener (org.eclipse.sapphire.FilteredListener)2 Listener (org.eclipse.sapphire.Listener)2 PossibleValuesService (org.eclipse.sapphire.PossibleValuesService)2 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)2 Status (org.eclipse.sapphire.modeling.Status)2 SapphireDialog (org.eclipse.sapphire.ui.forms.swt.SapphireDialog)2 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)2 IWebProject (com.liferay.ide.core.IWebProject)1 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)1 PluginType (com.liferay.ide.project.core.model.PluginType)1 ProjectName (com.liferay.ide.project.core.model.ProjectName)1 NewLiferayPluginProjectWizard (com.liferay.ide.project.ui.wizard.NewLiferayPluginProjectWizard)1 File (java.io.File)1 IOException (java.io.IOException)1