Search in sources :

Example 51 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project tdi-studio-se by Talend.

the class WizardComponentFolderPage method initialize.

@Override
protected void initialize() {
    if (this.componentPref.getName() == null) {
        useJavaLangButton.setSelection(true);
        componentPref.setLanguageType(LanguageType.JAVALANGUAGETYPE);
        componentFolderText.addModifyListener(new ModifyListener() {

            /*
                 * (non-Javadoc)
                 * 
                 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
                 */
            @Override
            public void modifyText(ModifyEvent e) {
                setPageComplete(validatePage());
                componentPref.setName(componentFolderText.getText());
            }
        });
        componentLongName.addModifyListener(new ModifyListener() {

            /*
                 * (non-Javadoc)
                 * 
                 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
                 */
            @Override
            public void modifyText(ModifyEvent e) {
                setPageComplete(validatePage());
                componentPref.setLongName(componentLongName.getText());
            }
        });
        this.setPageComplete(validatePage());
    } else {
        this.componentFolderText.setText(componentPref.getName());
        this.componentFolderText.setEnabled(false);
        switch(componentPref.getLanguageType()) {
            case JAVALANGUAGETYPE:
                this.useJavaLangButton.setSelection(true);
                break;
            case BOTHLANGUAGETYPE:
                this.useJavaLangButton.setSelection(true);
                break;
            default:
        }
        this.setPageComplete(true);
    }
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener)

Example 52 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.

the class AddFuncParamsDialog method createdbNameGroup.

/**
	 * Create Database Name Group
	 * 
	 * @param composite the parent composite
	 */
private void createdbNameGroup(Composite composite) {
    final Group dbnameGroup = new Group(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    layout.numColumns = 2;
    final GridData gdDbnameGroup = new GridData(GridData.FILL_BOTH);
    dbnameGroup.setLayoutData(gdDbnameGroup);
    dbnameGroup.setLayout(layout);
    final Label parameterNameLabel = new Label(dbnameGroup, SWT.LEFT | SWT.WRAP);
    parameterNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    parameterNameLabel.setText(Messages.lblParameterName);
    parameterNameText = new Text(dbnameGroup, SWT.BORDER);
    parameterNameText.setTextLimit(ValidateUtil.MAX_SCHEMA_NAME_LENGTH);
    parameterNameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    parameterNameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            setValidMessage();
        }
    });
    if (isCommentSupport) {
        final Label parameterDescriptionLabel = new Label(dbnameGroup, SWT.LEFT | SWT.WRAP);
        parameterDescriptionLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        parameterDescriptionLabel.setText(Messages.lblParameterDescription);
        parameterDescriptionText = new Text(dbnameGroup, SWT.BORDER);
        parameterDescriptionText.setTextLimit(ValidateUtil.MAX_DB_OBJECT_COMMENT);
        parameterDescriptionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        parameterDescriptionText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                setValidMessage();
            }
        });
    }
    final Label databaseName = new Label(dbnameGroup, SWT.LEFT | SWT.WRAP);
    databaseName.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    databaseName.setText(Messages.lblSqlType);
    paramTypeCombo = new Combo(dbnameGroup, SWT.SINGLE);
    paramTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    paramTypeCombo.setVisibleItemCount(10);
    paramTypeCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            String name = paramTypeCombo.getText();
            if (sqlTypeMap.containsKey(name.toUpperCase(Locale.getDefault()))) {
                setJavaTypeEnable(true);
            } else {
                setJavaTypeEnable(false);
            }
            String level = sqlTypeMap.get(name.toUpperCase(Locale.getDefault()));
            paramTypeCombo.setData(level);
            if (level == null) {
                return;
            }
            if (("4").equals(level)) {
                setJavaTypeEnable(false);
            } else {
                setJavaTypeEnable(true);
                List<String> list = javaTypeMap.get(level);
                javaTypeList.removeAll();
                for (String tmp : list) {
                    javaTypeList.add(tmp);
                }
                javaTypeList.select(0);
            }
            setValidMessage();
        }
    });
    javaTypeLabel2 = new Label(dbnameGroup, SWT.LEFT | SWT.WRAP);
    javaTypeLabel2.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    javaTypeLabel2.setText(Messages.lblSpecialJavaType);
    javaTypeLabel2.setEnabled(false);
    javaTypeText = new Text(dbnameGroup, SWT.BORDER);
    javaTypeText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    javaTypeText.setEnabled(false);
    javaTypeText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            setValidMessage();
        }
    });
    javaTypeLabel = new Label(dbnameGroup, SWT.LEFT | SWT.WRAP);
    javaTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    javaTypeLabel.setText(Messages.lblJavaType);
    javaTypeList = new org.eclipse.swt.widgets.List(dbnameGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    javaTypeList.setLayoutData(gd);
    javaTypeList.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent event) {
        //
        }

        public void widgetSelected(SelectionEvent event) {
            setValidMessage();
        }
    });
    final Label paramModelLabel = new Label(dbnameGroup, SWT.LEFT | SWT.WRAP);
    paramModelLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    paramModelLabel.setText(Messages.lblParamModel);
    paramModelCombo = new Combo(dbnameGroup, SWT.SINGLE | SWT.READ_ONLY);
    paramModelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}
