scala-ide/scala-ide — pull request #364 by dnadolny (2013-04-04 00:21:06+00:00)
Title: Add a quick fix to create a new class

This quick fix is available for any error that would have caused us to attempt an import completion quick fix.

Get rid of some duplication in the current quick fixes which define a set of 6 methods (getRelevance, getDisplayString, etc) with the trait BasicCompletionProposal.

I have also added an option to the AbstractNewElementWizardPage to put the created file in a folder that differs from the package, which is allowed in scala but not in java. The main motivation for this is so that using the new class quick fix will put the created class in the same directory as the class you were attempting to use the missing class from. This only applies when your code is in a folder that doesn't match the package, otherwise we default to the java convention of using a folder path that matches the package name.
It would be a little bit nicer to have the folder displayed as "com/some/thing" rather than "com.some.thing", but it turns out to be a lot of work: you would have to create a new CompletionProcessor to replace JavaPackageCompletionProcessor, make the UI for it to replace what comes with NewTypeWizard.choosePackage, set up the key binding so that autocompletion kicks in on '/' rather than '.', and the easy part of replacing '/' (or File.separatorChar) with '.' and coercing it in to an IPackageFragment when we need it.

Fixed source formatting of QuickFixesTests, and moved the actual test to a separate file. With the exception of renaming withQuickFixes to withManyQuickFixesPerLine, none of that code was changed, only the formatting.

Fix #1000809, Re #1000898