use of net.sourceforge.sqlexplorer.connections.actions.ConnectAliasAction in project tdq-studio-se by Talend.
the class ConnectionTreeActionGroup method fillContextMenu.
/**
* Fill the node context menu with all the correct actions.
*
* @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
public void fillContextMenu(IMenuManager menu) {
ConnectionsView view = SQLExplorerPlugin.getDefault().getConnectionsView();
Object[] selection = (view == null) ? null : view.getSelected();
// If nothing is selected, then show the default ones
if (selection == null || selection.length != 1) {
// addAction(menu, new CloseAllConnectionsAction());
return;
}
if (selection[0] instanceof Alias) {
Alias alias = (Alias) selection[0];
addAction(menu, new NewEditorAction());
addAction(menu, new NewDatabaseStructureViewAction());
addAction(menu, new ConnectAliasAction());
menu.add(new Separator());
for (User user : alias.getUsers()) if (!user.isAutoCommit()) {
addAction(menu, new CommitAction());
addAction(menu, new RollbackAction());
menu.add(new Separator());
break;
}
// addAction(menu, new NewUserAction());
// addAction(menu, new ChangeAliasAction());
// addAction(menu, new CopyAliasAction());
// addAction(menu, new DeleteAction());
} else if (selection[0] instanceof User) {
User user = (User) selection[0];
addAction(menu, new NewEditorAction());
addAction(menu, new NewDatabaseStructureViewAction());
addAction(menu, new ConnectAliasAction());
menu.add(new Separator());
if (!user.isAutoCommit()) {
addAction(menu, new CommitAction());
addAction(menu, new RollbackAction());
menu.add(new Separator());
}
// addAction(menu, new NewUserAction());
// addAction(menu, new EditUserAction());
// addAction(menu, new CopyUserAction());
// addAction(menu, new DeleteAction());
} else if (selection[0] instanceof SQLConnection) {
SQLConnection connection = (SQLConnection) selection[0];
addAction(menu, new NewEditorAction());
addAction(menu, new NewDatabaseStructureViewAction());
menu.add(new Separator());
if (!connection.getUser().isAutoCommit()) {
addAction(menu, new CommitAction());
addAction(menu, new RollbackAction());
menu.add(new Separator());
}
// addAction(menu, new CloseConnectionAction());
}
}
Aggregations