Also used : Group(org.eclipse.swt.widgets.Group) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(java.util.List) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 53 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.

the class EditFunctionDialog method createFunctionSettingComposite.

/**
	 * Create the function setting composite
	 *
	 * @return the composite
	 */
private Composite createFunctionSettingComposite() {
    final Composite composite = new Composite(tabFolder, SWT.LEFT | SWT.WRAP);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layoutComp;
    layoutComp = new GridLayout();
    layoutComp.marginWidth = 10;
    layoutComp.marginHeight = 10;
    layoutComp.numColumns = 2;
    composite.setLayout(layoutComp);
    final Label functionNameLabel = new Label(composite, SWT.NONE);
    functionNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    functionNameLabel.setText(Messages.lblFunctionName);
    funcNameText = new Text(composite, SWT.BORDER);
    funcNameText.setTextLimit(ValidateUtil.MAX_SCHEMA_NAME_LENGTH);
    funcNameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    funcNameText.addKeyListener(new org.eclipse.swt.events.KeyAdapter() {

        public void keyPressed(KeyEvent event) {
        }

        public void keyReleased(KeyEvent event) {
            String userName = funcNameText.getText();
            if (userName == null || StringUtil.isEmpty(userName)) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
                return;
            }
            getButton(IDialogConstants.OK_ID).setEnabled(true);
        }
    });
    if (isCommentSupport) {
        final Label commentLabel = new Label(composite, SWT.NONE);
        commentLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        commentLabel.setText(Messages.lblFunctionDescription);
        funcDescriptionText = new Text(composite, SWT.BORDER);
        funcDescriptionText.setTextLimit(ValidateUtil.MAX_DB_OBJECT_COMMENT);
        funcDescriptionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    }
    final String[] userColumnNameArr = isCommentSupport ? new String[] { Messages.tblColFunctionParamName, Messages.tblColFunctionParamType, Messages.tblColFunctionJavaParamType, Messages.tblColFunctionModel, Messages.tblColFunctionMemo } : new String[] { Messages.tblColFunctionParamName, Messages.tblColFunctionParamType, Messages.tblColFunctionJavaParamType, Messages.tblColFunctionModel };
    funcParamsTableViewer = CommonUITool.createCommonTableViewer(composite, null, userColumnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 6, 4, -1, 200));
    funcParamsTable = funcParamsTableViewer.getTable();
    funcParamsTableViewer.getTable().addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent event) {
        }

        public void widgetSelected(SelectionEvent event) {
            if (funcParamsTableViewer.getTable().getSelectionCount() > 0) {
                getButton(BUTTON_EDIT_ID).setEnabled(true);
                getButton(BUTTON_UP_ID).setEnabled(true);
                getButton(BUTTON_DOWN_ID).setEnabled(true);
                getButton(BUTTON_DROP_ID).setEnabled(true);
            }
        }
    });
    funcParamsTableViewer.setInput(funcParamsListData);
    funcParamsTable.setLinesVisible(true);
    funcParamsTable.setHeaderVisible(true);
    funcParamsTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
        // setBtnEnableDisable();
        }
    });
    barComp = new Composite(composite, SWT.NONE);
    final GridData gdbarComp = new GridData(GridData.FILL_HORIZONTAL);
    gdbarComp.horizontalSpan = 2;
    barComp.setLayoutData(gdbarComp);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    barComp.setLayout(layout);
    Label returnSQLTypeLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    returnSQLTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    returnSQLTypeLabel.setText(Messages.lblReturnSQLType);
    returnTypeCombo = new Combo(composite, SWT.SINGLE);
    returnTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    returnTypeCombo.setVisibleItemCount(10);
    returnTypeCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            String name = returnTypeCombo.getText();
            String level = sqlTypeMap.get(name.toUpperCase(Locale.getDefault()));
            returnTypeCombo.setData(level);
            if (sqlTypeMap.containsKey(name.toUpperCase(Locale.getDefault()))) {
                setJavaTypeEnable(true);
            } else {
                setJavaTypeEnable(false);
            }
            if (level == null) {
                return;
            }
            if ("4".equals(level)) {
                javaTypeList.setEnabled(false);
                javaTypeList.setSelection(-1);
                javaTypeText.setEnabled(true);
                javaTypeLabel2.setEnabled(true);
                javaTypeLabel.setEnabled(false);
            } else {
                javaTypeList.setEnabled(true);
                javaTypeText.setEnabled(false);
                javaTypeLabel2.setEnabled(false);
                javaTypeLabel.setEnabled(true);
                List<String> list = javaTypeMap.get(level);
                javaTypeList.removeAll();
                if (list == null) {
                    return;
                }
                for (String tmp : list) {
                    javaTypeList.add(tmp);
                }
                javaTypeList.select(0);
            }
            setJavaTypeList();
        }
    });
    returnTypeCombo.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent event) {
            List<String> list = javaTypeMap.get("1");
            javaTypeList.removeAll();
            for (String tmp : list) {
                javaTypeList.add(tmp);
            }
        }

        public void widgetSelected(SelectionEvent event) {
            String name = returnTypeCombo.getText();
            String level = sqlTypeMap.get(name);
            returnTypeCombo.setData(level);
            if (("4").equals(level)) {
                javaTypeList.setEnabled(false);
                javaTypeList.setSelection(-1);
                javaTypeText.setEnabled(true);
                javaTypeLabel2.setEnabled(true);
                javaTypeLabel.setEnabled(false);
            } else {
                javaTypeList.setEnabled(true);
                javaTypeText.setEnabled(false);
                javaTypeLabel2.setEnabled(false);
                javaTypeLabel.setEnabled(true);
                List<String> list = javaTypeMap.get(level);
                javaTypeList.removeAll();
                if (list == null) {
                    return;
                }
                for (String tmp : list) {
                    javaTypeList.add(tmp);
                }
                javaTypeList.select(0);
            }
        }
    });
    final Label javaNameLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    javaNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    javaNameLabel.setText(Messages.lblJavaFunctionName);
    javaNameText = new Text(composite, SWT.BORDER);
    GridData gdJavaNameText = new GridData(GridData.FILL_HORIZONTAL);
    javaNameText.setLayoutData(gdJavaNameText);
    javaTypeLabel2 = new Label(composite, SWT.LEFT | SWT.WRAP);
    javaTypeLabel2.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    javaTypeLabel2.setText(Messages.lblSpecialJavaType);
    javaTypeLabel2.setEnabled(false);
    javaTypeText = new Text(composite, SWT.BORDER);
    javaTypeText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    javaTypeText.setEnabled(false);
    javaTypeLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    javaTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    javaTypeLabel.setText(Messages.lblReturnJavaType);
    javaTypeList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gdJavaTypeList = new GridData(GridData.FILL_HORIZONTAL);
    gdJavaTypeList.heightHint = 60;
    javaTypeList.setLayoutData(gdJavaTypeList);
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(java.util.List) ArrayList(java.util.ArrayList) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 54 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.

