mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-01 03:10:06 +00:00
Introjucer: added a menu to choose which IDE to launch when there's more than one.
This commit is contained in:
parent
67740c1441
commit
f196f88330
9 changed files with 74 additions and 7 deletions
|
|
@ -491,13 +491,51 @@ void ProjectContentComponent::closeProject()
|
|||
mw->closeCurrentProject();
|
||||
}
|
||||
|
||||
StringArray ProjectContentComponent::getExportersWhichCanLaunch() const
|
||||
{
|
||||
StringArray s;
|
||||
|
||||
for (Project::ExporterIterator exporter (*project); exporter.next();)
|
||||
if (exporter->canLaunchProject())
|
||||
s.add (exporter->getName());
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void ProjectContentComponent::openInIDE (const String& exporterName)
|
||||
{
|
||||
if (project != nullptr)
|
||||
for (Project::ExporterIterator exporter (*project); exporter.next();)
|
||||
if (exporter->getName() == exporterName && exporter->launchProject())
|
||||
break;
|
||||
}
|
||||
|
||||
static void openIDEMenuCallback (int result, ProjectContentComponent* comp)
|
||||
{
|
||||
if (comp != nullptr && result > 0)
|
||||
comp->openInIDE (comp->getExportersWhichCanLaunch() [result - 1]);
|
||||
}
|
||||
|
||||
void ProjectContentComponent::openInIDE()
|
||||
{
|
||||
if (project != nullptr)
|
||||
{
|
||||
for (Project::ExporterIterator exporter (*project); exporter.next();)
|
||||
if (exporter->launchProject())
|
||||
break;
|
||||
StringArray possibleExporters = getExportersWhichCanLaunch();
|
||||
|
||||
if (possibleExporters.size() > 1)
|
||||
{
|
||||
PopupMenu menu;
|
||||
|
||||
for (int i = 0; i < possibleExporters.size(); ++i)
|
||||
menu.addItem (i + 1, possibleExporters[i]);
|
||||
|
||||
menu.showMenuAsync (PopupMenu::Options(),
|
||||
ModalCallbackFunction::forComponent (openIDEMenuCallback, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
openInIDE (possibleExporters[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue