Search in sources :

Example 6 with ToolTip

use of org.eclipse.swt.widgets.ToolTip in project cubrid-manager by CUBRID.

the class TableEditorPart method createPartControl.

public void createPartControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    {
        final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd.heightHint = 500;
        gd.widthHint = 800;
        composite.setLayoutData(gd);
        GridLayout gl = new GridLayout();
        gl.numColumns = 1;
        composite.setLayout(gl);
    }
    tabFolder = new TabFolder(composite, SWT.NONE);
    {
        final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd.heightHint = 469;
        gd.widthHint = 621;
        tabFolder.setLayoutData(gd);
    }
    tabFolder.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            TabItem[] tabItems = tabFolder.getSelection();
            if (tabItems == null || tabItems.length == 0 || tabItems[0] == null) {
                return;
            }
            String tabTitle = tabItems[0].getText();
            if (!StringUtil.isEqual(tabTitle, Messages.infoSQLScriptTab)) {
                return;
            }
            String tableName = tableNameText.getText();
            newSchemaInfo.setClassname(tableName);
            String owner = ownerCombo.getText();
            newSchemaInfo.setOwner(owner);
            if (reuseOIDBtn != null) {
                newSchemaInfo.setReuseOid(reuseOIDBtn.getSelection());
            }
            StringBuilder sql = new StringBuilder();
            if (oldSchemaInfo != null) {
                sql.append(schemaDDL.getSchemaDDL(oldSchemaInfo));
                for (int i = 0; i < 3; i++) {
                    sql.append(StringUtil.NEWLINE);
                }
            }
            String alterSql = schemaDDL.getSchemaDDL(oldSchemaInfo, newSchemaInfo);
            if (alterSql != null) {
                sql.append(alterSql);
            }
            sql.append(getChangeOwnerDDL());
            sqlText.setText(sql.toString());
        }
    });
    editorAdaptor = new TableEditorAdaptor(this);
    createGeneralTabItem(tabFolder);
    createFkIndexTabItem(tabFolder);
    createPartitionTabItem(tabFolder);
    createSqlScriptTabItem(tabFolder);
    toolTip = new ToolTip(columnsTable.getShell(), SWT.NONE);
    toolTip.setAutoHide(true);
    errorBaloon = new ToolTip(tabFolder.getShell(), SWT.NONE);
    errorBaloon.setAutoHide(true);
    init();
    if (isNewTableFlag) {
        tableNameText.setFocus();
    }
    Composite btnComposite = new Composite(composite, SWT.NONE);
    {
        GridLayout gl = new GridLayout();
        gl.numColumns = 2;
        btnComposite.setLayout(gl);
        btnComposite.setLayoutData(new GridData(SWT.END, SWT.FILL, true, false));
    }
    okBtn = new Button(btnComposite, SWT.NONE);
    {
        GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
        gd.minimumWidth = 80;
        gd.widthHint = 80;
        okBtn.setLayoutData(gd);
    }
    okBtn.setText(Messages.btnOK);
    okBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            okPressed();
        }
    });
    Button cancelBtn = new Button(btnComposite, SWT.NONE);
    {
        GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
        gd.minimumWidth = 80;
        gd.widthHint = 80;
        cancelBtn.setLayoutData(gd);
    }
    cancelBtn.setText(Messages.btnCancel);
    cancelBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            if (!CommonUITool.openConfirmBox(Messages.msgCancelEditTableConfirm)) {
                return;
            }
            IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
            if (page != null) {
                page.closeEditor(editor, false);
            }
        }
    });
    addNewColumn();
    if (showDefaultType == EditTableAction.MODE_INDEX_EDIT) {
        tabFolder.setSelection(1);
    }
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) TableEditorAdaptor(com.cubrid.common.ui.cubrid.table.TableEditorAdaptor)

Aggregations

ToolTip (org.eclipse.swt.widgets.ToolTip)6 GridLayout (org.eclipse.swt.layout.GridLayout)3 Point (org.eclipse.swt.graphics.Point)2 GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 TabFolder (org.eclipse.swt.widgets.TabFolder)2 TableEditorAdaptor (com.cubrid.common.ui.cubrid.table.TableEditorAdaptor)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuListener2 (org.eclipse.jface.action.IMenuListener2)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1 ToolBarManager (org.eclipse.jface.action.ToolBarManager)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 ViewForm (org.eclipse.swt.custom.ViewForm)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Button (org.eclipse.swt.widgets.Button)1