Search in sources :

Example 1 with IFolderNode

use of org.talend.dq.nodes.foldernode.IFolderNode in project tdq-studio-se by Talend.

the class DBTablesViewLabelProvider method getImage.

@Override
public Image getImage(Object element) {
    if (element instanceof IProject) {
        return ImageLib.getImage(ImageLib.PROJECT_ACTIVE);
    } else if (element instanceof IFolder) {
        IFolder folder = (IFolder) element;
        if (ResourceManager.isDBConnectionFolder(folder)) {
            return ImageLib.getImage(ImageLib.CONNECTION);
        }
        return ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
    } else if (element instanceof IFolderNode) {
        return ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
    } else if (element instanceof IFile) {
        return ImageLib.getImage(ImageLib.TD_DATAPROVIDER);
    } else if (element instanceof IRepositoryViewObject) {
        IRepositoryViewObject conn = (IRepositoryViewObject) element;
        Item connItem = conn.getProperty().getItem();
        return ImageLib.getImage(ImageLib.TD_DATAPROVIDER);
    }
    return super.getImage(element);
}
Also used : Item(org.talend.core.model.properties.Item) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) IFile(org.eclipse.core.resources.IFile) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder)

Example 2 with IFolderNode

use of org.talend.dq.nodes.foldernode.IFolderNode in project tdq-studio-se by Talend.

the class ModelElementCompareEditorLauncher method open.

@Override
public void open(IPath file) {
    try {
        // final EObject snapshot = ModelUtils.load(file.toFile(), new ResourceSetImpl());
        // if (snapshot instanceof ComparisonResourceSnapshot) {
        CompareConfiguration comapreConfiguration = new CompareConfiguration();
        comapreConfiguration.setDefaultLabelProvider(new ICompareInputLabelProvider() {

            @Override
            public Image getAncestorImage(Object input) {
                return null;
            }

            @Override
            public String getAncestorLabel(Object input) {
                // $NON-NLS-1$
                return "";
            }

            @Override
            public Image getLeftImage(Object input) {
                return null;
            }

            @Override
            public String getLeftLabel(Object input) {
                // $NON-NLS-1$
                String showLabel = Messages.getString("ModelElementCompareEditorLauncher.LocalStructure", connectionName);
                if (compareEachOther) {
                    // $NON-NLS-1$
                    showLabel = Messages.getString("ModelElementCompareEditorLauncher.FirstElement");
                }
                return showLabel;
            }

            @Override
            public Image getRightImage(Object input) {
                return null;
            }

            @Override
            public String getRightLabel(Object input) {
                // $NON-NLS-1$
                String showLabel = Messages.getString("ModelElementCompareEditorLauncher.DistantStructure");
                if (compareEachOther) {
                    // $NON-NLS-1$
                    showLabel = Messages.getString("ModelElementCompareEditorLauncher.SecondElement");
                }
                return showLabel;
            }

            @Override
            public Image getImage(Object element) {
                return null;
            }

            @Override
            public String getText(Object element) {
                // $NON-NLS-1$
                return Messages.getString("ModelElementCompareEditorLauncher.TextLabel");
            }

            @Override
            public void addListener(ILabelProviderListener listener) {
            // needn't to do anything ???
            }

            @Override
            public void dispose() {
            // needn't to do anything ???
            }

            @Override
            public boolean isLabelProperty(Object element, String property) {
                return false;
            }

            @Override
            public void removeListener(ILabelProviderListener listener) {
            // needn't to do anything ???
            }
        });
        // ModelElementCompareEditorInput compEditorInput = new ModelElementCompareEditorInput(
        // (ComparisonResourceSnapshot) snapshot, comapreConfiguration, selectedObject);
        // MOD mzhao bug 8581 Add the specific title for comparison
        // editor.
        // $NON-NLS-1$
        String editorTitle = Messages.getString("ModelElementCompareEditorLauncher.Compare");
        if (selectedObject instanceof IFile) {
            editorTitle = PrvResourceFileHelper.getInstance().findProvider((IFile) selectedObject).getName();
        } else if (selectedObject instanceof IFolderNode) {
            editorTitle = ((ModelElement) ((IFolderNode) selectedObject).getParent()).getName();
        } else if (selectedObject instanceof Catalog) {
            editorTitle = ((Catalog) selectedObject).getName();
        } else if (selectedObject instanceof IRepositoryViewObject) {
            editorTitle = ((ConnectionItem) ((IRepositoryViewObject) selectedObject).getProperty().getItem()).getConnection().getName();
        } else if (selectedObject instanceof Connection) {
            editorTitle = ((Connection) selectedObject).getName();
        }
    // compEditorInput.setTitle(editorTitle);
    // CompareUI.openCompareEditor(compEditorInput);
    // compEditorInput.hookLeftPanelContextMenu(compareEachOther);
    // compEditorInput.hookToolBar(compareEachOther);
    // }
    // } catch (IOException e) {
    } catch (Exception e) {
        // Fichier non lisible
        System.out.println(e);
        assert false;
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) CompareConfiguration(org.eclipse.compare.CompareConfiguration) ICompareInputLabelProvider(org.eclipse.compare.ICompareInputLabelProvider) Connection(org.talend.core.model.metadata.builder.connection.Connection) Image(org.eclipse.swt.graphics.Image) Catalog(orgomg.cwm.resource.relational.Catalog) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 3 with IFolderNode

use of org.talend.dq.nodes.foldernode.IFolderNode in project tdq-studio-se by Talend.

the class FolderNodeHelper method createColumFolderNodes.

private static IFolderNode[] createColumFolderNodes(org.eclipse.emf.ecore.EObject eObject) {
    IFolderNode[] folderNodes;
    IFolderNode columnFolderNode = new ColumnFolderNode();
    columnFolderNode.setParent(eObject);
    folderNodes = new IFolderNode[] { columnFolderNode };
    catalogFolderNodeMap.put(eObject, folderNodes);
    return folderNodes;
}
Also used : IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) ColumnFolderNode(org.talend.dataprofiler.core.model.nodes.foldernode.ColumnFolderNode)

