use of org.talend.repository.model.RepositoryNode 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.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class SQLEditorSessionSwitcher method createControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
*/
protected Control createControl(Composite parent) {
sessionCombo = new Combo(parent, SWT.READ_ONLY);
//$NON-NLS-1$
sessionCombo.setToolTipText(Messages.getString("SQLEditor.Actions.ChooseSession.ToolTip"));
List<String> repositoryNameList = nodeManager.getALLReposotoryNodeNames();
sessionCombo.setItems(repositoryNameList.toArray(new String[repositoryNameList.size()]));
sessionCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String repoName = sessionCombo.getText();
RepositoryNode node = nodeManager.getRepositoryNodebyName(repoName);
if (!repoName.equals(DBTreeProvider.BUILT_IN)) {
MultiPageSqlBuilderEditor multiPageEditor = editor.getMultiPageEditor();
multiPageEditor.setRepositoryNode(node);
}
// editor.refresh(true);
}
});
return sessionCombo;
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class ShowQueryPropertyAction method run.
@Override
public void run() {
RepositoryNode node = (RepositoryNode) getStructuredSelection().getFirstElement();
QueryRepositoryObject object = (QueryRepositoryObject) node.getObject();
Query query = object.getQuery();
String oldQuery = query.getLabel();
// Finds the root
node = SQLBuilderRepositoryNodeManager.getRoot(node);
List<String> existingName = repositoryNodeManager.getALLQueryLabels(node);
SQLPropertyDialog saveSQLDialog = new SQLPropertyDialog(dialog.getShell(), true);
saveSQLDialog.setQuery(query);
if (Window.OK == saveSQLDialog.open()) {
query = saveSQLDialog.getQuery();
repositoryNodeManager.saveQuery(node, query, oldQuery);
dialog.refreshNode(node);
dialog.notifySQLBuilder(node.getObject());
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class GenerateSelectSQLAction method init.
//$NON-NLS-1$
@SuppressWarnings("unchecked")
public void init() {
selectedNodes.clear();
IStructuredSelection structuredSelection = (IStructuredSelection) provider.getSelection();
for (int i = 0; i < structuredSelection.toList().size(); i++) {
RepositoryNode repositoryNode = (RepositoryNode) structuredSelection.toList().get(i);
if (SQLBuilderRepositoryNodeManager.getRepositoryType(repositoryNode) == RepositoryNodeType.FOLDER) {
this.setEnabled(false);
return;
}
RepositoryNode rootNode = SQLBuilderRepositoryNodeManager.getRoot(repositoryNode);
if (!selectedNodes.isEmpty() && selectedNodes.get(0) != null && !rootNode.equals(SQLBuilderRepositoryNodeManager.getRoot((RepositoryNode) selectedNodes.get(0)))) {
setEnabled(false);
return;
}
selectedNodes.add(repositoryNode);
}
if (selectedNodes.isEmpty()) {
this.setEnabled(false);
return;
}
this.setEnabled(true);
for (IRepositoryNode node : selectedNodes) {
Object type = node.getProperties(EProperties.CONTENT_TYPE);
if (type != RepositoryNodeType.COLUMN && type != RepositoryNodeType.TABLE && type != RepositoryNodeType.DATABASE) {
setEnabled(false);
break;
}
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class GenerateSelectSQLAction method getTablePrefix.
private String getTablePrefix(IRepositoryNode node) {
RepositoryNode root = SQLBuilderRepositoryNodeManager.getRoot((RepositoryNode) node);
DatabaseConnection connection = (DatabaseConnection) ((ConnectionItem) root.getObject().getProperty().getItem()).getConnection();
if (connection.getUiSchema() != null && !connection.getUiSchema().trim().equals("")) {
//$NON-NLS-1$
return connection.getUiSchema();
} else {
//$NON-NLS-1$
return "";
}
}
Aggregations