Package com.googlecode.goclipse.tooling.env

Examples of com.googlecode.goclipse.tooling.env.GoEnvironment


   * @throws IOException
   * @throws CommonException
   * @throws RecognitionException
   */
  public static CodeContext getExternalCodeContext(final IProject project, String packagePath) throws IOException, CommonException {
    GoEnvironment goEnvironment = GoProjectEnvironment.getGoEnvironment(project);
   
    CodeContext codeContext = new CodeContext(packagePath, project);

    // InterfaceParser interfaceParser = new InterfaceParser(tokenizer);
    // find path
    File pkgdir = goEnvironment.getGoRoot().getSourceRootLocation().resolve(packagePath).toFile();
   
    // TODO Get rid of the following duplication

    if (pkgdir.exists() && pkgdir.isDirectory()) {
      processExternalPackage(codeContext, pkgdir);

    } else {

      for (IFolder folder : Environment.getSourceFolders(project)) {

//        String path = Environment.INSTANCE.getAbsoluteProjectPath();

        pkgdir = new File(folder.getLocation().toOSString() + File.separator + packagePath);

        if (pkgdir.exists() && pkgdir.isDirectory()) {
          processExternalPackage(codeContext, pkgdir);

        } else {
          continue;
        }

        List<String> goPathElements = goEnvironment.getGoPathEntries();
        // FIXME: BM: this code is most certainly buggy, perhaps the whole function too.
        String goPath = goPathElements.get(0);

        pkgdir = new File(goPath + "/src/" + packagePath);
        if (pkgdir.exists() && pkgdir.isDirectory()) {
View Full Code Here


    GoEnvironmentPrefs.GO_PATH.set(SAMPLE_GOPATH_Entry.toString());
    TestsWorkingDir.deleteDir(SAMPLE_GOPATH_Entry);
   
    {
      // Test that it works with null
      GoEnvironment goEnvironment = GoProjectEnvironment.getGoEnvironment(null);
     
      assertEquals(goEnvironment.getGoRoot().asString(), SAMPLE_GO_ROOT.asString());
      assertEquals(goEnvironment.getGoPathString(), SAMPLE_GO_PATH.asString());
      assertEquals(goEnvironment.getGoPathEntries(), list(SAMPLE_GOPATH_Entry.toString()));
    }
   
    // Test with sample project.
    try (SampleProject sampleProject = new SampleProject(getClass().getSimpleName())){
      IProject project = sampleProject.getProject();
View Full Code Here

  }
 
  protected void checkEnvGoPath(IProject project, Collection<String> list, boolean insideGoPath)
      throws CoreException {
    assertTrue(GoProjectEnvironment.isProjectInsideGoPath(project) == insideGoPath);
    GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);
    assertEquals(goEnv.getGoPathEntries(), list);
  }
View Full Code Here

TOP

Related Classes of com.googlecode.goclipse.tooling.env.GoEnvironment

Copyright © 2018 www.massapicom. 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.