Example 4 with IFolderNode

use of org.talend.dq.nodes.foldernode.IFolderNode in project tdq-studio-se by Talend.

the class FolderNodeHelper method createTableViewNodes.

/**
 * @param catalog
 * @return
 */
private static IFolderNode[] createTableViewNodes(EObject eObject) {
    IFolderNode[] folderNodes;
    IFolderNode tabbleFolderNode = new TableFolderNode();
    tabbleFolderNode.setParent(eObject);
    IFolderNode viewFolderNode = new ViewFolderNode();
    viewFolderNode.setParent(eObject);
    folderNodes = new IFolderNode[] { tabbleFolderNode, viewFolderNode };
    catalogFolderNodeMap.put(eObject, folderNodes);
    return folderNodes;
}
Also used : IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) ViewFolderNode(org.talend.dataprofiler.core.model.nodes.foldernode.ViewFolderNode) TableFolderNode(org.talend.dataprofiler.core.model.nodes.foldernode.TableFolderNode)

Example 5 with IFolderNode

use of org.talend.dq.nodes.foldernode.IFolderNode in project tdq-studio-se by Talend.

the class ChangeConnectionAction method reloadByColumnSetFolderLevel.

private void reloadByColumnSetFolderLevel(List<SynTreeModel> treeModelLs, AnalyzedElementSynDialog anaEleSynDialog, Connection newDataProv) throws ReloadCompareException {
    ModelElement oldDataProviderModel = treeModelLs.get(0).getOldDataProvElement();
    // Reload columnSet folder
    ColumnSet columnset = null;
    if (oldDataProviderModel instanceof ColumnSet) {
        columnset = (ColumnSet) oldDataProviderModel;
    } else if (oldDataProviderModel instanceof TdColumn) {
        columnset = ColumnHelper.getColumnOwnerAsColumnSet(oldDataProviderModel);
    } else {
        return;
    }
    // MOD mzhao bug 8567 2010-03-29
    IFolderNode reloadFolder = FolderNodeHelper.getFolderNode((Package) treeModelLs.get(0).getNewDataProvElement(), columnset);
    if (reloadFolder != null) {
        IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(reloadFolder);
        if (creatComparisonLevel != null) {
            // FIXME newDataProv is never used in the following codes.
            newDataProv = creatComparisonLevel.reloadCurrentLevelElement();
        }
        // Recompute after reload
        // FIXME treeModelLs is never used in the following codes.
        treeModelLs = anaEleSynDialog.getSynInputModel();
    }
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) TdColumn(org.talend.cwm.relational.TdColumn) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Aggregations

IFolderNode (org.talend.dq.nodes.foldernode.IFolderNode)10 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 ConnectionItem (org.talend.core.model.properties.ConnectionItem)3 TdColumn (org.talend.cwm.relational.TdColumn)3 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)3 ColumnSet (orgomg.cwm.resource.relational.ColumnSet)3 IContainer (org.eclipse.core.resources.IContainer)2 IFile (org.eclipse.core.resources.IFile)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 IComparisonLevel (org.talend.cwm.compare.factory.IComparisonLevel)2 CompareConfiguration (org.eclipse.compare.CompareConfiguration)1 ICompareInputLabelProvider (org.eclipse.compare.ICompareInputLabelProvider)1 IFolder (org.eclipse.core.resources.IFolder)1 IProject (org.eclipse.core.resources.IProject)1 URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ILabelProviderListener (org.eclipse.jface.viewers.ILabelProviderListener)1 Image (org.eclipse.swt.graphics.Image)1 Item (org.talend.core.model.properties.Item)1 ReloadCompareException (org.talend.cwm.compare.exception.ReloadCompareException)1