Search in sources :

Example 11 with Spinner

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

the class BrokerLogTopMergeDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.brokerLogTopMergeDialogTitle);
    setTitle(Messages.brokerLogTopMergeDialogTitle);
    setMessage(Messages.brokerLogTopMergeDialogMessages);
    Composite comp = new Composite(parent, SWT.BORDER);
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));
    comp.setLayout(new GridLayout(3, false));
    Label qLabel = new Label(comp, SWT.NONE);
    qLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    qLabel.setText(Messages.brokerLogTopMergeQLabel);
    qText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
    GridData text1Gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    text1Gd.grabExcessHorizontalSpace = true;
    qText.setLayoutData(text1Gd);
    Button qButton = new Button(comp, SWT.NONE);
    qButton.setText(Messages.brokerLogTopMergeOpenBtn);
    qButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            final FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.SINGLE);
            fileDialog.setFilterPath(qText.getText());
            fileDialog.setFilterExtensions(new String[] { "*.q" });
            fileDialog.setFilterNames(new String[] { "*.q" });
            final String fileTmp = fileDialog.open();
            if (fileTmp == null) {
                return;
            }
            qText.setText(fileTmp);
            validate();
        }
    });
    Label resLabel = new Label(comp, SWT.NONE);
    resLabel.setText(Messages.brokerLogTopMergeResLabel);
    resLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    resText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
    GridData resTextGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    resTextGd.grabExcessHorizontalSpace = true;
    resText.setLayoutData(resTextGd);
    Button resButton = new Button(comp, SWT.NONE);
    resButton.setText(Messages.brokerLogTopMergeOpenBtn);
    resButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            final FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.SINGLE);
            fileDialog.setFilterPath(resText.getText());
            fileDialog.setFilterExtensions(new String[] { "*.res" });
            fileDialog.setFilterNames(new String[] { "*.res" });
            final String fileTmp = fileDialog.open();
            if (fileTmp == null) {
                return;
            }
            resText.setText(fileTmp);
            validate();
        }
    });
    Label exlPathLabel = new Label(comp, SWT.NONE);
    exlPathLabel.setText(Messages.brokerLogTopMergeExcelPathLabel);
    exlPathLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    exlPathText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
    GridData exlTextGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    exlTextGd.grabExcessHorizontalSpace = true;
    exlPathText.setLayoutData(exlTextGd);
    Button exlButton = new Button(comp, SWT.NONE);
    exlButton.setText(Messages.brokerLogTopMergeOpenBtn);
    exlButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
            dialog.setFilterPath(exlPathText.getText());
            String dir = dialog.open();
            if (dir != null) {
                if (!dir.endsWith(File.separator)) {
                    dir += File.separator;
                }
                exlPathText.setText(dir);
                excelFullPathText.setText(dir + exlNameText.getText() + ".xls");
            }
            validate();
        }
    });
    new Label(comp, SWT.NONE).setText(Messages.brokerLogTopMergeExcelNameLabel);
    exlNameText = new Text(comp, SWT.BORDER);
    exlNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    exlNameText.setText("log_top_merge");
    exlNameText.addModifyListener(new ModifyListener() {

        public void modifyText(final ModifyEvent event) {
            excelFullPathText.setText(exlPathText.getText() + exlNameText.getText() + ".xls");
            validate();
        }
    });
    new Label(comp, SWT.NONE);
    new Label(comp, SWT.NONE).setText(Messages.brokerLogTopMergeExcelFullNameLabel);
    excelFullPathText = new Text(comp, SWT.READ_ONLY | SWT.BORDER);
    excelFullPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    excelFullPathText.setText(exlPathText.getText() + exlNameText.getText() + ".xls");
    new Label(comp, SWT.NONE);
    new Label(comp, SWT.NONE).setText(com.cubrid.common.ui.cubrid.table.Messages.lblFileCharset);
    Composite paramComp = new Composite(comp, SWT.NONE);
    GridData paramCompGd = new GridData(GridData.FILL_HORIZONTAL);
    paramCompGd.horizontalSpan = 2;
    paramComp.setLayoutData(paramCompGd);
    paramComp.setLayout(new GridLayout(3, false));
    fileCharsetCombo = new Combo(paramComp, SWT.NONE);
    {
        GridData gridData = new GridData(GridData.BEGINNING);
        fileCharsetCombo.setLayoutData(gridData);
        fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
        fileCharsetCombo.select(0);
    }
    new Label(paramComp, SWT.NONE).setText(Messages.brokerLogTopMergePartionLineLabel);
    lineCountspinner = new Spinner(paramComp, SWT.BORDER | SWT.LEFT);
    lineCountspinner.setValues(3000, 1000, 10000, 0, 1000, 1000);
    lineCountspinner.setToolTipText(Messages.brokerLogTopMergePartionLineDescription);
    return parent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) 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) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 12 with Spinner

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

