Просмотр исходного кода

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

Isak Andersson 12 лет назад
Родитель
Сommit
3b876bcbd0
1 измененных файлов с 9 добавлено и 0 удалено
  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);