Search in sources :

Example 11 with JavaTypeInfo

use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.

the class JavaTypesSearch method collectPackages.

private void collectPackages(List<JavaTypeInfo> javaTypes) {
    if (packageName != null) {
        Set<String> subPackages = new HashSet<>();
        try {
            // Loop for package root
            IPackageFragmentRoot[] packageFragmentRoots = javaProject.getPackageFragmentRoots();
            for (int i = 0; i < packageFragmentRoots.length; i++) {
                fillWithSubPackages(packageName, packageFragmentRoots[i], subPackages);
            }
        } catch (JavaModelException e) {
            LOGGER.log(Level.SEVERE, "Error while collecting sub packages for '" + packageName + "'.", e);
        }
        for (String subPackageName : subPackages) {
            JavaTypeInfo packageInfo = new JavaTypeInfo();
            packageInfo.setKind(JavaTypeKind.Package);
            packageInfo.setSignature(subPackageName);
            javaTypes.add(packageInfo);
        }
    }
}
Also used : JavaModelException(org.eclipse.jdt.core.JavaModelException) JavaTypeInfo(com.redhat.qute.commons.JavaTypeInfo) HashSet(java.util.HashSet) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot)

Example 12 with JavaTypeInfo

use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.

the class TemplateGetJavaTypeTest method nested.

@Test
public void nested() throws Exception {
    loadMavenProject(QuteMavenProjectName.qute_quickstart);
    QuteJavaTypesParams params = new QuteJavaTypesParams("org.acme.qute.NestedClass.", QuteMavenProjectName.qute_quickstart);
    List<JavaTypeInfo> actual = QuteSupportForTemplate.getInstance().getJavaTypes(params, getJDTUtils(), new NullProgressMonitor());
    assertJavaTypes(// 
    actual, // 
    t("org.acme.qute.NestedClass.Foo", JavaTypeKind.Class), t("org.acme.qute.NestedClass.Bar", JavaTypeKind.Class));
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) QuteJavaTypesParams(com.redhat.qute.commons.QuteJavaTypesParams) JavaTypeInfo(com.redhat.qute.commons.JavaTypeInfo) Test(org.junit.Test)

Example 13 with JavaTypeInfo

use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.

the class MethodValueResolver method getJavaTypeInfo.

@Override
public JavaTypeInfo getJavaTypeInfo() {
    JavaTypeInfo javaType = super.getJavaTypeInfo();
    if (javaType == null && sourceType != null) {
        javaType = new JavaTypeInfo();
        javaType.setSignature(sourceType);
        super.setJavaType(javaType);
    }
    return javaType;
}
Also used : ResolvedJavaTypeInfo(com.redhat.qute.commons.ResolvedJavaTypeInfo) JavaTypeInfo(com.redhat.qute.commons.JavaTypeInfo)

Example 14 with JavaTypeInfo

use of com.redhat.qute.commons.JavaTypeInfo in project quarkus-ls by redhat-developer.

the class MockQuteProject method createJavaTypeInfo.

protected static JavaTypeInfo createJavaTypeInfo(String typeName, JavaTypeKind kind, List<JavaTypeInfo> cache) {
    JavaTypeInfo typeInfo = new JavaTypeInfo();
    typeInfo.setSignature(typeName);
    typeInfo.setKind(kind);
    cache.add(typeInfo);
    return typeInfo;
}
Also used : JavaTypeInfo(com.redhat.qute.commons.JavaTypeInfo) ResolvedJavaTypeInfo(com.redhat.qute.commons.ResolvedJavaTypeInfo)

Aggregations

JavaTypeInfo (com.redhat.qute.commons.JavaTypeInfo)14 QuteJavaTypesParams (com.redhat.qute.commons.QuteJavaTypesParams)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 Test (org.junit.Test)5 ResolvedJavaTypeInfo (com.redhat.qute.commons.ResolvedJavaTypeInfo)4 JavaMemberInfo (com.redhat.qute.commons.JavaMemberInfo)2 List (java.util.List)2 JavaModelException (org.eclipse.jdt.core.JavaModelException)2 Range (org.eclipse.lsp4j.Range)2 InvalidMethodReason (com.redhat.qute.commons.InvalidMethodReason)1 JavaElementInfo (com.redhat.qute.commons.JavaElementInfo)1 JavaParameterInfo (com.redhat.qute.commons.JavaParameterInfo)1 JavaTypeKind (com.redhat.qute.commons.JavaTypeKind)1 QuteJavaDefinitionParams (com.redhat.qute.commons.QuteJavaDefinitionParams)1 NamespaceResolverInfo (com.redhat.qute.commons.datamodel.resolvers.NamespaceResolverInfo)1 QuteMavenProjectName (com.redhat.qute.jdt.QuteProjectTest.QuteMavenProjectName)1 QuteProjectTest.getJDTUtils (com.redhat.qute.jdt.QuteProjectTest.getJDTUtils)1 QuteProjectTest.loadMavenProject (com.redhat.qute.jdt.QuteProjectTest.loadMavenProject)1 QuteSupportForTemplate (com.redhat.qute.jdt.QuteSupportForTemplate)1 ObjectPart (com.redhat.qute.parser.expression.ObjectPart)1