Previously, package specs needed to deactivate the root view to test
their package serialization. Now, specs can just deactivate and then
reactivate the package, relying on serialization infrastructure that's
independent of the lifecycle of the RootView.
It serializes the package state to the atom.packageStates hash when
the package is deactivated, which means we will be able to test
package serialization independent of the overall window lifecycle by
just deactivating and re-activating the package.
The requiring of a package's main module is now decoupled from package
activation. Non-deferred packages will always be required before the
panes are deserialized. This allows the package to register any
deserializers for objects displayed in the panes.
Deferred packages can contain a 'deferredDeserializers' array in their
package.cson. If we attempt to deserialize an object with a deserializer
in the list, the package's main module will be required first so it has
a chance to register the deserializer. But the package still won't be
activated until an activation event occurs.
We may want to add an additional optional hook called 'load' which is
called at require time. We would not guarantee that the rootView
global would exist, but we could give the package a chance to register
deserializers etc. For now, registering deserializers is a side-effect
of requiring the package.
Modal dialogs can be presented while other modal dialogs are already
being displayed. Previously, dialogs were always displayed in the order
they were requested. But say you have two untitled buffers in a
pane and you close all items… You'll display prompt dialogs for both
buffers asking the user if they want to save. If the user answers yes
to the first dialog, they should see the path selection dialog before
they see the save prompt for the second buffer.
This commit uses a stack of queues to store deferred dialogs and allow
dialogs presented by the dismissal of another dialog to take precedence
over other pending dialogs.
Keeping the shutdown state as a local var in window.coffee causes spec failures because window.shutdown can only be called once in the entire spec suite
In additional, rename `registerViewClass(es)` to `registerDeserializer(s)`.
This moves us to a situation where any kind of object may want to be
deserialized, not just views.