Lines 19-31
Link Here
|
19 |
import java.io.IOException; |
19 |
import java.io.IOException; |
20 |
|
20 |
|
21 |
import org.eclipse.core.runtime.IStatus; |
21 |
import org.eclipse.core.runtime.IStatus; |
|
|
22 |
import org.eclipse.datatools.connectivity.internal.DriverUtil; |
23 |
import org.eclipse.datatools.connectivity.sqm.internal.core.connection.ConnectionAdapter; |
22 |
import org.eclipse.datatools.modelbase.sql.tables.Column; |
24 |
import org.eclipse.datatools.modelbase.sql.tables.Column; |
23 |
import org.eclipse.datatools.sqltools.data.internal.core.editor.IRowData; |
25 |
import org.eclipse.datatools.sqltools.data.internal.core.editor.IRowData; |
|
|
26 |
import org.eclipse.datatools.sqltools.data.internal.core.editor.TableDataImpl; |
24 |
import org.eclipse.datatools.sqltools.data.internal.ui.DataUIPlugin; |
27 |
import org.eclipse.datatools.sqltools.data.internal.ui.DataUIPlugin; |
25 |
import org.eclipse.jface.dialogs.IDialogConstants; |
28 |
import org.eclipse.jface.dialogs.IDialogConstants; |
26 |
import org.eclipse.jface.dialogs.MessageDialog; |
29 |
import org.eclipse.jface.dialogs.MessageDialog; |
27 |
import org.eclipse.jface.wizard.WizardPage; |
30 |
import org.eclipse.jface.wizard.WizardPage; |
28 |
import org.eclipse.swt.SWT; |
31 |
import org.eclipse.swt.SWT; |
|
|
32 |
import org.eclipse.swt.custom.Field3270; |
29 |
import org.eclipse.swt.events.SelectionEvent; |
33 |
import org.eclipse.swt.events.SelectionEvent; |
30 |
import org.eclipse.swt.events.SelectionListener; |
34 |
import org.eclipse.swt.events.SelectionListener; |
31 |
import org.eclipse.swt.layout.GridData; |
35 |
import org.eclipse.swt.layout.GridData; |
Lines 34-41
Link Here
|
34 |
import org.eclipse.swt.widgets.Composite; |
38 |
import org.eclipse.swt.widgets.Composite; |
35 |
import org.eclipse.swt.widgets.Control; |
39 |
import org.eclipse.swt.widgets.Control; |
36 |
import org.eclipse.swt.widgets.FileDialog; |
40 |
import org.eclipse.swt.widgets.FileDialog; |
37 |
import org.eclipse.swt.widgets.Text; |
|
|
38 |
import org.eclipse.swt.widgets.TableItem; |
41 |
import org.eclipse.swt.widgets.TableItem; |
|
|
42 |
import org.eclipse.swt.widgets.Text; |
39 |
|
43 |
|
40 |
/** |
44 |
/** |
41 |
* The default Wizard Page for external editing of the TableDataEditor. |
45 |
* The default Wizard Page for external editing of the TableDataEditor. |
Lines 55-60
Link Here
|
55 |
/** the default implementation of the edit area, a simple Text area */ |
59 |
/** the default implementation of the edit area, a simple Text area */ |
56 |
protected Text textWidget; |
60 |
protected Text textWidget; |
57 |
|
61 |
|
|
|
62 |
/** the bidi-specific implementation of the edit area, a BidiStyledText area */ |
63 |
protected Field3270 field3270Widget; |
58 |
/** The Import button */ |
64 |
/** The Import button */ |
59 |
protected Button btnImport; |
65 |
protected Button btnImport; |
60 |
|
66 |
|
Lines 85-90
Link Here
|
85 |
|
91 |
|
86 |
protected int buttonAreaSpan; |
92 |
protected int buttonAreaSpan; |
87 |
|
93 |
|
|
|
94 |
private boolean is3270SupportRequired = false; |
95 |
|
88 |
/** |
96 |
/** |
89 |
* Creates the default page with the given editor |
97 |
* Creates the default page with the given editor |
90 |
* @param pageName the name of the page |
98 |
* @param pageName the name of the page |
Lines 122-127
Link Here
|
122 |
|
130 |
|
123 |
// how many buttons we create in the buttonArea |
131 |
// how many buttons we create in the buttonArea |
124 |
buttonAreaSpan = 1; |
132 |
buttonAreaSpan = 1; |
|
|
133 |
|
134 |
if ((rowData.getTable() instanceof TableDataImpl) && |
135 |
(((TableDataImpl)rowData.getTable()).getConnection() instanceof ConnectionAdapter)){ |
136 |
ConnectionAdapter ca = (ConnectionAdapter)((TableDataImpl)rowData.getTable()).getConnection(); |
137 |
is3270SupportRequired = DriverUtil.is3270SupportRequired(ca.getConnectionInfo().getConnectionProfile()); |
138 |
} |
125 |
} |
139 |
} |
126 |
|
140 |
|
127 |
/** |
141 |
/** |
Lines 191-213
Link Here
|
191 |
glEditor.marginWidth = 0; |
205 |
glEditor.marginWidth = 0; |
192 |
editorComp.setLayout(glEditor); |
206 |
editorComp.setLayout(glEditor); |
193 |
editorComp.setLayoutData( new GridData(GridData.FILL_BOTH) ); |
207 |
editorComp.setLayoutData( new GridData(GridData.FILL_BOTH) ); |
194 |
|
208 |
if (!is3270SupportRequired){ |
195 |
textWidget = new Text(editorComp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL ); |
209 |
textWidget = new Text(editorComp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL ); |
|
|
210 |
} else { |
211 |
field3270Widget = new Field3270(editorComp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); |
212 |
} |
196 |
// always enable it so that at least a manual copy and paste from a read-only table can be copied.. |
213 |
// always enable it so that at least a manual copy and paste from a read-only table can be copied.. |
197 |
textWidget.setEnabled(true); |
214 |
getEditWidget().setEnabled(true); |
198 |
boolean editable = (!hasNullValue && !editor.isReadonly()) ; |
215 |
boolean editable = (!hasNullValue && !editor.isReadonly()) ; |
199 |
|
216 |
|
200 |
// if it is new (yet null) value of a non-nullable column (i.e. non-nullable and set to null) |
217 |
// if it is new (yet null) value of a non-nullable column (i.e. non-nullable and set to null) |
201 |
// we force the editorarea, import, export to be enabled and the null button is set to false |
218 |
// we force the editorarea, import, export to be enabled and the null button is set to false |
202 |
// see further down as well |
219 |
// see further down as well |
203 |
boolean nonNullableCheck = (!((Column)editor.getSqlTable().getColumns().get(columnIndex)).isNullable() && hasNullValue); |
220 |
boolean nonNullableCheck = (!((Column)editor.getSqlTable().getColumns().get(columnIndex)).isNullable() && hasNullValue); |
204 |
textWidget.setEditable(editable || nonNullableCheck); |
221 |
|
|
|
222 |
if (!is3270SupportRequired) |
223 |
textWidget.setEditable(editable || nonNullableCheck); |
224 |
else |
225 |
field3270Widget.setEditable(editable || nonNullableCheck); |
205 |
|
226 |
|
206 |
editorAreaIsSerialized = true; // as we deal with a text field, we want it serialized |
227 |
editorAreaIsSerialized = true; // as we deal with a text field, we want it serialized |
207 |
GridData gdtxtTextValue = new GridData(GridData.FILL_BOTH); |
228 |
GridData gdtxtTextValue = new GridData(GridData.FILL_BOTH); |
208 |
gdtxtTextValue.grabExcessHorizontalSpace = true; |
229 |
gdtxtTextValue.grabExcessHorizontalSpace = true; |
209 |
gdtxtTextValue.grabExcessVerticalSpace = true; |
230 |
gdtxtTextValue.grabExcessVerticalSpace = true; |
210 |
textWidget.setLayoutData(gdtxtTextValue); |
231 |
getEditWidget().setLayoutData(gdtxtTextValue); |
211 |
gdtxtTextValue.horizontalSpan = 1; |
232 |
gdtxtTextValue.horizontalSpan = 1; |
212 |
//limit width/height of text area when string content is very wide or long |
233 |
//limit width/height of text area when string content is very wide or long |
213 |
gdtxtTextValue.widthHint = 400; |
234 |
gdtxtTextValue.widthHint = 400; |
Lines 403-409
Link Here
|
403 |
// for others disable widget itself |
424 |
// for others disable widget itself |
404 |
if (getEditWidget() instanceof Text){ |
425 |
if (getEditWidget() instanceof Text){ |
405 |
((Text)getEditWidget()).setEditable(!btnSetNull.getSelection()); |
426 |
((Text)getEditWidget()).setEditable(!btnSetNull.getSelection()); |
406 |
} else{ |
427 |
} else if (getEditWidget() instanceof Field3270){ |
|
|
428 |
((Field3270)getEditWidget()).setEditable(!btnSetNull.getSelection()); |
429 |
} else { |
407 |
getEditWidget().setEnabled(!btnSetNull.getSelection()); |
430 |
getEditWidget().setEnabled(!btnSetNull.getSelection()); |
408 |
} |
431 |
} |
409 |
if(displayImportBtn){ |
432 |
if(displayImportBtn){ |
Lines 600-606
Link Here
|
600 |
protected Object getEditorAreaContent(){ |
623 |
protected Object getEditorAreaContent(){ |
601 |
// we dont need to deserialize |
624 |
// we dont need to deserialize |
602 |
// as we deal with Strings |
625 |
// as we deal with Strings |
603 |
return textWidget.getText(); |
626 |
if (!is3270SupportRequired) |
|
|
627 |
return textWidget.getText(); |
628 |
else |
629 |
if (field3270Widget.isWidgetReversed() ^ field3270Widget.isPushMode()) |
630 |
return Field3270.reverseStr(field3270Widget.getText()); |
631 |
return field3270Widget.getText(); |
604 |
} |
632 |
} |
605 |
|
633 |
|
606 |
/** |
634 |
/** |
Lines 616-624
Link Here
|
616 |
} |
644 |
} |
617 |
if (serializedContent == null){ |
645 |
if (serializedContent == null){ |
618 |
hasNullValue = true; // input is still null |
646 |
hasNullValue = true; // input is still null |
619 |
textWidget.setText(""); //$NON-NLS-1$ |
647 |
if (!is3270SupportRequired) |
|
|
648 |
textWidget.setText(""); //$NON-NLS-1$ |
649 |
else |
650 |
field3270Widget.setText(""); //$NON-NLS-1$ |
620 |
} else{ |
651 |
} else{ |
621 |
textWidget.setText(serializedContent); |
652 |
if (!is3270SupportRequired) |
|
|
653 |
textWidget.setText(serializedContent); |
654 |
else |
655 |
field3270Widget.setText(serializedContent); |
622 |
hasNullValue = false; |
656 |
hasNullValue = false; |
623 |
} |
657 |
} |
624 |
} |
658 |
} |
Lines 654-659
Link Here
|
654 |
* @return the edit widget |
688 |
* @return the edit widget |
655 |
*/ |
689 |
*/ |
656 |
protected Control getEditWidget(){ |
690 |
protected Control getEditWidget(){ |
657 |
return textWidget; |
691 |
if (!is3270SupportRequired) |
658 |
} |
692 |
return textWidget; |
|
|
693 |
return field3270Widget; |
694 |
} |
659 |
} |
695 |
} |