Search in sources :

Example 66 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class JobAutoDashboardEditorPart method createQueryPlanInfoTable.

public void createQueryPlanInfoTable(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
    toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
    refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            refreshQueryPlan();
        }
    });
    ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
    createItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
    createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
    createItem.setEnabled(canAddOrEdit);
    createItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addQueryPlan();
        }
    });
    ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
    editItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
    editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
    editItem.setEnabled(canAddOrEdit);
    editItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            editQueryPlan();
        }
    });
    ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
    deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
    deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
    deleteItem.setEnabled(canAddOrEdit);
    deleteItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            deleteQueryPlan();
        }
    });
    ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
    openLogItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
    openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
    openLogItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            openQueryPlanLog();
        }
    });
    final Composite tableComposite = new Composite(parent, SWT.NONE);
    tableComposite.setLayout(new FillLayout());
    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    queryPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    queryPlanInfoTable.getTable().setHeaderVisible(true);
    queryPlanInfoTable.getTable().setLinesVisible(true);
    queryPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            editQueryPlan();
        }
    });
    final TableViewerColumn nameColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
    nameColumn.getColumn().setWidth(120);
    nameColumn.getColumn().setText(Messages.queryPlanInfoTableNameColumn);
    final TableViewerColumn periodTypeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
    periodTypeColumn.getColumn().setWidth(100);
    periodTypeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTypeColumn);
    final TableViewerColumn periodDetailColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
    periodDetailColumn.getColumn().setWidth(150);
    periodDetailColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodDetailColumn);
    final TableViewerColumn queryTimeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
    queryTimeColumn.getColumn().setWidth(90);
    queryTimeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTimeColumn);
    if (isSupportPeriodicAutoJob) {
        final TableViewerColumn queryIntervalColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
        queryIntervalColumn.getColumn().setWidth(100);
        queryIntervalColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodIntervalColumn);
    }
    final TableViewerColumn queryColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
    queryColumn.getColumn().setWidth(200);
    queryColumn.getColumn().setText(Messages.queryPlanInfoTableQueryColumn);
    queryPlanInfoTable.setContentProvider(new QueryPlanTableViewerContentProvider());
    queryPlanInfoTable.setLabelProvider(new QueryPlanTableViewerLabelProvider());
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    Menu contextMenu = menuManager.createContextMenu(queryPlanInfoTable.getTable());
    queryPlanInfoTable.getTable().setMenu(contextMenu);
    Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
    final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
    createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
    createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
    createMenuItem.setEnabled(canAddOrEdit);
    createMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addQueryPlan();
        }
    });
    final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
    editMenuItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
    editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
    editMenuItem.setEnabled(canAddOrEdit);
    editMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            editQueryPlan();
        }
    });
    final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
    dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
    dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
    dropMenuItem.setEnabled(canAddOrEdit);
    dropMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            deleteQueryPlan();
        }
    });
    final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
    openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
    openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
    openLogMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            openQueryPlanLog();
        }
    });
    queryPlanInfoTable.getTable().setMenu(menu);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) FillLayout(org.eclipse.swt.layout.FillLayout) GridLayout(org.eclipse.swt.layout.GridLayout) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) ToolItem(org.eclipse.swt.widgets.ToolItem) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 67 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class SettingHAConfirmPage method createControl.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FillLayout());
    setControl(container);
    setDescription(Messages.descSettingConfirmPage);
    Composite composite = new Composite(container, SWT.None);
    composite.setLayout(new GridLayout(1, false));
    text = new Text(composite, SWT.MULTI | SWT.BORDER);
    text.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    text.setEditable(false);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Text(org.eclipse.swt.widgets.Text) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 68 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method createTablesDetailInfoTable.

/**
	 * createTablesDetailInfoTable
	 *
	 * @param parent
	 */
