Example usage for org.eclipse.jface.viewers TableViewer getTable

List of usage examples for org.eclipse.jface.viewers TableViewer getTable

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers TableViewer getTable.

Prototype

public Table getTable() 

Source Link

Document

Returns this table viewer's table control.

Usage

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.mapping.tables.inputtable.InputFieldEditingSupport.java

License:Apache License

public InputFieldEditingSupport(TableViewer viewer) {
    super(viewer);
    this.viewer = viewer;
    //cellEditor = new TextCellEditor(viewer.getTable(), SWT.MULTI | SWT.WRAP | SWT.BORDER);
    cellEditor = new TextCellEditor(viewer.getTable());

    final Text aaa = (Text) cellEditor.getControl();
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.AbstractExpressionComposite.java

License:Apache License

/**
 * @param isParam/*from   w  w w . ja v a  2  s .  c  om*/
 * @param isWholeOperationParameter
 */
protected void disabledWidgetsifWholeExpressionIsParameter(Button isParam, boolean isWholeOperationParameter) {
    if (isWholeOperationParameter) {
        TableViewer tableViewer = (TableViewer) isParam.getData(Constants.INPUT_FIELD_TABLE);
        Button addButton = (Button) isParam.getData(Constants.ADD_BUTTON);
        Button deleteButton = (Button) isParam.getData(Constants.DELETE_BUTTON);
        Text expressionIdTextBox = (Text) isParam.getData(Constants.EXPRESSION_ID_TEXT_BOX);
        Button browseButton = (Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON);
        Text outputFieldTextBox = (Text) isParam.getData(Constants.OUTPUT_FIELD_TEXT_BOX);
        tableViewer.getTable().setEnabled(false);
        addButton.setEnabled(false);
        deleteButton.setEnabled(false);
        expressionIdTextBox.setEnabled(false);
        browseButton.setEnabled(false);
        outputFieldTextBox.setEnabled(false);
    }
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassComposite.java

License:Apache License

private void disabledWidgetsifWholeOperationIsParameter(Button isParam, boolean isWholeOperationParameter) {
    if (isWholeOperationParameter) {
        Button text = (Button) isParam;
        Text parameterTextBox = (Text) text.getData(PARAMETER_TEXT_BOX);
        TableViewer operationInputFieldTableViewer = (TableViewer) text
                .getData(OPERATION_INPUT_FIELD_TABLE_VIEWER);
        TableViewer operationalOutputFieldTableViewer = (TableViewer) text
                .getData(OPERATION_OUTPUT_FIELD_TABLE_VIEWER);
        Text operationClassTextBox = (Text) text.getData(OPERATION_CLASS_TEXT_BOX);
        Text operationIDTextBox = (Text) text.getData(OPERATION_ID_TEXT_BOX);
        Button btnNewButton = (Button) text.getData(BTN_NEW_BUTTON);
        Button inputAdd = (Button) text.getData(INPUT_ADD_BUTTON);

        Button inputDelete = (Button) text.getData(INPUT_DELETE_BUTTON);
        Button outputAdd = (Button) text.getData(OUTPUT_ADD_BUTTON);
        Button outputDelete = (Button) text.getData(OUTPUT_DELETE_BUTTON);
        parameterTextBox.setEnabled(true);

        operationInputFieldTableViewer.getTable().setEnabled(false);

        operationalOutputFieldTableViewer.getTable().setEnabled(false);
        operationClassTextBox.setEnabled(false);

        operationIDTextBox.setEnabled(false);

        btnNewButton.setEnabled(false);//  w  w  w .  j a  v a 2  s.  c  o  m
        inputAdd.setEnabled(false);
        inputDelete.setEnabled(false);

        outputAdd.setEnabled(false);
        outputDelete.setEnabled(false);

    }
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassDialog.java

License:Apache License

private void moveRowUp(TableViewer nameValueTableViewer) {

    Table table = nameValueTableViewer.getTable();
    int[] indexes = table.getSelectionIndices();
    for (int index : indexes) {

        if (index > 0) {
            Collections.swap(mappingSheetRow.getNameValueProperty(), index, index - 1);
            nameValueTableViewer.refresh();
            applyButton.setEnabled(true);
        }//  ww  w. j a  v  a2  s  .c  o  m
    }

}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassDialog.java

License:Apache License

private void moveRowDown(TableViewer nameValueTableViewer) {
    Table table = nameValueTableViewer.getTable();
    int[] indexes = table.getSelectionIndices();
    for (int i = indexes.length - 1; i > -1; i--) {

        if (indexes[i] < mappingSheetRow.getNameValueProperty().size() - 1) {
            Collections.swap(mappingSheetRow.getNameValueProperty(), indexes[i], indexes[i] + 1);
            nameValueTableViewer.refresh();
            applyButton.setEnabled(true);

        }//ww w.  ja v a  2s .co  m
    }

}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java

License:Apache License

private void operationalOutputTableDoubleClick(final MappingSheetRow mappingSheetRow,
        final TableViewer tableViewer) {
    tableViewer.getTable().addMouseListener(new MouseAdapter() {
        @Override//w  w w.ja v  a 2  s  .co  m
        public void mouseDoubleClick(MouseEvent e) {
            operationOutputTableAddButton(mappingSheetRow, tableViewer);
        }

        @Override
        public void mouseDown(MouseEvent e) {
        }
    });
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java

License:Apache License

private void operationalInputTableDoubleClick(final MappingSheetRow mappingSheetRow,
        final TableViewer tableViewer) {
    tableViewer.getTable().addMouseListener(new MouseAdapter() {
        @Override/*  ww w  .ja  v  a  2  s .c  om*/
        public void mouseDoubleClick(MouseEvent e) {
            operationInputTableAddButton(mappingSheetRow, tableViewer);
        }

        @Override
        public void mouseDown(MouseEvent e) {
        }
    });
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java

License:Apache License

private void deleteButtonListenerForOperationClassWidget(final MappingSheetRow mappingSheetRow,
        final TableViewer operationOutputtableViewer, Button deleteLabel) {
    deleteLabel.setToolTipText(Messages.DELETE_SCHEMA_TOOLTIP);
    deleteLabel.addMouseListener(new MouseAdapter() {
        @Override/*from  w w w  .  ja va  2s .c  om*/
        public void mouseUp(MouseEvent e) {
            Table table = operationOutputtableViewer.getTable();
            int temp = table.getSelectionIndex();
            int[] indexs = table.getSelectionIndices();
            mappingSheetRow.getOutputList().size();
            if (temp == -1) {
                WidgetUtility.errorMessage(Messages.SelectRowToDelete);
            } else {
                table.remove(indexs);

                List<FilterProperties> tempList = new ArrayList<FilterProperties>();
                for (int index : indexs) {
                    tempList.add(mappingSheetRow.getOutputList().get(index));
                }
                for (FilterProperties filterProperties : tempList) {
                    mappingSheetRow.getOutputList().remove(filterProperties);
                    int index = -1;
                    for (int j = 0; j < transformMapping.getOutputFieldList().size(); j++) {
                        if (transformMapping.getOutputFieldList().get(j) == filterProperties) {
                            index = j;
                            break;
                        }
                    }
                    if (index != -1)
                        transformMapping.getOutputFieldList().remove(index);

                }
                TransformMappingFeatureUtility.INSTANCE.setCursorOnDeleteRow(operationOutputtableViewer, indexs,
                        mappingSheetRow.getOutputList());
                refreshOutputTable();
                showHideValidationMessage();
            }
        }

    });
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java

License:Apache License

private void addIsParamSelectionListenerForOperationClassWidget(Button btnIsParam,
        final MappingSheetRow mappingSheetRow) {
    btnIsParam.addSelectionListener(new SelectionAdapter() {
        @Override/*from   w ww .  j a  va  2s  .c  o m*/
        public void widgetSelected(SelectionEvent e) {

            Button text = (Button) e.widget;
            Text parameterTextBox = (Text) text.getData(PARAMETER_TEXT_BOX);
            TableViewer operationInputFieldTableViewer = (TableViewer) text
                    .getData(OPERATION_INPUT_FIELD_TABLE_VIEWER);
            TableViewer operationOutputFieldTableViewer = (TableViewer) text
                    .getData(OPERATION_OUTPUT_FIELD_TABLE_VIEWER);

            Text operationClassTextBox = (Text) text.getData(OPERATION_CLASS_TEXT_BOX);
            Text operationIDTextBox = (Text) text.getData(OPERATION_ID_TEXT_BOX);
            Button btnNewButton = (Button) text.getData(BTN_NEW_BUTTON);
            Button inputAdd = (Button) text.getData(INPUT_ADD_BUTTON);
            Button inputDelete = (Button) text.getData(INPUT_DELETE_BUTTON);
            Button outputAdd = (Button) text.getData(OUTPUT_ADD_BUTTON);
            Button outputDelete = (Button) text.getData(OUTPUT_DELETE_BUTTON);

            if (text.getSelection()) {
                if (WidgetUtility.eltConfirmMessage(Messages.ALL_DATA_WILL_BE_LOST_DO_YOU_WISH_TO_CONTINUE)) {
                    mappingSheetRow.setWholeOperationParameter(text.getSelection());
                    parameterTextBox.setEnabled(true);

                    operationInputFieldTableViewer.getTable().setEnabled(false);
                    operationInputFieldTableViewer.getTable().clearAll();
                    operationOutputFieldTableViewer.getTable().setEnabled(false);
                    operationOutputFieldTableViewer.getTable().clearAll();

                    operationClassTextBox.setEnabled(false);
                    operationClassTextBox.setText("");
                    operationIDTextBox.setEnabled(false);

                    btnNewButton.setEnabled(false);
                    outputAdd.setEnabled(false);
                    outputDelete.setEnabled(false);
                    inputAdd.setEnabled(false);
                    inputDelete.setEnabled(false);
                    transformMapping.getOutputFieldList().removeAll(mappingSheetRow.getOutputList());
                    mappingSheetRow.getOutputList().clear();
                    mappingSheetRow.getInputFields().clear();
                    mappingSheetRow.setComboBoxValue(Messages.CUSTOM);
                    mappingSheetRow.getNameValueProperty().clear();
                    mappingSheetRow.setClassParameter(false);
                    mappingSheetRow.setOperationClassPath("");
                    refreshOutputTable();
                    showHideValidationMessage();

                } else
                    text.setSelection(false);
            } else {
                parameterTextBox.setText("");
                mappingSheetRow.setWholeOperationParameter(text.getSelection());
                parameterTextBox.setEnabled(false);

                operationInputFieldTableViewer.getTable().setEnabled(true);
                operationInputFieldTableViewer.refresh();
                operationOutputFieldTableViewer.getTable().setEnabled(true);
                operationOutputFieldTableViewer.refresh();
                operationClassTextBox.setEnabled(true);
                operationClassTextBox.setText("");
                operationIDTextBox.setEnabled(true);

                btnNewButton.setEnabled(true);
                inputAdd.setEnabled(true);
                inputDelete.setEnabled(true);
                outputAdd.setEnabled(true);
                outputDelete.setEnabled(true);

            }
        }

    });
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java

License:Apache License

private void addIsParamSelectionListener(Button btnIsParam, final MappingSheetRow mappingSheetRow) {
    btnIsParam.addSelectionListener(new SelectionAdapter() {
        @Override//from  w  w  w .j  a v a 2  s .c  o m
        public void widgetSelected(SelectionEvent e) {

            Button isParam = (Button) e.widget;
            TableViewer tableViewer = (TableViewer) isParam.getData("inputFieldTable");
            Button addButton = (Button) isParam.getData("addButton");
            Button deleteButton = (Button) isParam.getData("deleteButton");
            Text expressionIdTextBox = (Text) isParam.getData("expressionIdTextBox");
            Button browseButton = (Button) isParam.getData("expressionEditorButton");
            Text outputFieldTextBox = (Text) isParam.getData("outputFieldTextBox");
            Text expressionTextBox = (Text) isParam.getData("expressionTextBox");
            Text parameterTextBox = (Text) isParam.getData("parameterTextBox");
            Text textAccumulator = (Text) isParam.getData("textAccumulator");
            Button isParamAccumulator = (Button) isParam.getData("isParamAccumulator");
            Combo comboDataTypes = (Combo) isParam.getData("comboDataTypes");
            Text mergeExpressionTextBox = (Text) isParam.getData(Constants.EXPRESSION_TEXT_BOX1);
            Button mergeExpressionBrowseButton = (Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON1);
            if (isParam.getSelection()) {
                if (WidgetUtility.eltConfirmMessage(Messages.ALL_DATA_WILL_BE_LOST_DO_YOU_WISH_TO_CONTINUE)) {
                    parameterTextBox.setEnabled(true);
                    mappingSheetRow.setWholeOperationParameter(true);
                    mappingSheetRow.getExpressionEditorData().setExpression("");
                    mappingSheetRow.getExpressionEditorData().getSelectedInputFieldsForExpression().clear();
                    tableViewer.getTable().clearAll();
                    tableViewer.getTable().setEnabled(false);
                    addButton.setEnabled(false);
                    deleteButton.setEnabled(false);
                    expressionIdTextBox.setEnabled(false);
                    expressionTextBox.setText("");
                    browseButton.setEnabled(false);
                    if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
                        mergeExpressionBrowseButton.setEnabled(false);
                        mergeExpressionTextBox.setText("");
                        mappingSheetRow.getMergeExpressionDataForGroupCombine().setExpression("");
                        mappingSheetRow.getMergeExpressionDataForGroupCombine()
                                .getSelectedInputFieldsForExpression().clear();
                    }
                    outputFieldTextBox.setText("");
                    outputFieldTextBox.setEnabled(false);
                    textAccumulator.setEnabled(false);
                    isParamAccumulator.setEnabled(false);
                    comboDataTypes.setEnabled(false);

                    mappingSheetRow.getInputFields().clear();
                    mappingSheetRow.getOutputList().clear();
                    refreshOutputTable();
                    showHideValidationMessage();
                } else
                    isParam.setSelection(false);
            } else {
                parameterTextBox.setText("");
                expressionTextBox.setText("");
                parameterTextBox.setEnabled(false);
                mappingSheetRow.setWholeOperationParameter(false);
                tableViewer.getTable().setEnabled(true);
                tableViewer.refresh();
                addButton.setEnabled(true);
                deleteButton.setEnabled(true);
                expressionIdTextBox.setEnabled(true);
                browseButton.setEnabled(true);
                outputFieldTextBox.setEnabled(true);
                textAccumulator.setEnabled(true);
                isParamAccumulator.setEnabled(true);
                comboDataTypes.setEnabled(true);
                if (Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName())) {
                    mergeExpressionBrowseButton.setEnabled(true);
                    mergeExpressionTextBox.setText("");
                }
            }
        }
    });
}