Search in sources :

Example 21 with CTabItem

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

the class ObjectInfoComposite method initIndexTabItem.

/**
	 * Initial index tab index
	 * 
	 */
private void initIndexTabItem() {
    CubridDatabase database = schemaNode.getDatabase();
    CTabItem indexTabItem = new CTabItem(objInfoFolder, SWT.NONE);
    indexTabItem.setText(Messages.titleIndex);
    indexTabItem.setShowClose(false);
    Composite composite = new Composite(objInfoFolder, SWT.None);
    indexTabItem.setControl(composite);
    composite.setLayout(new FillLayout());
    final SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
    sashForm.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
    /*Index table composite*/
    Composite indexComposite = new Composite(sashForm, SWT.None);
    indexComposite.setLayout(new GridLayout());
    /*FK table composite*/
    Composite fkComposite = new Composite(sashForm, SWT.None);
    fkComposite.setLayout(new GridLayout());
    /*Set the sashform*/
    sashForm.setWeights(new int[] { 1, 1 });
    // create index table view
    final Label indexLabel = new Label(indexComposite, SWT.NONE);
    indexLabel.setText(Messages.lblIndexes);
    indexTableViewer = new TableViewer(indexComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table indexTable = indexTableViewer.getTable();
    indexTable.setLinesVisible(true);
    indexTable.setHeaderVisible(true);
    indexTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    TableColumn tblCol = new TableColumn(indexTable, SWT.NONE);
    tblCol.setWidth(150);
    tblCol.setText(Messages.tblColumnIndexName);
    TableColumn indexNameColumn = new TableColumn(indexTable, SWT.NONE);
    indexNameColumn.setWidth(78);
    indexNameColumn.setText(Messages.tblColumnIndexType);
    TableColumn indexTypeColumn = new TableColumn(indexTable, SWT.NONE);
    indexTypeColumn.setWidth(218);
    indexTypeColumn.setText(Messages.tblColumnOnColumns);
    TableColumn ruleColumn = new TableColumn(indexTable, SWT.NONE);
    ruleColumn.setWidth(282);
    ruleColumn.setText(Messages.tblColumnIndexRule);
    IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
    IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
    indexTableViewer.setContentProvider(indexContentProvider);
    indexTableViewer.setLabelProvider(indexLabelProvider);
    // create the fk table viewer
    final Label fkLabel = new Label(fkComposite, SWT.NONE);
    fkLabel.setText(Messages.lblFK);
    fkTableViewer = new TableViewer(fkComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table fkTable = fkTableViewer.getTable();
    fkTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    fkTable.setLinesVisible(true);
    fkTable.setHeaderVisible(true);
    TableColumn fkNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkNameColumn.setWidth(100);
    fkNameColumn.setText(Messages.tblColumnFK);
    TableColumn fkColumnName = new TableColumn(fkTable, SWT.NONE);
    fkColumnName.setWidth(119);
    fkColumnName.setText(Messages.tblColumnColumnName);
    TableColumn fTableColumn = new TableColumn(fkTable, SWT.NONE);
    fTableColumn.setWidth(93);
    fTableColumn.setText(Messages.tblColumnForeignTable);
    TableColumn fkColumnNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkColumnNameColumn.setWidth(143);
    fkColumnNameColumn.setText(Messages.tblColumnForeignColumnName);
    TableColumn updateRuletblColumn = new TableColumn(fkTable, SWT.NONE);
    updateRuletblColumn.setWidth(84);
    updateRuletblColumn.setText(Messages.tblColumnUpdateRule);
    TableColumn deleteRuleColumn = new TableColumn(fkTable, SWT.NONE);
    deleteRuleColumn.setWidth(86);
    deleteRuleColumn.setText(Messages.tblColumnDeleteRule);
    TableColumn cacheColumn = new TableColumn(fkTable, SWT.NONE);
    cacheColumn.setWidth(100);
    cacheColumn.setText(Messages.tblColumnCacheColumn);
    fkTableViewer.setContentProvider(new FKTableViewerContentProvider());
    fkTableViewer.setLabelProvider(new FKTableViewerLabelProvider(database.getDatabaseInfo()));
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) IndexTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) FKTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerLabelProvider) CTabItem(org.eclipse.swt.custom.CTabItem) TableColumn(org.eclipse.swt.widgets.TableColumn) IndexTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerLabelProvider) SashForm(org.eclipse.swt.custom.SashForm) FKTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerContentProvider) GridLayout(org.eclipse.swt.layout.GridLayout) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 22 with CTabItem

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

the class CombinedQueryEditorComposite method renameAllObjectInfoTabs.

/**
	 * Rename tab names of all object information tabs when there have any changed.
	 *
	 * @param schemaNode
	 */
