Search in sources :

Example 1 with DQRespositoryView

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

the class MatchAnalysisDetailsPage method createAnaDataLabelComposite.

/**
 * create Analysis Data Label Composite.
 *
 * @param dataparent
 */
private void createAnaDataLabelComposite(Composite dataparent) {
    Composite titleComposite = toolkit.createComposite(dataparent);
    GridLayout layout = new GridLayout(2, Boolean.TRUE);
    titleComposite.setLayout(layout);
    analyzeDataLabel = new Label(titleComposite, SWT.NONE);
    final int analysisColumnSize = analysisHandler.getAnalyzedColumns().size();
    final RepositoryNode firstColumnNode = analysisColumnSize > 0 ? RepositoryNodeHelper.recursiveFind(analysisHandler.getAnalyzedColumns().get(0)) : null;
    // register: refresh the dataprovider combobox when the name of the data provider is changed.
    refreshDataProiverLabel = new EventReceiver() {

        @Override
        public boolean handle(Object data) {
            if (firstColumnNode != null) {
                updateAnalyzeDataLabel(firstColumnNode);
            }
            return true;
        }
    };
    EventManager.getInstance().register(getCurrentModelElement(), EventEnum.DQ_MATCH_ANALYSIS_REFRESH_DATAPROVIDER_LABEL, refreshDataProiverLabel);
    if (analysisColumnSize > 0 && firstColumnNode != null) {
        updateAnalyzeDataLabel(firstColumnNode);
    } else if (analysisColumnSize > 0 && firstColumnNode == null) {
        // $NON-NLS-1$
        analyzeDataLabel.setText(analyzeDataDefaultInfo + "The connection is not available now!");
    } else {
        analyzeDataLabel.setText(analyzeDataDefaultInfo);
    }
    // ADD msjian TDQ-8040 2013-11-8: Add a button "show in repository view"
    ImageHyperlink showInDQViewLink = toolkit.createImageHyperlink(titleComposite, SWT.NONE);
    // $NON-NLS-1$
    showInDQViewLink.setToolTipText(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.showDQElement"));
    showInDQViewLink.setImage(ImageLib.getImage(ImageLib.APPLICATION_HOME));
    showInDQViewLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            List<IRepositoryNode> analysedElements = findAllSelectedRepositoryNode();
            if (analysedElements != null && analysedElements.size() > 0) {
                DQRespositoryView dqview = CorePlugin.getDefault().findAndOpenRepositoryView();
                // if DqRepository view is not openning we will not do anything
                if (dqview == null) {
                    return;
                }
                ModelElement column = RepositoryNodeHelper.getModelElementFromRepositoryNode(analysedElements.get(0));
                ModelElement container = (ModelElement) (column.eContainer());
                RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(container);
                if (recursiveFind == null) {
                    recursiveFind = RepositoryNodeHelper.createRepositoryNode(container);
                }
                dqview.showSelectedElements(recursiveFind);
            }
        }
    });
// TDQ-8040~
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Label(org.eclipse.swt.widgets.Label) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) EventReceiver(org.talend.dataprofiler.core.ui.events.EventReceiver) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) GridLayout(org.eclipse.swt.layout.GridLayout) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 2 with DQRespositoryView

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

the class SelectedComparisonAction method run.

@Override
public void run() {
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException {
            final IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(selectedObj1, selectedObj2);
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    try {
                        creatComparisonLevel.popComparisonUI(new UiHandler());
                    } catch (ReloadCompareException e) {
                        log.error(e, e);
                    }
                }
            });
        }
    };
    try {
        ProgressUI.popProgressDialog(op);
        if (selectedObj1 instanceof Connection && selectedObj2 instanceof Connection) {
            DQRespositoryView repositoryView = CorePlugin.getDefault().getRepositoryView();
            if (repositoryView != null) {
                repositoryView.refresh();
            }
        }
    } catch (InvocationTargetException e) {
        // $NON-NLS-1$
        MessageUI.openError(Messages.getString("PopComparisonUIAction.checkConnectionFailure", e.getCause().getMessage()));
        log.error(e, e);
    } catch (InterruptedException e) {
        log.error(e, e);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) Connection(org.talend.core.model.metadata.builder.connection.Connection) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Example 3 with DQRespositoryView

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

the class AnalysisColumnCompareTreeViewer method showDetailView.

