Snippets code from my daily experience

July 1, 2008

Determine if the current view is a macro in Komodo

Filed under: komodo — dafi @ 6:23 pm

Komodo allows to edit macros in editor windows, this feature simplifies the macro code writing.

Do you need to know if you are editing a macro? Well You must fight with koIPart interface.

After digging into Komodo IDLs I found a way to know if current view is a macro, take a look at code shown below.

var currView = ko.views.manager.currentView;
var fileURL = currView.document.file.URI;
var macroPart = ko.toolboxes.user.toolbox.getChildByURL(fileURL);
var isMacro = macroPart != null && macroPart.type == “macro”;

I’ve asked at irc.mozilla.org#komodo channel and mixedpuppy confirmed me this is the best way.

Blog at WordPress.com.

%d bloggers like this: