Commits

ryanackley committed bed0405

latest change

Comments (0)

Files changed (9)

AtlassianPluginProject.js

 		name: 'Atlassian Plugin',
 		key: 'atlassian.plugin',
 		locationType : 'local',
-		createProject : function(root, callback){
+		createProject : function(root, url, callback){
 			var project = new AtlassianPluginProject();
-			project.load(root, function(error){
+			project.load(root, url, function(error){
 				callback(project, error);
 			});
 		} 

BackgroundMsgSupport.js

 
 var backgroundMsgSupport = {
-	launchFileSelect : function(index, callback){
-		chrome.extension.sendRequest({key: 'launchFileSelect', index: index}, function(response){
+	launchFileSelect : function(index, url,  callback){
+		chrome.extension.sendRequest({key: 'launchFileSelect', index: index, url: url}, function(response){
 			callback(response);
 		});
 	},
 			callback(response);
 		});
 	},
-	loadProject : function(type, path, callback){
-		chrome.extension.sendRequest({key: 'loadProject', type: type, path: path}, function(response){
+	loadProject : function(type, path, url, callback){
+		chrome.extension.sendRequest({key: 'loadProject', type: type, path: path, url: url}, function(response){
 			callback(response);
 		});
 	}

FileUrlProject.js

 }
 
 FileUrlProjectFactory = {
-	createProject : function(dir, callback){
+	createProject : function(dir, url, callback){
 		callback(new FileUrlProject());
 	}
 }

ProjectManager.js

 }
 
 ProjectManager.prototype = {
-    _initProject : function(tabId, path, projectType, sendResponse){
+    _initProject : function(tabId, path, url, projectType, sendResponse){
     	var self = this;
     	var projectsByTab = this.projectsByTab;
     	this.cleanUp(tabId);
     	window.requestFileSystem(window.PERMANENT, 5*1024*1024*1024, function(fs){
 			fs.root.getDirectory(path, {create:false}, function(dir){
-				projectType.createProject(dir,function(project, error){
+				projectType.createProject(dir,url,function(project, error){
 					self.fsRoot = fs.root;
 					project.matchedResourceMap = {};
 					projectsByTab[tabId] = project;
 			});
 		});
     },
-	launchFileSelect : function(tabId, typeIndex, sendResponse){
+    
+	launchFileSelect : function(tabId, url, typeIndex, sendResponse){
 		var self = this;
 		nativeFileSupport.launchFileSelect(function(path){
 			if (path && path.length){
 				var projectType = ProjectTypes[typeIndex];
-				self._initProject(tabId, path, projectType, sendResponse);
+				self._initProject(tabId, path, url, projectType, sendResponse);
 			}
 		});
 	},
 			sendResponse();
 		}
 	},
-	loadProject : function(tabId, projectTypeKey, path, sendResponse){
+	loadProject : function(tabId, projectTypeKey, path, url, sendResponse){
 		if (projectTypeKey == 'fileUrl'){
-			this._initProject(tabId, path, FileUrlProjectFactory, sendResponse);
+			this._initProject(tabId, path, url, FileUrlProjectFactory, sendResponse);
 		}
 		else{		
 			for (var i = 0; i < ProjectTypes.length; i++){
 				if (ProjectTypes[i].key === projectTypeKey){
-					this._initProject(tabId, path, ProjectTypes[i], sendResponse);
+					this._initProject(tabId, path, url, ProjectTypes[i], sendResponse);
 					break;
 				}
 			}

RubyOnRailsProject.js

 		name: 'Ruby on Rails (3.1 or higher)',
 		key: 'ror3.1',
 		locationType : 'local',
-		createProject : function(root, callback){
+		createProject : function(root, url, callback){
 			routes = [
 				{from: /\/assets\/(.+\.js)/,
 				 to: slash + ['app','assets','javascripts'].join(slash) + slash + '$1'},
 		} 
     }
 );
-
-/*var RubyOnRails31Project = function(){
-	this.processedMap = {};	
-}
-
-RubyOnRails31Project.prototype = {
-    _loadResourceMappings : function(dir, prefix, callback){
-		Gito.FileUtils.ls(dir, function(jsEntries){
-			for (var i = 0; i < jsEntries.length; i++){
-				var jsEntry = jsEntries[i];
-				var jsIdx = jsEntry.name.indexOf('.js.');
-				if (jsIdx != -1){
-					jsEntry
-				}
-			}
-		});
-	},
-	load : function(root, callback){
-		this.root = root;
-		this.assetRoot = root.fullPath + slash + ['app','assets'].join(slash) + slash;
-		callback();
-	},
-	filePathForUrl : function(url, type){
-		var pieces = url.split('/');
-		for (var min = 0; min < pieces.length; min++){
-			if (pieces[min] == 'assets'){
-				break;
-			}
-		}
-		var last = pieces.length - 1
-		if (min >= last){
-			return null;
-		}
-		
-		var partialPath = pieces.slice(min).join('/');
-		if (type == 'script'){
-			partialPath = 'javascripts/' + partialPath;
-		}
-		else{
-			partialPath = 'stylesheets/' + partialPath; 
-		}
-		
-		return this.root.fullPath + '/assets/' + partialPath
-	},
-	urlsForFilePath : function(path){
-		var assetRoot = this.assetRoot;
-		if (path.indexOf(assetRoot) == 0){
-			var partialPath = path.substring(assetRoot.length);
-			if (partialPath.indexOf('javascripts') == 0){
-				
-			}
-			else if (partialPath.indexOf('stylesheets') == 0){
-				
-			}
-		}
-		return [];
-	},
-	resetUrls : function(){
-		this.projectUrls = {};
-	}
-}*/
-
     		var watchersByTab={};
     	</script>
     	<script src="file_utils.js"></script>
-		<script src="AtlassianPluginProject.js"></script>
 		<script src="RubyOnRailsProject.js"></script>
+		<script src="ChromeExtensionProject.js"></script>
+		<script src="AtlassianPluginProject.js"></script>
 		<script src="FileUrlProject.js"></script>
 		<script src="zepto1.0rc1.js"></script>
 		<script src="RecentUpdateHandler.js"></script>
 					sendResponse(ProjectTypes);
 				}
 				else if (request.key == 'launchFileSelect'){
-					projectManager.launchFileSelect(sender.tab.id, request.index, sendResponse);
+					projectManager.launchFileSelect(sender.tab.id, request.url, request.index, sendResponse);
 				}
 				else if (request.key == 'checkResources'){
 					projectManager.checkResources(sender.tab.id, request.resources, sendResponse);
 					projectManager.watchDirectory(sender.tab.id, request.path);
 				}
 				else if (request.key == 'loadProject'){
-					projectManager.loadProject(sender.tab.id, request.type, request.path, sendResponse);
+					projectManager.loadProject(sender.tab.id, request.type, request.path, request.url, sendResponse);
 				}
 				else{
 					sendResponse({});
 			}
 		}
 		if (type && path && projectState.path != path){
-			backgroundMsgSupport.loadProject(type, path, function(){
+			backgroundMsgSupport.loadProject(type, path, inspectedLocation.href, function(){
 				loadProject(type, path);
 			});
 		}
+fieldset{
+    border:none;
+}
+
+#project-select-form{
+    border: 1px solid black;
+    font-family: "Lucida Grande", sans-serif;
+    font-size: 75%
+}
+
+#local-file-path{
+    margin-left:15px;
+    font-size: 90%;
+    border: 2px inset;
+    padding: 2px;
+}
 			});
 			$('#native-browse').on('click', function(e){
 				var index = typeSelect.selectedIndex;
-				backgroundMsgSupport.launchFileSelect(index, function(result){
+				backgroundMsgSupport.launchFileSelect(index, window.devtoolsWindow.inspectedLocation.href, function(result){
 					if (result.path && result.path.length){
 						$('#local-file-path').text(result.path);
 						if (result.error){
 		</p>
 		<p id="file-select" style="display:none">
 			<fieldset>
-				<label>Select Root Directory</label><label id="local-file-path"></label>
+				<label>Root Directory</label><label id="local-file-path"></label>
 				<button id="native-browse">Browse</button>
 			</fieldset>
 		</p>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.