Strange behaviour of Structure view

Answered

Using Intellij Idea 15.0.4. I added a new method to a class but it did not appear in the Structure tool window. I eventually found it, hidden in a bogus property element. It appears that because my method was named "setLocation" Idea assumed it was a setter for a property. But I already have a field called location, of a completely different type.

My workaround is to change the name of the method, but it seems to me that the assumed linkage between setters/getters and properties should check for matching types at least.

While I'm on the subject of the Structure window, it's very annoying that if I am editing a Java file with the Structure window in the right hand side, when I switch the active editor window to an XML layout file the preview window automatically appears in place of the Structure window but when I switch back to the Java file the Structure window is not restored. At least this prompted me to learn the keyboard shortcut for Structure.

 

7 comments
Comment actions Permalink

Please submit a bug at htps://youtrack.jetbrains.com/issues/IDEA with the sample Java file to reproduce this problem.

The second problem seems to be related to https://youtrack.jetbrains.com/issue/IDEA-81249.

0
Comment actions Permalink

Ok, I'll submit the report. With regard to the second issue, I looked at that bug report, but I don't understand the statement

"As a workaround - specify for "UI Designer" mode "Split Mode" and "Project" exhibit at the minimum height mode "UI Designer"."

I think this might be an automatic translation from Russian but it makes no sense to me. 

0
Comment actions Permalink

Are you referring to Android XML layout preview? I can't reproduce the problem. Structure view remains open on the right when pinned.

I'm using 2016.1, so you may want to update and see if it fixes the problem for you.

0
Comment actions Permalink

I have the window pinned and docked. I have downloaded 2016.1 so will install and try it. Video of problem here:

https://youtu.be/_8nrlTszrfY

0
Comment actions Permalink

Same behaviour with 2016.1.

0
Comment actions Permalink

OK, I see what's the difference in our configurations, you have enabled the separate Preview tool window, so the workaround would be to disable it by ticking off the Prefer XML Editor:

If you don't want to disable this mode, there is another workaround: enable Split Mode for Preview tool window (from the tool window button right click menu) so that structure is at the top and Preview is at the bottom (or vice versa), then maximize the Preview split window:

This way Structure tool window will not close when you switch back to Java file.

0
Comment actions Permalink

Thanks - the Split Mode does the job nicely.

0

Please sign in to leave a comment.