Search in sources :

Example 6 with IFolderNode

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

the class ChangeConnectionAction method reloadByColumnFolderLevel.

private void reloadByColumnFolderLevel(List<SynTreeModel> treeModelLs, AnalyzedElementSynDialog anaEleSynDialog, Connection newDataProv) throws ReloadCompareException {
    ModelElement newDataProviderModel = treeModelLs.get(0).getNewDataProvElement();
    // If schema or catalog changed, we did not load anymore.
    // Reload column folder
    ColumnSet columnset = null;
    if (newDataProviderModel instanceof ColumnSet) {
        columnset = (ColumnSet) newDataProviderModel;
    } else if (newDataProviderModel instanceof TdColumn) {
        columnset = ColumnHelper.getColumnOwnerAsColumnSet(newDataProviderModel);
    } else {
        return;
    }
    // MOD mzhao bug 8567 2010-03-29
    IFolderNode reloadFolder = FolderNodeHelper.getFolderNodes(columnset)[0];
    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)

Example 7 with IFolderNode

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

the class RenameComparedElementAction method getRightResource.

private Resource getRightResource(ColumnSet selectedColumnSet) throws ReloadCompareException {
    Connection tempReloadProvider = createTempConnectionFile();
    Package matchedPackage = DQStructureComparer.findMatchedPackage((Package) originCompareElement, tempReloadProvider);
    IFolderNode columnSetFolderNode = FolderNodeHelper.getFolderNode(matchedPackage, selectedColumnSet);
    columnSetFolderNode.loadChildren();
    ColumnSet findMatchedColumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, tempReloadProvider);
    List<TdColumn> columns = null;
    try {
        columns = DqRepositoryViewService.getColumns(tempReloadProvider, findMatchedColumnSet, null, true);
    } catch (Exception e1) {
        throw new ReloadCompareException(e1);
    }
    URI uri = tempReloadProvider.eResource().getURI();
    Resource rightResource = null;
    rightResource = EMFSharedResources.getInstance().getResource(uri, true);
    if (rightResource == null) {
        // $NON-NLS-1$
        throw new ReloadCompareException("NoFactoryFoundForURI" + uri.toFileString());
    }
    rightResource.getContents().clear();
    for (TdColumn column : columns) {
        DQStructureComparer.clearSubNode(column);
        rightResource.getContents().add(column);
    }
    EMFSharedResources.getInstance().saveResource(rightResource);
    return rightResource;
}
Also used : IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) TdColumn(org.talend.cwm.relational.TdColumn) Connection(org.talend.core.model.metadata.builder.connection.Connection) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) Resource(org.eclipse.emf.ecore.resource.Resource) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) Package(orgomg.cwm.objectmodel.core.Package) URI(org.eclipse.emf.common.util.URI) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException)

Example 8 with IFolderNode

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

the class DBTablesViewLabelProvider method getText.

@Override
public String getText(Object element) {
    if (element instanceof IContainer) {
        return ((IContainer) element).getName();
    } else if (element instanceof IFolderNode) {
        return ((IFolderNode) element).getName();
    } else if (element instanceof IRepositoryViewObject) {
        IRepositoryViewObject reposViewObj = (IRepositoryViewObject) element;
        ConnectionItem item = (ConnectionItem) reposViewObj.getProperty().getItem();
        String decorateText = PluginConstant.EMPTY_STRING;
        if (item.getConnection() != null) {
            decorateText = item.getConnection().getName();
        }
        return decorateText;
    }
    return super.getText(element);
}
Also used : IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IContainer(org.eclipse.core.resources.IContainer)

Example 9 with IFolderNode

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

the class FolderNodeHelper method getFolderNode.

/**
 * MOD mzhao bug 8567, 2010-03-29 Alter the first parameter type from EObject to Package.
 *
 * @param eObject
 * @param columnSet
 * @return
 */
public static IFolderNode getFolderNode(orgomg.cwm.objectmodel.core.Package eObject, ColumnSet columnSet) {
    IFolderNode[] folderNodes = catalogFolderNodeMap.get(eObject);
    if (folderNodes == null) {
        folderNodes = createTableViewNodes(eObject);
    }
    TdTable doSwitch = SwitchHelpers.TABLE_SWITCH.doSwitch(columnSet);
    if (doSwitch != null) {
        return folderNodes[0];
    } else {
        return folderNodes[1];
    }
}
Also used : IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) TdTable(org.talend.cwm.relational.TdTable)

Example 10 with IFolderNode

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

the class DBPackagesViewLabelProvider method getText.

public String getText(Object element) {
    if (element instanceof IContainer) {
        return ((IContainer) element).getName();
    } else if (element instanceof IFolderNode) {
        return ((IFolderNode) element).getName();
    } else if (element instanceof IRepositoryViewObject) {
        IRepositoryViewObject reposViewObj = (IRepositoryViewObject) element;
        ConnectionItem item = (ConnectionItem) reposViewObj.getProperty().getItem();
        String decorateText = PluginConstant.EMPTY_STRING;
        if (item.getConnection() != null) {
            decorateText = item.getConnection().getName();
        }
        return decorateText;
    }
    return super.getText(element);
}
Also used : IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IContainer(org.eclipse.core.resources.IContainer)

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