scala-ide/scala-ide — pull request #575 by dotta (2013-10-18 13:31:18+00:00)
Title: `ScalaClassFileEditor` should always hold a `ScalaClassFile`

There doesn't seem to be a good reason for not creating a `ScalaClassFile` when
source attachments cannot be located.

Doing so has two nice consequences:

1) When sources are manually attached to a Scala JAR, and a classfile is opened
in an editor, the source is now correctly syntactically highlighted. This
basically fix half of ticket Re #1001926 (the other half is triggering
semantic highlighting).

2) `ScalaClassFileEditor` instances are now ensured to be always created with
an underlying `ScalaClassFile`. This is an important fact, as
`ScalaClassFileEditor` assumes it (in fact, the `ClassCastException`
reported in ticket Re #1001925 was happening because this implicit contract
was broken, i.e., it was possible that a `ScalaClassFileEditor` could be
created with a (Java) `ClassFile` when no source attachment was found.

By the way, the `ClassCastException` issue mentioned in point 2) could be
reproduced by copying a **Scala** classfile in the root of a project, and then
trying to opening (by double-clicking on it from the Package Explorer view)
would result in an error prompted to the user.

Fixes #1001925