scala-ide/scala-ide — pull request #761 by sschaef (2014-08-07 14:02:03+00:00)
Title: Save actions

This is not yet completely finished but because I already used it in production and it worked great so far I want to give you the possibility to play with it around as early as possible. In the following a short overview about what is included in this PR.

Features included:

- Java save actions do no longer work for Scala editors
- Instead there are even better Scala save actions
- A preference page in `Scala→Editor→Save actions` where the save actions can be enabled/disabled
- A timeout for save actions (can be configured in the preferences). This timeout keeps the editor responsive but can't abort the computation of the save action (in the worst case it means that a non returning save action will run until termination of Eclipse in a background thread)
- Document driven (fast) and compiler driven (slow) save actions. The former usually operates in ~1-10ms, the latter more in ~50-timeout ms.

Design overview:

- Package `org.scalaide.extensions` contains new API+save actions
- Package `org.scalaide.core.text` also contains new API
- Package `org.scalaide.core.internal.{text,extensions}` contains implementations of the API
- Package `org.scalaide.ui.internal.editor` contains additions needed for save actions.
- A new save action needs to be a `trait X extends SaveAction with {CompilerSupport,DocumentSupport}`
- The save action needs to be enabled in `SaveActionExtensions.saveActionSettings` and in one of `SaveActionExtensions#{applyDocumentExtensions,applyCompilerExtensions}`

Drawbacks/TODOs:

- Implicit highlighting is gone, it need to be restored.
- API is not yet finished
- Resource leak when a save action never returns. I see possibilities to "reactify" the save action API because most functionality is hidden to users. But it is not yet implemented.