本文整理汇总了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);
});
示例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);
}
示例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
});
}
示例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
}
示例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');
}
示例6: findTextInEditor
export function findTextInEditor() {
const state: FileEditorState = currentEditorState();
const resource: FilePath = state.getResource();
Command.searchFiles(resource.getProjectPath());
}
示例7: updateResourcePath
public updateResourcePath(resourcePath: FilePath, isReadOnly: boolean) {
window.location.hash = resourcePath.getProjectPath(); // update # anchor
this._editorResource = resourcePath;
this._editorReadOnly = isReadOnly;
}