use of org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method openIndicatorOptionDialog.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.editor.composite.AbstractColumnDropTree#openIndicatorOptionDialog(org.eclipse
* .swt.widgets.Shell, org.eclipse.swt.widgets.TreeItem)
*/
@Override
public boolean openIndicatorOptionDialog(Shell shell, TreeItem indicatorItem) {
if (isDirty()) {
masterPage.doSave(null);
}
TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) indicatorItem.getData(INDICATOR_UNIT_KEY);
if (FormEnum.isExsitingForm(indicatorUnit)) {
TableIndicatorOptionsWizard wizard = new TableIndicatorOptionsWizard(indicatorUnit);
String href = FormEnum.getFirstFormHelpHref(indicatorUnit);
OpeningHelpWizardDialog optionDialog = new OpeningHelpWizardDialog(shell, wizard, href);
optionDialog.create();
if (Window.OK == optionDialog.open()) {
setDirty(wizard.isDirty());
return hasIndicatorParameters(indicatorUnit);
}
} else {
openNoIndicatorOptionsMessageDialog(shell);
}
return false;
}
use of org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method removeSelectedElements.
private void removeSelectedElements(Tree newTree) {
TreeItem[] selection = newTree.getSelection();
if (isRowCountIndicator(selection)) {
return;
}
boolean branchIndicatorExist = false;
for (TreeItem item : selection) {
TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
if (indicatorUnit != null) {
deleteIndicatorItems((TableIndicator) item.getData(TABLE_INDICATOR_KEY), indicatorUnit);
} else {
deleteTableItems((TableIndicator) item.getData(TABLE_INDICATOR_KEY));
}
if (item.getParentItem() != null && item.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
branchIndicatorExist = true;
continue;
} else {
removeItemBranch(item);
removeTreeItem(item);
}
}
if (branchIndicatorExist) {
setElements(tableIndicators);
}
// MOD mzhao 2005-05-05 bug 6587.
// MOD mzhao 2009-06-8, bug 5887.
// updateBindConnection(masterPage, getTableIndicator(), tree);
}
use of org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit 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()));
}
}
}
}
// ~
}
use of org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method dropWhereRules.
public void dropWhereRules(Object data, List<RuleRepNode> nodes, int index, TreeItem item) {
TreeItem treeItem = null;
if (item == null) {
if (getTree().getItemCount() > 0) {
treeItem = getTree().getItem(0);
}
} else {
treeItem = item;
}
if (data != null && treeItem != null && nodes.size() > 0) {
Analysis analysis = getAnalysis();
for (RuleRepNode node : nodes) {
TableIndicatorUnit addIndicatorUnit = DQRuleUtilities.createIndicatorUnit(node, (TableIndicator) data, analysis);
if (addIndicatorUnit != null) {
createOneUnit(treeItem, addIndicatorUnit);
setDirty(true);
}
}
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method isExpressionNull.
private String isExpressionNull(TreeItem item) {
String expressContent = null;
TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
TableIndicator tableIndicator = (TableIndicator) item.getData(TABLE_INDICATOR_KEY);
NamedColumnSet set = tableIndicator.getColumnSet();
Connection dataprovider = ConnectionHelper.getTdDataProvider(ColumnSetHelper.getParentCatalogOrSchema(set));
DbmsLanguage dbmsLang = DbmsLanguageFactory.createDbmsLanguage(dataprovider);
Expression expression = dbmsLang.getInstantiatedExpression(indicatorUnit.getIndicator());
if (expression != null) {
expressContent = expression.getBody();
}
return expressContent;
}
Aggregations