the class PstmtOneDataDialog method handleValueInPlace.

/**
	 * 
	 * Edit value in place
	 * 
	 * @param item TableItem
	 */
private void handleValueInPlace(final TableItem item) {
    final Text newEditor = new Text(parameterTable, SWT.MULTI | SWT.WRAP);
    final int editColumn = 2;
    newEditor.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            if (!validate(newEditor.getText(), item)) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            }
        }
    });
    newEditor.addFocusListener(new FocusAdapter() {

        public void focusLost(FocusEvent event) {
            if (isChanging) {
                return;
            }
            isChanging = true;
            if (validate(newEditor.getText(), item)) {
                item.setText(editColumn, newEditor.getText());
            }
            newEditor.dispose();
            isChanging = false;
            packTable();
            validate();
        }
    });
    // add listener for key pressed
    newEditor.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent event) {
            if (event.detail == SWT.TRAVERSE_RETURN) {
                if (isChanging) {
                    return;
                }
                isChanging = true;
                if (validate(newEditor.getText(), item)) {
                    item.setText(editColumn, newEditor.getText());
                }
                newEditor.dispose();
                isChanging = false;
                packTable();
                validate();
                event.doit = true;
                int selItem = 0;
                for (int i = 0; i < parameterTable.getItemCount(); i++) {
                    if (item == parameterTable.getItem(i)) {
                        selItem = i;
                        break;
                    }
                }
                selItem = selItem + 1;
                if (selItem >= parameterTable.getItemCount()) {
                    getButton(IDialogConstants.OK_ID).setFocus();
                } else {
                    handleType(parameterTable.getItem(selItem));
                }
            } else if (event.detail == SWT.TRAVERSE_ESCAPE) {
                if (isChanging) {
                    return;
                }
                isChanging = true;
                newEditor.dispose();
                event.doit = false;
                isChanging = false;
            }
        }
    });
    tableEditor.setEditor(newEditor, item, editColumn);
    newEditor.setText(item.getText(editColumn));
    newEditor.selectAll();
    newEditor.setFocus();
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) ModifyEvent(org.eclipse.swt.events.ModifyEvent) TraverseEvent(org.eclipse.swt.events.TraverseEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) TraverseListener(org.eclipse.swt.events.TraverseListener) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 55 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.

