org.eclipse.swt.custom.TableEditor Java Examples
The following examples show how to use
org.eclipse.swt.custom.TableEditor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelPropertiesDialog.java From erflute with Apache License 2.0 | 7 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #2
Source File: CategoryManageDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void initNodeTable() { this.nodeTable.removeAll(); this.nodeCheckMap = new HashMap<NodeElement, TableEditor>(); for (NodeElement nodeElement : this.diagram.getDiagramContents() .getContents()) { TableItem tableItem = new TableItem(this.nodeTable, SWT.NONE); Button selectCheckButton = new Button(this.nodeTable, SWT.CHECK); selectCheckButton.pack(); TableEditor editor = new TableEditor(this.nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, ResourceString .getResourceString("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, nodeElement.getName()); this.nodeCheckMap.put(nodeElement, editor); } }
Example #3
Source File: RelationByExistingColumnsDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private NormalColumn getSelectedColumn(final TableEditor tableEditor) { final Combo foreignKeyCombo = (Combo) tableEditor.getEditor(); final int foreignKeyComboIndex = foreignKeyCombo.getSelectionIndex(); int startIndex = 1; NormalColumn foreignKeyColumn = null; final List<NormalColumn> foreignKeyList = editorReferencedMap.get(tableEditor); if (foreignKeyList != null) { if (foreignKeyComboIndex <= foreignKeyList.size()) { foreignKeyColumn = foreignKeyList.get(foreignKeyComboIndex - startIndex); } else { startIndex += foreignKeyList.size(); } } if (foreignKeyColumn == null) { foreignKeyColumn = candidateForeignKeyColumns.get(foreignKeyComboIndex - startIndex); } return foreignKeyColumn; }
Example #4
Source File: RelationByExistingColumnsDialog.java From ermasterr with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void perfomeOK() { final int index = columnCombo.getSelectionIndex(); if (index < columnComboInfo.complexUniqueKeyStartIndex) { referenceForPK = true; } else if (index < columnComboInfo.columnStartIndex) { final ComplexUniqueKey complexUniqueKey = source.getComplexUniqueKeyList().get(index - columnComboInfo.complexUniqueKeyStartIndex); referencedComplexUniqueKey = complexUniqueKey; } else { referencedColumn = columnComboInfo.candidateColumns.get(index - columnComboInfo.columnStartIndex); } for (final TableEditor tableEditor : tableEditorList) { final NormalColumn foreignKeyColumn = getSelectedColumn(tableEditor); foreignKeyColumnList.add(foreignKeyColumn); } }
Example #5
Source File: RelationByExistingColumnsDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private NormalColumn getSelectedColumn(TableEditor tableEditor) { Combo foreignKeyCombo = (Combo) tableEditor.getEditor(); int foreignKeyComboIndex = foreignKeyCombo.getSelectionIndex(); int startIndex = 1; NormalColumn foreignKeyColumn = null; List<NormalColumn> foreignKeyList = this.editorReferencedMap .get(tableEditor); if (foreignKeyList != null) { if (foreignKeyComboIndex <= foreignKeyList.size()) { foreignKeyColumn = foreignKeyList.get(foreignKeyComboIndex - startIndex); } else { startIndex += foreignKeyList.size(); } } if (foreignKeyColumn == null) { foreignKeyColumn = this.candidateForeignKeyColumns .get(foreignKeyComboIndex - startIndex); } return foreignKeyColumn; }
Example #6
Source File: RelationByExistingColumnsDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
@Override protected String getErrorMessage() { Set<NormalColumn> selectedColumns = new HashSet<NormalColumn>(); for (TableEditor tableEditor : this.tableEditorList) { Combo foreignKeyCombo = (Combo) tableEditor.getEditor(); int index = foreignKeyCombo.getSelectionIndex(); if (index == 0) { return "error.foreign.key.not.selected"; } NormalColumn selectedColumn = this.getSelectedColumn(tableEditor); if (selectedColumns.contains(selectedColumn)) { return "error.foreign.key.must.be.different"; } selectedColumns.add(selectedColumn); } if (this.existForeignKeySet(selectedColumns)) { return "error.foreign.key.already.exist"; } return null; }
Example #7
Source File: RelationByExistingColumnsDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void column2TableItem(NormalColumn referencedColumn) { TableItem tableItem = new TableItem(this.comparisonTable, SWT.NONE); tableItem.setText(0, Format.null2blank(referencedColumn .getLogicalName())); List<NormalColumn> foreignKeyList = this.referencedMap .get(referencedColumn.getRootReferencedColumn()); TableEditor tableEditor = new TableEditor(this.comparisonTable); tableEditor.grabHorizontal = true; tableEditor.setEditor(this.createForeignKeyCombo(foreignKeyList), tableItem, 1); this.tableEditorList.add(tableEditor); this.editorReferencedMap.put(tableEditor, foreignKeyList); }
Example #8
Source File: ModelPropertiesDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #9
Source File: AbapGitWizardPageApack.java From ADT_Frontend with MIT License | 6 votes |
private void addThePackageButton(IApackDependency dependency, final int packageColumnIndex, TableItem tableItem) { Button button = new Button(this.table, SWT.NONE); button.setText("..."); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IAdtPackageServiceUI packageServiceUI = AdtPackageServiceUIFactory.getOrCreateAdtPackageServiceUI(); IAdtObjectReference[] selectedPackages = packageServiceUI.openPackageSelectionDialog(e.display.getActiveShell(), false, AbapGitWizardPageApack.this.destination, tableItem.getText(packageColumnIndex)); if (selectedPackages != null && selectedPackages.length > 0) { setPageComplete(true); setMessage(null); tableItem.setText(packageColumnIndex, selectedPackages[0].getName()); dependency.setTargetPackage(selectedPackages[0]); packTheTable(); } } }); button.pack(); TableEditor editor = new TableEditor(this.table); editor.horizontalAlignment = SWT.RIGHT; editor.minimumWidth = button.getSize().x; editor.setEditor(button, tableItem, packageColumnIndex); editor.layout(); }
Example #10
Source File: RelationByExistingColumnsDialog.java From ermasterr with Apache License 2.0 | 6 votes |
@Override protected String getErrorMessage() { final Set<NormalColumn> selectedColumns = new HashSet<NormalColumn>(); for (final TableEditor tableEditor : tableEditorList) { final Combo foreignKeyCombo = (Combo) tableEditor.getEditor(); final int index = foreignKeyCombo.getSelectionIndex(); if (index == 0) { return "error.foreign.key.not.selected"; } final NormalColumn selectedColumn = getSelectedColumn(tableEditor); if (selectedColumns.contains(selectedColumn)) { return "error.foreign.key.must.be.different"; } selectedColumns.add(selectedColumn); } if (existForeignKeySet(selectedColumns)) { return "error.foreign.key.already.exist"; } return null; }
Example #11
Source File: ComplexUniqueKeyTabWrapper.java From ermaster-b with Apache License 2.0 | 6 votes |
public void restruct() { this.columnTable.removeAll(); this.disposeTableEditor(); for (NormalColumn normalColumn : this.copyData.getNormalColumns()) { TableItem tableItem = new TableItem(this.columnTable, SWT.NONE); tableItem.setText(0, Format.null2blank(normalColumn.getName())); TableEditor tableEditor = CompositeFactory .createCheckBoxTableEditor(tableItem, false, 1); this.tableEditorList.add(tableEditor); this.editorColumnMap.put(tableEditor, normalColumn); } this.setComboData(); this.setButtonStatus(false); }
Example #12
Source File: CompositeFactory.java From ermaster-b with Apache License 2.0 | 6 votes |
public static TableEditor createCheckBoxTableEditor(TableItem tableItem, boolean selection, int column) { Table table = tableItem.getParent(); final Button checkBox = new Button(table, SWT.CHECK); checkBox.pack(); TableEditor editor = new TableEditor(table); editor.minimumWidth = checkBox.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(checkBox, tableItem, column); checkBox.setSelection(selection); return editor; }
Example #13
Source File: ModelPropertiesDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(final FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #14
Source File: ComplexUniqueKeyTabWrapper.java From ermasterr with Apache License 2.0 | 6 votes |
@Override public void restruct() { columnTable.removeAll(); disposeTableEditor(); for (final NormalColumn normalColumn : copyData.getNormalColumns()) { final TableItem tableItem = new TableItem(columnTable, SWT.NONE); final TableEditor tableEditor = CompositeFactory.createCheckBoxTableEditor(tableItem, false, 0); tableEditorList.add(tableEditor); editorColumnMap.put(tableEditor, normalColumn); tableItem.setText(1, Format.null2blank(normalColumn.getName())); } setComboData(); setButtonStatus(false); nameText.setText(""); columnTable.getColumns()[1].pack(); }
Example #15
Source File: RelationshipByExistingColumnsDialog.java From erflute with Apache License 2.0 | 6 votes |
private void setupRelationship() { newCreatedRelationship = createRelationship(); newCreatedRelationship.setForeignKeyName(foreignKeyNameText.getText().trim()); if (isCreateNewColumn()) { // TODO ymd コマンド外の操作でカラムを追加しているため、undoしてもカラムが削除されない。コマンド化する。 for (final NormalColumn referredColumn : selectedReferredColumnList) { final NormalColumn newColumn = new NormalColumn(referredColumn, newCreatedRelationship, resultReferenceForPK); adjustNewForeignKeyColumn(newColumn); selectedForeignKeyColumnList.add(newColumn); target.addColumn(newColumn); } } else { for (final TableEditor mapperEditor : mapperEditorList) { selectedForeignKeyColumnList.add(findSelectedColumn(mapperEditor)); } } }
Example #16
Source File: RelationshipByExistingColumnsDialog.java From erflute with Apache License 2.0 | 6 votes |
private NormalColumn findSelectedColumn(TableEditor tableEditor) { // not null final Combo foreignKeySelector = (Combo) tableEditor.getEditor(); final int selectionIndex = foreignKeySelector.getSelectionIndex(); int startIndex = 1; NormalColumn foreignKeyColumn = null; final List<NormalColumn> foreignKeyList = mapperEditorToReferredColumnsMap.get(tableEditor); if (foreignKeyList != null) { if (selectionIndex <= foreignKeyList.size()) { foreignKeyColumn = foreignKeyList.get(selectionIndex - startIndex); } else { startIndex += foreignKeyList.size(); } } if (foreignKeyColumn == null) { foreignKeyColumn = candidateForeignKeyColumns.get(selectionIndex - startIndex); } return foreignKeyColumn; }
Example #17
Source File: MainWalkerGroupManageDialog.java From erflute with Apache License 2.0 | 6 votes |
private void initNodeTable() { nodeTable.removeAll(); nodeCheckMap = new HashMap<>(); for (final DiagramWalker walker : getTableWalkers()) { final TableItem tableItem = new TableItem(nodeTable, SWT.NONE); final Button selectCheckButton = new Button(nodeTable, SWT.CHECK); selectCheckButton.pack(); final TableEditor editor = new TableEditor(nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, DisplayMessages.getMessage("label.object.type." + walker.getObjectType())); tableItem.setText(2, walker.getName()); nodeCheckMap.put(walker, editor); } }
Example #18
Source File: IndexDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void setTableEditor(final NormalColumn normalColumn, TableItem tableItem, Boolean desc) { Button descCheckButton = new Button(this.indexColumnList, SWT.CHECK); descCheckButton.pack(); if (DBManagerFactory.getDBManager(this.table.getDiagram()).isSupported( DBManager.SUPPORT_DESC_INDEX)) { TableEditor editor = new TableEditor(this.indexColumnList); editor.minimumWidth = descCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(descCheckButton, tableItem, 1); this.columnCheckMap.put(normalColumn, editor); } this.descCheckBoxMap.put(normalColumn, descCheckButton); descCheckButton.setSelection(desc.booleanValue()); }
Example #19
Source File: ChartMakerDialog.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override public void update(@Nullable ViewerCell cell) { if (cell == null) { return; } /* Create a button if it doesn't exist */ ChartSeriesDialog series = (ChartSeriesDialog) cell.getViewerRow().getElement(); Button button = series.getButton(); /* Set the position of the button into the cell */ TableItem item = (TableItem) cell.getItem(); TableEditor editor = new TableEditor(item.getParent()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(button, item, cell.getColumnIndex()); editor.layout(); }
Example #20
Source File: CompoundUniqueKeyTabWrapper.java From erflute with Apache License 2.0 | 6 votes |
private void checkSelectedKey() { final int index = compoundUniqueKeyCombo.getSelectionIndex(); CompoundUniqueKey complexUniqueKey = null; String name = null; if (index != -1) { complexUniqueKey = table.getCompoundUniqueKeyList().get(index); name = complexUniqueKey.getUniqueKeyName(); setUpdateDeleteButtonStatus(true); } else { setUpdateDeleteButtonStatus(false); } uniqueKeyNameText.setText(Format.null2blank(name)); for (final TableEditor tableEditor : tableEditorList) { final Button checkbox = (Button) tableEditor.getEditor(); final NormalColumn column = editorColumnMap.get(tableEditor); if (complexUniqueKey != null && complexUniqueKey.getColumnList().contains(column)) { checkbox.setSelection(true); } else { checkbox.setSelection(false); } } }
Example #21
Source File: CategoryManageDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private void initNodeTable() { nodeTable.removeAll(); nodeCheckMap = new HashMap<NodeElement, TableEditor>(); for (final NodeElement nodeElement : diagram.getDiagramContents().getContents()) { final TableItem tableItem = new TableItem(nodeTable, SWT.NONE); final Button selectCheckButton = new Button(nodeTable, SWT.CHECK); selectCheckButton.pack(); final TableEditor editor = new TableEditor(nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, ResourceString.getResourceString("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, Format.null2blank(nodeElement.getName())); nodeCheckMap.put(nodeElement, editor); } }
Example #22
Source File: VGroupManageDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void initNodeTable() { this.nodeTable.removeAll(); this.nodeCheckMap = new HashMap<NodeElement, TableEditor>(); for (ERVirtualTable vtable : erModel.getTables()) { NodeElement nodeElement = vtable; //.getRawTable(); TableItem tableItem = new TableItem(this.nodeTable, SWT.NONE); Button selectCheckButton = new Button(this.nodeTable, SWT.CHECK); selectCheckButton.pack(); TableEditor editor = new TableEditor(this.nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, ResourceString .getResourceString("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, nodeElement.getName()); this.nodeCheckMap.put(nodeElement, editor); } }
Example #23
Source File: IndexDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private void setTableEditor(final NormalColumn normalColumn, final TableItem tableItem, final Boolean desc) { final Button descCheckButton = new Button(indexColumnList, SWT.CHECK); descCheckButton.pack(); if (DBManagerFactory.getDBManager(table.getDiagram()).isSupported(DBManager.SUPPORT_DESC_INDEX)) { final TableEditor editor = new TableEditor(indexColumnList); editor.minimumWidth = descCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(descCheckButton, tableItem, 1); columnCheckMap.put(normalColumn, editor); } descCheckBoxMap.put(normalColumn, descCheckButton); descCheckButton.setSelection(desc.booleanValue()); }
Example #24
Source File: CategoryManageDialog.java From erflute with Apache License 2.0 | 6 votes |
private void initNodeTable() { nodeTable.removeAll(); nodeCheckMap = new HashMap<>(); for (final DiagramWalker nodeElement : diagram.getDiagramContents().getDiagramWalkers()) { final TableItem tableItem = new TableItem(nodeTable, SWT.NONE); final Button selectCheckButton = new Button(nodeTable, SWT.CHECK); selectCheckButton.pack(); final TableEditor editor = new TableEditor(nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, DisplayMessages.getMessage("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, nodeElement.getName()); nodeCheckMap.put(nodeElement, editor); } }
Example #25
Source File: IndexTabWrapper.java From ermaster-b with Apache License 2.0 | 5 votes |
private void clearButtonAndEditor() { for (Button checkButton : this.checkButtonList) { checkButton.dispose(); } this.checkButtonList.clear(); for (TableEditor editor : this.editorList) { editor.dispose(); } this.editorList.clear(); }
Example #26
Source File: ERTableComposite.java From erflute with Apache License 2.0 | 5 votes |
private void disposeCheckBox(ERColumn column) { final TableEditor[] oldEditors = columnNotNullCheckMap.get(column); if (oldEditors != null) { for (final TableEditor oldEditor : oldEditors) { if (oldEditor.getEditor() != null) { oldEditor.getEditor().dispose(); oldEditor.dispose(); } } columnNotNullCheckMap.remove(column); } }
Example #27
Source File: ComplexUniqueKeyTabWrapper.java From ermaster-b with Apache License 2.0 | 5 votes |
private void checkSelectedKey() { int index = complexUniqueKeyCombo.getSelectionIndex(); ComplexUniqueKey complexUniqueKey = null; String name = null; if (index != -1) { complexUniqueKey = copyData.getComplexUniqueKeyList().get(index); name = complexUniqueKey.getUniqueKeyName(); setButtonStatus(true); } else { setButtonStatus(false); } nameText.setText(Format.null2blank(name)); for (TableEditor tableEditor : tableEditorList) { Button checkbox = (Button) tableEditor.getEditor(); NormalColumn column = editorColumnMap.get(tableEditor); if (complexUniqueKey != null && complexUniqueKey.getColumnList().contains(column)) { checkbox.setSelection(true); } else { checkbox.setSelection(false); } } }
Example #28
Source File: RelationByExistingColumnsDialog.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void perfomeOK() { int index = this.columnCombo.getSelectionIndex(); if (index < this.columnComboInfo.complexUniqueKeyStartIndex) { this.referenceForPK = true; } else if (index < this.columnComboInfo.columnStartIndex) { ComplexUniqueKey complexUniqueKey = this.source .getComplexUniqueKeyList() .get( index - this.columnComboInfo.complexUniqueKeyStartIndex); this.referencedComplexUniqueKey = complexUniqueKey; } else { this.referencedColumn = this.columnComboInfo.candidateColumns .get(index - this.columnComboInfo.columnStartIndex); } for (TableEditor tableEditor : this.tableEditorList) { NormalColumn foreignKeyColumn = this.getSelectedColumn(tableEditor); this.foreignKeyColumnList.add(foreignKeyColumn); } }
Example #29
Source File: RelationshipByExistingColumnsDialog.java From erflute with Apache License 2.0 | 5 votes |
private void addColumnToMapperItem(NormalColumn referredColumn) { final TableItem tableItem = new TableItem(foreignKeyColumnMapper, SWT.NONE); tableItem.setText(0, Format.null2blank(referredColumn.getLogicalName())); final List<NormalColumn> foreignKeyColumnList = existingRootReferredToFkColumnsMap.get(referredColumn.getFirstRootReferredColumn()); final TableEditor mapperEditor = new TableEditor(foreignKeyColumnMapper); mapperEditor.grabHorizontal = true; final Combo foreignKeyColumnSelector = createForeignKeyColumnSelector(foreignKeyColumnList); mapperEditor.setEditor(foreignKeyColumnSelector, tableItem, 1); mapperEditorList.add(mapperEditor); mapperEditorToReferredColumnsMap.put(mapperEditor, foreignKeyColumnList); }
Example #30
Source File: ComplexUniqueKeyTabWrapper.java From ermaster-b with Apache License 2.0 | 5 votes |
public ComplexUniqueKeyTabWrapper(AbstractDialog dialog, TabFolder parent, int style, ERTable copyData) { super(dialog, parent, style, "label.complex.unique.key"); this.copyData = copyData; this.tableEditorList = new ArrayList<TableEditor>(); this.editorColumnMap = new HashMap<TableEditor, NormalColumn>(); this.init(); }