the class RestoreDatabaseDialog method createDataTimeComp.

/**
	 * 
	 * Create restored date and time information composite
	 * 
	 * @param parent the parent composite
	 */
private void createDataTimeComp(Composite parent) {
    Composite dataTimeComp = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 9;
    layout.horizontalSpacing = 2;
    dataTimeComp.setLayout(layout);
    dataTimeComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    selectTimeButton = new Button(dataTimeComp, SWT.LEFT | SWT.CHECK);
    selectTimeButton.setText(Messages.btnSelectDateAndTime);
    selectTimeButton.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 9, 1, -1, -1));
    selectTimeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (selectTimeButton.getSelection()) {
                changeDateTimeBtnStatus(true);
            } else {
                changeDateTimeBtnStatus(false);
            }
        }
    });
    backupTimeButton = new Button(dataTimeComp, SWT.LEFT | SWT.RADIO);
    backupTimeButton.setText(Messages.btnBackupTime);
    backupTimeButton.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 9, 1, -1, -1));
    backupTimeButton.addSelectionListener(this);
    restoredDataTimeButton = new Button(dataTimeComp, SWT.LEFT | SWT.RADIO);
    restoredDataTimeButton.setText(Messages.btnRestoreDate);
    restoredDataTimeButton.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 9, 1, -1, -1));
    restoredDataTimeButton.addSelectionListener(this);
    Label dateLabel = new Label(dataTimeComp, SWT.LEFT);
    dateLabel.setText(Messages.lblDate);
    dateLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    yearSpn = new Spinner(dataTimeComp, SWT.BORDER);
    yearSpn.setMinimum(1);
    Calendar cal = Calendar.getInstance();
    yearSpn.setMaximum(cal.get(Calendar.YEAR));
    yearSpn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    yearSpn.addSelectionListener(this);
    yearSpn.addModifyListener(this);
    monthSpn = new Spinner(dataTimeComp, SWT.BORDER);
    monthSpn.setMinimum(1);
    monthSpn.setMaximum(12);
    monthSpn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    monthSpn.addSelectionListener(this);
    monthSpn.addModifyListener(this);
    daySpn = new Spinner(dataTimeComp, SWT.BORDER);
    daySpn.setMinimum(1);
    daySpn.setMaximum(31);
    daySpn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    daySpn.addSelectionListener(this);
    daySpn.addModifyListener(this);
    Label timeLabel = new Label(dataTimeComp, SWT.LEFT);
    timeLabel.setText(Messages.lblTime);
    timeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    hourSpn = new Spinner(dataTimeComp, SWT.BORDER);
    hourSpn.setMinimum(0);
    hourSpn.setMaximum(23);
    hourSpn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    hourSpn.addSelectionListener(this);
    hourSpn.addModifyListener(this);
    minuteSpn = new Spinner(dataTimeComp, SWT.BORDER);
    minuteSpn.setMinimum(0);
    minuteSpn.setMaximum(59);
    minuteSpn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    minuteSpn.addSelectionListener(this);
    minuteSpn.addModifyListener(this);
    secondSpn = new Spinner(dataTimeComp, SWT.BORDER);
    secondSpn.setMinimum(0);
    secondSpn.setMaximum(59);
    secondSpn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    secondSpn.addSelectionListener(this);
    secondSpn.addModifyListener(this);
    Label label = new Label(dataTimeComp, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Calendar(java.util.Calendar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label)

Example 13 with Spinner

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

the class TimeSetDialog method createDataTimeGroup.

/**
	 *
	 * Create restored date and time information group
	 *
	 * @param parent Composite
	 */
private void createDataTimeGroup(Composite parent) {
    Group dataTimeGroupFrom = new Group(parent, SWT.NONE);
    dataTimeGroupFrom.setText("FROM:");
    GridLayout layoutFrom = new GridLayout();
    layoutFrom.numColumns = 9;
    layoutFrom.horizontalSpacing = 2;
    dataTimeGroupFrom.setLayout(layoutFrom);
    dataTimeGroupFrom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label dateLabelFrom = new Label(dataTimeGroupFrom, SWT.LEFT);
    dateLabelFrom.setText("Date:");
    dateLabelFrom.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    yearSpnFrom = new Spinner(dataTimeGroupFrom, SWT.BORDER);
    yearSpnFrom.setMinimum(1);
    Calendar cal = Calendar.getInstance();
    yearSpnFrom.setMaximum(cal.get(Calendar.YEAR));
    yearSpnFrom.setLayoutData(CommonUITool.createGridData(1, 1, 60, -1));
    yearSpnFrom.addSelectionListener(this);
    yearSpnFrom.addModifyListener(this);
    monthSpnFrom = new Spinner(dataTimeGroupFrom, SWT.BORDER);
    monthSpnFrom.setMinimum(1);
    monthSpnFrom.setMaximum(12);
    monthSpnFrom.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    monthSpnFrom.addSelectionListener(this);
    monthSpnFrom.addModifyListener(this);
    daySpnFrom = new Spinner(dataTimeGroupFrom, SWT.BORDER);
    daySpnFrom.setMaximum(31);
    daySpnFrom.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    daySpnFrom.addSelectionListener(this);
    daySpnFrom.addModifyListener(this);
    Label timeLabel = new Label(dataTimeGroupFrom, SWT.LEFT);
    timeLabel.setText("Time:");
    timeLabel.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    hourSpnFrom = new Spinner(dataTimeGroupFrom, SWT.BORDER);
    hourSpnFrom.setMinimum(0);
    hourSpnFrom.setMaximum(23);
    hourSpnFrom.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    hourSpnFrom.addSelectionListener(this);
    hourSpnFrom.addModifyListener(this);
    minuteSpnFrom = new Spinner(dataTimeGroupFrom, SWT.BORDER);
    minuteSpnFrom.setMinimum(0);
    minuteSpnFrom.setMaximum(59);
    minuteSpnFrom.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    minuteSpnFrom.addSelectionListener(this);
    minuteSpnFrom.addModifyListener(this);
    secondSpnFrom = new Spinner(dataTimeGroupFrom, SWT.BORDER);
    secondSpnFrom.setMinimum(0);
    secondSpnFrom.setMaximum(59);
    secondSpnFrom.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    secondSpnFrom.addSelectionListener(this);
    secondSpnFrom.addModifyListener(this);
    Label label = new Label(dataTimeGroupFrom, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Group dataTimeGroupTo = new Group(parent, SWT.NONE);
    dataTimeGroupTo.setText("TO:");
    GridLayout layoutTo = new GridLayout();
    layoutTo.numColumns = 9;
    layoutTo.horizontalSpacing = 2;
    dataTimeGroupTo.setLayout(layoutTo);
    dataTimeGroupTo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label dateLabelTo = new Label(dataTimeGroupTo, SWT.LEFT);
    dateLabelTo.setText("Date:");
    dateLabelTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    yearSpnTo = new Spinner(dataTimeGroupTo, SWT.BORDER);
    yearSpnTo.setMinimum(1);
    yearSpnTo.setMaximum(cal.get(Calendar.YEAR));
    yearSpnTo.setLayoutData(CommonUITool.createGridData(1, 1, 60, -1));
    yearSpnTo.addSelectionListener(this);
    yearSpnTo.addModifyListener(this);
    monthSpnTo = new Spinner(dataTimeGroupTo, SWT.BORDER);
    monthSpnTo.setMinimum(1);
    monthSpnTo.setMaximum(12);
    monthSpnTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    monthSpnTo.addSelectionListener(this);
    monthSpnTo.addModifyListener(this);
    daySpnTo = new Spinner(dataTimeGroupTo, SWT.BORDER);
    daySpnTo.setMaximum(31);
    daySpnTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    daySpnTo.addSelectionListener(this);
    daySpnTo.addModifyListener(this);
    Label timeLabelTo = new Label(dataTimeGroupTo, SWT.LEFT);
    timeLabelTo.setText("Time:");
    timeLabelTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    hourSpnTo = new Spinner(dataTimeGroupTo, SWT.BORDER);
    hourSpnTo.setMinimum(0);
    hourSpnTo.setMaximum(23);
    hourSpnTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    hourSpnTo.addSelectionListener(this);
    hourSpnTo.addModifyListener(this);
    minuteSpnTo = new Spinner(dataTimeGroupTo, SWT.BORDER);
    minuteSpnTo.setMinimum(0);
    minuteSpnTo.setMaximum(59);
    minuteSpnTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    minuteSpnTo.addSelectionListener(this);
    minuteSpnTo.addModifyListener(this);
    secondSpnTo = new Spinner(dataTimeGroupTo, SWT.BORDER);
    secondSpnTo.setMinimum(0);
    secondSpnTo.setMaximum(59);
    secondSpnTo.setLayoutData(CommonUITool.createGridData(1, 1, 40, -1));
    secondSpnTo.addSelectionListener(this);
    secondSpnTo.addModifyListener(this);
    Label labelTo = new Label(dataTimeGroupTo, SWT.NONE);
    labelTo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Spinner(org.eclipse.swt.widgets.Spinner) Calendar(java.util.Calendar) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 14 with Spinner

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

the class CasRunnerConfigDialog method createGroup.

/**
	 * This method initializes group
	 *
	 */
private void createGroup() {
    GridData gridData17 = new GridData(GridData.FILL_HORIZONTAL);
    gridData17.horizontalSpan = 2;
    GridData gridData6 = new GridData(GridData.FILL_HORIZONTAL);
    gridData6.horizontalSpan = 2;
    GridData gridData13 = new GridData(GridData.FILL_HORIZONTAL);
    gridData13.horizontalSpan = 3;
    GridData gridData12 = new GridData(GridData.FILL_HORIZONTAL);
    gridData12.horizontalAlignment = GridData.FILL;
    GridData gridData11 = new GridData(GridData.FILL_HORIZONTAL);
    gridData11.horizontalAlignment = GridData.FILL;
    GridData gridData10 = new GridData(GridData.FILL_HORIZONTAL);
    gridData10.horizontalAlignment = GridData.FILL;
    gridData10.heightHint = 15;
    GridData gridData9 = new GridData(GridData.FILL_HORIZONTAL);
    gridData9.horizontalAlignment = GridData.FILL;
    gridData9.heightHint = 15;
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    group = new Group(composite, SWT.FILL);
    Label labelDBName = new Label(group, SWT.NONE);
    createComboDBName();
    group.setLayoutData(gridData13);
    group.setLayout(gridLayout);
    Label labelBrokerName = new Label(group, SWT.NONE);
    labelBrokerName.setText(Messages.labelBrokerName);
    createComboBrokerName();
    Label labelUserName = new Label(group, SWT.NONE);
    labelUserName.setText(Messages.labelUserId);
    textUserName = new Text(group, SWT.BORDER);
    textUserName.setLayoutData(gridData9);
    Label labelPassword = new Label(group, SWT.NONE);
    labelPassword.setText(Messages.labelPassword);
    textPassword = new Text(group, SWT.BORDER | SWT.PASSWORD);
    textPassword.setLayoutData(gridData10);
    Label labelNumThread = new Label(group, SWT.NONE);
    labelNumThread.setText(Messages.labelNumThread);
    spinnerNumThread = new Spinner(group, SWT.BORDER);
    spinnerNumThread.setMaximum(20);
    spinnerNumThread.setLayoutData(gridData11);
    spinnerNumThread.setMinimum(1);
    Label labelRepeatCount = new Label(group, SWT.NONE);
    labelRepeatCount.setText(Messages.labelNumRepeatCount);
    spinnerRepeatCount = new Spinner(group, SWT.BORDER);
    spinnerRepeatCount.setMaximum(1000);
    spinnerRepeatCount.setMinimum(1);
    spinnerRepeatCount.setLayoutData(gridData12);
    spinnerRepeatCount.setDigits(0);
    checkBoxShowQueryResult = new Button(group, SWT.CHECK);
    checkBoxShowQueryResult.setText(Messages.labelViewCasRunnerQueryResult);
    checkBoxShowQueryResult.setLayoutData(gridData6);
    checkBoxShowQueryResult.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
            checkBoxShowQueryPlan.setEnabled(checkBoxShowQueryResult.getSelection());
        }
    });
    checkBoxShowQueryPlan = new Button(group, SWT.CHECK);
    checkBoxShowQueryPlan.setEnabled(false);
    checkBoxShowQueryPlan.setLayoutData(gridData17);
    checkBoxShowQueryPlan.setText(Messages.labelViewCasRunnerQueryPlan);
    labelDBName.setText(Messages.labelDatabase);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 15 with Spinner

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

the class TableConfigCellEditor method createControl.

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FormLayout());
    setControl(container);
    Composite leftComposite = new Composite(container, SWT.NONE);
    leftComposite.setLayout(new GridLayout(1, false));
    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(55, 0);
    leftComposite.setLayoutData(leftData);
    Group grpButtons = new Group(leftComposite, SWT.NONE);
    {
        grpButtons.setLayout(new GridLayout(4, false));
        grpButtons.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
        grpButtons.setText(Messages.grpAddRemove);
    }
    Button sqlSchemaFileButton = new Button(grpButtons, SWT.NONE);
    sqlSchemaFileButton.setText(Messages.btnAddSchemaFile);
    sqlSchemaFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlSchemaFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addFile(TableConfig.TYPE_SCHEMA);
        }
    });
    Button sqlDataFileButton = new Button(grpButtons, SWT.NONE);
    sqlDataFileButton.setText(Messages.btnAddDataFile);
    sqlDataFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlDataFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addFile(TableConfig.TYPE_DATA);
        }
    });
    Button sqlIndexFileButton = new Button(grpButtons, SWT.NONE);
    sqlIndexFileButton.setText(Messages.btnAddIndexFile);
    sqlIndexFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlIndexFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addFile(TableConfig.TYPE_INDEX);
        }
    });
    delFileButton = new Button(grpButtons, SWT.NONE);
    delFileButton.setText(Messages.btnDelFiles);
    delFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    delFileButton.setEnabled(false);
    delFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            deleteSelectedFile();
        }
    });
    sqlFileTableViewer = new TableViewer(leftComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    sqlFileTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 4, 1, -1, -1));
    sqlFileTableViewer.getTable().setLinesVisible(true);
    sqlFileTableViewer.getTable().setHeaderVisible(true);
    final TableViewerColumn fileNameCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
    fileNameCol.getColumn().setWidth(300);
    fileNameCol.getColumn().setText(Messages.columnImportFileName);
    final TableViewerColumn fileTypeCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
    fileTypeCol.getColumn().setWidth(100);
    fileTypeCol.getColumn().setText(Messages.columnImportFileType);
    CellEditor[] editors = new CellEditor[4];
    editors[0] = new TextCellEditor(sqlFileTableViewer.getTable());
    editors[1] = new ComboBoxCellEditor(sqlFileTableViewer.getTable(), TYPE_ITEMS, SWT.READ_ONLY);
    sqlFileTableViewer.setColumnProperties(PROPS);
    sqlFileTableViewer.setContentProvider(new SQLFileTableContentProvider());
    sqlFileTableViewer.setLabelProvider(new SQLFileTableLabelProvider());
    sqlFileTableViewer.setCellModifier(new TableConfigCellEditor(sqlFileTableViewer, this));
    sqlFileTableViewer.setCellEditors(editors);
    sqlFileTableViewer.getTable().addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            delFileButton.setEnabled(delCanEnable());
        }
    });
    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(55, 0);
    rightData.right = new FormAttachment(100, -5);
    rightComposite.setLayoutData(rightData);
    GridLayout rightCompositeLayout = new GridLayout();
    rightCompositeLayout.verticalSpacing = 10;
    rightComposite.setLayout(rightCompositeLayout);
    Group enCodingOptionGroup = new Group(rightComposite, SWT.None);
    enCodingOptionGroup.setText(Messages.grpEncodingOption);
    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.lblDBCharset);
    dbCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
    dbCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
    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.select(0);
    fileCharsetCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            getImportDataWizard().getImportConfig().setFilesCharset(fileCharsetCombo.getText());
        }
    });
    Group importOptionGroup = new Group(rightComposite, SWT.None);
    importOptionGroup.setText(Messages.grpImportOptions);
    importOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    importOptionGroup.setLayout(new GridLayout(2, false));
    Label threadCountLabel = new Label(importOptionGroup, SWT.None);
    threadCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    threadCountLabel.setText(Messages.lblThreadNum);
    threadCountSpinner = new Spinner(importOptionGroup, SWT.BORDER);
    threadCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    threadCountSpinner.setMaximum(ImportConfig.MAX_IMPORT_THREAD_COUNT);
    threadCountSpinner.setMinimum(ImportConfig.MIN_IMPORT_THREAD_COUNT);
    threadCountSpinner.setSelection(ImportConfig.DEFAULT_IMPORT_THREAD_COUNT);
    threadCountSpinner.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            validate();
        }
    });
    Label commitCountLabel = new Label(importOptionGroup, SWT.None);
    commitCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    commitCountLabel.setText(Messages.lblCommitCount);
    commitCountSpinner = new Spinner(importOptionGroup, SWT.BORDER);
    commitCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    commitCountSpinner.setMaximum(ImportConfig.MAX_IMPORT_COMMIT_COUNT);
    commitCountSpinner.setMinimum(ImportConfig.MIN_IMPORT_COMMIT_COUNT);
    commitCountSpinner.setIncrement(ImportConfig.IMPORT_COMMIT_STEP);
    commitCountSpinner.setSelection(ImportConfig.DEFAULT_IMPORT_COMMIT_COUNT);
    final Button haModeButton = new Button(rightComposite, SWT.CHECK);
    haModeButton.setText(Messages.btnInHaMode);
    haModeButton.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    haModeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ImportConfig importConfig = getImportDataWizard().getImportConfig();
            importConfig.setHaMode(haModeButton.getSelection());
            Collections.sort(fileList, new TableConfigComparator(getImportDataWizard().getImportConfig()));
            sqlFileTableViewer.refresh();
        }
    });
    registerContextMenu();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

Spinner (org.eclipse.swt.widgets.Spinner)70 GridLayout (org.eclipse.swt.layout.GridLayout)54 Label (org.eclipse.swt.widgets.Label)54 Button (org.eclipse.swt.widgets.Button)53 Composite (org.eclipse.swt.widgets.Composite)52 GridData (org.eclipse.swt.layout.GridData)51 Group (org.eclipse.swt.widgets.Group)32 SelectionEvent (org.eclipse.swt.events.SelectionEvent)25 Text (org.eclipse.swt.widgets.Text)24 Combo (org.eclipse.swt.widgets.Combo)20 SelectionListener (org.eclipse.swt.events.SelectionListener)19 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)18 SWT (org.eclipse.swt.SWT)16 ModifyListener (org.eclipse.swt.events.ModifyListener)14 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11 Point (org.eclipse.swt.graphics.Point)11 Control (org.eclipse.swt.widgets.Control)10 CoreException (org.eclipse.core.runtime.CoreException)6 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)6 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)6