Search in sources :

Example 76 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DBTreeProvider method getBackground.

public Color getBackground(Object element, int columnIndex) {
    RepositoryNode repositoryNode = (RepositoryNode) element;
    SqlBuilderRepositoryObject repositoryObject = (SqlBuilderRepositoryObject) repositoryNode.getObject();
    if (columnIndex == 2) {
        return null;
    } else {
        return colors.get((repositoryObject).getColor());
    }
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 77 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DBTreeProvider method createMetacolumn.

private RepositoryNode createMetacolumn(RepositoryNode tableNode, IRepositoryViewObject repObj, MetadataColumn metadataColumn, boolean isBuildIn) {
    MetadataColumnRepositoryObject modelObj = new MetadataColumnRepositoryObject(repObj, metadataColumn);
    modelObj.setRepositoryName(metadataColumn.getLabel());
    // statusCode use for source table name
    modelObj.setSourceName(metadataColumn.getOriginalField());
    // purpose use for Image text.
    if (metadataColumn.isSynchronised()) {
        modelObj.setImage(IMAGES_REFRESH_ICON);
    } else {
        modelObj.setImage(IMAGES_COLUMN_NODE_ICON);
    }
    // description use for color.
    if (modelObj.getColumn().isDivergency() && !isBuildIn) {
        modelObj.setColor(COLOR_RED);
    }
    if (modelObj.getRepositoryName() == null || modelObj.getRepositoryName().trim().equals("")) {
        //$NON-NLS-1$
        modelObj.setColor(COLOR_GRAY);
    }
    modelObj.setBuildIn(isBuildIn);
    RepositoryNode columnNode = new RepositoryNodeExt(modelObj, tableNode, ENodeType.REPOSITORY_ELEMENT);
    columnNode.setProperties(EProperties.LABEL, metadataColumn.getLabel());
    columnNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.COLUMN);
    return columnNode;
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Example 78 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DBTreeProvider method createMetatable.

/**
     * tguiu Comment method "createMetatable".
     * 
     * @param node
     * @param iMetadataFileDelimited
     * @param table
     * @return
     */
private RepositoryNode createMetatable(RepositoryNode node, IRepositoryViewObject repObj, final org.talend.core.model.metadata.builder.connection.MetadataTable table, boolean isBuildIn) {
    MetadataTableRepositoryObject modelObj = new MetadataTableRepositoryObject(repObj, table);
    if (table instanceof MetadataTableImpl) {
        modelObj.setRepositoryName(((MetadataTableImpl) table).getOriginalLabel());
    } else {
        modelObj.setRepositoryName(table.getLabel());
    }
    // statusCode use for source table name
    modelObj.setSourceName(table.getSourceName());
    // purpose use for Image text.
    modelObj.setImage(IMAGES_TABLE_NODE_ICON);
    // description use for color.
    if (modelObj.getTable().isDivergency() && !isBuildIn && !modelObj.getTable().isSynchronised()) {
        modelObj.setColor(COLOR_RED);
    }
    if (modelObj.getRepositoryName() == null || modelObj.getRepositoryName().trim().equals("")) {
        //$NON-NLS-1$
        modelObj.setColor(COLOR_GRAY);
    }
    modelObj.setBuildIn(isBuildIn);
    RepositoryNode tableNode = new RepositoryNodeExt(modelObj, node, ENodeType.REPOSITORY_ELEMENT);
    tableNode.setProperties(EProperties.LABEL, table.getLabel());
    tableNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.TABLE);
    boolean[] isDiffs = repositoryNodeManager.isDiff(tableNode);
    if (isDiffs[0]) {
        modelObj.setDiffImage(IMAGES_GRAY_ICON);
    }
    if (isDiffs[1]) {
        modelObj.setDiffImage(IMAGES_RED_ICON);
    }
    if (isDiffs[2]) {
        modelObj.setDiffImage(IMAGES_REFRESH_ICON);
    }
    return tableNode;
}
Also used : MetadataTableImpl(org.talend.core.model.metadata.builder.connection.impl.MetadataTableImpl) RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Example 79 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DBTreeProvider method getElements.

public Object[] getElements(Object inputElement) {
    if (!(inputElement instanceof RepositoryNode)) {
        return new Object[0];
    }
    RepositoryNode treeRoot = (RepositoryNode) inputElement;
    if (!isInitialized) {
        initialize(treeRoot);
        isInitialized = true;
    }
    return treeRoot.getChildren().toArray();
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 80 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class SessionTreeNodeManager method getSessionTreeNode.

/**
     * Converts the DatabaseConnection to SessionTreeNode, and stores the SessionTreeNode.
     * 
     * @param repositoryNode RepositoryNode
     * @param selectedContext
     * @return SessionTreeNode
     */
public SessionTreeNode getSessionTreeNode(RepositoryNode repositoryNode, String selectedContext) throws Exception {
    // Gets the root RepositoryNode
    RepositoryNode root = getRoot(repositoryNode);
    // Gets the DatabaseConnection
    DatabaseConnection connection = (DatabaseConnection) ((ConnectionItem) root.getObject().getProperty().getItem()).getConnection();
    if (EDatabaseTypeName.ACCESS.getDisplayName().equals(connection.getDatabaseType())) {
        if (connection.getURL().lastIndexOf("=") != connection.getURL().length() - 1) {
            //$NON-NLS-1$
            connection.setDatasourceName(connection.getURL().substring(connection.getURL().lastIndexOf(File.separator) + 1, connection.getURL().length()));
            connection.setSID(connection.getURL().substring(connection.getURL().lastIndexOf(File.separator) + 1, connection.getURL().length()));
        }
    }
    SessionTreeNode sessionTreeNode = map.get(connection);
    // hyWang modified for bug 0007062
    if (sessionTreeNode != null && !sessionTreeNode.isConnectionClosed()) {
        return sessionTreeNode;
    }
    // If the node is not existent,creates one and cache it.
    sessionTreeNode = SessionTreeNodeUtils.getSessionTreeNode(connection, root, selectedContext);
    map.put(connection, sessionTreeNode);
    return sessionTreeNode;
}
Also used : SessionTreeNode(org.talend.sqlbuilder.sessiontree.model.SessionTreeNode) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) RepositoryNode(org.talend.repository.model.RepositoryNode)

Aggregations

RepositoryNode (org.talend.repository.model.RepositoryNode)250 IRepositoryNode (org.talend.repository.model.IRepositoryNode)94 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)74 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)44 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)44 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)42 Item (org.talend.core.model.properties.Item)38 ArrayList (java.util.ArrayList)33 PersistenceException (org.talend.commons.exception.PersistenceException)27 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)27 ProcessItem (org.talend.core.model.properties.ProcessItem)23 RepositoryObject (org.talend.core.model.repository.RepositoryObject)22 ISelection (org.eclipse.jface.viewers.ISelection)20 ConnectionItem (org.talend.core.model.properties.ConnectionItem)20 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)20 List (java.util.List)18 Property (org.talend.core.model.properties.Property)18 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)17 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)16 WizardDialog (org.eclipse.jface.wizard.WizardDialog)13