use of com.liferay.ide.core.ILiferayPortal in project liferay-ide by liferay.
the class CustomJspsBindingImpl method init.
@Override
public void init(Property property) {
super.init(property);
ILiferayProject liferayProject = LiferayCore.create(project());
if (liferayProject != null) {
ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
if (portal != null) {
_portalDir = portal.getAppServerPortalDir();
}
}
}
use of com.liferay.ide.core.ILiferayPortal 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;
}
use of com.liferay.ide.core.ILiferayPortal in project liferay-ide by liferay.
the class NewPortletClassDataModelProvider method getPropertyDescriptor.
@Override
public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
if (VIEW_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "view");
} else if (EDIT_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "edit");
} else if (HELP_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "help");
} else if (ABOUT_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "about");
} else if (CONFIG_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "config");
} else if (EDITDEFAULTS_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "edit_defaults");
} else if (EDITGUEST_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "edit_guest");
} else if (PREVIEW_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "preview");
} else if (PRINT_MODE.equals(propertyName)) {
return new DataModelPropertyDescriptor(getProperty(propertyName), "print");
} else if (CATEGORY.equals(propertyName)) {
if (getProperty(CATEGORY).equals("category.sample")) {
return new DataModelPropertyDescriptor("category.sample", "Sample");
}
} else if (ENTRY_CATEGORY.equals(propertyName)) {
// following if block is for modifying portlet class name will resynch the model
// and lose the user choice
// check for null is for switching projects of different portal versions
Object entryCategory = getProperty(ENTRY_CATEGORY);
if ((entryCategory != null) && (getEntryCategories() != null) && (getEntryCategories().get(entryCategory) != null)) {
Properties entryCategories = getEntryCategories();
DataModelPropertyDescriptor descriptor = new DataModelPropertyDescriptor(entryCategory, entryCategories.get(entryCategory).toString());
return descriptor;
}
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) {
Version portalVersion = Version.parseVersion(portal.getVersion());
if (CoreUtil.compareVersions(portalVersion, ILiferayConstants.V620) < 0) {
return new DataModelPropertyDescriptor("category.my", "My Account Section");
}
}
return new DataModelPropertyDescriptor("category.my", "My Account Administration");
}
return super.getPropertyDescriptor(propertyName);
}
use of com.liferay.ide.core.ILiferayPortal in project liferay-ide by liferay.
the class NewPortletClassDataModelProvider method getInitParams.
protected Object getInitParams() {
List<ParamValue> initParams = new ArrayList<>();
if (/* getStringProperty(SUPERCLASS).equals(QUALIFIED_MVC_PORTLET) && */
getBooleanProperty(CREATE_JSPS)) {
String[] modes = ALL_PORTLET_MODES;
ParamValue[] paramVals = null;
try {
ILiferayProject liferayProject = LiferayCore.create(getProject());
ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
String version = portal.getVersion();
Version portalVersion = Version.parseVersion(version);
if (CoreUtil.compareVersions(portalVersion, ILiferayConstants.V610) >= 0) {
paramVals = createDefaultParamValuesForModes(modes, initNames61, initValues);
}
} catch (Exception e) {
}
if (paramVals == null) {
paramVals = createDefaultParamValuesForModes(modes, initNames60, initValues);
}
Collections.addAll(initParams, paramVals);
}
return initParams;
}
use of com.liferay.ide.core.ILiferayPortal in project liferay-ide by liferay.
the class PluginPackageEditor method getPortalDir.
public IPath getPortalDir() {
try {
IFile file = getEditorInput().getFile();
ILiferayProject liferayProject = LiferayCore.create(file.getProject());
ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
return portal.getAppServerPortalDir();
} catch (Exception e) {
return null;
}
}
Aggregations