@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(2, false)); Label lblResultType = new Label(container, SWT.NONE); lblResultType.setText(Messages.get().RDBPreferencePage_resultType); comboRDBResultType = new Combo(container, SWT.READ_ONLY); comboRDBResultType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboRDBResultType.add("Table"); // comboRDBResultType.add("Text"); // comboRDBResultType.add("JSON"); comboRDBResultType.select(0); Label lblNumberColumnAdd = new Label(container, SWT.NONE); lblNumberColumnAdd.setText(Messages.get().RDBPreferencePage_lblNumberColumnAdd_text); comboRDBNumberComma = new Combo(container, SWT.READ_ONLY); comboRDBNumberComma.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboRDBNumberComma.add(PublicTadpoleDefine.YES_NO.YES.name()); comboRDBNumberComma.add(PublicTadpoleDefine.YES_NO.NO.name()); comboRDBNumberComma.select(0); Label lblNewLabel = new Label(container, SWT.NONE); lblNewLabel.setText(Messages.get().DefaultPreferencePage_0); textSelectLimit = new Text(container, SWT.BORDER); textSelectLimit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblNewLabel_1 = new Label(container, SWT.NONE); lblNewLabel_1.setText(Messages.get().DefaultPreferencePage_other_labelText_1); textResultPage = new Text(container, SWT.BORDER); textResultPage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblResultViewFont = new Label(container, SWT.NONE); lblResultViewFont.setText(Messages.get().RDBPreferencePage_lblResultViewFont_text); lblUserFont = new Label(container, SWT.NONE); lblUserFont.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblUserFont.setText(""); new Label(container, SWT.NONE); Button btnNewButton = new Button(container, SWT.NONE); btnNewButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setFontData(); } }); btnNewButton.setText(Messages.get().RDBPreferencePage_btnNewButton_text); Label lblQueryTimeout = new Label(container, SWT.NONE); lblQueryTimeout.setText(Messages.get().RDBPreferencePage_lblQueryTimeout_text); textQueryTimeout = new Text(container, SWT.BORDER); textQueryTimeout.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblCommitCount = new Label(container, SWT.NONE); lblCommitCount.setText(Messages.get().RDBPreferencePage_lblCommitCount_text); textCommitCount = new Text(container, SWT.BORDER); textCommitCount.setText(Messages.get().RDBPreferencePage_text_text); textCommitCount.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblCharacterShownIn = new Label(container, SWT.NONE); lblCharacterShownIn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblCharacterShownIn.setText(Messages.get().RDBPreferencePage_lblCharacterShownIn_text); textShowInTheColumn = new Text(container, SWT.BORDER); textShowInTheColumn.setText(Messages.get().RDBPreferencePage_text_text_1); textShowInTheColumn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label label = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); label.setText(""); // $NON-NLS-1$ Label lblNewLabel_2 = new Label(container, SWT.NONE); lblNewLabel_2.setText(Messages.get().DefaultPreferencePage_other_labelText); textOraclePlan = new Text(container, SWT.BORDER); textOraclePlan.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(container, SWT.NONE); Button btnCreatePlanTable = new Button(container, SWT.NONE); btnCreatePlanTable.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TadpoleSimpleMessageDialog planDialog = new TadpoleSimpleMessageDialog( getShell(), textOraclePlan.getText(), ORACLE_PLAN_TABLE); planDialog.open(); } }); btnCreatePlanTable.setText(Messages.get().RDBPreferencePage_btnCreatePlanTable_text); initDefaultValue(); // google analytic AnalyticCaller.track(this.getClass().getName()); return container; }
@Override public boolean performOk() { String txtResultType = comboRDBResultType.getText(); String txtSelectLimit = textSelectLimit.getText(); String txtResultPage = textResultPage.getText(); String txtQueryTimtout = textQueryTimeout.getText(); String txtOraclePlan = textOraclePlan.getText(); String txtRDBNumberColumnIsComman = comboRDBNumberComma.getText(); String txtFontInfo = lblUserFont.getText(); String txtCommitCount = textCommitCount.getText(); String txtShownInTheColumn = textShowInTheColumn.getText(); if (!NumberUtils.isNumber(txtSelectLimit)) { MessageDialog.openError( getShell(), "Confirm", Messages.get().DefaultPreferencePage_0 + Messages.get().RDBPreferencePage_0); // $NON-NLS-1$ textSelectLimit.setFocus(); return false; } if (!NumberUtils.isNumber(txtResultPage)) { MessageDialog.openError( getShell(), "Confirm", Messages.get().DefaultPreferencePage_other_labelText_1 + Messages.get().RDBPreferencePage_0); // $NON-NLS-1$ textResultPage.setFocus(); return false; } if (!NumberUtils.isNumber(txtQueryTimtout)) { MessageDialog.openError( getShell(), "Confirm", "Query timeout is " + Messages.get().RDBPreferencePage_0); textQueryTimeout.setFocus(); return false; } if (!NumberUtils.isNumber(txtCommitCount)) { MessageDialog.openError( getShell(), "Confirm", "Commit count is " + Messages.get().RDBPreferencePage_0); textCommitCount.setFocus(); return false; } if ("".equals(txtOraclePlan)) { // $NON-NLS-1$ MessageDialog.openError( getShell(), "Confirm", Messages.get().RDBPreferencePage_3); // $NON-NLS-1$ return false; } if (!NumberUtils.isNumber(txtShownInTheColumn)) { MessageDialog.openError(getShell(), "Confirm", Messages.get().RDBPreferencePage_0); textShowInTheColumn.setFocus(); return false; } // 테이블에 저장 try { TadpoleSystem_UserInfoData.updateRDBUserInfoData( txtSelectLimit, txtResultPage, txtQueryTimtout, txtOraclePlan, txtRDBNumberColumnIsComman, txtFontInfo, txtCommitCount, txtShownInTheColumn, txtResultType); // session 데이터를 수정한다. SessionManager.setUserInfo(PreferenceDefine.RDB_RESULT_TYPE, txtResultType); SessionManager.setUserInfo(PreferenceDefine.SELECT_LIMIT_COUNT, txtSelectLimit); SessionManager.setUserInfo(PreferenceDefine.SELECT_RESULT_PAGE_PREFERENCE, txtResultPage); SessionManager.setUserInfo(PreferenceDefine.SELECT_QUERY_TIMEOUT, txtQueryTimtout); SessionManager.setUserInfo(PreferenceDefine.ORACLE_PLAN_TABLE, txtOraclePlan); SessionManager.setUserInfo( PreferenceDefine.RDB_RESULT_NUMBER_IS_COMMA, txtRDBNumberColumnIsComman); SessionManager.setUserInfo(PreferenceDefine.RDB_RESULT_FONT, txtFontInfo); SessionManager.setUserInfo(PreferenceDefine.RDB_COMMIT_COUNT, txtCommitCount); SessionManager.setUserInfo( PreferenceDefine.RDB_CHARACTER_SHOW_IN_THE_COLUMN, txtShownInTheColumn); } catch (Exception e) { logger.error("RDBPreference saveing", e); MessageDialog.openError( getShell(), "Confirm", Messages.get().RDBPreferencePage_5 + e.getMessage()); // $NON-NLS-1$ return false; } return super.performOk(); }