Search in sources :

Example 11 with PatternRepNode

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) Pattern(org.talend.dataquality.domain.pattern.Pattern) IStatus(org.eclipse.core.runtime.IStatus) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) DQRepositoryViewLabelProvider(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider) PatternRepNode(org.talend.dq.nodes.PatternRepNode)

Aggregations

PatternRepNode (org.talend.dq.nodes.PatternRepNode)11 SysIndicatorDefinitionRepNode (org.talend.dq.nodes.SysIndicatorDefinitionRepNode)6 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)5 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)4 ReportRepNode (org.talend.dq.nodes.ReportRepNode)4 RuleRepNode (org.talend.dq.nodes.RuleRepNode)4 IRepositoryNode (org.talend.repository.model.IRepositoryNode)4 ArrayList (java.util.ArrayList)3 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)3 Pattern (org.talend.dataquality.domain.pattern.Pattern)3 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)3 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)3 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)3 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)3 DFConnectionRepNode (org.talend.dq.nodes.DFConnectionRepNode)3 SourceFileRepNode (org.talend.dq.nodes.SourceFileRepNode)3 IPath (org.eclipse.core.runtime.IPath)2 TreeItem (org.eclipse.swt.widgets.TreeItem)2