Search in sources :

Example 1 with ReloadDatabaseAction

use of org.talend.cwm.compare.ui.actions.ReloadDatabaseAction in project tdq-studio-se by Talend.

the class ReloadDatabaseProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    // MOD bug 16532 scorreia 2010-10-19 hide menu when not in TOP standalone
    // if (!PluginChecker.isOnlyTopLoaded()) {
    // return;
    // }
    // ~
    Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
    if (obj instanceof RepositoryNode) {
        RepositoryNode node = (RepositoryNode) obj;
        if (shouldShowReloadMenu(node)) {
            String menuText = RELOADDATABASE_MENUTEXT;
            if (node instanceof DBTableFolderRepNode) {
                menuText = RELOADTABLES_MENUTEXT;
            } else if (node instanceof DBViewFolderRepNode) {
                menuText = RELOADVIEWS_MENUTEXT;
            } else if (node instanceof DBColumnFolderRepNode) {
                menuText = RELOADCOLUMNS_MENUTEXT;
            }
            // menu.add(new ReloadDatabaseAction(node.getObject(), menuText));
            menu.add(new ReloadDatabaseAction(node, menuText));
        }
    }
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) ReloadDatabaseAction(org.talend.cwm.compare.ui.actions.ReloadDatabaseAction) TreeSelection(org.eclipse.jface.viewers.TreeSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode)

Example 2 with ReloadDatabaseAction

use of org.talend.cwm.compare.ui.actions.ReloadDatabaseAction in project tdq-studio-se by Talend.

the class TDQCompareService method reloadDatabase.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.ITDQCompareService#reloadDatabase(org.talend.core.model.properties.ConnectionItem)
     */
/**
 * Comment method "reloadDatabase".
 *
 * @param connectionItem
 */
public ReturnCode reloadDatabase(ConnectionItem connectionItem) {
    ReturnCode retCode = new ReturnCode(Boolean.TRUE);
    Connection conn = connectionItem.getConnection();
    if (conn instanceof DatabaseConnection) {
        // MOD TDQ-7528 20130627 yyin: no need to popup select compare dialog
        ReloadDatabaseAction reloadDatabaseAction = new ReloadDatabaseAction(conn, ReloadDatabaseProvider.RELOADDATABASE_MENUTEXT, false);
        reloadDatabaseAction.run();
        retCode = reloadDatabaseAction.getReturnCode();
    }
    return retCode;
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) ReloadDatabaseAction(org.talend.cwm.compare.ui.actions.ReloadDatabaseAction) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection)

Aggregations

ReloadDatabaseAction (org.talend.cwm.compare.ui.actions.ReloadDatabaseAction)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 DBColumnFolderRepNode (org.talend.dq.nodes.DBColumnFolderRepNode)1 DBTableFolderRepNode (org.talend.dq.nodes.DBTableFolderRepNode)1 DBViewFolderRepNode (org.talend.dq.nodes.DBViewFolderRepNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 ReturnCode (org.talend.utils.sugars.ReturnCode)1