use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.
the class MultipleSurrogateSection method creationComplement.
/**
* DOC hcw Comment method "onCreationChange".
*
* @param value
* @param key
* @param item
*/
protected void creationComplement(Integer value, final SurrogateKey key, final TableItem item) {
// dispose editor
TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
editorManager.disposeEditor(editor);
if (value == SurrogateCreationType.ROUTINE.getIndex()) {
// create routine editor
editor = editorManager.createTextEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX, new IPropertySetter<String>() {
public void set(String value) {
key.setComplement(value);
}
});
// add content proposal
TalendProposalUtils.installOn(editor.getEditor(), null);
} else if (value == SurrogateCreationType.DB_SEQUENCE.getIndex()) {
editor = editorManager.createTextEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX, new IPropertySetter<String>() {
public void set(String value) {
key.setComplement(value);
}
});
// add content proposal
TalendProposalUtils.installOn(editor.getEditor(), null);
} else if (value == SurrogateCreationType.INPUT_FIELD.getIndex()) {
// combo editor
// final List<String> inputColumns = scdManager.getInputColumnNames();
// inputColumns.add(0, "");
// int index = editorManager.getComboIndex(inputColumns, key.getComplement());
// editor = editorManager.createComboEditor(table, inputColumns.toArray(new String[inputColumns.size()]),
// item,
// COMPLEMENT_INDEX, index, new IPropertySetter<Integer>() {
//
// public void set(Integer value) {
// key.setComplement(inputColumns.get(value));
// Color color = value == 0 ? ERROR_COLOR : null;
// editorManager.setComboColor(item, COMPLEMENT_INDEX, color);
// scdManager.fireFieldChange();
// }
// });
//
// if (StringUtils.isEmpty(key.getComplement())) {
// // display as error status, this field must not be null
// editorManager.setComboColor(item, COMPLEMENT_INDEX, ERROR_COLOR);
// }
// label editor
editor = editorManager.createLabelEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX);
final Label text = (Label) editor.getEditor();
if (StringUtils.isEmpty(key.getComplement())) {
// display as error status, this field must not be null
text.setBackground(ERROR_COLOR);
}
// add drag and drop support
// IDragDropDelegate delegate = createDragDropDelegate(key, text);
// dragDropManager.addDragSupport(text, delegate);
// dragDropManager.addDropSupport(text, delegate);
}
}
use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.
the class Type2Section method onStartCreationChange.
/**
* DOC hcw Comment method "onStartCreationChange".
*
* @param value
* @param versioning
* @param startItem
*/
protected void onStartCreationChange(Integer value, final Versioning versioning, TableItem item) {
//$NON-NLS-1$
versioning.setStartComplement("");
scdManager.fireFieldChange();
// dispose editor
TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
editorManager.disposeEditor(editor);
if (value == VersionStartType.INPUT_FIELD.getIndex()) {
createStartComplement(versioning, item, editor);
}
}
use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.
the class Type2Section method onEndCreationChange.
/**
* DOC hcw Comment method "onEndCreationChange".
*
* @param value
* @param versioning
* @param endItem
*/
protected void onEndCreationChange(Integer value, final Versioning versioning, TableItem item) {
//$NON-NLS-1$
versioning.setEndComplement("");
// dispose editor
TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
editorManager.disposeEditor(editor);
if (value == VersionEndType.FIXED_YEAR.getIndex()) {
createEndComplement(versioning, item, editor);
}
}
use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method removeTableItem.
protected void removeTableItem(TableItem item) {
if (item == null) {
return;
}
TableEditor[] editors = (TableEditor[]) item.getData(ITEM_EDITOR_KEY);
if (editors != null) {
for (TableEditor editor : editors) {
editor.getEditor().dispose();
editor.dispose();
}
}
item.dispose();
}
use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.
the class TableEditorManager method getEditor.
public TableEditor getEditor(TableItem item, int column) {
ArrayList<TableEditor> editors = (ArrayList<TableEditor>) editorMap.get(item);
TableEditor editor = null;
if (editors != null && column < editors.size()) {
editor = editors.get(column);
}
return editor;
}
Aggregations