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");
}
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;
}
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;
}
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);
}
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"));
}
Aggregations