Search in sources :

Example 1 with RenameColumnDialog

use of com.cubrid.common.ui.cubrid.table.dialog.RenameColumnDialog 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

RenameColumnDialog (com.cubrid.common.ui.cubrid.table.dialog.RenameColumnDialog)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)1 TableColumn (com.cubrid.cubridmanager.core.cubrid.table.model.TableColumn)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1