Search in sources :

Example 1 with RunAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction in project tdq-studio-se by Talend.

the class CorrelationAnalysisDetailsPage method createPreviewSection.

void createPreviewSection(final ScrolledForm form, Composite parent) {
    previewSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$ //$NON-NLS-2$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
    previewSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(previewSection);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    Button chartButton = new Button(sectionClient, SWT.NONE);
    // $NON-NLS-1$
    chartButton.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.refreshGraphics"));
    final Label message = toolkit.createLabel(sectionClient, // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.spaceWhite"));
    message.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    message.setVisible(false);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    chartComposite = toolkit.createComposite(sectionClient);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final Analysis analysis = correlationAnalysisHandler.getAnalysis();
    chartButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            for (Control control : chartComposite.getChildren()) {
                control.dispose();
            }
            boolean analysisStatue = analysis.getResults().getResultMetadata() != null && analysis.getResults().getResultMetadata().getExecutionDate() != null;
            if (!analysisStatue) {
                boolean returnCode = MessageDialog.openConfirm(null, // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ViewResult"), // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.RunOrSeeSampleData"));
                if (returnCode) {
                    new RunAnalysisAction().run();
                    message.setVisible(false);
                } else {
                    createPreviewCharts(form, chartComposite, false);
                    // $NON-NLS-1$
                    message.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.warning"));
                    message.setVisible(true);
                }
            } else {
                createPreviewCharts(form, chartComposite, true);
            }
            chartComposite.layout();
            form.reflow(true);
        }
    });
    previewSection.setClient(sectionClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) Button(org.eclipse.swt.widgets.Button) Analysis(org.talend.dataquality.analysis.Analysis) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction)

Example 2 with RunAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction in project tdq-studio-se by Talend.

the class DynamicAnalysisMasterPage method createPreviewSection.

