}
});
dialog.setTitle("Select Go main package");
dialog.setMessage("Select Go main package");
GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);
Collection<GoPackageName> sourcePackages = GoProjectEnvironment.getSourcePackages(project, goEnv);
dialog.setElements(ArrayUtil.createFrom(sourcePackages));
if (dialog.open() == IDialogConstants.OK_ID) {
GoPackageName goPackageName = (GoPackageName) dialog.getFirstResult();
String packageResourcePath = goPackageName.getFullNameAsString();
if(!GoProjectEnvironment.isProjectInsideGoPath(project, goEnv.getGoPath())) {
packageResourcePath = "src/" + packageResourcePath;
} else {
Path projectLocation = project.getLocation().toFile().toPath();
GoPackageName projectGoPackage =
goEnv.getGoPath().findGoPackageForSourceFile(projectLocation.resolve("dummy.go"));
// snip project base name.
packageResourcePath = StringUtil.segmentAfterMatch(packageResourcePath,
projectGoPackage.getFullNameAsString() + "/");