Os WindowCommands não requerem uma view para serem executados, embora possa existir uma view associada.
Pelo contrário, os TextCommands requerem uma view para estarem disponíveis.
A titulo de exemplo, no exemplo que forneceu:
self.view.insert(edit, 0, "Hello, World!")
A view é componente obrigatória por ser um TextCommand.
No exemplo abaixo de WindowCommand não é utilizada uma view mas apenas o acesso a window do sublime para criar um novo documento.
Ref.: Extracto do plugin side_bar
(http://folk.uib.no/hab001/Info100/Sublime%20Text%202.0.2/Data/Packages/Default/side_bar.py)
import sublime, sublime_plugin
import os
class NewFileAtCommand(sublime_plugin.WindowCommand):
def run(self, dirs):
v = self.window.new_file()
if len(dirs) == 1:
v.settings().set('default_dir', dirs[0])
def is_visible(self, dirs):
return len(dirs) == 1
Window Commands
Window commands operate at the window level. This doesn’t mean that you
can’t manipulate views from window commands, but rather that you don’t
need views in order for window commands to be available. For instance,
the built-in command new_file is defined as a WindowCommand so it works
even when no view is open. Requiring a view to exist in that case
wouldn’t make sense.
Window command instances have a .window attribute to point to the window
instance that created them.
The .run() method of a window command doesn’t require any positional
parameter.
Window commands are able to route text commands to their window’s active
view.
Text Commands
Text commands operate at the view level, so they require a view to exist
in order to be available.
Text command instances have a .view attribute pointing to the view
instance that created them.
The .run() method of text commands requires an edit instance as its
first positional argument.
Referências:
http://docs.sublimetext.info/en/latest/extensibility/plugins.html#window-commands
http://docs.sublimetext.info/en/latest/extensibility/plugins.html#text-commands