Skip to content

Commit

Permalink
Fix issue #284, PackageWizard only allowed for ROSProjectManagers
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Nov 26, 2018
1 parent bfb062a commit bef333d
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/project_manager/ros_package_wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,29 @@ ROSPackageWizard::ROSPackageWizard()
setFlags(Core::IWizardFactory::PlatformIndependent);
}

Core::BaseFileWizard *ROSPackageWizard::create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const
{
Q_UNUSED(parameters);
m_wizard = new ROSPackageWizardDialog(this, parent);

Core::BaseFileWizard *ROSPackageWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
QString defaultPath = parameters.defaultPath();

ROSProject *rosProject = qobject_cast<ROSProject *>(ProjectExplorer::ProjectTree::currentProject());

if( rosProject )
{
ROSBuildConfiguration *bc = rosProject->rosBuildConfiguration();
if(!rosProject )
return nullptr;

if( bc )
{
ROSUtils::WorkspaceInfo workspaceInfo = ROSUtils::getWorkspaceInfo(bc->project()->projectDirectory(),
bc->buildSystem(),
bc->project()->distribution());
ROSBuildConfiguration *bc = rosProject->rosBuildConfiguration();

if( defaultPath == workspaceInfo.path.toString() )
defaultPath = workspaceInfo.sourcePath.toString();
}
if( bc )
{
ROSUtils::WorkspaceInfo workspaceInfo = ROSUtils::getWorkspaceInfo(bc->project()->projectDirectory(),
bc->buildSystem(),
bc->project()->distribution());

if( defaultPath == workspaceInfo.path.toString() )
defaultPath = workspaceInfo.sourcePath.toString();
}

m_wizard = new ROSPackageWizardDialog(this, parent);

m_wizard->setProjectDirectory(rosProject->projectDirectory().toString() + QDir::separator());
m_wizard->setPath(defaultPath);

Expand Down

0 comments on commit bef333d

Please sign in to comment.