Search in sources :

Example 1 with ProjectTreeView

use of net.heartsome.cat.ts.test.ui.views.ProjectTreeView 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);
    }
}
Also used : ConfirmProjectDeleteDialog(net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) ProgressDialog(net.heartsome.cat.ts.test.ui.msgdialogs.ProgressDialog) ProjectTreeView(net.heartsome.cat.ts.test.ui.views.ProjectTreeView)

Aggregations

ConfirmProjectDeleteDialog (net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog)1 ProgressDialog (net.heartsome.cat.ts.test.ui.msgdialogs.ProgressDialog)1 ProjectTreeView (net.heartsome.cat.ts.test.ui.views.ProjectTreeView)1 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)1 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)1