开发者

Print or edit variables from run/external tools configuration in eclipse

Is it possible to print and edit the current variables in eclipse from Run &开发者_JAVA百科gt; External tools > External tools configuration menu?


I use this:

In Location put:

C:\Windows\System32\cmd.exe

In Argumentes put one or more:

/k echo ${container_loc} ${project_loc} ${resource_path} ${target_home}


Go to Windows | Preferences | C/C++ | Build | Build Variables.

Enable the check box Show system variables, and you will see all variables. Many of them will have the value <ECLIPSE_DYNAMIC_VARIABLE>. Editing them will show their actual value.


tm1, in Eclipse Luna 4.4.2 on Win 7 x64, editing the values always shows blank entries here. Perhaps the behavior has changed recently.

Ray, apologies that I don't have enough reputation yet to respond to your answer directly. I must say, I liked your idea enough to expand on it, hope you don't mind.

For Location, ${system_path:cmd.exe} was used since it is not locked to the C: drive.

For Arguments, the following was assembled. Note, it contains decimal 160 characters to space the text evenly.

/c echo build_files:áááááááááááá${build_files}&echo
build_type:ááááááááááááá${build_type}&echo
config_description:ááááá${config_description:${project_name}}&echo
config_name:áááááááááááá${config_name:${project_name}}&echo
container_loc:áááááááááá${container_loc}&echo
container_name:ááááááááá${container_name}&echo
container_path:ááááááááá${container_path}&echo
current_date:ááááááááááá${current_date}&echo
eclipse_home:ááááááááááá${eclipse_home}&echo
env_var:^%windir^%áááááááá${env_var:windir}&echo
git_branch:ááááááááááááá${git_branch}&echo
git_dir:áááááááááááááááá${git_dir}&echo
git_repo_relative_path:á${git_repo_relative_path}&echo
git_work_tree:áááááááááá${git_work_tree}&echo
project_loc:áááááááááááá${project_loc}&echo
project_name:ááááááááááá${project_name}&echo
project_path:ááááááááááá${project_path}&echo
resource_loc:ááááááááááá${resource_loc}&echo
resource_name:áááááááááá${resource_name}&echo
resource_path:áááááááááá${resource_path}&echo
selected_resource_loc:áá${selected_resource_loc}&echo
selected_resource_name:á${selected_resource_name}&echo
selected_resource_path:á${selected_resource_path}&echo
system:ARCH:áááááááááááá${system:ARCH}&echo
system:ECLIPSE_HOME:áááá${system:ECLIPSE_HOME}&echo
system:NL:áááááááááááááá${system:NL}&echo
system:OS:áááááááááááááá${system:OS}&echo
system:WS:áááááááááááááá${system:WS}&echo
system_path:cmd.exeááááá${system_path:cmd.exe}&echo
system_property:upTime:á${system_property:eclipse.startTime}&echo
workspace_loc:áááááááááá${workspace_loc}

The output looks like this:

Print or edit variables from run/external tools configuration in eclipse

A few notes:

  • A source file must be opened in the editor, and active, for it to work.
  • Variable recursion is supported: ${config_name:${project_name}}
  • I couldn't get ${build_project} or ${cdt_pathentry_var} to do much.
  • Interestingly, Eclipse reports my architecture as x86_64, but OS as x86.
  • ${system_property:eclipse.startTime} is a great way to access some "hidden" internal properties of Eclipse. There is a full list of the available commands on help.eclipse.org under Reference, Other Reference, Runtime Options here.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