use of org.talend.sqlbuilder.dbstructure.DBTreeProvider in project tdi-studio-se by Talend.
the class OpenNewEditorAction method run.
@Override
public void run() {
IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
RepositoryNode firstNode = (RepositoryNode) selection.getFirstElement();
if (firstNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.FOLDER) {
firstNode = repositoryNodeManager.getRepositoryNodebyName(connParam.getRepositoryName());
}
List<String> repositoryNames = repositoryNodeManager.getALLReposotoryNodeNames();
IRepositoryViewObject object = SQLBuilderRepositoryNodeManager.getRoot(firstNode).getObject();
connParam.setRepositoryName(object.getLabel());
connParam.setRepositoryId(object.getId());
connParam.setFirstOpenSqlBuilder(false);
if (isQuery) {
DBTreeProvider provider = (DBTreeProvider) selectionProvider.getContentProvider();
selectReveal(provider.getSelectedExtReposiotryNode());
isQuery = false;
} else {
connParam.setEditorTitle(TextUtil.getNewQueryLabel());
}
dialog.openEditor(firstNode, repositoryNames, connParam, false);
}
use of org.talend.sqlbuilder.dbstructure.DBTreeProvider in project tdi-studio-se by Talend.
the class DBStructureComposite method createDBTree.
/**
* Create contents of the dialog.
*/
protected void createDBTree() {
treeViewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
//
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
treeViewer.setUseHashlookup(true);
Tree tree = treeViewer.getTree();
TreeColumn database = new TreeColumn(tree, SWT.LEFT);
//$NON-NLS-1$
database.setText(Messages.getString("DBStructureComposite.Databases"));
database.setWidth(COLUMN_DATABASE_WIDTH);
TreeColumn repository = new TreeColumn(tree, SWT.LEFT);
//$NON-NLS-1$
repository.setText(Messages.getString("DBStructureComposite.Repository"));
repository.setWidth(COLUMN_REPOSITORY_WIDTH);
TreeColumn diff = new TreeColumn(tree, SWT.LEFT);
//$NON-NLS-1$
diff.setText("Diff");
diff.setWidth(30);
tree.setHeaderVisible(true);
treeLabelProvider = new DBTreeProvider(this, builderDialog.getConnParameters());
treeViewer.setContentProvider(treeLabelProvider);
treeViewer.setLabelProvider(treeLabelProvider);
treeViewer.addFilter(filter);
treeViewer.setInput(new RepositoryNode(null, null, ENodeType.SYSTEM_FOLDER));
doExpand();
treeViewer.setSorter(new DBTreeViewerSorter());
treeViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(TreeExpansionEvent event) {
// doSetColorOrNot(event);
}
@Override
public void treeExpanded(TreeExpansionEvent event) {
// doSetColorOrNot(event);
}
});
hookDoubleClickAction();
addContextMenu();
}
use of org.talend.sqlbuilder.dbstructure.DBTreeProvider in project tdi-studio-se by Talend.
the class DBStructureComposite method updateStructureView.
/**
* Updates the structure view to reflect the change of Repository View.
*
* @see SQLBuilderDialog.repositoryChanged(RepositoryChangedEvent event)
* @param event
*/
protected void updateStructureView(RepositoryChangedEvent event) {
if (!isShowAllConnections) {
DatabaseConnectionItem originalConnection = getDisplayedConnection();
IRepositoryViewObject repositoryObject = event.getDelta().getRepositoryObject();
if (repositoryObject != null) {
DatabaseConnectionItem newConnection = (DatabaseConnectionItem) repositoryObject.getProperty().getItem();
if (!originalConnection.getProperty().getId().equals(newConnection.getProperty().getId())) {
return;
}
if (!originalConnection.getProperty().getLabel().equals(newConnection.getProperty().getLabel())) {
String newRepositoryName = newConnection.getProperty().getLabel();
this.builderDialog.getConnParameters().setRepositoryName(newRepositoryName);
this.builderDialog.getConnParameters().setRepositoryId(newConnection.getProperty().getId());
}
}
}
((DBTreeProvider) treeViewer.getContentProvider()).setInitialized(false);
treeViewer.setInput(new RepositoryNode(null, null, ENodeType.SYSTEM_FOLDER));
doExpand();
}
Aggregations