package com.python.pydev.codecompletion;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.python.pydev.editor.codecompletion.revisited.CodeCompletionTestsBase;
import org.python.pydev.editor.codecompletion.revisited.javaintegration.AbstractJavaIntegrationTestWorkbench;

public class JavaIntegrationPydevComTestWorkbench extends AbstractJavaIntegrationTestWorkbench {
    
    
    
    /**
     * Check many code-completion cases with the java integration.
     */
    public void testJavaClassModule() throws Throwable {
        try{
            //case 1: try find definition for java classes
            checkCase1();
            
            //case 2: try context-insensitive code completion
            checkCase2();
            
//            goToManual();
        }catch(Throwable e){
            //ok, I like errors to appear in stderr (and not only in the unit-test view)
            e.printStackTrace();
            throw e;
        }
    }

    public void checkCase1() throws CoreException {
        String mod1Contents = "from javamod1 import javamod2\njavamod2.JavaClass2";
        setFileContents(mod1Contents);
        //TODO: Do F3 on JavaClass2
    }
    
    public void checkCase2() throws CoreException {
        String mod1Contents = "JavaClas";
        setFileContents(mod1Contents);
        ICompletionProposal[] proposals = this.requestProposals(mod1Contents, editor);
        
        CodeCompletionTestsBase.assertContains("JavaClass - javamod1", proposals);
        CodeCompletionTestsBase.assertContains("JavaClass2 - javamod1.javamod2", proposals);
    }


}

@@ -111,46 +111,144 @@
 ace.
-text.contentassist.ICompletionProposal
+action.IAction;%0Aimport org.eclipse.jface.text.contentassist.ICompletionProposal;%0Aimport org.python.pydev.editor.actions.PyGoToDefinition
 ;%0Aim
@@ -435,16 +435,66 @@
 rkbench;
+%0Aimport org.python.pydev.editor.model.ItemPointer;
 %0A%0Apublic
@@ -1355,35 +1355,455 @@
     
-//TODO: Do F3 on JavaClass2
+%0A        PyGoToDefinition pyGoToDefinition = new PyGoToDefinition();%0A        pyGoToDefinition.setEditor(editor);%0A        editor.setSelection(mod1Contents.length()-2, 0);%0A        editor.doSave(null); //update the caches%0A        ItemPointer%5B%5D itemPointers = pyGoToDefinition.findDefinitionsAndOpen(false);%0A        for(ItemPointer pointer:itemPointers)%7B%0A            System.out.println(pointer);%0A        %7D%0A        assertTrue(itemPointers.length %3E= 1);
 %0A   

Find definition working for java classes in java modules.