diff options
author | Ananya Sen | 2012-02-01 11:59:11 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-01 11:59:11 -0800 |
commit | 553fce7721cacfd13b6013fdcdd0243c90083b5e (patch) | |
tree | d0ef0c7fdf19053e2d78a3700e7234955eccb30c | |
parent | 61ff730a1897890f71403cbfac4d15269e2d271f (diff) | |
download | ninja-553fce7721cacfd13b6013fdcdd0243c90083b5e.tar.gz |
fixed reference to coreioapi
cleaning up opening code view tabs
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-x | js/components/layout/document-entry.reel/document-entry.js | 6 | ||||
-rwxr-xr-x | js/components/ui/FilePicker/file-picker-controller.js | 9 | ||||
-rwxr-xr-x | js/io/document/document-controller.js | 46 | ||||
-rwxr-xr-x | js/io/system/coreioapi.js | 3 | ||||
-rw-r--r-- | js/io/utils/file-utils.js | 4 | ||||
-rwxr-xr-x | js/lib/NJUtils.js | 2 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 72 |
7 files changed, 97 insertions, 45 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 6f265c91..1431e76f 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js | |||
@@ -81,7 +81,7 @@ exports.DocumentEntry = Montage.create(Component, { | |||
81 | prepareForDraw: { | 81 | prepareForDraw: { |
82 | enumerable: false, | 82 | enumerable: false, |
83 | value: function() { | 83 | value: function() { |
84 | //this.element.addEventListener("click", this, false); | 84 | this.element.addEventListener("click", this, false); |
85 | } | 85 | } |
86 | }, | 86 | }, |
87 | 87 | ||
@@ -98,10 +98,10 @@ exports.DocumentEntry = Montage.create(Component, { | |||
98 | handleClick: { | 98 | handleClick: { |
99 | value: function(event) { | 99 | value: function(event) { |
100 | if(event._event.target.nodeName === "IMG") { | 100 | if(event._event.target.nodeName === "IMG") { |
101 | documentManagerModule.DocumentManager.closeDocument(this._uuid); | 101 | this.application.ninja.documentController.closeDocument(this._uuid); |
102 | } else { | 102 | } else { |
103 | if(!this._document.isActive) { | 103 | if(!this._document.isActive) { |
104 | documentManagerModule.DocumentManager.switchDocument(this._uuid); | 104 | this.application.ninja.stage.stageView.switchCodeView(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | } | 107 | } |
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js index 635da3a2..e71d1460 100755 --- a/js/components/ui/FilePicker/file-picker-controller.js +++ b/js/components/ui/FilePicker/file-picker-controller.js | |||
@@ -8,7 +8,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
8 | var Montage = require("montage/core/core").Montage, | 8 | var Montage = require("montage/core/core").Montage, |
9 | pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator, | 9 | pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator, |
10 | filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"), | 10 | filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"), |
11 | fileSystem = require("js/io/system/coreioapi").CoreIoApi, | ||
12 | Popup = require("montage/ui/popup/popup.reel").Popup; | 11 | Popup = require("montage/ui/popup/popup.reel").Popup; |
13 | 12 | ||
14 | //singleton with functions to create a new file picker instance and utilities to format or filter the model data | 13 | //singleton with functions to create a new file picker instance and utilities to format or filter the model data |
@@ -101,7 +100,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
101 | var aModel = filePickerModelModule.FilePickerModel.create(); | 100 | var aModel = filePickerModelModule.FilePickerModel.create(); |
102 | 101 | ||
103 | var topLevelDirectories = null; | 102 | var topLevelDirectories = null; |
104 | var driveData = fileSystem.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); | 103 | var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); |
105 | if(driveData.success){ | 104 | if(driveData.success){ |
106 | topLevelDirectories = (JSON.parse(driveData.content)).children; | 105 | topLevelDirectories = (JSON.parse(driveData.content)).children; |
107 | }else{ | 106 | }else{ |
@@ -244,7 +243,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
244 | || !this._directoryContentCache[folderUri].children){ | 243 | || !this._directoryContentCache[folderUri].children){ |
245 | //get data using IO api | 244 | //get data using IO api |
246 | try{ | 245 | try{ |
247 | var iodata = fileSystem.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); | 246 | var iodata = this.application.ninja.coreIoApi.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); |
248 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); | 247 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); |
249 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ | 248 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ |
250 | folderContent = JSON.parse(iodata.content); | 249 | folderContent = JSON.parse(iodata.content); |
@@ -456,7 +455,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
456 | //check for directory staleness.... if stale query filesystem | 455 | //check for directory staleness.... if stale query filesystem |
457 | if((new Date()).getTime() > (this._directoryContentCache[folderUri].queriedTimeStamp + this.cacheStaleTime)){ | 456 | if((new Date()).getTime() > (this._directoryContentCache[folderUri].queriedTimeStamp + this.cacheStaleTime)){ |
458 | try{ | 457 | try{ |
459 | var ifModifiedResponse = fileSystem.isDirectoryModified({uri:folderUri, recursive:false, returnType:"all"}, this._directoryContentCache[folderUri].queriedTimeStamp); | 458 | var ifModifiedResponse = this.application.ninja.coreIoApi.isDirectoryModified({uri:folderUri, recursive:false, returnType:"all"}, this._directoryContentCache[folderUri].queriedTimeStamp); |
460 | //console.log("ifModifiedResponse"); | 459 | //console.log("ifModifiedResponse"); |
461 | //console.log(ifModifiedResponse); | 460 | //console.log(ifModifiedResponse); |
462 | }catch(e){ | 461 | }catch(e){ |
@@ -468,7 +467,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
468 | wasStale = true; | 467 | wasStale = true; |
469 | //uri has changed. so update cache | 468 | //uri has changed. so update cache |
470 | try{ | 469 | try{ |
471 | var iodata = fileSystem.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); | 470 | var iodata = this.application.ninja.coreIoApi.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); |
472 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); | 471 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); |
473 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ | 472 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ |
474 | folderContent = JSON.parse(iodata.content); | 473 | folderContent = JSON.parse(iodata.content); |
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js index 7cf7f409..bba7e0e7 100755 --- a/js/io/document/document-controller.js +++ b/js/io/document/document-controller.js | |||
@@ -15,10 +15,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
15 | var Montage = require("montage/core/core").Montage, | 15 | var Montage = require("montage/core/core").Montage, |
16 | Component = require("montage/ui/component").Component, | 16 | Component = require("montage/ui/component").Component, |
17 | Uuid = require("montage/core/uuid").Uuid, | 17 | Uuid = require("montage/core/uuid").Uuid, |
18 | fileSystem = require("js/io/system/coreioapi").CoreIoApi; | 18 | nj= require("js/lib/NJUtils.js").NJUtils, |
19 | 19 | HTMLDocument = require("js/io/document/html-document").HTMLDocument, | |
20 | var HTMLDocument = require("js/io/document/html-document").HTMLDocument; | 20 | TextDocument = require("js/io/document/text-document").TextDocument; |
21 | var TextDocument = require("js/io/document/text-document").TextDocument; | ||
22 | 21 | ||
23 | var DocumentController = exports.DocumentController = Montage.create(Component, { | 22 | var DocumentController = exports.DocumentController = Montage.create(Component, { |
24 | hasTemplate: { | 23 | hasTemplate: { |
@@ -96,7 +95,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
96 | 95 | ||
97 | openFileWithURI: { | 96 | openFileWithURI: { |
98 | value: function(uriArrayObj) { | 97 | value: function(uriArrayObj) { |
99 | var uri = "", fileContent = "", response=null; | 98 | var uri = "", fileContent = "", response=null, filename="", fileType="js"; |
100 | if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){ | 99 | if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){ |
101 | uri = uriArrayObj.uri[0]; | 100 | uri = uriArrayObj.uri[0]; |
102 | } | 101 | } |
@@ -104,18 +103,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
104 | 103 | ||
105 | // Get file from Jose Code with a callback to here | 104 | // Get file from Jose Code with a callback to here |
106 | if(!!uri){ | 105 | if(!!uri){ |
107 | response = fileSystem.openFile({"uri":uri}); | 106 | response = this.application.ninja.coreIoApi.openFile({"uri":uri}); |
108 | if((response.success === true) && ((response.status === 200) || (response.status === 304))){ | 107 | if((response.success === true) && ((response.status === 200) || (response.status === 304))){ |
109 | fileContent = response.content; | 108 | fileContent = response.content; |
110 | } | 109 | } |
111 | 110 | ||
112 | console.log("$$$ "+uri+"\n content = \n\n\n"+ fileContent+"\n\n\n"); | 111 | //console.log("$$$ "+uri+"\n content = \n\n\n"+ fileContent+"\n\n\n"); |
113 | this.openDocument({"type": "js", "name": "tmp.js", "source": fileContent}); | 112 | filename = nj.getFileNameFromPath(uri); |
113 | if(uri.indexOf('.') != -1){ | ||
114 | fileType = uri.substr(uri.lastIndexOf('.') + 1); | ||
115 | } | ||
116 | this.openDocument({"type": ""+fileType, "name": ""+filename, "source": fileContent}); | ||
114 | } | 117 | } |
115 | 118 | ||
116 | } | 119 | } |
117 | }, | 120 | }, |
118 | 121 | ||
122 | |||
119 | openProjectWithURI: { | 123 | openProjectWithURI: { |
120 | value: function(uri) { | 124 | value: function(uri) { |
121 | console.log("URI is: ", uri); | 125 | console.log("URI is: ", uri); |
@@ -211,7 +215,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
211 | this._documents.splice(this._findIndexByUUID(id), 1); | 215 | this._documents.splice(this._findIndexByUUID(id), 1); |
212 | 216 | ||
213 | if(this.activeDocument.uuid === id && this._documents.length > 0) { | 217 | if(this.activeDocument.uuid === id && this._documents.length > 0) { |
214 | this.switchDocument(this._documents[0].uuid) | 218 | this.switchDocument(this._documents[0].uuid); |
215 | } | 219 | } |
216 | } | 220 | } |
217 | }, | 221 | }, |
@@ -254,11 +258,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
254 | lineNumbers: true, | 258 | lineNumbers: true, |
255 | mode: "htmlmixed", | 259 | mode: "htmlmixed", |
256 | onCursorActivity: function() { | 260 | onCursorActivity: function() { |
257 | DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.hline, null); | 261 | DocumentController._codeEditor.editor.setLineClass(DocumentController._codeEditor.hline, null); |
258 | DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.editor.getCursor().line, "activeline"); | 262 | DocumentController._codeEditor.hline = DocumentController._codeEditor.editor.setLineClass(DocumentController._codeEditor.editor.getCursor().line, "activeline"); |
259 | } | 263 | } |
260 | }); | 264 | }); |
261 | this._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(0, "activeline"); | 265 | this._codeEditor.hline = DocumentController._codeEditor.editor.setLineClass(0, "activeline"); |
262 | } | 266 | } |
263 | } | 267 | } |
264 | }, | 268 | }, |
@@ -284,9 +288,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
284 | 288 | ||
285 | _onOpenTextDocument: { | 289 | _onOpenTextDocument: { |
286 | value: function(doc) { | 290 | value: function(doc) { |
287 | DocumentManager._hideCurrentDocument(); | 291 | this._hideCurrentDocument(); |
288 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | 292 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe |
289 | DocumentManager.activeDocument = doc; | 293 | this.activeDocument = doc; |
290 | 294 | ||
291 | var type; |