use of org.talend.dataprofiler.core.ui.dialog.IndicatorCheckedTreeSelectionDialog in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method showAddDQRuleDialog.
/**
* DOC xqliu Comment method "showAddDQRuleDialog".
*
* @param treeItem
* @param tableIndicator
*/
private void showAddDQRuleDialog(final TreeItem treeItem, final TableIndicator tableIndicator) {
// MOD xqliu 2009-04-30 bug 6808
IndicatorCheckedTreeSelectionDialog dialog = new IndicatorCheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
dialog.setInput(AnalysisUtils.getSelectDialogInputData(EResourceConstant.RULES_SQL));
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
for (Object ruleNode : selection) {
if (ruleNode instanceof RuleRepNode) {
IndicatorDefinition findWhereRule = ((RuleRepNode) ruleNode).getRule();
boolean validStatus = TaggedValueHelper.getValidStatus(findWhereRule);
if (!validStatus) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
"AnalysisTableTreeViewer.chooseValidDQRules"));
}
}
}
// $NON-NLS-1$
return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null);
}
});
dialog.setContainerMode(true);
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.dqruleSelector"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.dqrules"));
dialog.setSize(80, 30);
dialog.create();
// MOD xqliu 2009-04-30 bug 6808
Object[] ownedWhereRuleNodes = getOwnedWhereRuleNodes(tableIndicator);
dialog.setCheckedElements(ownedWhereRuleNodes);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
removeUncheckedWhereRuleIndicator(ownedWhereRuleNodes, result, tableIndicator);
Object[] results = clearAddedResult(ownedWhereRuleNodes, result);
for (Object obj : results) {
if (obj instanceof RuleRepNode) {
RuleRepNode node = (RuleRepNode) obj;
TableIndicatorUnit addIndicatorUnit = DQRuleUtilities.createIndicatorUnit(node, tableIndicator, getAnalysis());
if (addIndicatorUnit != null) {
createOneUnit(treeItem, addIndicatorUnit);
setDirty(true);
} else {
IndicatorDefinition whereRule = node.getRule();
MessageUI.openError(// $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"AnalysisTableTreeViewer.ErrorWhenAddWhereRule", whereRule.getName()));
}
}
}
}
// ~
}
Aggregations