How to register a custom PsiClass into a project so that it can automatically prompt when entering code

My question and How to register a psi file created in memory into a project module? Similar, But I couldn’t find the answer , Can anyone help me,

I will use the following code to create a Java code editor

  EditorFactory editorFactory = EditorFactory.getInstance();
        editor = editorFactory.createEditor(document, project, JavaFileType.INSTANCE, false);

I am writing custom code that requires the use of classes outside of the project. I want this editor to recognize additional PsiClasses. How should I register PsiClasses

If you need to open a Java source code (.java) that is outside of the project, use the [ PsiFileFactory.createFileFromText(). You can provide a Language parameter to indicate that this is a Java source.

This cannot solve my problem, my problem and How to register a psi file created in memory into a project module? Same, but there’s no answer inside