据我所知,我们可以在eclipse中使用快速辅助( CTRL + 1 )将if-else构造转换为java。但是,我有一个情况,我必须在工作区进行广泛的改变。有谁知道如何做到这一点。
另外,任何想法如何使用工具转换下面的构造?
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '0') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Alright For Agent To Renew");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '1') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Computer Renew");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '2') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Alright For Home Office To renew");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '3') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Already Renewed");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '4') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Agent Issued First Policy, Computer To Renew");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '7') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Non-Renewal With A Notice");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '8') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Non-Renewal Without A Notice");
} else {
if (getBcListEntryArr38(wsCount).getBcRenewal0cd() == '9') {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("Cancelled Policy");
} else {
getBcListEntryArr38(wsCount).setBcRenewal0cdDesc("");
}
}
}
}
}
}
}
答案 0 :(得分:1)
首先使用 CTRL + 1 将此语句转换为var list = document.getElementById('list');
var list_items = list.children;
alert(list_items.length);
,然后您就可以转换{{1}中的if-else if
语句}}
更新:
根据您的Eclipse版本,请注意有一个错误,即#34;将if-else if
转换为switch
"快速帮助,请参阅https://bugs.eclipse.org/bugs/show_bug.cgi?id=348179。
修复了这个问题:启动4.3里程碑1 Eclipse将支持将if-else语句转换为switch语句。