the class ExportSettingForLoadDBPage method createControl.

/**
	 * Create the page content
	 *
	 * @param parent Composite
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FormLayout());
    Composite leftComposite = new Composite(container, SWT.NONE);
    leftComposite.setLayout(new GridLayout());
    FormData leftData = new FormData();
    leftData.top = new FormAttachment(0, 5);
    leftData.bottom = new FormAttachment(100, 0);
    leftData.left = new FormAttachment(0, 5);
    leftData.right = new FormAttachment(45, 0);
    leftComposite.setLayoutData(leftData);
    Composite rightComposite = new Composite(container, SWT.NONE);
    FormData rightData = new FormData();
    rightData.top = new FormAttachment(0, 5);
    rightData.bottom = new FormAttachment(100, 0);
    rightData.left = new FormAttachment(45, 0);
    rightData.right = new FormAttachment(100, -5);
    rightComposite.setLayoutData(rightData);
    GridLayout rightCompositeLayout = new GridLayout();
    rightCompositeLayout.verticalSpacing = 10;
    rightComposite.setLayout(rightCompositeLayout);
    Label tableInfoLabel = new Label(leftComposite, SWT.None);
    tableInfoLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    tableInfoLabel.setText(Messages.exportWizardSourceTableLable);
    ctv = new CheckboxTreeViewer(leftComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    ctv.getTree().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    ctv.setContentProvider(new FilterTreeContentProvider());
    ctv.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            updateDialogStatus();
        }
    });
    final TreeViewerColumn dbObjectCol = new TreeViewerColumn(ctv, SWT.NONE);
    dbObjectCol.setLabelProvider(new ExportObjectLabelProvider());
    final TreeViewerColumn whereCnd = new TreeViewerColumn(ctv, SWT.NONE);
    whereCnd.setLabelProvider(new ExportObjectLabelProvider());
    whereCnd.setEditingSupport(new EditingSupport(ctv) {

        TextCellEditor textCellEditor;

        protected boolean canEdit(Object element) {
            if (element instanceof ICubridNode) {
                ICubridNode node = (ICubridNode) element;
                if (node.getType() == NodeType.TABLE_COLUMN_FOLDER) {
                    return true;
                }
            }
            return false;
        }

        protected CellEditor getCellEditor(Object element) {
            if (textCellEditor == null) {
                textCellEditor = new TextCellEditor(ctv.getTree());
            }
            return textCellEditor;
        }

        protected Object getValue(Object element) {
            final ICubridNode node = (ICubridNode) element;
            String condition = (String) node.getData(ExportObjectLabelProvider.CONDITION);
            if (condition == null) {
                return "";
            } else {
                return condition;
            }
        }

        protected void setValue(Object element, Object value) {
            final ICubridNode node = (ICubridNode) element;
            node.setData(ExportObjectLabelProvider.CONDITION, value);
            ctv.refresh();
        }
    });
    dbObjectCol.getColumn().setWidth(160);
    dbObjectCol.getColumn().setText(Messages.tableLabel);
    whereCnd.getColumn().setWidth(120);
    whereCnd.getColumn().setText(Messages.conditionLabel);
    final Button selectAllBtn = new Button(leftComposite, SWT.CHECK);
    {
        selectAllBtn.setText(Messages.btnSelectAll);
        GridData gridData = new GridData();
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalIndent = 0;
        gridData.horizontalSpan = 3;
        selectAllBtn.setLayoutData(gridData);
    }
    selectAllBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            boolean selection = selectAllBtn.getSelection();
            for (ICubridNode node : tablesOrViewLst) {
                ctv.setGrayed(node, false);
                ctv.setChecked(node, selection);
            }
            updateDialogStatus();
        }
    });
    Group fileOptionGroup = new Group(rightComposite, SWT.None);
    fileOptionGroup.setText(Messages.exportWizardWhereExport);
    fileOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    fileOptionGroup.setLayout(new GridLayout(3, false));
    schemaButton = new Button(fileOptionGroup, SWT.CHECK);
    schemaButton.setText("Schema");
    schemaButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    schemaButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (schemaButton.getSelection()) {
                schemaPathText.setEnabled(true);
                schemaBrowseButton.setEnabled(true);
                startValueButton.setEnabled(true);
            } else {
                schemaPathText.setEnabled(false);
                schemaBrowseButton.setEnabled(false);
                startValueButton.setEnabled(false);
            }
            updateDialogStatus();
        }
    });
    schemaPathText = new Text(fileOptionGroup, SWT.BORDER);
    schemaPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    schemaPathText.setEnabled(true);
    schemaPathText.setEditable(false);
    schemaPathText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            updateDialogStatus();
        }
    });
    schemaBrowseButton = new Button(fileOptionGroup, SWT.None);
    schemaBrowseButton.setText(Messages.btnBrowse);
    schemaBrowseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    schemaBrowseButton.setEnabled(true);
    schemaBrowseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DatabaseInfo databaseInfo = getDatabase().getDatabaseInfo();
            String databaseName = databaseInfo.getDbName();
            String fileNameForLoaddbSchema = databaseName + "_schema";
            File savedFile = TableUtil.getSavedFile(getShell(), new String[] { "*.*" }, new String[] { "All Files" }, fileNameForLoaddbSchema, null, null);
            if (savedFile != null) {
                schemaPathText.setText(savedFile.getAbsolutePath());
            }
            updateDialogStatus();
        }
    });
    indexButton = new Button(fileOptionGroup, SWT.CHECK);
    indexButton.setText("Index");
    indexButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    indexButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (indexButton.getSelection()) {
                indexPathText.setEnabled(true);
                indexBrowseButton.setEnabled(true);
            } else {
                indexPathText.setEnabled(false);
                indexBrowseButton.setEnabled(false);
            }
            updateDialogStatus();
        }
    });
    indexPathText = new Text(fileOptionGroup, SWT.BORDER);
    indexPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    indexPathText.setEnabled(true);
    indexPathText.setEditable(false);
    indexPathText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            updateDialogStatus();
        }
    });
    indexBrowseButton = new Button(fileOptionGroup, SWT.None);
    indexBrowseButton.setText(Messages.btnBrowse);
    indexBrowseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    indexBrowseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DatabaseInfo databaseInfo = getDatabase().getDatabaseInfo();
            String databaseName = databaseInfo.getDbName();
            String fileNameForLoaddbIndex = databaseName + "_indexes";
            File savedFile = TableUtil.getSavedFile(getShell(), new String[] { "*.*" }, new String[] { "All Files" }, fileNameForLoaddbIndex, null, null);
            if (savedFile != null) {
                indexPathText.setText(savedFile.getAbsolutePath());
            }
            updateDialogStatus();
        }
    });
    dataButton = new Button(fileOptionGroup, SWT.CHECK);
    dataButton.setText("Data");
    dataButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    dataButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (dataButton.getSelection()) {
                dataPathText.setEnabled(true);
                dataBrowseButton.setEnabled(true);
            } else {
                dataPathText.setEnabled(false);
                dataBrowseButton.setEnabled(false);
            }
            updateDialogStatus();
        }
    });
    dataPathText = new Text(fileOptionGroup, SWT.BORDER);
    dataPathText.setEditable(false);
    dataPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    dataPathText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            updateDialogStatus();
        }
    });
    dataBrowseButton = new Button(fileOptionGroup, SWT.None);
    dataBrowseButton.setText(Messages.btnBrowse);
    dataBrowseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    dataBrowseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DatabaseInfo databaseInfo = getDatabase().getDatabaseInfo();
            String databaseName = databaseInfo.getDbName();
            String fileNameForLoaddbData = databaseName + "_objects";
            File savedFile = TableUtil.getSavedFile(getShell(), new String[] { "*.*" }, new String[] { "All Files" }, fileNameForLoaddbData, null, null);
            if (savedFile != null) {
                dataPathText.setText(savedFile.getAbsolutePath());
            }
            updateDialogStatus();
        }
    });
    Group enCodingOptionGroup = new Group(rightComposite, SWT.None);
    enCodingOptionGroup.setText(Messages.exportWizardDataOption);
    enCodingOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    enCodingOptionGroup.setLayout(new GridLayout(4, false));
    Label dbCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
    dbCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    dbCharsetLabel.setText(Messages.lblJDBCCharset);
    dbCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
    dbCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
    dbCharsetCombo.setItems(QueryOptions.getAllCharset(null));
    dbCharsetCombo.setEnabled(false);
    Label fileCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
    fileCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    fileCharsetLabel.setText(Messages.lblFileCharset);
    fileCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
    fileCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
    fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
    fileCharsetCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            updateDialogStatus();
        }
    });
    startValueButton = new Button(enCodingOptionGroup, SWT.CHECK);
    startValueButton.setText(Messages.lblExportTargetStartValue);
    startValueButton.setLayoutData(CommonUITool.createGridData(4, 1, -1, -1));
    startValueButton.setToolTipText(Messages.tipExportTargetStartValue);
    setControl(container);
}
Also used : Group(org.eclipse.swt.widgets.Group) ModifyListener(org.eclipse.swt.events.ModifyListener) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) Label(org.eclipse.swt.widgets.Label) EditingSupport(org.eclipse.jface.viewers.EditingSupport) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) FilterTreeContentProvider(com.cubrid.common.ui.common.dialog.FilterTreeContentProvider) ExportObjectLabelProvider(com.cubrid.common.ui.common.navigator.ExportObjectLabelProvider) GridData(org.eclipse.swt.layout.GridData) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) File(java.io.File)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)1196 ModifyListener (org.eclipse.swt.events.ModifyListener)1191 Text (org.eclipse.swt.widgets.Text)814 Label (org.eclipse.swt.widgets.Label)784 SelectionEvent (org.eclipse.swt.events.SelectionEvent)701 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)627 GridData (org.eclipse.swt.layout.GridData)595 Button (org.eclipse.swt.widgets.Button)572 Composite (org.eclipse.swt.widgets.Composite)563 GridLayout (org.eclipse.swt.layout.GridLayout)481 FormAttachment (org.eclipse.swt.layout.FormAttachment)347 FormData (org.eclipse.swt.layout.FormData)347 FormLayout (org.eclipse.swt.layout.FormLayout)340 Event (org.eclipse.swt.widgets.Event)324 Listener (org.eclipse.swt.widgets.Listener)316 Shell (org.eclipse.swt.widgets.Shell)307 Display (org.eclipse.swt.widgets.Display)294 ShellEvent (org.eclipse.swt.events.ShellEvent)285 ShellAdapter (org.eclipse.swt.events.ShellAdapter)283 Group (org.eclipse.swt.widgets.Group)245