Forráskód Böngészése

Add "Open in Resources" to FileSelect context menu

Leonardo Jeanteur 1 éve
szülő
commit
2b126b2adb
3 módosított fájl, 13 hozzáadás és 5 törlés
  1. 7 0
      hide/Ide.hx
  2. 5 1
      hide/comp/FileSelect.hx
  3. 1 4
      hide/view/FileView.hx

+ 7 - 0
hide/Ide.hx

@@ -1117,6 +1117,13 @@ class Ide extends hide.tools.IdeData {
 		window.menu = new hide.ui.Menu(menu).root;
 	}
 
+	public function showFileInResources(path: String) {
+		var filetree = getViews(hide.view.FileTree)[0];
+		if( filetree != null ) {
+			filetree.revealNode(path);
+		}
+	}
+
 	public static function showFileInExplorer(path : String) {
 		if(!haxe.io.Path.isAbsolute(path)) {
 			path = Ide.inst.getPath(path);

+ 5 - 1
hide/comp/FileSelect.hx

@@ -33,9 +33,13 @@ class FileSelect extends Component {
 					path = ide.getClipboard();
 					onChange();
 				}},
-				{ label : "Open in explorer", enabled : fpath != null, click : function(){
+				{ label : "Open in Explorer", enabled : fpath != null, click : function(){
 					Ide.showFileInExplorer(fpath);
 				} },
+				{ label : "Open in Resources", enabled : path != null, click : function() {
+					ide.showFileInResources(path);
+				}},
+
 			]);
 			return false;
 		}

+ 1 - 4
hide/view/FileView.hx

@@ -217,10 +217,7 @@ class FileView extends hide.ui.View<{ path : String }> {
 				{ label : "Copy Path", enabled : hasPath, click : function() { ide.setClipboard(state.path); } },
 				{ label : "Open in Explorer", enabled : hasPath, click : function() { Ide.showFileInExplorer(getPath()); } },
 				{ label : "Open in Resources", enabled : hasPath, click : function() {
-					var filetree = ide.getViews(FileTree)[0];
-					if( filetree != null ) {
-						filetree.revealNode(state.path);
-					}
+					ide.showFileInResources(state.path);
 				}},
 				{ label : null, isSeparator : true },
 			];