首页 > 解决方案 > Buildship in Eclipse - 可以以编程方式运行项目导入向导吗?

问题描述

更新:我得到了开发者的回答:https ://discuss.gradle.org/t/possible-to-run-the-import-wizard-programmatically/39133 - 这是不可能的,目前没有计划做到这一点可能,但他们愿意接受使之成为可能的贡献。


我有一个可以自动打开 buildship 导入项目向导的 eclipse 插件。代码的相关部分如下所示:

IWizardDescriptor buildshipImportWizardDescriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard("org.eclipse.buildship.ui.wizards.project.import");
PlatformUI.getWorkbench().getDisplay().asyncExec(() ->
{
  Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  try
  {
    IWizard wizard = buildshipImportWizardDescriptor.createWizard();
    WizardDialog wd = new WizardDialog(activeShell, wizard);
    wd.open();
  }
  catch (Exception ex)
  {
    // ..
  }
});

所以,我可以启动导入向导。但我也想自动化下一步。在某些条件下(工作区根目录有某些子目录,工作区中当前的项目列表为空)我想使用此导入向导自动导入 gradle 项目,而无需用户单击或键入。这可能吗?如果没有,是否可以至少为项目根目录预先填写正确的值?

(最初在这里问https://discuss.gradle.org/t/possible-to-run-the-import-wizard-programmatically/39133

标签: buildship

解决方案


推荐阅读