public void createTablesDetailInfoTable(Composite parent) {
    final Composite tableComposite = new Composite(parent, SWT.NONE);
    tableComposite.setLayout(new FillLayout());
    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    tableListView = new TableViewer(tableComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    tableListView.getTable().setHeaderVisible(true);
    tableListView.getTable().setLinesVisible(true);
    final TableViewerColumn columnTableName = new TableViewerColumn(tableListView, SWT.LEFT);
    columnTableName.getColumn().setWidth(150);
    columnTableName.getColumn().setText(Messages.tablesDetailInfoPartColTableName);
    columnTableName.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_NAME));
            tableListView.getTable().setSortColumn(columnTableName.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnTableDesc = new TableViewerColumn(tableListView, SWT.LEFT);
    columnTableDesc.getColumn().setWidth(200);
    columnTableDesc.getColumn().setText(Messages.tablesDetailInfoPartColTableMemo);
    columnTableDesc.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_MEMO));
            tableListView.getTable().setSortColumn(columnTableDesc.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnRecordsCount = new TableViewerColumn(tableListView, SWT.LEFT);
    columnRecordsCount.getColumn().setWidth(60);
    columnRecordsCount.getColumn().setText(Messages.tablesDetailInfoPartColRecordsCount);
    columnRecordsCount.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_RECORD));
            tableListView.getTable().setSortColumn(columnRecordsCount.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnColumnsCount = new TableViewerColumn(tableListView, SWT.LEFT);
    columnColumnsCount.getColumn().setWidth(80);
    columnColumnsCount.getColumn().setText(Messages.tablesDetailInfoPartColColumnsCount);
    columnColumnsCount.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_COLUMN));
            tableListView.getTable().setSortColumn(columnColumnsCount.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnPK = new TableViewerColumn(tableListView, SWT.LEFT);
    columnPK.getColumn().setWidth(50);
    columnPK.getColumn().setText(Messages.tablesDetailInfoPartColPK);
    columnPK.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_PK));
            tableListView.getTable().setSortColumn(columnPK.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnTableUK = new TableViewerColumn(tableListView, SWT.LEFT);
    columnTableUK.getColumn().setWidth(50);
    columnTableUK.getColumn().setText(Messages.tablesDetailInfoPartColUK);
    columnTableUK.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_UK));
            tableListView.getTable().setSortColumn(columnTableUK.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnFK = new TableViewerColumn(tableListView, SWT.LEFT);
    columnFK.getColumn().setWidth(50);
    columnFK.getColumn().setText(Messages.tablesDetailInfoPartColFK);
    columnFK.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_FK));
            tableListView.getTable().setSortColumn(columnFK.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnIndex = new TableViewerColumn(tableListView, SWT.LEFT);
    columnIndex.getColumn().setWidth(50);
    columnIndex.getColumn().setText(Messages.tablesDetailInfoPartColIndex);
    columnIndex.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_INDEX));
            tableListView.getTable().setSortColumn(columnIndex.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    final TableViewerColumn columnRecordsSize = new TableViewerColumn(tableListView, SWT.LEFT);
    columnRecordsSize.getColumn().setWidth(100);
    columnRecordsSize.getColumn().setText(Messages.tablesDetailInfoPartColTableRecordsSize);
    columnRecordsSize.getColumn().addSelectionListener(new SelectionAdapter() {

        boolean isAsc = false;

        public void widgetSelected(SelectionEvent e) {
            tableListView.setSorter(new ColumnViewerSorter(isAsc, ColumnViewerSorter.PROPERTY_SIZE));
            tableListView.getTable().setSortColumn(columnRecordsSize.getColumn());
            tableListView.getTable().setSortDirection(isAsc ? SWT.UP : SWT.DOWN);
            isAsc = !isAsc;
        }
    });
    tableListView.setContentProvider(new TableDashboardContentProvider());
    tableListView.setLabelProvider(new TableDashboardLabelProvider());
    tableListView.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            TableDetailInfo oneTableDetail = (TableDetailInfo) selection.getFirstElement();
            openTableDetail(oneTableDetail);
        }
    });
    tableListView.getTable().addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent event) {
            if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
                copySelectedTableNamesToClipboard();
            } else if (event.keyCode == SWT.CR) {
                showEditDialog(tableListView.getTable(), tableListView.getTable().getSelectionIndex());
            }
        }
    });
    registerContextMenu();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) KeyAdapter(org.eclipse.swt.events.KeyAdapter) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) KeyEvent(org.eclipse.swt.events.KeyEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 69 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method createTabFolder.

public void createTabFolder(Composite parent) {
    tabFolder = new CTabFolder(parent, SWT.TOP);
    tabFolder.setLayout(new FillLayout());
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    tabFolder.setSimple(false);
    tabFolder.setUnselectedImageVisible(true);
    tabFolder.setUnselectedCloseVisible(true);
    tabFolder.setSelectionBackground(ResourceManager.getColor(136, 161, 227));
    tabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    Menu menu = new Menu(tabFolder.getShell(), SWT.POP_UP);
    tabFolder.setMenu(menu);
    MenuItem closeItem = new MenuItem(menu, SWT.PUSH);
    closeItem.setText(Messages.tablesDetailInfoPartCloseMenu);
    closeItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CTabItem item = tabFolder.getSelection();
            item.dispose();
        }
    });
    MenuItem closeOthersItem = new MenuItem(menu, SWT.PUSH);
    closeOthersItem.setText(Messages.tablesDetailInfoPartCloseOthersMenu);
    closeOthersItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CTabItem[] items = tabFolder.getItems();
            CTabItem selectedItem = tabFolder.getSelection();
            for (CTabItem item : items) {
                if (!item.equals(selectedItem)) {
                    item.dispose();
                }
            }
        }
    });
    MenuItem closeAllItem = new MenuItem(menu, SWT.PUSH);
    closeAllItem.setText(Messages.tablesDetailInfoPartCloseAllMenu);
    closeAllItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CTabItem[] items = tabFolder.getItems();
            for (CTabItem item : items) {
                item.dispose();
            }
        }
    });
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) FillLayout(org.eclipse.swt.layout.FillLayout) Menu(org.eclipse.swt.widgets.Menu) TablesDetailInfoCTabItem(com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 70 with FillLayout

use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method createPartControl.

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
    toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
    refreshItem.setText(Messages.tablesDetailInfoPartRefreshBtn);
    refreshItem.setToolTipText(Messages.tablesDetailInfoPartBtnRefreshTip);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            refresh();
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem countItem = new ToolItem(toolBar, SWT.PUSH);
    countItem.setText(Messages.tablesDetailInfoPartBtnEsitmateRecord);
    countItem.setToolTipText(Messages.tablesDetailInfoPartBtnEsitmateRecordTip);
    countItem.setImage(CommonUIPlugin.getImage("icons/action/count.gif"));
    countItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            List<TableDetailInfo> list = new ArrayList<TableDetailInfo>();
            TableItem[] items = tableListView.getTable().getSelection();
            for (TableItem item : items) {
                list.add((TableDetailInfo) item.getData());
            }
            // Check selected size and confirm
            if (list.size() == 0) {
                CommonUITool.openWarningBox(Messages.tablesDetailInfoPartAlertNotSelected);
                return;
            }
            if (CommonUITool.openConfirmBox(Messages.tablesDetailInfoPartBtnEsitmateRecordAlert)) {
                LoadTableRecordCountsProgress progress = new LoadTableRecordCountsProgress(database, list);
                progress.getTableCounts();
                tableListView.refresh();
            }
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem viewDataItem = new ToolItem(toolBar, SWT.PUSH);
    viewDataItem.setText(Messages.tablesDetailInfoPartBtnViewData);
    viewDataItem.setToolTipText(Messages.tablesDetailInfoPartBtnViewDataTip);
    viewDataItem.setImage(CommonUIPlugin.getImage("icons/action/table_select_all.png"));
    viewDataItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = tableListView.getTable().getSelection();
            if (items.length == 1) {
                TableDetailInfo tableDetailInfo = (TableDetailInfo) items[0].getData();
                String query = SQLGenerateUtils.getSelectSQLWithLimit(tableDetailInfo.getTableName(), 1, 100);
                QueryEditorUtil.openQueryEditorAndRunQuery(database, query, true, true);
            } else {
                CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnViewDataSelectOne);
            }
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem copyTableNamesItem = new ToolItem(toolBar, SWT.PUSH);
    copyTableNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyTableNames);
    copyTableNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyTableNamesTip);
    copyTableNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_table_name.gif"));
    copyTableNamesItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            List<String> nameList = new ArrayList<String>();
            for (TableDetailInfo tablesDetailInfoPOJO : tableList) {
                nameList.add(tablesDetailInfoPOJO.getTableName());
            }
            if (nameList.size() == 0) {
                CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
                return;
            }
            copyNamesToClipboard(nameList);
            CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem copyColumnNamesItem = new ToolItem(toolBar, SWT.PUSH);
    copyColumnNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyColumnNames);
    copyColumnNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyColumnNamesTip);
    copyColumnNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_column_name.gif"));
    copyColumnNamesItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TablesDetailInfoCTabItem tabItem = (TablesDetailInfoCTabItem) tabFolder.getSelection();
            schemaInfo = tabItem.getTableInfoComposite().getData();
            if (schemaInfo == null) {
                CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
                return;
            }
            List<String> nameList = new ArrayList<String>();
            for (DBAttribute att : schemaInfo.getAttributes()) {
                nameList.add(att.getName());
            }
            copyNamesToClipboard(nameList);
            CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    final NewTableAction newTableAction = (NewTableAction) ActionManager.getInstance().getAction(NewTableAction.ID);
    ToolItem newTableItem = new ToolItem(toolBar, SWT.PUSH);
    newTableItem.setText(newTableAction.getText());
    newTableItem.setImage(CommonUITool.getImage(newTableAction.getImageDescriptor()));
    newTableItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            newTableAction.run(database);
        }
    });
    ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComp.setLayout(new FillLayout());
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    topSash = new SashForm(scrolledComp, SWT.VERTICAL);
    topSash.setBackground(ResourceManager.getColor(136, 161, 227));
    GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.horizontalSpacing = 0;
    topSash.setLayout(gridLayout);
    topSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    topSash.SASH_WIDTH = 1;
    scrolledComp.setContent(topSash);
    createTablesDetailInfoTable(topSash);
    createTabFolder(topSash);
    topSash.setWeights(new int[] { 70, 30 });
    this.setInputs();
}
Also used : TablesDetailInfoCTabItem(com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) FillLayout(org.eclipse.swt.layout.FillLayout) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) DBAttribute(com.cubrid.common.core.common.model.DBAttribute) NewTableAction(com.cubrid.common.ui.cubrid.table.action.NewTableAction) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ArrayList(java.util.ArrayList) List(java.util.List) LoadTableRecordCountsProgress(com.cubrid.common.ui.spi.progress.LoadTableRecordCountsProgress) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)298 Composite (org.eclipse.swt.widgets.Composite)180 GridData (org.eclipse.swt.layout.GridData)130 Shell (org.eclipse.swt.widgets.Shell)104 GridLayout (org.eclipse.swt.layout.GridLayout)97 Label (org.eclipse.swt.widgets.Label)69 SelectionEvent (org.eclipse.swt.events.SelectionEvent)67 Display (org.eclipse.swt.widgets.Display)63 Button (org.eclipse.swt.widgets.Button)60 Point (org.eclipse.swt.graphics.Point)55 Table (org.eclipse.swt.widgets.Table)48 Group (org.eclipse.swt.widgets.Group)40 SelectionListener (org.eclipse.swt.events.SelectionListener)38 TableColumn (org.eclipse.swt.widgets.TableColumn)38 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)37 Text (org.eclipse.swt.widgets.Text)36 Test (org.junit.Test)36 TableItem (org.eclipse.swt.widgets.TableItem)35 SashForm (org.eclipse.swt.custom.SashForm)31 Rectangle (org.eclipse.swt.graphics.Rectangle)29