Search in sources :

Example 26 with CTabItem

use of org.eclipse.swt.custom.CTabItem in project cubrid-manager by CUBRID.

the class UnifyHostConfigEditor method createBrokerConfTabItem.

/**
	 * create broker conf table
	 */
public void createBrokerConfTabItem() {
    Composite comp = new Composite(confTabFolder, SWT.NONE);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    comp.setLayout(new GridLayout(1, false));
    brokerConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
    brokerConfTableCTabItem.setText(BROKERCONFCONFIGFILENAME);
    brokerConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    brokerConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    brokerConfTabTableViewer.getTable().setHeaderVisible(true);
    brokerConfTabTableViewer.getTable().setLinesVisible(true);
    brokerConfTabTableViewer.setUseHashlookup(true);
    //create column
    TableViewerColumn column = new TableViewerColumn(brokerConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(0);
    column.getColumn().setText("");
    brokerConfTabTableViewer.setContentProvider(new UnifyHostCubridBrokerTableContentProvider());
    brokerConfTabTableViewer.setLabelProvider(new UnifyHostCubridBrokerTableLabelProvider());
    brokerConfTabTableViewer.setSorter(new BrokerConfTableViewerSorter());
    //use to mark click point, the right click menu use this point
    brokerConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {

        public void handleEvent(Event event) {
            cubridBrokerTableClickPoint = new Point(event.x, event.y);
            cubridBrokerTableClickPointTiming = System.currentTimeMillis();
        }
    });
    registerCubridBrokerTableContextMenu();
    brokerConfTableCTabItem.setControl(comp);
    if (confTabFolder.getSelection() == null) {
        confTabFolder.setSelection(brokerConfTableCTabItem);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FocusEvent(org.eclipse.swt.events.FocusEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 27 with CTabItem

use of org.eclipse.swt.custom.CTabItem in project cubrid-manager by CUBRID.

the class UnifyHostConfigEditor method createCubridCMConfTabItem.

/**
	 * create cubrid CM table
	 */
public void createCubridCMConfTabItem() {
    Composite comp = new Composite(confTabFolder, SWT.NONE);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    comp.setLayout(new GridLayout(1, false));
    cubridCMConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
    cubridCMConfTableCTabItem.setText("cm.conf");
    cubridCMConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    cubridCMConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    cubridCMConfTabTableViewer.getTable().setHeaderVisible(true);
    cubridCMConfTabTableViewer.getTable().setLinesVisible(true);
    cubridCMConfTabTableViewer.setUseHashlookup(true);
    //create column
    TableViewerColumn column = new TableViewerColumn(cubridCMConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(0);
    column.getColumn().setText("");
    cubridCMConfTabTableViewer.setContentProvider(new UnifyHostCubridCMConfTableContentProvider());
    cubridCMConfTabTableViewer.setLabelProvider(new UnifyHostCubridCMConfTableLabelProvider());
    //use to mark click point, the right click menu use this point
    cubridCMConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {

        public void handleEvent(Event event) {
            cubridCMConfTableClickPoint = new Point(event.x, event.y);
            cubridCMConfTableClickPointTiming = System.currentTimeMillis();
        }
    });
    registerCubridCMConfTableContextMenu();
    cubridCMConfTableCTabItem.setControl(comp);
    if (confTabFolder.getSelection() == null) {
        confTabFolder.setSelection(cubridCMConfTableCTabItem);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FocusEvent(org.eclipse.swt.events.FocusEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 28 with CTabItem

use of org.eclipse.swt.custom.CTabItem in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method openTableDetail.

private void openTableDetail(TableDetailInfo info) {
    //if had opend, set it selection
    for (CTabItem tabItem : tabFolder.getItems()) {
        if (tabItem.getText().equals(info.getTableName())) {
            tabFolder.setSelection(tabItem);
            return;
        }
    }
    //if a new table info, create a new tab
    TableDashboardComposite tableComp = new TableDashboardComposite(tabFolder, SWT.NONE);
    tableComp.initialize();
    SchemaProvider schemaProvider = new SchemaProvider(database.getDatabaseInfo(), info.getTableName());
    SchemaInfo schemaInfo = schemaProvider.getSchema();
    if (schemaInfo == null && StringUtil.isNotEmpty(schemaProvider.getErrorMessage())) {
        String msg = Messages.bind(Messages.errGetSchemaInfo, info.getTableName());
        CommonUITool.openErrorBox(msg);
        return;
    }
    // load table descriptions
    // FIXME move this logic to core module
    Connection conn = null;
    try {
        conn = JDBCConnectionManager.getConnection(database.getDatabaseInfo(), true);
        IDatabaseSpec dbSpec = database.getDatabaseInfo();
        boolean isSchemaCommentInstalled = SchemaCommentHandler.isInstalledMetaTable(dbSpec, conn);
        if (schemaInfo != null && isSchemaCommentInstalled) {
            Map<String, SchemaComment> comments = SchemaCommentHandler.loadDescription(dbSpec, conn, schemaInfo.getClassname());
            SchemaCommentHandler.bindSchemaInfo(comments, schemaInfo);
        }
    } catch (SQLException e) {
        LOGGER.error(e.getMessage(), e);
    } finally {
        QueryUtil.freeQuery(conn);
    }
    tableComp.setInput(schemaInfo, database.getDatabaseInfo(), isSchemaCommentInstalled);
}
Also used : IDatabaseSpec(com.cubrid.common.core.common.model.IDatabaseSpec) SQLException(java.sql.SQLException) Connection(java.sql.Connection) SchemaProvider(com.cubrid.cubridmanager.core.cubrid.table.SchemaProvider) SchemaComment(com.cubrid.common.core.schemacomment.model.SchemaComment) TablesDetailInfoCTabItem(com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem) CTabItem(org.eclipse.swt.custom.CTabItem) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 29 with CTabItem

use of org.eclipse.swt.custom.CTabItem 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 30 with CTabItem

use of org.eclipse.swt.custom.CTabItem in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method fireTableDetailChanged.

/**
	 * Fire the table info changed to tabFolder
	 *
	 * @param name
	 */
private void fireTableDetailChanged(String name) {
    if (tabFolder != null && !tabFolder.isDisposed()) {
        CTabItem[] items = tabFolder.getItems();
        for (CTabItem item : items) {
            TablesDetailInfoCTabItem tabItem = (TablesDetailInfoCTabItem) item;
            SchemaInfo schema = tabItem.getTableInfoComposite().getData();
            if (schema != null && StringUtil.isEqualNotIgnoreNull(schema.getClassname(), name)) {
                item.dispose();
            }
        }
    }
}
Also used : TablesDetailInfoCTabItem(com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem) TablesDetailInfoCTabItem(com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem) CTabItem(org.eclipse.swt.custom.CTabItem) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Aggregations

CTabItem (org.eclipse.swt.custom.CTabItem)377 Composite (org.eclipse.swt.widgets.Composite)246 FormLayout (org.eclipse.swt.layout.FormLayout)189 FormAttachment (org.eclipse.swt.layout.FormAttachment)185 FormData (org.eclipse.swt.layout.FormData)185 SelectionEvent (org.eclipse.swt.events.SelectionEvent)173 Label (org.eclipse.swt.widgets.Label)168 CTabFolder (org.eclipse.swt.custom.CTabFolder)165 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)149 Button (org.eclipse.swt.widgets.Button)142 Text (org.eclipse.swt.widgets.Text)117 Event (org.eclipse.swt.widgets.Event)107 Listener (org.eclipse.swt.widgets.Listener)107 TextVar (org.pentaho.di.ui.core.widget.TextVar)107 ModifyListener (org.eclipse.swt.events.ModifyListener)106 ModifyEvent (org.eclipse.swt.events.ModifyEvent)104 Shell (org.eclipse.swt.widgets.Shell)101 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)100 TableView (org.pentaho.di.ui.core.widget.TableView)99 ShellEvent (org.eclipse.swt.events.ShellEvent)95