public void showDetailView(TableViewer tableView) {
    TableItem[] selection = tableView.getTable().getSelection();
    if (selection.length > 0) {
        RespositoryDetailView detailView = CorePlugin.getDefault().getRespositoryDetailView();
        if (detailView == null) {
            return;
        }
        DQRespositoryView dqview = CorePlugin.getDefault().getRepositoryView();
        detailView.selectionChanged(dqview, new StructuredSelection(selection[0].getData()));
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) RespositoryDetailView(org.talend.dataprofiler.core.ui.views.RespositoryDetailView)

Example 4 with DQRespositoryView

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

the class AnalysisColumnNominalIntervalTreeViewer method createTreeMenu.

/**
 * DOC xzhao Comment method "createTreeMenu".
 *
 * @param newTree
 * @param containEdit
 */
private void createTreeMenu(final Tree newTree, boolean containEdit) {
    Menu oldMenu = newTree.getMenu();
    if (oldMenu != null && !oldMenu.isDisposed()) {
        oldMenu.dispose();
    }
    menu = new Menu(newTree);
    MenuItem deleteMenuItem = new MenuItem(menu, SWT.CASCADE);
    // $NON-NLS-1$
    deleteMenuItem.setText(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.removeElement"));
    deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
    deleteMenuItem.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse .swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            removeSelectedElements(newTree);
        // MOD mzhao 2005-05-05 bug 6587.
        // MOD mzhao 2009-06-8, bug 5887.
        // updateBindConnection(masterPage, tree);
        }
    });
    // ADD 2009-01-07 mzhao for feature:0005664
    MenuItem showMenuItem = new MenuItem(menu, SWT.CASCADE);
    // $NON-NLS-1$
    showMenuItem.setText(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.showDQElement"));
    showMenuItem.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
    showMenuItem.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse .swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            TreeItem[] selection = newTree.getSelection();
            if (selection.length > 0) {
                // if DqRepository view is not openning we will not do anything
                DQRespositoryView dqview = CorePlugin.getDefault().findAndOpenRepositoryView();
                if (dqview == null) {
                    return;
                }
                // TdColumn tdColumn = (TdColumn) selection[0].getData(COLUMN_INDICATOR_KEY);
                dqview.showSelectedElements(selection[0].getData(COLUMN_INDICATOR_KEY));
            }
        }
    });
    if (containEdit) {
        editPatternMenuItem = new MenuItem(menu, SWT.CASCADE);
        // $NON-NLS-1$
        editPatternMenuItem.setText(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.editPattern"));
        editPatternMenuItem.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
        editPatternMenuItem.addSelectionListener(new SelectionAdapter() {

            /*
                 * (non-Javadoc)
                 * 
                 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org .eclipse.swt.events.SelectionEvent)
                 */
            @Override
            public void widgetSelected(SelectionEvent e) {
                TreeItem[] selection = tree.getSelection();
                if (selection.length > 0) {
                    TreeItem treeItem = selection[0];
                    IndicatorUnit indicatorUnit = (IndicatorUnit) treeItem.getData(INDICATOR_UNIT_KEY);
                    PatternMatchingIndicator indicator = (PatternMatchingIndicator) indicatorUnit.getIndicator();
                    Pattern pattern = indicator.getParameters().getDataValidDomain().getPatterns().get(0);
                    // MOD mzhao 2009-03-13 Feature 6066 Move all folders
                    // into one project.
                    IFile file = ResourceFileMap.findCorrespondingFile(pattern);
                    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                    try {
                        activePage.openEditor(new FileEditorInput(file), // $NON-NLS-1$
                        "org.talend.dataprofiler.core.ui.editor.pattern.PatternEditor");
                    } catch (PartInitException e1) {
                        log.error(e1, e1);
                    }
                }
            }
        });
    }
    newTree.setMenu(menu);
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) IFile(org.eclipse.core.resources.IFile) TreeItem(org.eclipse.swt.widgets.TreeItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) MenuItem(org.eclipse.swt.widgets.MenuItem) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) FileEditorInput(org.eclipse.ui.part.FileEditorInput) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Menu(org.eclipse.swt.widgets.Menu) PartInitException(org.eclipse.ui.PartInitException) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView)

Example 5 with DQRespositoryView

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

the class AnalysisColumnNominalIntervalTreeViewer method showDetailView.

private void showDetailView(Tree newTree) {
    TreeItem[] selection = newTree.getSelection();
    if (selection.length > 0) {
        RespositoryDetailView detailView = CorePlugin.getDefault().getRespositoryDetailView();
        if (detailView == null) {
            return;
        }
        DQRespositoryView dqview = CorePlugin.getDefault().getRepositoryView();
        detailView.selectionChanged(dqview, new StructuredSelection(selection[0].getData(COLUMN_INDICATOR_KEY)));
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) RespositoryDetailView(org.talend.dataprofiler.core.ui.views.RespositoryDetailView)

Aggregations

DQRespositoryView (org.talend.dataprofiler.core.ui.views.DQRespositoryView)19 IRepositoryNode (org.talend.repository.model.IRepositoryNode)9 TreeItem (org.eclipse.swt.widgets.TreeItem)6 ISelection (org.eclipse.jface.viewers.ISelection)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 RepositoryNode (org.talend.repository.model.RepositoryNode)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)3 RespositoryDetailView (org.talend.dataprofiler.core.ui.views.RespositoryDetailView)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IFolder (org.eclipse.core.resources.IFolder)2 CoreException (org.eclipse.core.runtime.CoreException)2 TableItem (org.eclipse.swt.widgets.TableItem)2 PartInitException (org.eclipse.ui.PartInitException)2 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 IFile (org.eclipse.core.resources.IFile)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1