Eclipse opens .class instead of .java when opening declaration in the same project

When I hit F3 on a class name in the editor window of one of my classes, a new editor window opens with the .class file of the corresponding class, which is in the same project. I expect to see a new editor window with the .java file, as it is happening when opening declarations in other projects.

I did look at my .classpath build.properties and .project and the related questions here, but found no solution.

build.properties:

bin.includes = META-INF/,\
               plugin.xml,\
               LICENSE.txt,\
               bin/,\
               org.rulez.magwas.styledhtml.jar,\
               lib/jython.jar,\
               lib/saxon9-unpack.jar,\
               lib/saxon9he.jar
src.includes = doc/,\
               LICENSE.txt,\
               README,\
               lib/
source.org.rulez.magwas.styledhtml.jar = src/

.classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry exported="true" kind="lib" path="lib/saxon9-unpack.jar"/>
    <classpathentry exported="true" kind="lib" path="lib/saxon9he.jar"/>
    <classpathentry exported="true" kind="lib" path="lib/jython.jar"/>
    <classpathentry exported="true" kind="lib" path="bin/" sourcepath="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

.project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>org.rulez.magwas.styledhtml</name>
    <comment></comment>
    <projects>
        <project>uk.ac.bolton.archimate.editor</project>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.pde.ManifestBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.pde.SchemaBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.pde.PluginNature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

Upvotes: 1

Views: 1090

Answers (1)

William F. Jameson
William F. Jameson

Reputation: 1853

Your classpath has a very odd entry here:

<classpathentry exported="true" kind="lib" path="bin/" sourcepath="src"/>

You have your output directory as a regular library. Even though you do have the sourcepath attribute as well, this probably confuses Eclipse.

I would suggest removing the entire entry because it is probably causing Eclipse to open the .class file produced by compiling your code.

Upvotes: 1

Related Questions