Search in sources :

Example 11 with AnalysisEditor

use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor in project tdq-studio-se by Talend.

the class IndicatorThresholdsForm method isContainRowCountIndicator.

private boolean isContainRowCountIndicator() {
    IEditorPart editor = CorePlugin.getDefault().getCurrentActiveEditor();
    if (editor == null) {
        return false;
    }
    AbstractAnalysisMetadataPage masterPage = ((AnalysisEditor) editor).getMasterPage();
    if (masterPage == null) {
        return false;
    }
    // if the analysis type is TABLE Analysis, just return true
    if (AnalysisType.TABLE.equals(masterPage.getAnalysisHandler().getAnalysis().getParameters().getAnalysisType())) {
        return true;
    }
    ModelElementIndicator[] currentModelElementIndicators = masterPage.getCurrentModelElementIndicators();
    if (currentModelElementIndicators == null) {
        return false;
    }
    for (ModelElementIndicator meIndicator : currentModelElementIndicators) {
        if (meIndicator != null && meIndicator.getIndicators() != null) {
            for (Indicator indicator : meIndicator.getIndicators()) {
                if (IndicatorsPackage.eINSTANCE.getRowCountIndicator().equals(indicator.eClass())) {
                    return true;
                }
                if (IndicatorsPackage.eINSTANCE.getCountsIndicator().equals(indicator.eClass())) {
                    CountsIndicator cInd = (CountsIndicator) indicator;
                    if (cInd.getRowCountIndicator() != null) {
                        return true;
                    }
                }
                if (ColumnsetPackage.eINSTANCE.getSimpleStatIndicator().equals(indicator.eClass())) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : CountsIndicator(org.talend.dataquality.indicators.CountsIndicator) AbstractAnalysisMetadataPage(org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage) IEditorPart(org.eclipse.ui.IEditorPart) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) CountsIndicator(org.talend.dataquality.indicators.CountsIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 12 with AnalysisEditor

use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor in project tdq-studio-se by Talend.

the class ColumnWizard method openEditor.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataprofiler.core.ui.wizard.analysis.AbstractAnalysisWizard#openEditor(org.talend.repository.model.IRepositoryNode
     * )
     */
@Override
public void openEditor(IRepositoryNode repNode) {
    super.openEditor(repNode);
    if (this.selectionPage != null) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            AbstractAnalysisMetadataPage masterPage = editor.getMasterPage();
            List<IRepositoryNode> nodes = this.selectionPage.nodes;
            if (nodes != null && nodes.size() > 0) {
                // MOD msjian TDQ-6665 2013-1-7: after the wizard, make the editor is saved status
                if (masterPage instanceof ColumnAnalysisDetailsPage) {
                    ((ColumnAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                    ModelElementIndicator[] predefinedColumnIndicator = this.getPredefinedColumnIndicator();
                    if (predefinedColumnIndicator != null) {
                        ((ColumnAnalysisDetailsPage) masterPage).refreshPreviewTable(predefinedColumnIndicator, false);
                        ((ColumnAnalysisDetailsPage) masterPage).refreshTheTree(predefinedColumnIndicator);
                    }
                    // TDQ-12349: when the database can not support PatternFrequency, set to java engine automatically
                    if (this instanceof PatternFrequencyWizard && !RepNodeUtils.isSupportPatternFrequency(nodes)) {
                        masterPage.changeExecuteLanguageToJava(true);
                    }
                // TDQ-12349~
                } else if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
                    ((ColumnSetAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                } else {
                    masterPage.getTreeViewer().setInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                }
                masterPage.doSave(new NullProgressMonitor());
            // TDQ-6665~
            }
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) AbstractAnalysisMetadataPage(org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 13 with AnalysisEditor

use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor in project tdq-studio-se by Talend.

the class OpenColumnSelectorAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[],
     * org.eclipse.ui.cheatsheets.ICheatSheetManager)
     */
public void run(String[] params, ICheatSheetManager manager) {
    // ADD xqliu TDQ-4285 2011-12-27
    if (!CheatSheetActionHelper.canRun()) {
        return;
    }
    if (params == null || params.length == 0) {
        return;
    }
    Integer analysisCatigory = null;
    if (NumberUtils.isNumber(params[0])) {
        analysisCatigory = NumberUtils.toInt(params[0]);
    }
    if (analysisCatigory != null) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor == null) {
            return;
        }
        switch(analysisCatigory) {
            case AnalysisType.BUSINESS_RULE_VALUE:
                BusinessRuleAnalysisDetailsPage page4 = (BusinessRuleAnalysisDetailsPage) editor.getMasterPage();
                page4.openTableSelectionDialog();
                page4.doSave(null);
                break;
            case AnalysisType.TABLE_FUNCTIONAL_DEPENDENCY_VALUE:
                FunctionalDependencyAnalysisDetailsPage page3 = (FunctionalDependencyAnalysisDetailsPage) editor.getMasterPage();
                if (params[1] != null) {
                    if ("A".equalsIgnoreCase(params[1])) {
                        // $NON-NLS-1$
                        page3.openColumnsSetASelectionDialog();
                    } else {
                        page3.openColumnsSetBSelectionDialog();
                    }
                }
                // page3.doSave(null);
                break;
            case AnalysisType.COLUMN_SET_VALUE:
                ColumnSetAnalysisDetailsPage page0 = (ColumnSetAnalysisDetailsPage) editor.getMasterPage();
                page0.openColumnsSelectionDialog();
                page0.doSave(null);
                break;
            case AnalysisType.MULTIPLE_COLUMN_VALUE:
                ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) editor.getMasterPage();
                page.openColumnsSelectionDialog();
                page.doSave(null);
                break;
            case AnalysisType.COLUMNS_COMPARISON_VALUE:
                RedundancyAnalysisDetailsPage page1 = (RedundancyAnalysisDetailsPage) editor.getMasterPage();
                if (params[1] != null) {
                    if (NumberUtils.isNumber(params[1])) {
                        int pos = NumberUtils.toInt(params[1]);
                        if (pos == 0) {
                            page1.openColumnsSetASelectionDialog();
                        } else {
                            page1.openColumnsSetBSelectionDialog();
                        }
                    }
                }
                // page1.doSave(null);
                break;
            case AnalysisType.COLUMN_CORRELATION_VALUE:
                CorrelationAnalysisDetailsPage page2 = (CorrelationAnalysisDetailsPage) editor.getMasterPage();
                page2.openColumnsSelectionDialog();
                page2.doSave(null);
                break;
            default:
                break;
        }
    }
}
Also used : RedundancyAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.RedundancyAnalysisDetailsPage) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) FunctionalDependencyAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.FunctionalDependencyAnalysisDetailsPage) CorrelationAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.CorrelationAnalysisDetailsPage) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) BusinessRuleAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.BusinessRuleAnalysisDetailsPage) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage)

Aggregations

AnalysisEditor (org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)13 IEditorPart (org.eclipse.ui.IEditorPart)6 IRepositoryNode (org.talend.repository.model.IRepositoryNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)6 ArrayList (java.util.ArrayList)4 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)4 Connection (org.talend.core.model.metadata.builder.connection.Connection)3 Item (org.talend.core.model.properties.Item)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 AbstractAnalysisMetadataPage (org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage)3 ColumnAnalysisDetailsPage (org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage)3 ColumnSetAnalysisDetailsPage (org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage)3 Indicator (org.talend.dataquality.indicators.Indicator)3 DbmsLanguage (org.talend.dq.dbms.DbmsLanguage)3 Iterator (java.util.Iterator)2 List (java.util.List)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 OpenItemEditorAction (org.talend.dataprofiler.core.ui.action.actions.OpenItemEditorAction)2 AnalysisItemEditorInput (org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput)2