public void renameAllObjectInfoTabs(DefaultSchemaNode schemaNode) {
    if (resultTabFolder == null) {
        return;
    }
    int total = resultTabFolder.getItemCount();
    try {
        for (int i = 2, index = 4; i < total; i++) {
            CTabItem item = resultTabFolder.getItem(i);
            if (item == null) {
                continue;
            }
            Control ctrl = item.getControl();
            if (ctrl == null || !(ctrl instanceof ObjectInfoComposite)) {
                continue;
            }
            ObjectInfoComposite comp = (ObjectInfoComposite) ctrl;
            if (schemaNode.getName() != null && schemaNode.getName().equals(comp.getTargetName())) {
                continue;
            }
            String tabName = null;
            if (i >= 9) {
                tabName = comp.getTargetName();
            } else {
                tabName = "[" + index + "] " + comp.getTargetName();
            }
            item.setText(tabName);
            index++;
        }
    } catch (Exception e) {
        LOGGER.error("", e);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 23 with CTabItem

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

the class CombinedQueryEditorComposite method fireDatabaseChanged.

/**
	 * Fire the database changes.
	 *
	 * @param database - The new database
	 */
public void fireDatabaseChanged(CubridDatabase database) {
    CTabItem[] tabItems = resultTabFolder.getItems();
    for (CTabItem tabItem : tabItems) {
        if (!isObjectInfoTab(tabItem)) {
            continue;
        }
        ObjectInfoComposite infoCom = (ObjectInfoComposite) tabItem.getControl();
        /*If the scheme node's database is not equal, then close it*/
        CubridDatabase nodeDatabase = infoCom.getSchemaNode().getDatabase();
        if (database == null || (database != null && !database.equals(nodeDatabase))) {
            tabItem.dispose();
        }
    }
}
Also used : CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 24 with CTabItem

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

the class QueryEditorPart method createCombinedQueryEditorCTabFolder.

/**
	 * create editor CTabFolder all sql editor tab will add to this
	 */
public void createCombinedQueryEditorCTabFolder() {
    combinedQueryEditortabFolder = new CTabFolder(topComposite, SWT.TOP);
    combinedQueryEditortabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    combinedQueryEditortabFolder.setUnselectedImageVisible(true);
    combinedQueryEditortabFolder.setUnselectedCloseVisible(false);
    combinedQueryEditortabFolder.setBorderVisible(true);
    combinedQueryEditortabFolder.setSimple(false);
    combinedQueryEditortabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
    combinedQueryEditortabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    combinedQueryEditortabFolder.setMinimizeVisible(false);
    combinedQueryEditortabFolder.setMaximizeVisible(false);
    combinedQueryEditortabFolder.setTabHeight(22);
    combinedQueryEditortabFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            CTabItem item = combinedQueryEditortabFolder.getSelection();
            if (item instanceof SubQueryEditorTabItem) {
                SubQueryEditorTabItem queryResultTabItem = (SubQueryEditorTabItem) item;
                combinedQueryComposite = queryResultTabItem.getControl();
                combinedQueryComposite.refreshEditorComposite();
                InfoWindowManager.getInstance().updateContent(QueryEditorPart.this);
            }
        }
    });
    TabContextMenuManager ctxmenu = new TabContextMenuManager(combinedQueryEditortabFolder);
    ctxmenu.createContextMenu();
    //add a default SQL Tab item
    addEditorTab();
}
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) CTabItem(org.eclipse.swt.custom.CTabItem) TabContextMenuManager(com.cubrid.common.ui.spi.util.TabContextMenuManager)

Example 25 with CTabItem

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

the class BrokerConfigEditComposite method createCubridBrokerConfPropEditor.

/**
	 * Create property editor
	 *
	 * @param cubridBrokerConfTabFolder
	 */
public void createCubridBrokerConfPropEditor(CTabFolder cubridBrokerConfTabFolder) {
    final Composite comp = new Composite(cubridBrokerConfTabFolder, SWT.NONE);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    comp.setLayout(new GridLayout(1, false));
    sourceCTabItem = new CTabItem(cubridBrokerConfTabFolder, SWT.NONE);
    sourceCTabItem.setText(Messages.cubridBrokerConfEditorCTabItemSource);
    final Composite editorComp = new Composite(comp, SWT.BORDER);
    editorComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    final GridLayout gridLayout = createGridLayout(1, 0, 0);
    gridLayout.horizontalSpacing = 0;
    editorComp.setLayout(gridLayout);
    propEditor = new PropEditor();
    try {
        propEditor.init(editorPart.getEditorSite(), editorPart.getEditorInput());
    } catch (PartInitException e) {
        LOGGER.error(e.getMessage(), e);
    }
    propEditor.createPartControl(editorComp);
    propEditor.getDocument().addDocumentListener(new DocumentAdpater());
    sourceCTabItem.setControl(comp);
}
Also used : CommonUITool.createGridLayout(com.cubrid.common.ui.spi.util.CommonUITool.createGridLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) PropEditor(com.cubrid.tool.editor.property.PropEditor) PartInitException(org.eclipse.ui.PartInitException) CTabItem(org.eclipse.swt.custom.CTabItem)

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