use of net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog in project translationstudio8 by heartsome.
the class ProjectDelete method deletePrj.
/**
* 删除项目
* @param name
* 项目名称
* @param deleteContent
* 是否同时删除项目文件夹
*/
public void deletePrj(Entry from, String name, boolean deleteContent) {
ProjectTreeView ptv = ProjectTreeView.getInstance();
SWTBotTree treePrj = ProjectTreeView.getTree();
Waits.prjExistOnTree(name);
// 取消选中任何项目,避免误操作
treePrj.unselect();
// 选择项目并删除
treePrj.select(name).isActive();
switch(from) {
case CONTEXT_MENU:
{
ptv.ctxMenuDelete().click();
break;
}
case MENU:
{
TS.getInstance().menuEditDelete().click();
break;
}
default:
{
assertTrue("无此入口:" + from, false);
}
}
// 确认删除对话框
ConfirmProjectDeleteDialog cpd = new ConfirmProjectDeleteDialog(name);
cpd.isActive();
// 选择是否删除内容
if (deleteContent) {
cpd.radBtnAlsoDeleteContentsUnder().click();
cpd.btnYes().click();
Waits.shellClosed(cpd);
SWTBotShell[] shells = HSBot.bot().shells();
if (shells.length > 1) {
ProgressDialog dlgProg = new ProgressDialog("dlgTitleProgressDeleteResource");
Waits.shellClosed(dlgProg);
}
Waits.prjNotExistOnTree(name);
Waits.prjNotExistInWorkspace(name);
} else {
cpd.radBtnDoNotDeleteContents().click();
cpd.btnYes().click();
Waits.shellClosed(cpd);
SWTBotShell[] shells = HSBot.bot().shells();
if (shells.length > 1) {
ProgressDialog dlgProg = new ProgressDialog("dlgTitleProgressDeleteResource");
Waits.shellClosed(dlgProg);
}
Waits.prjNotExistOnTree(name);
Waits.prjExistInWorkspace(name);
}
}
Aggregations