Search in sources :

Example 6 with TableColumn

use of com.cubrid.cubridmanager.core.cubrid.table.model.TableColumn in project cubrid-manager by CUBRID.

the class RenameColumnAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    Object[] obj = this.getSelectedObj();
    if (!isSupported(obj)) {
        setEnabled(false);
        return;
    }
    ISchemaNode cn = (ISchemaNode) obj[0];
    TableColumn tc = (TableColumn) cn.getAdapter(TableColumn.class);
    RenameColumnDialog dialog = new RenameColumnDialog(shell, cn.getParent().getParent().getName(), tc.getColumnName(), cn.getDatabase());
    if (dialog.open() == Dialog.OK) {
        CommonUITool.refreshNavigatorTree((TreeViewer) provider, cn.getParent().getParent());
        ICubridNode tableNode = cn.getParent().getParent();
        if (tableNode != null && tableNode instanceof ISchemaNode) {
            /* Broadcast the view changed */
            QueryEditorUtil.fireSchemaNodeChanged((ISchemaNode) tableNode);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) RenameColumnDialog(com.cubrid.common.ui.cubrid.table.dialog.RenameColumnDialog) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) TableColumn(com.cubrid.cubridmanager.core.cubrid.table.model.TableColumn)

Aggregations

TableColumn (com.cubrid.cubridmanager.core.cubrid.table.model.TableColumn)6 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 SQLException (java.sql.SQLException)3 ArrayList (java.util.ArrayList)3 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 ResultSet (java.sql.ResultSet)2 RenameColumnDialog (com.cubrid.common.ui.cubrid.table.dialog.RenameColumnDialog)1 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)1 DatabaseMetaData (java.sql.DatabaseMetaData)1 PreparedStatement (java.sql.PreparedStatement)1 Statement (java.sql.Statement)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Clipboard (org.eclipse.swt.dnd.Clipboard)1 TextTransfer (org.eclipse.swt.dnd.TextTransfer)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1