Skip to content

138 events and notifications

Nathan Rijksen edited this page Aug 13, 2015 · 7 revisions
Title: Komodo DOM Events and Observer Notifications
Status: active (but missing some lesser notifications)
Authors: TrentM
ShaneC
DavidA
ToddW
Created: 24-Sep-2001

Introduction

This document describes the current set of DOM events and observer notifications used by Komodo.

DOM Events

Dom events occur within the context of a window and can bubble/cascade over multiple elements (Nodes) in the DOM hierarchy.

Komodo Events

  • komodo-ui-started

    Sent after Komodo startup UI initialization is complete. Sent to the window.

  • komodo-post-startup

    Sent a few seconds after komodo-ui-started. Sent to the window.

  • workspace-restored

    Sent after workspace has been fully restored. Sent to the window.

  • view_opened

    View (event.originalTarget) has just been opened. Sent to the view.

  • view_closing

    View (event.originalTarget) is about to be closed. Sent to the view.

  • view_closed

    View (event.originalTarget) has just been closed - happens at the very last moment, so some things will not be available, such as the document. Sent to the view.

  • view_list_closed

    No views opened anymore. Sent to the viewlist class.

  • current_view_changed

    View (event.originalTarget) has just been made current. Sent to the viewlist class.

  • current_view_linecol_changed

    View (event.originalTarget) editor (caret) position has changed. Sent to the view. DataEvent, containing 'currentPos', 'line' (0 offset) and 'column' of where the caret is now positioned.

  • current_view_scroll_changed

    View (event.originalTarget) scrolling position has changed. Sent to the view.

  • view_document_attached

    View (event.originalTarget) now has a koDoc attached. Sent to the view.

  • view_document_detaching

    View (event.originalTarget) is about to have it's koDoc detached. Sent to the view.

  • view_dirty_status_changed

    View (event.originalTarget) has been modified and now has an unsaved buffer. Sent to the view.

  • current_view_encoding_changed

    Current view's encoding has been changed. Sent to the window.

  • current_view_language_changed

    Current view's programming language has been changed. Sent to the window.

  • editor_text_modified

    Sent when the editor text has been changed. Sent to the window. The event.data contains these attributes: 'view', 'position', 'modificationType' (insertion or deletion), 'text', 'bytelength', 'linesAdded', 'line', 'foldLevelNow' and 'foldLevelPrev'.

  • editor_margin_clicked

    Sent when one of the editor margins is clicked on. Dispatched to the view. The event.data contains these attributes: 'view', 'margin' (number 0-4), 'position', 'line', and 'modifiers'.

  • editor_dwell_start

    Sent when the mouse hovers over the particular editor position. Dispatched to the view. The event.data contains these attributes: 'view', 'position', 'x', and 'y'.

  • editor_dwell_end

    Sent when the mouse ends it's hovering over a particular editor position. Dispatched to the view. The event.data contains these attributes: 'view', 'position', 'x', and 'y'.

  • scintilla-add-char

    Sent when the editor adds a character, originated by a key press event. Sent from scintilla editor inside the view. DataEvent, containing 'pos' and 'charCode' of where the character was added.

  • file_saved

    Sent after the editor file has been saved. Sent to the window. DataEvent, containing 'view' for which view's editor was saved.

  • bookmark_added

    Sent when an editor bookmark is added. Sent to the window. DataEvent, containing 'line' (0 offset) of where the bookmark was added.

  • bookmark_deleted

    Sent when an editor bookmark is removed. Sent to the window. DataEvent, containing 'line' (0 offset) of where the bookmark was removed.

  • project_opened

    Sent when an project is opened. Sent to the window.

  • current_project_changed

    Sent when the active project is changed. Sent to the window.

  • current_project_saved

    Sent when a project is saved. Sent to the window.

  • codeintel_status_changed

    Sent when the codeintel system is activated (started) or deactivated (stopped). You can use `ko.codeintel.isActive` to check the current status.

  • codeintel_autocomplete_showing

    Sent when the codeintel completions dialog is first shown. Sent to the view. DataEvent, containing 'trg' codeintel trigger.

  • codeintel_autocomplete_selected

    Sent when an autocompletion selection is chosen and about to be inserted into the editor. Sent to the scintilla editor inside the view. DataEvent, containing 'position' and 'text' to insert.

  • debugger_state_changed

    When the debugger's state (running, stopped) has changed. Sent to the window.

Using DOM Events

Here is an example of Komodo dom events:

var listener = function(event) {
    var view = event.originalTarget;
    alert("komodo view changed to: " + view.koDoc.displayPath);
};
window.addEventListener(listener, "current_view_changed");

Here is an example of sending a dom event from Komodo:

xtk.fireEvent(window, "hi_there");

nsIObserver Notifications

The nsIObserver notifications are a litte different, in that they are sent globally, rather than through a specific window (like DOM events).

Komodo nsIObserver notifications

  • komodo-ui-started

    Sent after Komodo startup UI initialization is complete.

  • komodo-post-startup

    Sent a few seconds after komodo-ui-started.

  • application-activated

    A notification on Windows and OSX when Komodo is made the active application in the window manager (not available on Linux). 'subject' is a nsISupportsPRBool - true when activated, false when deactivated.

  • open-url

    Notifies that Komodo should open the given url. 'data' is the url.

  • open_file

    Same as open-url.

  • project_added

    Sent when a project is opened/added. 'subject' is a koIProject.

  • project_removed

    Sent when the project is removed. 'subject' is a koIProject.

  • current_project_changed

    Sent when the active project is changed. 'subject' is a koIProject (or None when no project is active).

  • scheme-changed

    The editor color scheme has been changed (e.g. the "Fonts and Colors" preferences). 'subject' is the koIScintillaScheme instance, 'data' contains the scheme name.

  • keybinding-scheme-changed

    The editor keybinding scheme has been changed (e.g. the "Editor > Keybindings" preferences). 'subject' is the koIKeybindingScheme instance, 'data' contains the scheme name.

  • status_message

    Used to send to the statusbar, to display the given status message. 'subject' is a koIStatusMessage instance.

  • file_changed

    Sent to notify that the given file/project/tool has been changed somehow. 'data' is a url. The file status service watches for this notification, and subsequently schedules the file to have it's status (scc, permissions) checked in the background.

  • file_status

    The file status service sends this notification when it detects the status of a file has changed (scc, permissions). 'data' is a list of url's (seperated by newlines).

  • codeintel_buffer_scanned

    The codeintel system has finished (re)scanning the given buffer. 'subject' is a koICodeIntelBuffer, 'data' is the path of the buffer.

  • user_environment_changed

    The user environment changed in Komodo, which may be caused from the user customing the environment preferences, or switching to/from a project that defined custom environment settings.

  • invocation_terminated

    A debugger session has finished/terminated.

  • run_terminated

    A run command has finished/terminated. 'subject' is a koIRunProcess.

Using nsIObserver notifications

Here is an example of observing notifications:

var obsSvc = Components.classes['@mozilla.org/observer-service;1']
             .getService(Components.interfaces.nsIObserverService);
var listener = {
    observe: function(subject, topic, data) {
        alert("received observer subject: " + subject);
    }
};
obsSvc.addObserver(listener, "application-activated", false);

Here is an example of sending notifications:

var obsSvc = Components.classes['@mozilla.org/observer-service;1']
             .getService(Components.interfaces.nsIObserverService);
obsSvc.notifyObservers(null, "my-topic", "some string data");