use of org.talend.sqlbuilder.dbstructure.RepositoryNodeType in project tdi-studio-se by Talend.
the class DeleteQueryAction method selectionChanged.
@Override
public void selectionChanged(IStructuredSelection selection) {
boolean enabled = true;
if (selection.size() != 1) {
enabled = false;
} else {
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
RepositoryNodeType type = (RepositoryNodeType) node.getProperties(EProperties.CONTENT_TYPE);
if (type != RepositoryNodeType.QUERY) {
enabled = false;
}
}
enabled = enabled && !dialog.getConnParameters().isNodeReadOnly();
setEnabled(enabled);
}
use of org.talend.sqlbuilder.dbstructure.RepositoryNodeType in project tdi-studio-se by Talend.
the class OpenQueryAction method selectionChanged.
@Override
public void selectionChanged(IStructuredSelection selection) {
boolean enabled = true;
if (selection.size() != 1) {
enabled = false;
} else {
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
RepositoryNodeType type = (RepositoryNodeType) node.getProperties(EProperties.CONTENT_TYPE);
if (type != RepositoryNodeType.QUERY) {
enabled = false;
}
}
setEnabled(enabled);
}
use of org.talend.sqlbuilder.dbstructure.RepositoryNodeType in project tdi-studio-se by Talend.
the class ShowQueryPropertyAction method selectionChanged.
@Override
public void selectionChanged(IStructuredSelection selection) {
boolean enabled = true;
if (selection.size() != 1) {
enabled = false;
} else {
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
RepositoryNodeType type = (RepositoryNodeType) node.getProperties(EProperties.CONTENT_TYPE);
if (type != RepositoryNodeType.QUERY) {
enabled = false;
}
}
enabled = enabled && !dialog.getConnParameters().isNodeReadOnly();
setEnabled(enabled);
}
use of org.talend.sqlbuilder.dbstructure.RepositoryNodeType in project tdi-studio-se by Talend.
the class TableNode method getMetadataTable.
/**
* Get repository table from table repositoryNode.
*
* @param repositoryNode -- table repositoryNode
* @return columns
* @exception
*/
//$NON-NLS-1$
@SuppressWarnings("deprecation")
public static MetadataTable getMetadataTable(RepositoryNode repositoryNode) {
RepositoryNodeType type = SQLBuilderRepositoryNodeManager.getRepositoryType(repositoryNode);
if (type != RepositoryNodeType.TABLE) {
//$NON-NLS-1$
throw new RuntimeException(Messages.getString("TableNode.exceptionMessage"));
}
MetadataTableRepositoryObject tableObject = (MetadataTableRepositoryObject) repositoryNode.getObject();
return tableObject.getTable();
}
use of org.talend.sqlbuilder.dbstructure.RepositoryNodeType in project tdi-studio-se by Talend.
the class EMFRepositoryNodeManager method getTables.
@SuppressWarnings("unchecked")
public List<MetadataTable> getTables(List<IRepositoryNode> nodes, List<MetadataColumn> selectedColumns) {
List<MetadataTable> tables = new ArrayList<MetadataTable>();
for (IRepositoryNode node : nodes) {
RepositoryNodeType type = SQLBuilderRepositoryNodeManager.getRepositoryType((RepositoryNode) node);
if (type == RepositoryNodeType.DATABASE) {
root = (RepositoryNode) node;
DatabaseConnection connection = (DatabaseConnection) SQLBuilderRepositoryNodeManager.getItem((RepositoryNode) node).getConnection();
for (MetadataTable table : ConnectionHelper.getTables(connection)) {
if (!tables.contains(table)) {
tables.add(table);
selectedColumns.addAll(table.getColumns());
}
}
// if database is selected , It does not need to check others.
break;
} else if (type == RepositoryNodeType.TABLE) {
MetadataTable table = ((MetadataTableRepositoryObject) node.getObject()).getTable();
if (!tables.contains(table)) {
tables.add(table);
selectedColumns.addAll(table.getColumns());
}
root = SQLBuilderRepositoryNodeManager.getRoot((RepositoryNode) node);
} else if (type == RepositoryNodeType.COLUMN) {
MetadataColumn column = ((MetadataColumnRepositoryObject) node.getObject()).getColumn();
if (!selectedColumns.contains(column)) {
selectedColumns.add(column);
}
MetadataTable table = column.getTable();
if (!tables.contains(table)) {
tables.add(table);
}
root = SQLBuilderRepositoryNodeManager.getRoot((RepositoryNode) node);
}
setRoot(null);
}
return tables;
}
Aggregations