Package com.googlecode.goclipse.tooling.env

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


      throw LangCore.createCoreException("Editor is not a GoEditor.", null);
    }
    goEditor = (GoEditor) editor;
    editorText = getEditorDocument(editor).get();
   
    GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(null);
    prepareProcessBuilder(goEnv);
  }
View Full Code Here


        }
      });
      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() + "/");
         
View Full Code Here

  public static GoEnvironment getGoEnvironment(IProject project) {
    GoRoot goRoot = getEffectiveGoRoot(project);
    GoArch goArch = getEffectiveGoArch(project);
    GoOs goOs = getEffectiveGoOs(project);
    GoPath goPath = getEffectiveGoPath(project);
    return new GoEnvironment(goRoot, goArch, goOs, goPath);
  }
View Full Code Here

  protected IProject[] doBuild(final IProject project, int kind, Map<String, String> args, IProgressMonitor monitor)
      throws CoreException {
   
    GoToolManager.getDefault().notifyBuildStarting(project, false);
   
    GoEnvironment goEnv = getValidGoEnvironment(project);
   
    ArrayList2<String> goBuildCmdLine = getGoToolCommandLine();
    goBuildCmdLine.addElements("install", "-v");
    goBuildCmdLine.addElements(GoProjectPrefConstants.GO_BUILD_EXTRA_OPTIONS.getParsedArguments(project));
    goBuildCmdLine.addElements("./...");
//    addSourcePackagesToCmdLine(project, goBuildCmdLine, goEnv);
   
    Path projectLocation = getProjectLocation(project);
    Path sourceRootDir;
   
    if(GoProjectEnvironment.isProjectInsideGoPath(project, goEnv.getGoPath())) {
      sourceRootDir = projectLocation;
    } else {
      sourceRootDir = projectLocation.resolve("src");
    }
   
View Full Code Here

   
    return null;
  }
 
  protected GoEnvironment getValidGoEnvironment(final IProject project) throws CoreException {
    GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);
    if(!goEnv.isValid()) { /* FIXME: one exception per build. */
      throw GoCore.createCoreException("Go Environment settings are not valid", null);
    }
    return goEnv;
  }
View Full Code Here

  @Override
  protected void clean(IProgressMonitor monitor) throws CoreException {
    deleteProjectBuildMarkers();
   
    IProject project = getProject();
    GoEnvironment goEnv = getValidGoEnvironment(project);
   
    ArrayList2<String> goBuildCmdLine = getGoToolCommandLine();
    goBuildCmdLine.addElements("clean", "-i", "-x");
    addSourcePackagesToCmdLine(project, goBuildCmdLine, goEnv);
   
View Full Code Here

      throws CoreException {
   
    ArrayList<ICompletionProposal> results = new ArrayList<ICompletionProposal>();
   
    try {
      GoEnvironment goEnvironment = GoProjectEnvironment.getGoEnvironment(project);
     
      // TODO: we should run this operation outside the UI thread.
      IProgressMonitor pm = new TimeoutProgressMonitor(5000, true);
      GocodeClient client = new GocodeClient(gocodePath.toOSString(), goEnvironment, pm);
     
View Full Code Here

    }
   
    IProject project = getProject(configuration);
    IPath launchResource = project.findMember(path).getLocation();
   
    GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);
   
    java.nio.file.Path goPackageAbsolutePath = launchResource.toFile().toPath();
    java.nio.file.Path goPathEntry = goEnv.getGoPath().findGoPathEntryForSourcePath(goPackageAbsolutePath);
   
    if (goPathEntry == null) {
      throw GoCore.createCoreException("Given Go package not found: " + path, null);
    } else {
      String cmdName = goPackageAbsolutePath.getFileName().toString(); // get last segment
View Full Code Here

    return NO_CHILDREN;
  }

  protected Object[] getProjectChildren(IProject project) {
   
    GoEnvironment goEnvironment = GoProjectEnvironment.getGoEnvironment(project);
   
    GoRoot goRoot = goEnvironment.getGoRoot();
    java.nio.file.Path goRootSource;
    try {
      goRootSource = goRoot.getSourceRootLocation();
    } catch (CommonException e) {
      return NO_CHILDREN;
    }
   
    if (goRoot.isEmpty()) {
      return NO_CHILDREN;
    }
   
    ArrayList2<GoPathElement> buildpathChildren = new ArrayList2<>();
   
    buildpathChildren.add(new GoRootElement(goRootSource.toFile()));
   
    GoPath effectiveGoPath = goEnvironment.getGoPath();
   
    for (String goPathEntry : effectiveGoPath.getGoPathEntries()) {
      Path goPathEntryPath;
      try {
        goPathEntryPath = MiscUtil.createPath(goPathEntry);
View Full Code Here

 
  @Override
  protected void performLongRunningComputation_do(IProgressMonitor monitor) throws CoreException {
    String goOraclePath = GoToolPreferences.GO_ORACLE_Path.get();
   
    GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);
   
    try {
      GoOracleFindDefinitionOperation op = new GoOracleFindDefinitionOperation(goOraclePath);
      ProcessBuilder pb = op.createProcessBuilder(goEnv, inputPath, range.getOffset());
     
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.