Explorar o código

IDE now opens external text editor if one is specified and enabled instead of internal text editor

Isak Andersson %!s(int64=12) %!d(string=hai) anos
pai
achega
3b876bcbd0
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      IDE/Contents/Source/PolycodeIDEApp.cpp

+ 9 - 0
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -507,7 +507,16 @@ void PolycodeIDEApp::openFileInProject(PolycodeProject *project, String filePath
 void PolycodeIDEApp::openFile(OSFileEntry file) {
 	PolycodeEditor *editor;
 	editor = editorManager->getEditorForPath(file.fullPath);
+
 	if(editor) {
+        CoreServices *core = CoreServices::getInstance();
+        Config *config = core->getConfig();
+        bool useExternalTextEditor = (config->getStringValue("Polycode", "useExternalTextEditor") == "true") && (config->getStringValue("Polycode", "externalTextEditorCommand") != "");
+        if(editor->getEditorType() == "PolycodeTextEditor" && useExternalTextEditor) {
+            core->getCore()->executeExternalCommand(config->getStringValue("Polycode", "externalTextEditorCommand"), file.fullPath, projectManager->getActiveProject()->getRootFolder());
+            return;
+        }
+
 		frame->showEditor(editor);
 	} else {
 		editor = editorManager->createEditorForExtension(file.extension);