Examples of GoPackageName


Examples of com.googlecode.goclipse.tooling.GoPackageName

  public GoOracleFindDefinitionOperation(String goOraclePath) {
    this.goOraclePath = goOraclePath;
  }
 
  public ProcessBuilder createProcessBuilder(GoEnvironment goEnv, Path filePath, int offset) throws CommonException {
    GoPackageName goPackage = goEnv.findGoPackageForSourceModule(filePath);
    if(goPackage == null) {
      throw new CommonException(MessageFormat.format(
        "Could not determine Go package for Go file ({0}), file not in the Go environment.", filePath),
        null);
    }
   
    // go oracle requires this
    goEnv.validateGoArch();
    goEnv.validateGoOs();
   
    ArrayList2<String> commandLine = new ArrayList2<>(
      goOraclePath,
      "-pos=" + filePath.toString() + ":#" + offset + ",#" + offset,
      "-format=json",
      "describe",
      goPackage.getFullNameAsString()
    );
   
    return goEnv.createProcessBuilder(commandLine);
  }
View Full Code Here

Examples of com.googlecode.goclipse.tooling.GoPackageName

  public String getGoPathString() {
    return goPath.getGoPathWorkspaceString();
  }
 
  public GoPackageName findGoPackageForSourceModule(Path goModulePath) throws CommonException {
    GoPackageName goPackage = goRoot.findGoPackageForSourceModule(goModulePath);
    if(goPackage != null) {
      return goPackage;
    }
   
    return goPath.findGoPackageForSourceFile(goModulePath);
View Full Code Here

Examples of com.googlecode.goclipse.tooling.GoPackageName

    try {
     
      ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider() {
        @Override
        public String getText(Object element) {
          GoPackageName goPackageName = (GoPackageName) element;
          return goPackageName.getFullNameAsString();
        }
      });
      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() + "/");
         
        }
        // check extension
        programPathField.setFieldValue(packageResourcePath);
      }
View Full Code Here

Examples of com.googlecode.goclipse.tooling.GoPackageName

  protected ILaunchConfiguration createConfiguration(ILaunchTarget launchable) {
    Path packageLocation = launchable.getAssociatedResource().getLocation().toFile().toPath();
    IProject project = launchable.getProject();
   
    GoPath goPath = GoProjectEnvironment.getEffectiveGoPath(project);
    GoPackageName goPackage = goPath.findGoPackageForSourceFile(packageLocation.resolve("dummy.go"));
    String suggestedName = project.getName() + " - " + goPackage.getFullNameAsString();
    return super.createConfiguration(launchable, suggestedName);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.