Package org.eclipse.dltk.core.environment

Examples of org.eclipse.dltk.core.environment.IEnvironment


      final boolean checked = fWorkspaceRadio.isSelected();
      if (checked) {
        fPreviousExternalLocation = fLocation.getText();
        fLocation.setText(getDefaultPath(fNameGroup.getName()));
      } else {
        IEnvironment environment = this.getEnvironment();
        if (environment != null && environment.isLocal()) {
          fLocation.setText(fPreviousExternalLocation);
        } else {
          fLocation.setText(""); //$NON-NLS-1$
        }
      }
View Full Code Here


      this.fProject = project;
    }

    public IBuildpathEntry[] getBuildpathEntries(IScriptProject project) {
      if (buildPathEntries == null) {
        IEnvironment environment = EnvironmentManager
            .getEnvironment(project);
        try {
          URL url = FileLocator.find(PHPCoreTests.getDefault()
              .getBundle(), new Path(libraryPath), null);
          URL resolved = FileLocator.resolve(url);
View Full Code Here

                .create(currentProject);
            if (currentProject != null && scriptProject != null) {
              IBuildpathEntry[] rawBuildpath = scriptProject
                  .getRawBuildpath();

              IEnvironment environment = EnvironmentManager
                  .getEnvironment(currentProject);
              IPath remoteFilePath = EnvironmentPathUtils
                  .getFullPath(environment, new Path(
                      remoteFile));
              for (IBuildpathEntry entry : rawBuildpath) {
View Full Code Here

            if (path != null) {

              LanguageModelInitializer.addPathName(path, provider
                  .getName());

              IEnvironment environment = EnvironmentManager
                  .getEnvironment(project);
              if (environment != null) {
                path = EnvironmentPathUtils.getFullPath(
                    environment, path);
              }
View Full Code Here

    if (type == null){
      throw new RuntimeException(
          Services.getMessage("interpreter.type.not.found"));
    }

    IEnvironment env = EnvironmentManager.getLocalEnvironment();
    IFileHandle file = PlatformFileUtils
      .findAbsoluteOrEclipseRelativeFile(env, new Path(interpreterPath));
    if (!file.exists()){
      throw new RuntimeException(
          Services.getMessage("interpreter.path.not.found", interpreterPath));
    }

    EnvironmentVariableContentProvider envVarsProvider =
      new EnvironmentVariableContentProvider();
    EnvironmentVariable[] envVars = envVarsProvider.getVariables();
    LibraryLocation[] libs = type.getDefaultLibraryLocations(
        file, envVars, new NullProgressMonitor());

    IStatus status = type.validateInstallLocation(
        file, envVars, libs, new NullProgressMonitor());
    if (!status.isOK()){
      throw new RuntimeException(status.getMessage());
    }

    IInterpreterInstall deflt =
      ScriptRuntime.getDefaultInterpreterInstall(
          new ScriptRuntime.DefaultInterpreterEntry(nature, env.getId()));
    if (deflt != null && deflt.getInstallLocation().equals(file)){
      throw new RuntimeException(
          Services.getMessage("interpreter.already.exists", interpreterPath));
    }

    ArrayList<IInterpreterInstall> interpreters =
      new ArrayList<IInterpreterInstall>();
    IInterpreterInstallType[] types =
      ScriptRuntime.getInterpreterInstallTypes(nature);

    for (IInterpreterInstallType iit : types){
      IInterpreterInstall[] installs = iit.getInterpreterInstalls();
      for (IInterpreterInstall install : installs){
        if (install.getInstallLocation().equals(file)){
          throw new RuntimeException(
              Services.getMessage("interpreter.already.exists", interpreterPath));
        }
        interpreters.add(install);
      }
    }

    String name = commandLine.getValue(Options.NAME_OPTION);
    if (name == null){
      name = generateInterpreterName(file, nature);
    }

    String id = null;
    do {
      id = String.valueOf(System.currentTimeMillis());
    } while (type.findInterpreterInstall(id) != null);

    IInterpreterInstall install = new InterpreterStandin(type, id);
    install.setInstallLocation(
        new LazyFileHandle(env.getId(), new Path(interpreterPath)));
    install.setName(name);
    install.setLibraryLocations(libs);
    install.setInterpreterArgs(null); // future use
    install = ((InterpreterStandin)install).convertToRealInterpreter();
    interpreters.add(install);
View Full Code Here

    if (projectName == null && alias == null){
      throw new RuntimeException(
          Services.getMessage("interpreters.arg.required"));
    }

    IEnvironment env = null;
    ArrayList<String> natures = new ArrayList<String>();
    if (projectName != null){
      IProject project = ProjectUtils.getProject(projectName, true);
      env = EnvironmentManager.getEnvironment(project);
      for (String n : DltkUtils.getDltkNatures()){
        if (project.hasNature(n)){
          natures.add(n);
        }
      }
    }else{
      String nature = ProjectNatureFactory.getNatureForAlias(alias);
      if (nature == null){
        throw new RuntimeException(
            Services.getMessage("nature.alias.not.found", alias));
      }
      natures.add(nature);
      env = EnvironmentManager.getLocalEnvironment();
    }

    ArrayList<HashMap<String,Object>> interpreters =
      new ArrayList<HashMap<String,Object>>();
    for (String natureId : natures){
      IInterpreterInstall deflt =
        ScriptRuntime.getDefaultInterpreterInstall(
            new ScriptRuntime.DefaultInterpreterEntry(natureId, env.getId()));
      if (deflt != null){
        HashMap<String,Object> defaultInt = new HashMap<String,Object>();
        defaultInt.put("nature", ProjectNatureFactory.getAliasForNature(natureId));
        defaultInt.put("name", deflt.getName());
        defaultInt.put("path", deflt.getInstallLocation().getPath().toOSString());
View Full Code Here

          Services.getMessage("nature.alias.not.found", alias));
    }

    String interpreterPath = commandLine.getValue(Options.PATH_OPTION);

    IEnvironment env = EnvironmentManager.getLocalEnvironment();
    IFileHandle file = PlatformFileUtils
      .findAbsoluteOrEclipseRelativeFile(env, new Path(interpreterPath));

    IInterpreterInstall deflt =
      ScriptRuntime.getDefaultInterpreterInstall(
          new ScriptRuntime.DefaultInterpreterEntry(nature, env.getId()));
    if (deflt != null && deflt.getInstallLocation().equals(file)){
      deflt = null;
    }

    IInterpreterInstallType[] types =
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.core.environment.IEnvironment

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.