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;
}
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);
}
}
}
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;
}
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;
}
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);
}
}
Aggregations