use of org.talend.sqlbuilder.RepositoryNodeExt in project tdi-studio-se by Talend.
the class DBTreeProvider method addNode.
private void addNode(RepositoryNode parent, IRepositoryViewObject repositoryObject, boolean isBuildIn, Integer index) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
DatabaseConnection connection = (DatabaseConnection) ((ConnectionItem) repositoryObject.getProperty().getItem()).getConnection();
String sid = connection.getSID();
MetadataConnectionRepositoryObject connectionRepositoryObject = new MetadataConnectionRepositoryObject(repositoryObject);
if (isBuildIn) {
connectionRepositoryObject.setRepositoryName(BUILT_IN);
} else {
connectionRepositoryObject.setRepositoryName(repositoryObject.getLabel());
}
//$NON-NLS-1$
connectionRepositoryObject.setSourceName((sid == null || sid.trim().equals("")) ? connection.getDatasourceName() : sid);
if (!isBuildIn) {
connectionRepositoryObject.setImage(IMAGES_CONNECTION_ICON);
} else {
connectionRepositoryObject.setImage(IMAGES_DATABASE_ICON);
}
connectionRepositoryObject.setBuildIn(isBuildIn);
RepositoryNode node = new RepositoryNodeExt(connectionRepositoryObject, parent, ENodeType.REPOSITORY_ELEMENT);
node.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.DATABASE);
node.setProperties(EProperties.LABEL, repositoryObject.getLabel());
boolean[] isDiffs = repositoryNodeManager.isDiff(node);
if (isDiffs[0]) {
connectionRepositoryObject.setDiffImage(IMAGES_GRAY_ICON);
}
if (isDiffs[1]) {
connectionRepositoryObject.setDiffImage(IMAGES_RED_ICON);
}
if (isDiffs[2]) {
connectionRepositoryObject.setDiffImage(IMAGES_REFRESH_ICON);
}
if (factory.getStatus(repositoryObject) == ERepositoryStatus.DELETED) {
// ignore recycle node
} else {
if (index == null) {
parent.getChildren().add(node);
} else {
parent.getChildren().add(index.intValue(), node);
}
repositoryNodeManager.addRepositoryNode(node);
DatabaseConnection metadataConnection = (DatabaseConnection) ((ConnectionItem) repositoryObject.getProperty().getItem()).getConnection();
createTables(node, repositoryObject, metadataConnection, isBuildIn);
createQueries(node, repositoryObject, metadataConnection, isBuildIn);
}
}
Aggregations