Search in sources :

Example 1 with PartitionTableLabelProvider

use of com.cubrid.common.ui.cubrid.table.control.PartitionTableLabelProvider in project cubrid-manager by CUBRID.

the class TableEditorPart method createPartitionTabItem.

private void createPartitionTabItem(final TabFolder tabFolder) {
    loadPartitionInfoList();
    final TabItem partTabItem = new TabItem(tabFolder, SWT.NONE);
    final Composite parentComp = new Composite(tabFolder, SWT.NONE);
    {
        GridLayout gd = new GridLayout();
        parentComp.setLayout(gd);
    }
    partTabItem.setControl(parentComp);
    partTabItem.setText(Messages.tabItemPartition);
    partitionTableView = new TableViewer(parentComp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    final Table partitionTable = partitionTableView.getTable();
    {
        partitionTable.setLayout(TableViewUtil.createTableViewLayout(new int[] { 20, 15, 10, 20, 25, 10 }));
        GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd.heightHint = 350;
        partitionTable.setLayoutData(gd);
    }
    partitionTable.setHeaderVisible(true);
    partitionTable.setLinesVisible(true);
    CommonUITool.hackForYosemite(partitionTable);
    TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColTableName);
    TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColPartitionName);
    TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColType);
    TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColExpr);
    TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColExprValue);
    TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColRows);
    partitionTableView.setLabelProvider(new PartitionTableLabelProvider());
    partitionTableView.setContentProvider(new PartitionContentProvider());
    partitionTableView.setInput(partitionInfoList);
    partitionTableView.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            editPartition();
        }
    });
    tabFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            if (tabFolder.getSelection()[0].getText().equals(Messages.tabItemPartition)) {
                partitionTableView.refresh();
            }
        }
    });
    createPartitionTabButtons(parentComp);
}
Also used : PartitionContentProvider(com.cubrid.common.ui.cubrid.table.control.PartitionContentProvider) TabItem(org.eclipse.swt.widgets.TabItem) PartitionTableLabelProvider(com.cubrid.common.ui.cubrid.table.control.PartitionTableLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

PartitionContentProvider (com.cubrid.common.ui.cubrid.table.control.PartitionContentProvider)1 PartitionTableLabelProvider (com.cubrid.common.ui.cubrid.table.control.PartitionTableLabelProvider)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 TabItem (org.eclipse.swt.widgets.TabItem)1 Table (org.eclipse.swt.widgets.Table)1