Search in sources :

Example 6 with IRepositoryNode

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

the class DynamicComposite method getConnectionItems.

/**
     * DOC qzhang Comment method "getConnectionItems".
     * 
     * @return
     * @throws PersistenceException
     */
private List<ConnectionItem> getConnectionItems() throws PersistenceException {
    List<ConnectionItem> list = new ArrayList<ConnectionItem>();
    IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
    if (repositoryView != null) {
        TreeViewer viewer = (TreeViewer) repositoryView.getViewer();
        IContentProvider contentProvider = viewer.getContentProvider();
        if (contentProvider instanceof RepositoryContentProvider) {
            RepositoryContentProvider provider = (RepositoryContentProvider) contentProvider;
            RepositoryNode metadataConNode = provider.getRootRepositoryNode(ERepositoryObjectType.METADATA);
            for (IRepositoryNode connectionItem : metadataConNode.getChildren()) {
                if (viewer.isExpandable(connectionItem)) {
                    provider.getChildren(connectionItem);
                }
                for (IRepositoryNode node : connectionItem.getChildren()) {
                    addConnectionItem(viewer, provider, list, (RepositoryNode) node);
                }
            }
        }
    }
    return list;
}
Also used : IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryContentProvider(org.talend.repository.viewer.ui.provider.RepositoryContentProvider) ConnectionItem(org.talend.core.model.properties.ConnectionItem) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ArrayList(java.util.ArrayList) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 7 with IRepositoryNode

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

the class RepositoryChangeMetadataCommand method setTableRelevantParameterValues.

protected void setTableRelevantParameterValues() {
    Connection conn = connection;
    if (conn == null) {
        if (newPropValue != null && newPropValue instanceof String) {
            String schemaId = (String) newPropValue;
            //$NON-NLS-1$
            String[] values = schemaId.split(" - ");
            String repositoryID = values[0];
            IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(repositoryID);
            if (repositoryNode != null && repositoryNode.getObject() != null) {
                Item item = repositoryNode.getObject().getProperty().getItem();
                if (item instanceof ConnectionItem) {
                    ConnectionItem conItem = (ConnectionItem) item;
                    conn = conItem.getConnection();
                }
            }
        }
    }
    for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
        if (handler.canHandle(conn)) {
            handler.handleTableRelevantParameters(conn, node, newOutputMetadata);
        }
    }
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) SalesforceSchemaConnectionItem(org.talend.core.model.properties.SalesforceSchemaConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IDragAndDropServiceHandler(org.talend.core.model.utils.IDragAndDropServiceHandler) ConnectionItem(org.talend.core.model.properties.ConnectionItem) SalesforceSchemaConnectionItem(org.talend.core.model.properties.SalesforceSchemaConnectionItem) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) SalesforceSchemaConnection(org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection)

Example 8 with IRepositoryNode

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

the class AbstractSchemaController method findRepositoryNode.

public RepositoryNode findRepositoryNode(String label, String id, RepositoryNode root) {
    String name = (String) root.getProperties(EProperties.LABEL);
    String rootID = root.getId();
    RepositoryNode toReturn = null;
    if (label.equals(name) && !id.equals(rootID)) {
        toReturn = root;
    } else {
        for (IRepositoryNode node : root.getChildren()) {
            toReturn = findRepositoryNode(label, id, (RepositoryNode) node);
            if (toReturn != null) {
                break;
            }
        }
    }
    return toReturn;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 9 with IRepositoryNode

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

the class JSONRepositoryContentHandler method isOwnTable.

@Override
public boolean isOwnTable(IRepositoryNode node, Class type) {
    if (type != JSONFileConnection.class) {
        return false;
    }
    ERepositoryObjectType nodeType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
        RepositoryNode repNode = node.getParent();
        nodeType = (ERepositoryObjectType) repNode.getProperties(EProperties.CONTENT_TYPE);
        if (nodeType == JSONRepositoryNodeType.JSON) {
            return true;
        }
    } else if (nodeType == ERepositoryObjectType.METADATA_CON_COLUMN) {
        RepositoryNode repNode = node.getParent().getParent().getParent();
        nodeType = (ERepositoryObjectType) repNode.getProperties(EProperties.CONTENT_TYPE);
        if (nodeType == JSONRepositoryNodeType.JSON) {
            return true;
        }
    }
    return false;
}
Also used : ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 10 with IRepositoryNode

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

the class AbstractVersionManagementProjectSettingPage method expandSomeNodes.

private void expandSomeNodes(final IProjectRepositoryNode rootNode) {
    // metadata
    IRepositoryNode metadataConNode = rootNode.getRootRepositoryNode(ERepositoryObjectType.METADATA);
    if (metadataConNode != null) {
        treeViewer.expandToLevel(metadataConNode, 1);
    }
    // code
    IRepositoryNode codeNode = rootNode.getRootRepositoryNode(ERepositoryObjectType.CODE);
    if (codeNode != null) {
        treeViewer.expandToLevel(codeNode, 1);
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Aggregations

IRepositoryNode (org.talend.repository.model.IRepositoryNode)73 RepositoryNode (org.talend.repository.model.RepositoryNode)24 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)21 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)13 PersistenceException (org.talend.commons.exception.PersistenceException)13 ArrayList (java.util.ArrayList)12 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 WizardDialog (org.eclipse.jface.wizard.WizardDialog)10 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)8 IEditorPart (org.eclipse.ui.IEditorPart)8 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)8 ISelection (org.eclipse.jface.viewers.ISelection)6 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)6 ProcessItem (org.talend.core.model.properties.ProcessItem)6 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)6 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)6 IRepositoryView (org.talend.repository.ui.views.IRepositoryView)6 IPath (org.eclipse.core.runtime.IPath)5 PartInitException (org.eclipse.ui.PartInitException)5 Item (org.talend.core.model.properties.Item)5