@Override protected Worker createWorker(final Project project, final ExecutionEnvironment execEnv) { return new Worker() { private final PathMap pathMap = RemoteSyncSupport.getPathMap(execEnv, project); @Override public void process(File file, Writer err) throws PathMapperException, InterruptedException, ExecutionException, IOException { String remotePath = pathMap.getRemotePath(file.getAbsolutePath(), false); if (remotePath == null) { throw new RemoteSyncSupport.PathMapperException(file); } Future<Integer> task = CommonTasksSupport.downloadFile(remotePath, execEnv, file.getAbsolutePath(), err); int rc = task.get(); if (rc != 0) { throw new IOException(NbBundle.getMessage(RemoteSyncActions.class, "ERR_RC", rc)); } } @Override public void close() {} }; } }
public ErrorParser(Project project, ExecutionEnvironment execEnv, FileObject relativeTo) { super(); this.relativeTo = relativeTo; this.execEnv = execEnv; pathMap = RemoteSyncSupport.getPathMap(execEnv, project); init(project); }
/** * For the case we know environment for sure, but project can be null - * instead of repeating in client construct like * pathMap = (project == null) ? HostInfoProvider.getMapper(execEnv) : RemoteSyncSupport.getPathMap(project); */ public static PathMap getPathMap(ExecutionEnvironment env, Lookup.Provider project) { PathMap pathMap = null; if (project != null) { pathMap = getPathMap(project); } if (pathMap == null) { pathMap = HostInfoProvider.getMapper(env); } return pathMap; }
protected static String convertToRemoteIfNeeded(ExecutionEnvironment execEnv, String localDir, Project project) { if (!checkConnection(execEnv)) { return null; } if (execEnv.isRemote()) { final PathMap pathMap = RemoteSyncSupport.getPathMap(execEnv, project); String remotePath = pathMap.getRemotePath(localDir, false); if (remotePath == null) { if (!pathMap.checkRemotePaths(new File[]{new File(localDir)}, true)) { return null; } remotePath = pathMap.getRemotePath(localDir, false); } return remotePath; } return localDir; }
public String getRunCommandAsString() { PathMap mapper = RemoteSyncSupport.getPathMap(getProject()); return getRunCommandAsString(getProfile().getRunCommand().getValue(), configuration, mapper); }
initComponents(); instructionsTextArea.setBackground(getBackground()); mapper = RemoteSyncSupport.getPathMap(pae.getProject()); String wd = conf.getMakefileConfiguration().getAbsBuildCommandWorkingDir(); if (mapper != null) {
public static String convertWorkingDirToRemoteIfNeeded(ProjectActionEvent pae, String localDir) { ExecutionEnvironment execEnv = pae.getConfiguration().getDevelopmentHost().getExecutionEnvironment(); if (!checkConnection(execEnv)) { return null; } if (execEnv.isRemote()) { PathMap mapper = RemoteSyncSupport.getPathMap(pae.getProject()); if (mapper != null) { String aLocalDir = mapper.getRemotePath(localDir, false); if (aLocalDir != null) { localDir = aLocalDir; } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{pae.getProject(), localDir}); //NOI18N } return localDir; } return localDir; }
private static String getOutput(MakeConfigurationDescriptor projectDescriptor, MakeConfiguration conf, CompilerSet compilerSet) { String output = conf.getOutputValue(); if (!conf.getDevelopmentHost().isLocalhost() && ! output.startsWith("$") && ! CndPathUtilities.isPathAbsolute(output)) { //NOI18N PathMap mapper = RemoteSyncSupport.getPathMap(projectDescriptor.getProject()); if (mapper != null) { output = mapper.getRemotePath(output, true); if (output == null) { output = conf.getOutputValue(); } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{projectDescriptor.getProject(), output}); // NOI18N } } switch (conf.getDevelopmentHost().getBuildPlatform()) { case PlatformTypes.PLATFORM_WINDOWS: switch (conf.getConfigurationType().getValue()) { case MakeConfiguration.TYPE_APPLICATION: case MakeConfiguration.TYPE_DB_APPLICATION: case MakeConfiguration.TYPE_QT_APPLICATION: output = mangleAppnameWin(output); break; } break; } if (compilerSet != null) { output = CppUtils.normalizeDriveLetter(compilerSet, output); } return output; }
public String getExecutable() { String result; if (type == PredefinedType.RUN || type == PredefinedType.DEBUG || type == PredefinedType.DEBUG_STEPINTO) { result = getExecutableFromRunCommand(); if (result != null && result.length() > 0) { ExecutionEnvironment execEnv = configuration.getDevelopmentHost().getExecutionEnvironment(); if (!CndPathUtilities.isPathAbsolute(result)) { CndUtils.assertTrueInConsole(false, "getExecutableFromRunCommand() returned non-absolute path", result); //NOI18N String baseDir = configuration.getProfile().getRunDirectory(); if (execEnv.isRemote()) { PathMap mapper = RemoteSyncSupport.getPathMap(getProject()); if (mapper != null) { baseDir = mapper.getRemotePath(baseDir, true); if (baseDir == null) { baseDir = configuration.getProfile().getRunDirectory(); } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{getProject(), baseDir}); //NOI18N } } result = baseDir + FileSystemProvider.getFileSeparatorChar(execEnv) + result; } result = FileSystemProvider.normalizeAbsolutePath(result, execEnv); } } else { result = executable; } return result; }
final ExecutionEnvironment execEnv = conf.getDevelopmentHost().getExecutionEnvironment(); if (!pae.isFinalExecutable()) { PathMap mapper = RemoteSyncSupport.getPathMap(pae.getProject()); if (mapper != null) { String anExecutable = mapper.getRemotePath(executable, true);
@Override public void actionPerformed(ActionEvent e) { for (int i = handleEvents.paes.length - 1; i >= 0; i--) { ProjectActionEvent pae = handleEvents.paes[i]; if (ProjectActionSupport.checkProject(pae)) { String projectName = ProjectUtils.getInformation(pae.getProject()).getDisplayName(); String dir = pae.getProfile().getRunDirectory(); ExecutionEnvironment env = pae.getConfiguration().getDevelopmentHost().getExecutionEnvironment(); if (env.isRemote()) { if (RemoteFileUtil.getProjectSourceExecutionEnvironment(pae.getProject()).isLocal()) { PathMap pathMap = RemoteSyncSupport.getPathMap(pae.getProject()); if (pathMap != null) { String aDir = pathMap.getRemotePath(dir); if (aDir != null) { dir = aDir; } } else { LOGGER.log(Level.SEVERE, "Path Mapper not found for project {0} - using local path {1}", new Object[]{pae.getProject(), dir}); //NOI18N } } } TerminalSupport.openTerminal(getString("TargetExecutor.TermAction.tabTitle", projectName, env.getDisplayName()), env, dir); // NOI18N } break; } } }
path = RemoteSyncSupport.getPathMap(exEnv, project).getRemotePath(path, true);