void resultButtonClicked(const String &name) override { if(name == "Search in Finder") { String file = getTextEditor("fileNames")->getText(); file.replace("\\", "/"); String fileName = file.fromLastOccurrenceOf("/", false, false); String pathName = file.upToLastOccurrenceOf("/", true, false); #if JUCE_WINDOWS String dialogName = "Explorer"; #else String dialogName = "Finder"; #endif PresetHandler::showMessageWindow("Search file", "Search for the sample:\n\n"+fileName +"\n\nPress OK to open the " + dialogName, PresetHandler::IconType::Info); FileChooser fc("Search sample location " + fileName); if(fc.browseForFileToOpen()) { File f = fc.getResult(); String newPath = f.getFullPathName().replaceCharacter('\\', '/').upToLastOccurrenceOf("/", true, false);; getTextEditor("search")->setText(pathName); getTextEditor("replace")->setText(newPath); } } };
String AlertWindow::getTextEditorContents (const String& nameOfTextEditor) const { if (TextEditor* const t = getTextEditor (nameOfTextEditor)) return t->getText(); return String(); }
String AlertWindow::getTextEditorContents (const String& nameOfTextEditor) const { TextEditor* const t = getTextEditor (nameOfTextEditor); return t != nullptr ? t->getText() : String::empty; }