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


TypeScript FilePath.getResourcePath方法代码示例

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


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

示例1: findFilesWithText

 findFilesWithText(matchText, filePatterns, searchCriteria, function(filesReplaced){
    var editorState: FileEditorState = FileEditor.currentEditorState();
    
    for(var i = 0; i < filesReplaced.length; i++) {
       var fileReplaced = filesReplaced[i];
       var fileReplacedResource: FilePath = FileTree.createResourcePath("/resource/" + fileReplaced.project + "/" + fileReplaced.resource);
       
       if(editorState.getResource().getResourcePath() == fileReplacedResource.getResourcePath()) {
          FileExplorer.openTreeFile(fileReplacedResource.getResourcePath(), function() {
             //FileEditor.showEditorLine(record.line);  
          }); 
       }
    }
 });
开发者ID:snapscript,项目名称:snap-develop,代码行数:14,代码来源:commands.ts

示例2: updateEditorFromHistory

 function updateEditorFromHistory(){
    var location = window.location.hash;
    var hashIndex = location.indexOf('#');
    
    if(hashIndex != -1) {
       var resource = location.substring(hashIndex + 1);
       var resourceData: FilePath = FileTree.createResourcePath(resource);
       var editorState: FileEditorState = FileEditor.currentEditorState();
       var editorResource: FilePath = editorState.getResource();
       
       if(editorResource == null || editorResource.getResourcePath() != resourceData.getResourcePath()) { // only if changed
          FileExplorer.openTreeFile(resourceData.getResourcePath(), function() {});
       }
    }
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:15,代码来源:history.ts

示例3: highlightProblems

 export function highlightProblems(){
    var editorState: FileEditorState = FileEditor.currentEditorState();
    var editorResource: FilePath = editorState.getResource();
    
    if(editorResource != null) {
       var highlightUpdates = [];
       
       //FileEditor.clearEditorHighlights(); this makes breakpoints jitter
       for (var problemKey in currentProblems) {
          if (currentProblems.hasOwnProperty(problemKey)) {
             if(Common.stringStartsWith(problemKey, editorResource.getResourcePath())) {
                var problemItem: ProblemItem = currentProblems[problemKey];
                
                if(problemItem != null) {                     
                   highlightUpdates.push(problemItem.getLine()); 
                }
             } 
          }
       }
       FileEditor.clearEditorHighlights(); 
       
       if(highlightUpdates.length > 0) {
          FileEditor.createMultipleEditorHighlights(highlightUpdates, "problemHighlight");
       }
    }
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:26,代码来源:problem.ts

示例4: updateProblems

 function updateProblems(socket, type, text) {
 	var problems = w2ui['problems'];
 	var message = JSON.parse(text);
 	var resourcePath: FilePath = FileTree.createResourcePath(message.resource);   	
 	var problemItem: ProblemItem = new ProblemItem(
          resourcePath,
 	      message.line,
 	      message.description,
 	      "<div class='errorDescription'>"+message.description+"</div>",
 	      message.project,
 	      message.time
 	);
 	if(message.line >= 0) {
 	   console.log("Add problem '" + problemItem.getDescription() + "' at line '" + problemItem.getLine() + "'");
 	} else {
 	   console.log("Clear all problems for " + problemItem.getResourcePath() + "");
 	}  	
 	
 	if(problemItem.getLine() >= 0) {
 	   currentProblems[problemItem.getKey()] = problemItem;
 	} else {
       for (var problemKey in currentProblems) {
          if (currentProblems.hasOwnProperty(problemKey)) {
             if(Common.stringStartsWith(problemKey, resourcePath.getResourcePath())) {
                currentProblems[problemKey] = null;
             }
          }
       }
 	}
 	showProblems(); // if it has changed then highlight
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:31,代码来源:problem.ts

示例5: 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

示例6: function

 function(){
    var message = {
       project : Common.getProjectName(),
       resource : resourceDetails.getFilePath()
    };
    ProcessConsole.clearConsole();
    EventBus.sendEvent("DELETE", message);
    Project.deleteEditorTab(resourceDetails.getResourcePath()); // rename tabs if open
 },
开发者ID:snapscript,项目名称:snap-develop,代码行数:9,代码来源:commands.ts

示例7: showStatus

 export function showStatus() {
    var statusRecords = [];
    var statusIndex = 1;
    
    for (var statusProcess in statusProcesses) {
       if (statusProcesses.hasOwnProperty(statusProcess)) {
          var statusProcessInfo: ProcessInfo = statusProcesses[statusProcess];
          
          if(statusProcessInfo != null) {
             var statusProject: string = statusProcessInfo.getProject();
             
             if(statusProject == Common.getProjectName() || statusProject == null) {
                var displayName = "<div class='debugIdleRecord'>"+statusProcess+"</div>";
                var active = "&nbsp;<input type='radio'><label></label>";
                var resourcePath = "";
                var debugging: boolean = statusProcessInfo.isDebug();
                var status: ProcessStatus = statusProcessInfo.getStatus();
                var running: boolean = false;
                
                if(statusFocus == statusProcess) {
                   active = "&nbsp;<input type='radio' checked><label></label>";
                }
                if(statusProcessInfo.getResource() != null) {
                   var resourcePathDetails: FilePath = FileTree.createResourcePath(statusProcessInfo.getResource());
                   
                   if(statusFocus == statusProcess && debugging) {
                      displayName = "<div class='debugFocusRecord'>"+statusProcess+"</div>";
                   } else {
                      displayName = "<div class='debugRecord'>"+statusProcess+"</div>";               
                   }
                   resourcePath = resourcePathDetails.getResourcePath();
                   running = true;
                } 
                statusRecords.push({
                   recid: statusIndex++,
                   name: displayName,
                   active: active,
                   process: statusProcess,
                   status: ProcessStatus[status],
                   running: running,
                   system: statusProcessInfo.getSystem(),
                   pid: statusProcessInfo.getPid(),
                   resource: statusProcessInfo.getResource(),
                   focus: statusFocus == statusProcess,
                   script: resourcePath
                });
             } else {
                console.log("Ignoring process " + statusProcess + " as it belongs to " + statusProject);
             }
          }
       }
    }
    Common.updateTableRecords(statusRecords, 'debug'); // update if changed only
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:54,代码来源:debug.ts

示例8: handleTreeMenu

 function handleTreeMenu(resourcePath: FilePath, commandName, elementId, isDirectory) {
    if(commandName == "runScript") {
       openTreeFile(resourcePath.getResourcePath(), function(){
          Command.runScript();
       });
    } else if(commandName == "debugScript") {
       openTreeFile(resourcePath.getResourcePath(), function(){
          Command.debugScript();
       });
    } else if(commandName == "createArchive") {
       var savePath: FilePath = FileTree.createResourcePath("/" + Common.getProjectName() + ".jar");
       Command.createArchive(savePath, resourcePath);      
    }else if(commandName == "newFile") {
       Command.newFile(resourcePath);
    }else if(commandName == "newDirectory") {
       Command.newDirectory(resourcePath);
    }else if(commandName == "exploreDirectory") {
       Command.exploreDirectory(resourcePath);
    }else if(commandName == "openTerminal") {
       Command.openTerminal(resourcePath);
    }else if(commandName == "renameFile") {
       if(isDirectory) {
          Command.renameDirectory(resourcePath);
       } else {
          Command.renameFile(resourcePath);
       }
    }else if(commandName == "saveFile") {
       openTreeFile(resourcePath.getResourcePath(), function(){
          Command.saveFile();
       });
    }else if(commandName == "deleteFile") {
       if(FileTree.isResourceFolder(resourcePath.getResourcePath())) {
          Command.deleteDirectory(resourcePath);
       } else {
          Command.deleteFile(resourcePath);
       }
    }
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:38,代码来源:explorer.ts

示例9: updateEditor

   export function updateEditor(fileResource: FileResource) { // why would you ever ignore an update here?
      var resourcePath: FilePath = fileResource.getResourcePath();
      var isReadOnly = fileResource.isHistorical() || fileResource.isError();
      var realText: string = fileResource.getFileContent();
      var textToDisplay = resolveEditorTextToUse(fileResource);
      var session = editorView.getEditorPanel().getSession();
      var currentMode = session.getMode();
      var actualMode = resolveEditorMode(resourcePath.getResourcePath());

      saveEditorHistory(); // save any existing history
      
      if(actualMode != currentMode) {
         session.setMode({
            path: actualMode,
            v: Date.now() 
         })
      }
      if(!isReadOnly) {
         createEditorUndoManager(session, textToDisplay, realText, resourcePath); // restore any existing history      
      } else {
         createEditorWithoutUndoManager(textToDisplay);
      }
      clearEditor();
      setReadOnly(isReadOnly);
      
      editorView.updateResourcePath(resourcePath, isReadOnly);
      ProblemManager.highlightProblems(); // higlight problems on this resource
      
      if (resourcePath != null && editorView.getEditorResource()) {
         var filePath: string = editorView.getEditorResource().getFilePath();
         var allBreakpoints = editorView.getEditorBreakpoints();
         var breakpoints = allBreakpoints[filePath];
   
         if (breakpoints != null) {
            for(var lineNumber in breakpoints) {
               if (breakpoints.hasOwnProperty(lineNumber)) {
                  if (breakpoints[lineNumber] == true) {
                     setEditorBreakpoint(parseInt(lineNumber) - 1, true);
                  }
               }
            }
         }
      }
      Project.createEditorTab(); // update the tab name
      History.showFileHistory(); // update the history
      StatusPanel.showActiveFile(editorView.getEditorResource().getProjectPath());  
      FileEditor.showEditorFileInTree();
      scrollEditorToPosition();
      updateEditorTabMark(); // add a * to the name if its not in sync
   }
开发者ID:snapscript,项目名称:snap-develop,代码行数:50,代码来源:editor.ts


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