当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript FilePath.getProjectPath方法代码示例

本文整理汇总了TypeScript中tree.FilePath.getProjectPath方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FilePath.getProjectPath方法的具体用法?TypeScript FilePath.getProjectPath怎么用?TypeScript FilePath.getProjectPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tree.FilePath的用法示例。


在下文中一共展示了FilePath.getProjectPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

 DialogBuilder.createArchiveTreeDialog(savePath, function(resourceDetails: FilePath) {
    var message = {
       project: Common.getProjectName(),
       resource: mainScript.getProjectPath(),
       archive: resourceDetails.getProjectPath()
    };
    EventBus.sendEvent("CREATE_ARCHIVE", message);
 });
开发者ID:snapscript,项目名称:snap-develop,代码行数:8,代码来源:commands.ts

示例2: showActiveFile

 export function showActiveFile(resource: string) {
    var resourcePath: FilePath = FileTree.createResourcePath(resource);
    var pathSegments = resourcePath.getProjectPath().split("/");
    var pathBreadcrumb = "";
    
    pathBreadcrumb += "<table border='0'>\n";
    pathBreadcrumb += "<tr>\n";
    pathBreadcrumb += "<td><div class='treeIndexFolder'></div><td>\n";
    pathBreadcrumb += "<td>"+Common.getProjectName()+"</td>\n";
    
    for(var i = 0; i < pathSegments.length; i++) {
       var segment = pathSegments[i];
       
       if(segment.length > 0) {
          pathBreadcrumb += "<td><div class='";
          
          if(segment.indexOf(".") != -1){
             pathBreadcrumb += "treeFile";
          } else {
             pathBreadcrumb += "treeFileFolder";
          }
          pathBreadcrumb += "'></div>";
          pathBreadcrumb += "</td>\n<td style='white-space: nowrap;'>";
          pathBreadcrumb += segment;
          pathBreadcrumb += "</td>\n";
       }
    }
    pathBreadcrumb += "</table>";
    
    $("#currentFile").html(pathBreadcrumb);
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:31,代码来源:status.ts

示例3: showFileHistory

 export function showFileHistory() {
    var editorState: FileEditorState = FileEditor.currentEditorState();
    var editorPath: FilePath = editorState.getResource();
 
    if(!editorPath) {
       console.log("Editor path does not exist: ", editorState);
    }
    var resource = editorPath.getProjectPath();
    
    $.ajax({
       url: '/history/' + Common.getProjectName() + '/' + resource,
       success: function (currentRecords) {
          var historyRecords = [];
          var historyIndex = 1;
          
          for (var i = 0; i < currentRecords.length; i++) {
             var currentRecord = currentRecords[i];
             var recordResource: FilePath = FileTree.createResourcePath(currentRecord.path);
             
             historyRecords.push({ 
                recid: historyIndex++,
                resource: "<div class='historyPath'>" + recordResource.getFilePath() + "</div>", // /blah/file.snap 
                date: currentRecord.date,
                time: currentRecord.timeStamp,
                script: recordResource.getResourcePath() // /resource/<project>/blah/file.snap
             });
          }
          w2ui['history'].records = historyRecords;
          w2ui['history'].refresh();
       },
       async: true
    });
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:33,代码来源:history.ts

示例4: showEditorBreakpoints

 export function showEditorBreakpoints() {
    var allBreakpoints = editorView.getEditorBreakpoints();
    var breakpointRecords = [];
    var breakpointIndex = 1;
 
    for(var filePath in allBreakpoints) {
       if(allBreakpoints.hasOwnProperty(filePath)) {
          var breakpoints = allBreakpoints[filePath];
 
          for(var lineNumber in breakpoints) {
             if (breakpoints.hasOwnProperty(lineNumber)) {
                if (breakpoints[lineNumber] == true) {
                   var resourcePathDetails: FilePath = FileTree.createResourcePath(filePath);
                   var displayName = "<div class='breakpointEnabled'>"+resourcePathDetails.getProjectPath()+"</div>";
                   
                   breakpointRecords.push({
                      recid: breakpointIndex++,
                      name: displayName,
                      location : "Line " + lineNumber,
                      resource : resourcePathDetails.getProjectPath(),
                      line: parseInt(lineNumber),
                      script : resourcePathDetails.getResourcePath()
                   });
                }
             }
          }
       }
    }
    w2ui['breakpoints'].records = breakpointRecords;
    w2ui['breakpoints'].refresh();
    Command.updateScriptBreakpoints(); // update the breakpoints
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:32,代码来源:editor.ts

示例5: updateProfiler

   function updateProfiler(socket, type, text) {
      var profileResult = JSON.parse(text);
      var profileRecords = profileResult.results;
      var profilerRecords = [];
      var profilerWidths = [];
      var profilerIndex = 1;
      var totalTime = 0;
      var currentHeight = w2ui['profiler'].records;
     
      for(var i = 0; i < profileRecords.length; i++) {
         totalTime += profileRecords[i].time;
      }
      for(var i = 0; i < profileRecords.length; i++) {
         var recordTime = profileRecords[i].time;
         
         if(recordTime > 0) {
            var percentageTime: number = (recordTime/totalTime)*100;
            var percentage: number = percentageTime;
            
            profilerWidths[i] = percentage;
         }
      }
      for(var i = 0; i < profileRecords.length; i++) {
         var profileRecord = profileRecords[i];
         var sortableProfilerWidth = ('0000'+ profilerWidths[i]).slice(-4); // padd with leading zeros
         var resourcePath: FilePath = FileTree.createResourcePath(profileRecord.resource);
         var displayName = "<div class='profilerRecord'>"+resourcePath.getProjectPath()+"</div>";
         var percentageBar = "<!-- " + sortableProfilerWidth + " --><div style='padding: 2px;'><div style='height: 10px; background: #ed6761; width: "+profilerWidths[i]+"%;'></div></div>";
         var averageTime = (profileRecord.time / profileRecord.count) / 1000; // average time in seconds

         profilerRecords.push({
            recid: profilerIndex++,
            resource: displayName,
            percentage: percentageBar,
            duration: profileRecord.time,
            line: profileRecord.line,
            count: profileRecord.count,
            average: averageTime.toFixed(5),
            script: resourcePath.getResourcePath()
         });
      }
      Common.updateTableRecords(profilerRecords, 'profiler');
   }
开发者ID:snapscript,项目名称:snap-develop,代码行数:43,代码来源:profiler.ts

示例6: findTextInEditor

 export function findTextInEditor() {
    const state: FileEditorState = currentEditorState();
    const resource: FilePath = state.getResource();
 
    Command.searchFiles(resource.getProjectPath());
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:6,代码来源:editor.ts

示例7: updateResourcePath

 public updateResourcePath(resourcePath: FilePath, isReadOnly: boolean) {
    window.location.hash = resourcePath.getProjectPath(); // update # anchor
    this._editorResource = resourcePath;
    this._editorReadOnly = isReadOnly;
 }  
开发者ID:snapscript,项目名称:snap-develop,代码行数:5,代码来源:editor.ts


注:本文中的tree.FilePath.getProjectPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。