use of org.talend.dq.nodes.PatternRepNode in project tdq-studio-se by Talend.
the class PatternLabelProvider method createPatternCheckedTreeSelectionDialog.
/**
* create CheckedTreeSelectionDialog for patterns.
*
* @param node Pattern root RepositoryNode.
* @return
*/
public static CheckedTreeSelectionDialog createPatternCheckedTreeSelectionDialog(IRepositoryNode node) {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
dialog.setInput(node);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
for (Object patte : selection) {
if (patte instanceof PatternRepNode) {
PatternRepNode patternNode = (PatternRepNode) patte;
Pattern findPattern = patternNode.getPattern();
boolean validStatus = TaggedValueHelper.getValidStatus(findPattern);
if (!validStatus) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
"AnalysisColumnTreeViewer.chooseValidPatterns"));
}
}
}
return new // $NON-NLS-1$
Status(// $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
PlatformUI.PLUGIN_ID, // $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
"", null);
}
});
dialog.setContainerMode(true);
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.patternSelector"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.patterns"));
dialog.setSize(80, 30);
return dialog;
}
Aggregations