[Sciviews-commits] r410 - in komodo/SciViews-K-dev/content: . js

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 11 19:22:18 CET 2011


Author: prezez
Date: 2011-12-11 19:22:17 +0100 (Sun, 11 Dec 2011)
New Revision: 410

Modified:
   komodo/SciViews-K-dev/content/js/commands.js
   komodo/SciViews-K-dev/content/overlayMain.xul
Log:
SciViews-K-dev: added "Load into R" context menu item for .RData files in "Places"

Modified: komodo/SciViews-K-dev/content/js/commands.js
===================================================================
--- komodo/SciViews-K-dev/content/js/commands.js	2011-10-19 15:20:41 UTC (rev 409)
+++ komodo/SciViews-K-dev/content/js/commands.js	2011-12-11 18:22:17 UTC (rev 410)
@@ -517,16 +517,32 @@
 this.places = {
 	sourceSelection: function sv_sourcePlacesSelection() {
 		var files = ko.places.manager.getSelectedItems()
-			.filter(function(x)(x.name.search(/\.[Rr]$/) != -1))
+			.filter(function(x) (x.file.ext.toLowerCase() == ".r"))
 			.map(function(x) x.file.path);
 		if (!files.length) return;
-		var cmd = files.map(function(x) "source('" + sv.tools.string.addslashes(x) +"')" ).join("\n");
+		var cmd = files.map(function(x) "source('" + 
+			sv.tools.string.addslashes(x) +"')" ).join("\n");
 		sv.rconn.eval(cmd, null, false);
 	},
 
 	get anyRFilesSelected()
-		ko.places.manager.getSelectedItems()
-		.some(function(x) /\.[Rr]$/.test(x.name))
+		ko.places.manager.getSelectedItems().some(function(x) 
+			x.file.ext.toLowerCase() == ".r"),
+		
+	loadSelection: function sv_loadPlacesSelection() {
+		var files = ko.places.manager.getSelectedItems()
+			.filter(function(x) (x.file.ext.toLowerCase() == ".rdata"))
+			.map(function(x) x.file.path);
+		if (!files.length) return;
+		var cmd = files.map(function(x) "load('" + 
+			sv.tools.string.addslashes(x) +"')" ).join("\n");
+		sv.rconn.eval(cmd, null, false);
+	},
+		
+	get anyRDataFilesSelected()
+		ko.places.manager.getSelectedItems().some(
+			function(x) x.file.ext.toLowerCase() == ".rdata")
+		
 }
 
 //}

Modified: komodo/SciViews-K-dev/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K-dev/content/overlayMain.xul	2011-10-19 15:20:41 UTC (rev 409)
+++ komodo/SciViews-K-dev/content/overlayMain.xul	2011-12-11 18:22:17 UTC (rev 410)
@@ -334,7 +334,7 @@
 
 <menupopup id="places-files-popup">
 	<menuseparator id="placesContextMenu_separatorR"
-		testEval_HideIf="!sv.command.places.anyRFilesSelected"
+		testEval_HideIf="!sv.command.places.anyRFilesSelected &amp;&amp; !sv.command.places.anyRDataFilesSelected"
 	/>
 <menuitem oncommand="sv.command.places.sourceSelection()"
 		  disableIf="folder"
@@ -343,20 +343,19 @@
 		  label="Source into R"
 		  testEval_HideIf="!sv.command.places.anyRFilesSelected"
 />
-</menupopup>
 
+<menuitem oncommand="sv.command.places.loadSelection()"
+		  disableIf="folder"
+		  class="menuitem-iconic"
+		  id="placesContextMenu_Rload"
+		  label="Load into R"
+		  testEval_HideIf="!sv.command.places.anyRDataFilesSelected"
+/>
 
+</menupopup>
 
 
 
-
-
-
-
-
-
-
-
 	<tabbox id="rightTabBox">
 		<tabs id="right_toolbox_tabs">
 			<tab id="rhelp_tab"



More information about the Sciviews-commits mailing list