void createPreviewSection(final ScrolledForm form1, Composite parent) {
    previewSection = createSection(form1, parent, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$ //$NON-NLS-2$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
    previewSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(previewSection);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite actionBarComp = toolkit.createComposite(sectionClient);
    GridLayout gdLayout = new GridLayout();
    gdLayout.numColumns = 3;
    actionBarComp.setLayout(gdLayout);
    createCollapseAllLink(actionBarComp);
    createExpandAllLink(actionBarComp);
    Button chartButton = new Button(actionBarComp, SWT.NONE);
    // $NON-NLS-1$
    chartButton.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.refreshGraphics"));
    final Label message = toolkit.createLabel(sectionClient, // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.spaceWhite"));
    message.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    message.setVisible(false);
    chartButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            disposeChartComposite();
            Analysis analysis = getAnalysisHandler().getAnalysis();
            boolean analysisStatue = analysis.getResults().getResultMetadata() != null && analysis.getResults().getResultMetadata().getExecutionDate() != null;
            if (!analysisStatue) {
                boolean returnCode = MessageDialog.openConfirm(null, // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ViewResult"), // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.RunOrSeeSampleData"));
                if (returnCode) {
                    new RunAnalysisAction().run();
                    message.setVisible(false);
                } else {
                    createPreviewCharts(form1, chartComposite);
                    // $NON-NLS-1$
                    message.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.warning"));
                    message.setVisible(true);
                }
            } else {
                createPreviewCharts(form1, chartComposite);
            }
            reLayoutChartComposite();
        }
    });
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    chartComposite = toolkit.createComposite(sectionClient);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    previewSection.setClient(sectionClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Button(org.eclipse.swt.widgets.Button) Analysis(org.talend.dataquality.analysis.Analysis) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction)

Example 3 with RunAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction in project tdq-studio-se by Talend.

the class RunAnalysisActionProvider method fillContextMenu.

/**
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    Object[] array = ((TreeSelection) this.getContext().getSelection()).toArray();
    ArrayList<TDQAnalysisItem> selectedItemsList = new ArrayList<TDQAnalysisItem>();
    for (Object obj : array) {
        RepositoryNode node = (RepositoryNode) obj;
        RepositoryNode parent = node.getParent();
        if (!(parent instanceof ReportSubFolderRepNode)) {
            // IPath append = WorkbenchUtils.getFilePath(node);
            Item item = node.getObject().getProperty().getItem();
            if (item instanceof TDQAnalysisItem) {
                selectedItemsList.add((TDQAnalysisItem) item);
            }
        }
    }
    if (!selectedItemsList.isEmpty()) {
        // IFile file = ResourceManager.getRootProject().getFile(append);
        RunAnalysisAction runAnalysisAction = new RunAnalysisAction();
        // runAnalysisAction.setSelectionFile(file);
        runAnalysisAction.setAnalysisItems(selectedItemsList.toArray(new TDQAnalysisItem[selectedItemsList.size()]));
        menu.add(runAnalysisAction);
    }
}
Also used : Item(org.talend.core.model.properties.Item) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 4 with RunAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction in project tdq-studio-se by Talend.

the class ColumnSetAnalysisDetailsPage method createPreviewSection.

void createPreviewSection(final ScrolledForm form, Composite parent) {
    previewSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$ //$NON-NLS-2$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
    previewSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(previewSection);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    Button chartButton = new Button(sectionClient, SWT.NONE);
    // $NON-NLS-1$
    chartButton.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.refreshGraphics"));
    final Label message = toolkit.createLabel(sectionClient, // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.spaceWhite"));
    message.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    message.setVisible(false);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    chartComposite = toolkit.createComposite(sectionClient);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final Analysis analysis = columnSetAnalysisHandler.getAnalysis();
    chartButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            disposeChartComposite();
            boolean analysisStatue = analysis.getResults().getResultMetadata() != null && analysis.getResults().getResultMetadata().getExecutionDate() != null;
            if (!analysisStatue) {
                boolean returnCode = MessageDialog.openConfirm(null, // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ViewResult"), // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.RunOrSeeSampleData"));
                if (returnCode) {
                    new RunAnalysisAction().run();
                    message.setVisible(false);
                } else {
                    createPreviewCharts(form, chartComposite, false);
                    // $NON-NLS-1$
                    message.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.warning"));
                    message.setVisible(true);
                }
            } else {
                createPreviewCharts(form, chartComposite, true);
            }
            chartComposite.layout();
            form.reflow(true);
        }
    });
    previewSection.setClient(sectionClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Button(org.eclipse.swt.widgets.Button) Analysis(org.talend.dataquality.analysis.Analysis) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction)

Example 5 with RunAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction in project tdq-studio-se by Talend.

the class AnalysisEditor method addPages.

@Override
protected void addPages() {
    TdEditorToolBar toolbar = getToolBar();
    if (toolbar != null) {
        saveAction = new DefaultSaveAction(this);
        runAction = new RunAnalysisAction();
        toolbar.addActions(saveAction, runAction);
    }
    switch(analysisType) {
        case COLUMN_CORRELATION:
            masterPage = new CorrelationAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new CorrelationAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case MULTIPLE_COLUMN:
            masterPage = new ColumnAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new ColumnAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case CONNECTION:
            masterPage = new ConnectionAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new OverviewResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case CATALOG:
            masterPage = new CatalogAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new OverviewResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case SCHEMA:
            masterPage = new SchemaAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new OverviewResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case COLUMNS_COMPARISON:
            masterPage = new RedundancyAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new RedundancyAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case TABLE:
            masterPage = new BusinessRuleAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new BusinessRuleAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case TABLE_FUNCTIONAL_DEPENDENCY:
            masterPage = new FunctionalDependencyAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new FunctionalDependencyAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case COLUMN_SET:
            masterPage = new ColumnSetAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new ColumnSetAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        case // Added 20130724 TDQ-7504
        MATCH_ANALYSIS:
            masterPage = new MatchAnalysisDetailsPage(this, MASTER_PAGE, ANALYSIS_SETTINGS);
            resultPage = new MatchAnalysisResultPage(this, RESULT_PAGE, ANALYSIS_RESULTS);
            break;
        default:
    }
    try {
        if (masterPage != null) {
            addPage(masterPage);
            setPartName(masterPage.getIntactElemenetName());
            initContext();
            // Added 20130930 TDQ-8117, yyin
            // init the run analysis action, to give it the analysis item and listener
            this.runAction.setAnalysisItems(new TDQAnalysisItem[] { (TDQAnalysisItem) getMasterPage().getCurrentRepNode().getObject().getProperty().getItem() });
        }
        if (resultPage != null) {
            addPage(resultPage);
        }
    } catch (PartInitException e) {
        ExceptionHandler.process(e, Level.ERROR);
    }
    // Added 20130725 TDQ-7639 yyin : register the run analysis event, which need to refresh the pages
    registerUpdateExecutionEvent();
}
Also used : RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction) PartInitException(org.eclipse.ui.PartInitException) DefaultSaveAction(org.talend.dataprofiler.core.ui.action.actions.DefaultSaveAction) TdEditorToolBar(org.talend.dataprofiler.core.ui.editor.TdEditorToolBar)

Aggregations

RunAnalysisAction (org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Button (org.eclipse.swt.widgets.Button)3 Composite (org.eclipse.swt.widgets.Composite)3 Label (org.eclipse.swt.widgets.Label)3 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)3 Analysis (org.talend.dataquality.analysis.Analysis)3 ArrayList (java.util.ArrayList)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Control (org.eclipse.swt.widgets.Control)1 PartInitException (org.eclipse.ui.PartInitException)1 Item (org.talend.core.model.properties.Item)1 DefaultSaveAction (org.talend.dataprofiler.core.ui.action.actions.DefaultSaveAction)1 TdEditorToolBar (org.talend.dataprofiler.core.ui.editor.TdEditorToolBar)1 HideSeriesChartComposite (org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite)1 TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)1 ReportSubFolderRepNode (org.talend.dq.nodes.ReportSubFolderRepNode)1