use of com.liferay.ide.project.core.modules.ServiceContainer in project liferay-ide by liferay.
the class LiferayDependencyQuickFix method _processUndefinedTypeProposals.
private List<IJavaCompletionProposal> _processUndefinedTypeProposals(IInvocationContext context, IProblemLocation problem) {
ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot());
String fullyQualifiedName = null;
if (selectedNode instanceof Name) {
Name node = (Name) selectedNode;
fullyQualifiedName = node.getFullyQualifiedName();
}
List<String> serviceWrapperList;
List<String> servicesList;
boolean depWrapperCanFixed = false;
List<IJavaCompletionProposal> proposals = new ArrayList<>();
try {
serviceWrapperList = TargetPlatformUtil.getServiceWrapperList().getServiceList();
servicesList = TargetPlatformUtil.getServicesList().getServiceList();
for (String wrapper : serviceWrapperList) {
if (wrapper.endsWith(fullyQualifiedName)) {
ServiceContainer bundle = TargetPlatformUtil.getServiceWrapperBundle(wrapper);
proposals.add(_createDepProposal(context, bundle));
}
}
if (!depWrapperCanFixed) {
for (String service : servicesList) {
if (service.endsWith(fullyQualifiedName)) {
ServiceContainer bundle = TargetPlatformUtil.getServiceBundle(service);
proposals.add(_createDepProposal(context, bundle));
}
}
}
} catch (Exception e) {
ProjectCore.logError("Error processing undefined type proposals", e);
}
return proposals;
}
use of com.liferay.ide.project.core.modules.ServiceContainer in project liferay-ide by liferay.
the class QuickFixGradleDep method _importNotFoundProposal.
private void _importNotFoundProposal(IInvocationContext context, IProblemLocation problem, Collection<IJavaCompletionProposal> proposals) {
ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot());
if (selectedNode == null) {
return;
}
ImportDeclaration importDeclaration = (ImportDeclaration) ASTNodes.getParent(selectedNode, ASTNode.IMPORT_DECLARATION);
if (importDeclaration == null) {
return;
}
String importName = importDeclaration.getName().toString();
List<String> serviceWrapperList;
List<String> servicesList;
boolean depWrapperCanFixed = false;
try {
serviceWrapperList = TargetPlatformUtil.getServiceWrapperList().getServiceList();
servicesList = TargetPlatformUtil.getServicesList().getServiceList();
if (serviceWrapperList.contains(importName)) {
ServiceContainer bundle = TargetPlatformUtil.getServiceWrapperBundle(importName);
depWrapperCanFixed = true;
_createDepProposal(context, proposals, bundle);
}
if (!depWrapperCanFixed) {
if (servicesList.contains(importName)) {
ServiceContainer bundle = TargetPlatformUtil.getServiceBundle(importName);
_createDepProposal(context, proposals, bundle);
}
}
if (TargetPlatformUtil.getThirdPartyBundleList(importName) != null) {
ServiceContainer bundle = TargetPlatformUtil.getThirdPartyBundleList(importName);
_createDepProposal(context, proposals, bundle);
}
} catch (Exception e) {
GradleCore.logError("Gradle dependence got error", e);
}
}
use of com.liferay.ide.project.core.modules.ServiceContainer in project liferay-ide by liferay.
the class QuickFixGradleDep method _undefinedType.
private void _undefinedType(IInvocationContext context, IProblemLocation problem, Collection<IJavaCompletionProposal> proposals) {
ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot());
String fullyQualifiedName = null;
if (selectedNode instanceof Name) {
Name node = (Name) selectedNode;
fullyQualifiedName = node.getFullyQualifiedName();
}
List<String> serviceWrapperList;
List<String> servicesList;
boolean depWrapperCanFixed = false;
try {
serviceWrapperList = TargetPlatformUtil.getServiceWrapperList().getServiceList();
servicesList = TargetPlatformUtil.getServicesList().getServiceList();
for (String wrapper : serviceWrapperList) {
if (wrapper.endsWith(fullyQualifiedName)) {
ServiceContainer bundle = TargetPlatformUtil.getServiceWrapperBundle(wrapper);
_createDepProposal(context, proposals, bundle);
}
}
if (!depWrapperCanFixed) {
for (String service : servicesList) {
if (service.endsWith(fullyQualifiedName)) {
ServiceContainer bundle = TargetPlatformUtil.getServiceBundle(service);
_createDepProposal(context, proposals, bundle);
}
}
}
} catch (Exception e) {
GradleCore.logError("Gradle dependence got error", e);
}
}
use of com.liferay.ide.project.core.modules.ServiceContainer in project liferay-ide by liferay.
the class NewLiferayComponentServiceOperation method getComponentDependency.
@Override
protected List<String[]> getComponentDependency() throws CoreException {
List<String[]> componentDependency = super.getComponentDependency();
try {
ServiceContainer serviceBundle = TargetPlatformUtil.getServiceWrapperBundle(serviceName);
if (serviceBundle != null) {
Version retriveVersion = new Version(serviceBundle.getBundleVersion());
componentDependency.add(new String[] { serviceBundle.getBundleGroup(), serviceBundle.getBundleName(), retriveVersion.getMajor() + "." + retriveVersion.getMinor() + ".0" });
}
} catch (Exception e) {
}
return componentDependency;
}
Aggregations