2011-12-21 18:58

Aptana Scripting - Find TODOs 範例中的參數

/*
 * Menu: Editors > Find TODOs
 * Kudos: Ingo Muschenetz
 * License: EPL 1.0
 * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
 */

function main() {
    var files = resources.filesMatching(".*\\.js");
    var match;

    for each( file in files ) {
        file.removeMyTasks( );
        for each( line in file.lines ) {
            if (match = line.string.match(/\/\/TODO: (.*)/)) {
                line.addMyTask( match[1] );
            }
        }
    }
    window.getActivePage().showView("org.eclipse.ui.views.TaskList");
}

只列出當前文件的方法
var files = resources.filesMatching('.*/'+editors.activeEditor.textEditor.titleToolTip);

resources 部分的方法
filesMatching(".*\\.js")
filesMatchingForProject("Project Name",".*\\.js")
filesMatchingIgnoreCase(".*\\.js")
filesMatchingForProjectIgnoreCase("Project Name",".*\\.js")

file 部分的方法
size
lines
removeMyTasks()

line 部分的方法
lineNumber
string
addMyTask('Task String')

0 回應: