Search in sources :

Example 1 with ResourceViewContentProvider

use of org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider in project tdq-studio-se by Talend.

the class IndicatorSettingsPage method openAnalysesSelectionDialog.

/**
 * DOC qzhang Comment method "openAnalysesSelectionDialog".
 */
protected void openAnalysesSelectionDialog(boolean isLowCase) {
    SpecialLimitFrequencyAnalysisFilter limitFilter = new SpecialLimitFrequencyAnalysisFilter(isLowCase ? 0 : freResultLimit, isLowCase ? lowFreResultLimit : 0);
    CheckedTreeSelectionDialog checkedTreeSelectionDialog = new CheckedTreeSelectionDialog(this.getShell(), new DQRepositoryViewLabelProviderWithFilter(limitFilter), new ResourceViewContentProvider());
    // $NON-NLS-1$
    checkedTreeSelectionDialog.setTitle(DefaultMessagesImpl.getString("IndicatorSettingsPage.analysisSelectDialog.title"));
    checkedTreeSelectionDialog.setMessage(// $NON-NLS-1$
    DefaultMessagesImpl.getString("IndicatorSettingsPage.analysisSelectDialog.message"));
    checkedTreeSelectionDialog.setContainerMode(true);
    checkedTreeSelectionDialog.addFilter(new SelectAnalysisDialogNodeFilter());
    checkedTreeSelectionDialog.addFilter(limitFilter);
    DQRepositoryNode analysisSelectDialogInputData = AnalysisUtils.getAnalysisSelectDialogInputDataWithoutRef(EResourceConstant.ANALYSIS);
    checkedTreeSelectionDialog.setInput(analysisSelectDialogInputData);
    if (checkedTreeSelectionDialog.open() == Dialog.OK) {
        Object[] result = checkedTreeSelectionDialog.getResult();
        for (Object obj : result) {
            if (obj instanceof AnalysisRepNode) {
                AnalysisRepNode anaNode = (AnalysisRepNode) obj;
                modifyAndSaveLimit(anaNode, isLowCase);
            }
        }
    }
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) SpecialLimitFrequencyAnalysisFilter(org.talend.dataprofiler.core.ui.filters.SpecialLimitFrequencyAnalysisFilter) SelectAnalysisDialogNodeFilter(org.talend.dataprofiler.core.ui.filters.SelectAnalysisDialogNodeFilter) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) DQRepositoryViewLabelProviderWithFilter(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProviderWithFilter)

Example 2 with ResourceViewContentProvider

use of org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider in project tdq-studio-se by Talend.

the class TwoPartCheckSelectionDialog method createFirstPart.

/**
 * Creates the tree viewer.
 *
 * @param parent the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createFirstPart(Composite parent) {
    if (fContainerMode) {
        if (DIALOG_TYPE_TABLE == this.getDialogType()) {
            fViewer = new TableSelectionViewer(parent, SWT.BORDER);
        } else if (!this.addConnFilter) {
            fViewer = new MatchColumnSelectionViewer(parent, SWT.BORDER);
        } else {
            fViewer = new ColumnSelectionViewer(parent, SWT.BORDER);
        }
    // {
    // 
    // protected void handleTreeExpand(TreeEvent event) {
    // super.handleTreeExpand(event);
    // checkElementChecked();
    // }
    // };
    } else {
        fViewer = new CheckboxTreeViewer(parent, SWT.BORDER) {

            @Override
            protected void handleTreeExpand(TreeEvent event) {
                super.handleTreeExpand(event);
            // checkElementChecked();
            }
        };
    }
    fViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(fViewer.getTree());
    fViewer.setContentProvider(fContentProvider);
    // mod gdbu 2011-7-25 bug 23220
    ((ResourceViewContentProvider) fContentProvider).setTreeViewer(fViewer);
    // ~23220
    fViewer.setLabelProvider(fLabelProvider);
    fViewer.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            updateOKStatus();
        }
    });
    fViewer.setComparator(fComparator);
    if (fFilters != null) {
        for (int i = 0; i != fFilters.size(); i++) {
            fViewer.addFilter(fFilters.get(i));
        }
    }
    fViewer.setInput(fInput);
    // fViewer.
    fViewer.addSelectionChangedListener(this);
    return fViewer;
}
Also used : CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) TreeEvent(org.eclipse.swt.events.TreeEvent) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) GridData(org.eclipse.swt.layout.GridData) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent)

Example 3 with ResourceViewContentProvider

use of org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider in project tdq-studio-se by Talend.

the class UDIUtils method createUdiCheckedTreeSelectionDialog.

/**
 * DOC xqliu Comment method "createUdiCheckedTreeSelectionDialog".
 *
 * @param meIndicator
 * @return
 */
public static CheckedTreeSelectionDialog createUdiCheckedTreeSelectionDialog(ModelElementIndicator meIndicator) {
    CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
    dialog.addFilter(new FolderObjFilter());
    DQRepositoryNode udiDialogInputData = AnalysisUtils.getSelectDialogInputData(EResourceConstant.USER_DEFINED_INDICATORS);
    dialog.setInput(udiDialogInputData);
    dialog.setValidator(new ISelectionStatusValidator() {

        public IStatus validate(Object[] selection) {
            for (Object patte : selection) {
                if (patte instanceof SysIndicatorDefinitionRepNode) {
                    SysIndicatorDefinitionRepNode udiNode = (SysIndicatorDefinitionRepNode) patte;
                    IndicatorDefinition indicatorDefinition = udiNode.getIndicatorDefinition();
                    boolean validStatus = TaggedValueHelper.getValidStatus(indicatorDefinition);
                    if (!validStatus) {
                        return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
                        "AnalysisColumnTreeViewer.chooseValidUdis"));
                    }
                }
            }
            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);
    dialog.setInitialSelections(getUDIFilesByIndicator(udiDialogInputData, meIndicator));
    // $NON-NLS-1$
    dialog.setTitle(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udiSelector"));
    // $NON-NLS-1$
    dialog.setMessage(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udis"));
    dialog.setSize(80, 30);
    return dialog;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) FolderObjFilter(org.talend.dataprofiler.core.ui.filters.FolderObjFilter) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) DQRepositoryViewLabelProvider(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)

Example 4 with ResourceViewContentProvider

use of org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider in project tdq-studio-se by Talend.

the class SetJDBCDriverPreferencePage method createConnSelectDialog.

private CheckedTreeSelectionDialog createConnSelectDialog() {
    RepositoryNode node = (RepositoryNode) RepositoryNodeHelper.getMetadataFolderNode(EResourceConstant.DB_CONNECTIONS);
    CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(getShell(), new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
    dialog.setInput(node);
    dialog.addFilter(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof DBConnectionRepNode) {
                return isJdbcConnectionNode((DBConnectionRepNode) element);
            } else if (element instanceof DBConnectionSubFolderRepNode) {
                return hasJdbcConnNodeChild((DBConnectionSubFolderRepNode) element);
            }
            return false;
        }
    });
    dialog.setValidator(new ISelectionStatusValidator() {

        public IStatus validate(Object[] selection) {
            for (Object object : selection) {
                if (object instanceof DBConnectionRepNode) {
                    IRepositoryViewObject nodeObject = ((DBConnectionRepNode) object).getObject();
                    // when it's locked, can not modify
                    if (nodeObject != null && nodeObject.getProperty() != null && nodeObject.getProperty().getItem() != null && (nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_OTHER || nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_USER || RepositoryManager.isOpenedItemInEditor(nodeObject))) {
                        String displayName = nodeObject.getProperty().getDisplayName();
                        String version = nodeObject.getProperty().getVersion();
                        return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.isLocked", // $NON-NLS-1$ //$NON-NLS-2$
                        displayName + " " + version));
                    }
                }
            }
            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("SetJDBCDriverPreferencePage.selectConnectionButton"));
    // $NON-NLS-1$
    dialog.setMessage(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.ApplytoConnectionEditors"));
    dialog.setSize(80, 30);
    return dialog;
}
Also used : ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) IStatus(org.eclipse.core.runtime.IStatus) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) Viewer(org.eclipse.jface.viewers.Viewer) DBConnectionSubFolderRepNode(org.talend.dq.nodes.DBConnectionSubFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) DQRepositoryViewLabelProvider(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)

Example 5 with ResourceViewContentProvider

use of org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider in project tdq-studio-se by Talend.

the class AnalysisDPSelectionPage method createMetaDataTree.

private void createMetaDataTree(Composite parent) {
    Composite treeContainer = new Composite(parent, SWT.NONE);
    treeContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
    treeContainer.setLayout(new FillLayout());
    int style = this.multiSelect ? SWT.BORDER | SWT.MULTI : SWT.BORDER;
    fViewer = new TreeViewer(treeContainer, style);
    fViewer.setContentProvider(fContentProvider);
    fViewer.setLabelProvider(fLabelProvider);
    fViewer.setInput(RepositoryNodeHelper.getRootNode(ERepositoryObjectType.METADATA, true));
    // MOD gdbu 2011-7-25 bug : 23220
    ((ResourceViewContentProvider) fContentProvider).setTreeViewer(fViewer);
// ~23220
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) GridData(org.eclipse.swt.layout.GridData) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout)

Aggregations

ResourceViewContentProvider (org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider)8 DQRepositoryViewLabelProvider (org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)5 IStatus (org.eclipse.core.runtime.IStatus)4 Status (org.eclipse.core.runtime.Status)4 CheckedTreeSelectionDialog (org.eclipse.ui.dialogs.CheckedTreeSelectionDialog)4 ISelectionStatusValidator (org.eclipse.ui.dialogs.ISelectionStatusValidator)4 GridData (org.eclipse.swt.layout.GridData)2 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)2 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)2 RuleRepNode (org.talend.dq.nodes.RuleRepNode)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTreeViewer (org.eclipse.jface.viewers.CheckboxTreeViewer)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 TreeEvent (org.eclipse.swt.events.TreeEvent)1 FillLayout (org.eclipse.swt.layout.FillLayout)1