use of net.heartsome.cat.ts.importproject.widgiet.ResourceTree in project translationstudio8 by heartsome.
the class ImportProjectWizardPage2 method createResourceTree.
/**
* 创建两颗显示资源树
*/
private void createResourceTree(Composite tparent) {
Composite resourceTreeCmp = new Composite(tparent, SWT.NONE);
resourceTreeCmp.setLayoutData(new GridData(GridData.FILL_BOTH));
resourceTreeCmp.setLayout(new GridLayout(2, true));
Label leftLbl = new Label(resourceTreeCmp, SWT.NONE);
leftLbl.setText(Messages.getString("importProjectWizardPage.projectOfImport"));
Label rightLbl = new Label(resourceTreeCmp, SWT.NONE);
rightLbl.setText(Messages.getString("importProjectWizardPage.repeatedContent"));
// 定义两颗树
selectContentProvider = new SelectProjectContentProvider();
repeateContentProvider = new RepeatProjectContentProvider();
selectElementTree = new ResourceTree(resourceTreeCmp, selectContentProvider, new ProjectLabelProvider());
repeatElementTree = new ResourceTree(resourceTreeCmp, repeateContentProvider, new ProjectLabelProvider());
// 左边的按钮
Composite leftBtnCmp = new Composite(resourceTreeCmp, SWT.NONE);
leftBtnCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(3).applyTo(leftBtnCmp);
leftSelectAllBtn = new Button(leftBtnCmp, SWT.PUSH);
leftSelectAllBtn.setText(Messages.getString("importProjectWizardPage.leftSelectAllBtn"));
leftSelectAllBtn.addListener(SWT.Selection, this);
setButtonLayoutData(leftSelectAllBtn);
leftDisSelectAllBtn = new Button(leftBtnCmp, SWT.PUSH);
leftDisSelectAllBtn.setText(Messages.getString("importProjectWizardPage.leftDisSelectAllBtn"));
leftDisSelectAllBtn.addListener(SWT.Selection, this);
setButtonLayoutData(leftDisSelectAllBtn);
leftAllExpandBtn = new Button(leftBtnCmp, SWT.PUSH);
leftAllExpandBtn.setText(Messages.getString("importProjectWizardPage.leftExpandAllBtn"));
leftAllExpandBtn.addListener(SWT.Selection, this);
setButtonLayoutData(leftAllExpandBtn);
// 右边的按钮
Composite rightBtnCmp = new Composite(resourceTreeCmp, SWT.NONE);
rightBtnCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(3).applyTo(rightBtnCmp);
rightSelectAllBtn = new Button(rightBtnCmp, SWT.PUSH);
rightSelectAllBtn.setText(Messages.getString("importProjectWizardPage.rightSelectAllBtn"));
rightSelectAllBtn.addListener(SWT.Selection, this);
setButtonLayoutData(rightSelectAllBtn);
rightDisSelectAllBtn = new Button(rightBtnCmp, SWT.PUSH);
rightDisSelectAllBtn.setText(Messages.getString("importProjectWizardPage.rightDisSelectAllBtn"));
rightDisSelectAllBtn.addListener(SWT.Selection, this);
setButtonLayoutData(rightDisSelectAllBtn);
rightAllExpandBtn = new Button(rightBtnCmp, SWT.PUSH);
rightAllExpandBtn.setText(Messages.getString("importProjectWizardPage.rightExpandAllBtn"));
rightAllExpandBtn.addListener(SWT.Selection, this);
setButtonLayoutData(rightAllExpandBtn);
// 初始化两颗树的事件
initTreeListener();
selectElementTree.setInput(this);
repeatElementTree.setInput(this);
}
Aggregations