Eclipse.外部工具.变量

在配置外部工具时可使用如下变量:
${workspace_loc}:
workspace的绝对路径
${workspace_loc:}:
所指定的resource的绝对路径。resource path是相对于workspace root的完整路径。
注意:${workspace_loc:/myproject/myfile.txt}和${workspace_loc}/myproject/myfile.txt不一定相同,因为前者表示的myfile.txt可能位于workspace之外。
${project_loc}:
当前所选择的resource所在的project或正构建的project或所选择的的绝对路径
${project_loc:}:
所指定的resource所在的project的绝对路径。resource path是相对于workspace root的相对路径。
${project_path}
当前选择的资源所在的project或者正构建的project的相对于workspace root的相对路径。
${project_name}
当前选择的资源所在的project或者正构建的project的名称
${container_loc}:
当前所选择的资源的parent的绝对路径
${container_loc:}
所指定的resource的parent的绝对路径
${resource_loc} 
当前选定的资源的绝对路径
${resource_loc:} 
所指定的资源的绝对路径
${container_path}
当前选定的资源的parent的相对于workspace root的路径
${resource_path}
当前选定的资源的相对于workspace root的路径
${container_name}
当前选定的资源的parent的名称
${resource_name}
当前选定的资源的名称
${build_type} 
在外部工具作为构建的一部分时表示构建的类型。值可以是“full”、“incremental”、“auto”。如果外部工具运行于构建之外,值为“none”
假设workspace目录为c:\eclipse\workspace。
有两个project:MyProject1和MyProject2。
MyProject1位于workspace之内。
MyProject2位于workspace目录之外:c:\projects\MyProject2。
选中资源/MyProject2/MyFolder/MyFile.txt,则运行外部工具时,各对应变量值如下:
Variable Examples            Expanded Results
${workspace_loc} c:\eclipse\workspace
${workspace_loc:/MyProject1/MyFile.txt} c:\eclipse\workspace\MyProject\MyFile.txt
${workspace_loc:/MyProject2/MyFile.txt} c:\projects\MyProject2\MyFile.txt
${project_loc} c:\projects\MyProject2
${project_loc:/MyProject1/MyFile.txt} c:\eclipse\workspace\MyProject
${container_loc} c:\projects\MyProject2\MyFolder
${resource_loc} c:\projects\MyProject2\MyFile.txt
${project_path} /MyProject2
${container_path} /MyProject2/MyFolder
${resource_path} /MyProject2/MyFolder/MyFile.txt
${project_name} MyProject2
${container_name} MyFolder
${resource_name} MyFile.txt
${build_type} none
 
转载:http://blog.csdn.net/zlp5201/article/details/22469653
 
附录:打开文件所在的目录
1、Run ---- External Tools ---- External Tools Configurations
2、双击program,新建
3、 Location 中填写 windows 资源管理器路径(C:\Windows\explorer.exe)
4、Arguments 中填写 ${container_loc}
5、Common 选项卡,选中 External Tools 复选框(使该项出现在工具栏中)
6、Apply

猜你喜欢

转载自398868310.iteye.com/blog/2382499