Search in sources :

Example 6 with DQRespositoryView

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

the class JoinConditionTableViewer method showSelectedElements.

/**
 * DOC xqliu Comment method "showSelectedElements".
 *
 * @param table
 * @param ab
 */
protected void showSelectedElements(Table table, String ab) {
    TableItem[] selection = table.getSelection();
    if (selection.length > 0) {
        JoinElement join = (JoinElement) selection[0].getData();
        ModelElement column = join.getColA();
        if (COLUMN_B.equals(ab)) {
            column = join.getColB();
        }
        DQRespositoryView dqview = CorePlugin.getDefault().findAndOpenRepositoryView();
        // if DqRepository view is not openning will don'st should show the element immediately
        if (dqview != null) {
            RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(column);
            if (recursiveFind == null) {
                recursiveFind = RepositoryNodeHelper.createRepositoryNode(column);
            }
            dqview.showSelectedElements(recursiveFind);
        }
    }
}
Also used : JoinElement(org.talend.dataquality.rules.JoinElement) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TableItem(org.eclipse.swt.widgets.TableItem) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView)

Example 7 with DQRespositoryView

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

the class ModelElementTreeMenuProvider method showSelectedElements.

/**
 * DOC Zqin Comment method "showSelectedElements".MOD 2009-01-07 mzhao.
 *
 * @param newTree
 */
private void showSelectedElements(Tree newTree) {
    TreeItem[] selection = newTree.getSelection();
    if (selection.length > 0) {
        DQRespositoryView dqview = CorePlugin.getDefault().findAndOpenRepositoryView();
        // if DqRepository view is not openning we will not do anything
        if (dqview == null) {
            return;
        }
        RepositoryNode node = getSelectedNode(selection);
        dqview.showSelectedElements(node);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView)

Example 8 with DQRespositoryView

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

the class LocalRepositoryObjectCRUD method getUISelection.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.views.resources.IRepositoryObjectCRUD#getUISelection()
     */
@Override
public ISelection getUISelection() {
    ISelection sel = null;
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow != null) {
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage != null) {
            IWorkbenchPart activePart = activePage.getActivePart();
            if (activePart != null) {
                if (activePart instanceof DQRespositoryView) {
                    sel = ((DQRespositoryView) activePart).getCommonViewer().getSelection();
                }
            }
        }
    }
    return sel;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView)

Example 9 with DQRespositoryView

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

the class WorkbenchUtils method closeAndOpenEditor.

/**
 * close and open the editors same method {@link CorePlugin}.getDefault().itemIsOpening() MOD TDQ-8360 20140410
 * yyin: will only operate the analysis who is related and has opened (by its observer --added when opening)
 *
 * @param iEditorReference
 */
private static void closeAndOpenEditor(List<IEditorReference> iEditorReference) {
    // Refresh current opened editors.
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IWorkbenchPartReference activePartReference = activePage.getActivePartReference();
    // MOD qiongli 2011-9-8 TDQ-3317.when focucs on DI perspective,don't refresh the open editors
    DQRespositoryView findView = (DQRespositoryView) activePage.findView(DQRespositoryView.ID);
    if (findView == null) {
        return;
    }
    if (iEditorReference.size() > 0) {
        try {
            for (IEditorReference editorRef : iEditorReference) {
                IEditorInput editorInput = editorRef.getEditorInput();
                if (editorInput instanceof AbstractItemEditorInput) {
                    AbstractItemEditorInput anaItemEditorInput = (AbstractItemEditorInput) editorInput;
                    // close the editor
                    activePage.closeEditor(editorRef.getEditor(false), false);
                    // reopen the analysis
                    new OpenItemEditorAction(new IRepositoryNode[] { anaItemEditorInput.getRepNode() }).run();
                }
            }
        } catch (PartInitException e) {
            log.error(e);
        }
    }
    activePage.activate(activePartReference.getPart(false));
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractItemEditorInput(org.talend.dataprofiler.core.ui.editor.AbstractItemEditorInput) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) IWorkbenchPartReference(org.eclipse.ui.IWorkbenchPartReference) OpenItemEditorAction(org.talend.dataprofiler.core.ui.action.actions.OpenItemEditorAction) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) IEditorInput(org.eclipse.ui.IEditorInput)

Example 10 with DQRespositoryView

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

the class FolderWizard method performFinish.

/**
 * @see org.eclipse.jface.wizard.Wizard#performFinish()
 */
@Override
public boolean performFinish() {
    final ReturnCode returncode = new ReturnCode(true);
    RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>(// $NON-NLS-1$
    DefaultMessagesImpl.getString("FolderWizard.newFolder")) {

        @Override
        protected void run() throws LoginException, PersistenceException {
            String folderName = mainPage.getName();
            if (defaultLabel == null) {
                IRepositoryNode currentSelectionNode = CorePlugin.getDefault().getCurrentSelectionNode();
                IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
                IFolder newFolder = folder.getFolder(folderName);
                try {
                    if (ResourceManager.getConnectionFolder().getFullPath().isPrefixOf(folder.getFullPath())) {
                        // when create folder under dbconnections
                        ProxyRepositoryFactory.getInstance().createFolder(ERepositoryObjectType.METADATA_CONNECTIONS, path.makeRelativeTo(ResourceManager.getConnectionFolder().getFullPath()), folderName);
                    } else {
                        // when create folder under other nodes
                        newFolder.create(false, true, null);
                    }
                    // do refresh
                    folder.refreshLocal(IResource.DEPTH_INFINITE, null);
                    DQRespositoryView findView = CorePlugin.getDefault().getRepositoryView();
                    if (findView != null) {
                        findView.getCommonViewer().setExpandedState(newFolder, true);
                        findView.getCommonViewer().refresh(currentSelectionNode);
                    }
                    // list .
                    if (DQRepositoryNode.isOnFilterring()) {
                        RepositoryNodeHelper.fillTreeList(null);
                        RepositoryNodeHelper.setFilteredNode(RepositoryNodeHelper.getRootNode(ERepositoryObjectType.TDQ_DATA_PROFILING, true));
                    }
                } catch (CoreException e) {
                    // $NON-NLS-1$
                    MessageDialog.openError(// $NON-NLS-1$
                    getShell(), // $NON-NLS-1$
                    DefaultMessagesImpl.getString("FolderWizard.error"), // $NON-NLS-1$
                    DefaultMessagesImpl.getString("FolderWizard.folderCreatedError"));
                    ExceptionHandler.process(e);
                    returncode.setOk(false);
                    return;
                }
            }
        }
    };
    workUnit.setAvoidUnloadResources(true);
    ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
    return returncode.isOk();
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) CoreException(org.eclipse.core.runtime.CoreException) RepositoryWorkUnit(org.talend.repository.RepositoryWorkUnit) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) IFolder(org.eclipse.core.resources.IFolder)

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