Search in sources :

Example 51 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project cubrid-manager by CUBRID.

the class TableConfigCellEditor method createControl.

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FormLayout());
    setControl(container);
    Composite leftComposite = new Composite(container, SWT.NONE);
    leftComposite.setLayout(new GridLayout(1, false));
    FormData leftData = new FormData();
    leftData.top = new FormAttachment(0, 5);
    leftData.bottom = new FormAttachment(100, 0);
    leftData.left = new FormAttachment(0, 5);
    leftData.right = new FormAttachment(55, 0);
    leftComposite.setLayoutData(leftData);
    Group grpButtons = new Group(leftComposite, SWT.NONE);
    {
        grpButtons.setLayout(new GridLayout(4, false));
        grpButtons.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
        grpButtons.setText(Messages.grpAddRemove);
    }
    Button sqlSchemaFileButton = new Button(grpButtons, SWT.NONE);
    sqlSchemaFileButton.setText(Messages.btnAddSchemaFile);
    sqlSchemaFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlSchemaFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addFile(TableConfig.TYPE_SCHEMA);
        }
    });
    Button sqlDataFileButton = new Button(grpButtons, SWT.NONE);
    sqlDataFileButton.setText(Messages.btnAddDataFile);
    sqlDataFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlDataFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addFile(TableConfig.TYPE_DATA);
        }
    });
    Button sqlIndexFileButton = new Button(grpButtons, SWT.NONE);
    sqlIndexFileButton.setText(Messages.btnAddIndexFile);
    sqlIndexFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlIndexFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addFile(TableConfig.TYPE_INDEX);
        }
    });
    delFileButton = new Button(grpButtons, SWT.NONE);
    delFileButton.setText(Messages.btnDelFiles);
    delFileButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    delFileButton.setEnabled(false);
    delFileButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            deleteSelectedFile();
        }
    });
    sqlFileTableViewer = new TableViewer(leftComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    sqlFileTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 4, 1, -1, -1));
    sqlFileTableViewer.getTable().setLinesVisible(true);
    sqlFileTableViewer.getTable().setHeaderVisible(true);
    final TableViewerColumn fileNameCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
    fileNameCol.getColumn().setWidth(300);
    fileNameCol.getColumn().setText(Messages.columnImportFileName);
    final TableViewerColumn fileTypeCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
    fileTypeCol.getColumn().setWidth(100);
    fileTypeCol.getColumn().setText(Messages.columnImportFileType);
    CellEditor[] editors = new CellEditor[4];
    editors[0] = new TextCellEditor(sqlFileTableViewer.getTable());
    editors[1] = new ComboBoxCellEditor(sqlFileTableViewer.getTable(), TYPE_ITEMS, SWT.READ_ONLY);
    sqlFileTableViewer.setColumnProperties(PROPS);
    sqlFileTableViewer.setContentProvider(new SQLFileTableContentProvider());
    sqlFileTableViewer.setLabelProvider(new SQLFileTableLabelProvider());
    sqlFileTableViewer.setCellModifier(new TableConfigCellEditor(sqlFileTableViewer, this));
    sqlFileTableViewer.setCellEditors(editors);
    sqlFileTableViewer.getTable().addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            delFileButton.setEnabled(delCanEnable());
        }
    });
    Composite rightComposite = new Composite(container, SWT.NONE);
    FormData rightData = new FormData();
    rightData.top = new FormAttachment(0, 5);
    rightData.bottom = new FormAttachment(100, 0);
    rightData.left = new FormAttachment(55, 0);
    rightData.right = new FormAttachment(100, -5);
    rightComposite.setLayoutData(rightData);
    GridLayout rightCompositeLayout = new GridLayout();
    rightCompositeLayout.verticalSpacing = 10;
    rightComposite.setLayout(rightCompositeLayout);
    Group enCodingOptionGroup = new Group(rightComposite, SWT.None);
    enCodingOptionGroup.setText(Messages.grpEncodingOption);
    enCodingOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    enCodingOptionGroup.setLayout(new GridLayout(4, false));
    Label dbCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
    dbCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    dbCharsetLabel.setText(Messages.lblDBCharset);
    dbCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
    dbCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
    dbCharsetCombo.setEnabled(false);
    Label fileCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
    fileCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    fileCharsetLabel.setText(Messages.lblFileCharset);
    fileCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
    fileCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
    fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
    fileCharsetCombo.select(0);
    fileCharsetCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            getImportDataWizard().getImportConfig().setFilesCharset(fileCharsetCombo.getText());
        }
    });
    Group importOptionGroup = new Group(rightComposite, SWT.None);
    importOptionGroup.setText(Messages.grpImportOptions);
    importOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    importOptionGroup.setLayout(new GridLayout(2, false));
    Label threadCountLabel = new Label(importOptionGroup, SWT.None);
    threadCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    threadCountLabel.setText(Messages.lblThreadNum);
    threadCountSpinner = new Spinner(importOptionGroup, SWT.BORDER);
    threadCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    threadCountSpinner.setMaximum(ImportConfig.MAX_IMPORT_THREAD_COUNT);
    threadCountSpinner.setMinimum(ImportConfig.MIN_IMPORT_THREAD_COUNT);
    threadCountSpinner.setSelection(ImportConfig.DEFAULT_IMPORT_THREAD_COUNT);
    threadCountSpinner.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            validate();
        }
    });
    Label commitCountLabel = new Label(importOptionGroup, SWT.None);
    commitCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    commitCountLabel.setText(Messages.lblCommitCount);
    commitCountSpinner = new Spinner(importOptionGroup, SWT.BORDER);
    commitCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    commitCountSpinner.setMaximum(ImportConfig.MAX_IMPORT_COMMIT_COUNT);
    commitCountSpinner.setMinimum(ImportConfig.MIN_IMPORT_COMMIT_COUNT);
    commitCountSpinner.setIncrement(ImportConfig.IMPORT_COMMIT_STEP);
    commitCountSpinner.setSelection(ImportConfig.DEFAULT_IMPORT_COMMIT_COUNT);
    final Button haModeButton = new Button(rightComposite, SWT.CHECK);
    haModeButton.setText(Messages.btnInHaMode);
    haModeButton.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    haModeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ImportConfig importConfig = getImportDataWizard().getImportConfig();
            importConfig.setHaMode(haModeButton.getSelection());
            Collections.sort(fileList, new TableConfigComparator(getImportDataWizard().getImportConfig()));
            sqlFileTableViewer.refresh();
        }
    });
    registerContextMenu();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 52 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project cubrid-manager by CUBRID.

the class ImportTypePage method createControl.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FormLayout());
    setControl(container);
    Composite leftComposite = new Composite(container, SWT.NONE);
    FormData leftData = new FormData();
    leftData.top = new FormAttachment(0, 5);
    leftData.bottom = new FormAttachment(100, 0);
    leftData.left = new FormAttachment(0, 5);
    leftData.right = new FormAttachment(50, 0);
    GridLayout leftLayout = new GridLayout();
    leftLayout.verticalSpacing = 0;
    leftComposite.setLayout(leftLayout);
    leftComposite.setLayoutData(leftData);
    Composite rightComposite = new Composite(container, SWT.NONE);
    FormData rightData = new FormData();
    rightData.top = new FormAttachment(0, 5);
    rightData.bottom = new FormAttachment(100, 0);
    rightData.left = new FormAttachment(50, 0);
    rightData.right = new FormAttachment(100, -5);
    GridLayout rightLayout = new GridLayout();
    rightLayout.verticalSpacing = 0;
    rightComposite.setLayout(rightLayout);
    rightComposite.setLayoutData(rightData);
    sqlButton = new Button(leftComposite, SWT.RADIO);
    sqlButton.setText(Messages.btnImportSQL);
    sqlButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    sqlButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        public void widgetSelected(SelectionEvent e) {
            excelButton.setSelection(!sqlButton.getSelection());
            txtButton.setSelection(!sqlButton.getSelection());
            historyButton.setSelection(!sqlButton.getSelection());
            historyCombo.setEnabled(false);
            deleteButton.setEnabled(false);
            renameButton.setEnabled(false);
            validate();
        }
    });
    Group sqlLabelGroup = new Group(leftComposite, SWT.None);
    sqlLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
    sqlLabelGroup.setLayout(new FillLayout());
    Label sqlLabel = new Label(sqlLabelGroup, SWT.WRAP);
    sqlLabel.setText(Messages.lblImportSQL);
    Label separator1Label = new Label(leftComposite, SWT.None);
    separator1Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
    {
        Label separator4Label = new Label(leftComposite, SWT.None);
        separator4Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
        excelButton = new Button(leftComposite, SWT.RADIO);
        excelButton.setText(Messages.btnImportExcel);
        excelButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        excelButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }

            public void widgetSelected(SelectionEvent e) {
                sqlButton.setSelection(!excelButton.getSelection());
                txtButton.setSelection(!excelButton.getSelection());
                historyButton.setSelection(!excelButton.getSelection());
                historyCombo.setEnabled(false);
                deleteButton.setEnabled(false);
                renameButton.setEnabled(false);
                validate();
            }
        });
        Group excelLabelGroup = new Group(leftComposite, SWT.None);
        excelLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
        excelLabelGroup.setLayout(new FillLayout());
        Label excelLabel = new Label(excelLabelGroup, SWT.WRAP);
        excelLabel.setText(Messages.lblImportExcel);
        Label separator2Label = new Label(leftComposite, SWT.None);
        separator2Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
    }
    // Txt
    {
        txtButton = new Button(rightComposite, SWT.RADIO);
        txtButton.setText(Messages.btnImportTxt);
        txtButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        txtButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }

            public void widgetSelected(SelectionEvent e) {
                sqlButton.setSelection(!txtButton.getSelection());
                excelButton.setSelection(!txtButton.getSelection());
                historyButton.setSelection(!txtButton.getSelection());
                historyCombo.setEnabled(false);
                deleteButton.setEnabled(false);
                renameButton.setEnabled(false);
                validate();
            }
        });
        Group txtLabelGroup = new Group(rightComposite, SWT.None);
        txtLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
        txtLabelGroup.setLayout(new FillLayout());
        Label txtLabel = new Label(txtLabelGroup, SWT.WRAP);
        txtLabel.setText(Messages.lblImportTxt);
        Label separator3Label = new Label(rightComposite, SWT.None);
        separator3Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
    }
    // History Button
    {
        Label separator4Label = new Label(rightComposite, SWT.None);
        separator4Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
        historyButton = new Button(rightComposite, SWT.RADIO);
        historyButton.setText(Messages.btnImportHistory);
        historyButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        historyButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }

            public void widgetSelected(SelectionEvent e) {
                sqlButton.setSelection(!historyButton.getSelection());
                excelButton.setSelection(!historyButton.getSelection());
                txtButton.setSelection(!historyButton.getSelection());
                historyCombo.setEnabled(historyButton.getSelection());
                if (historyButton.getSelection()) {
                    loadHistory();
                }
                validate();
            }
        });
        Group historyLabelGroup = new Group(rightComposite, SWT.None);
        historyLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
        historyLabelGroup.setLayout(new FillLayout());
        Label historyLabel = new Label(historyLabelGroup, SWT.WRAP);
        historyLabel.setText(Messages.lblImportHistory);
        Composite historyComposite = new Composite(rightComposite, SWT.None);
        historyComposite.setLayout(new GridLayout(3, false));
        historyComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
        historyCombo = new Combo(historyComposite, SWT.READ_ONLY);
        historyCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
        historyCombo.setEnabled(false);
        historyCombo.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                widgetDefaultSelected(e);
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                validate();
            }
        });
        loadHistory();
        final ImportConfigManager configManager = ImportConfigManager.getInstance();
        renameButton = new Button(historyComposite, SWT.None);
        renameButton.setText(Messages.btnRenameHistory);
        renameButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        renameButton.setEnabled(false);
        renameButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }

            public void widgetSelected(SelectionEvent e) {
                String historyName = historyCombo.getText();
                if (historyName == null || historyName.trim().length() == 0) {
                    return;
                }
                ImportConfig model = configManager.getConfig(historyName);
                if (model == null) {
                    return;
                }
                InputDialog dialog = new InputDialog(getShell(), Messages.titleRenameDialog, Messages.descRenameDialog, historyName, new IInputValidator() {

                    public String isValid(String newText) {
                        if (newText == null || newText.trim().length() == 0) {
                            return Messages.msgRenamePleaseInputNewName;
                        }
                        if (configManager.getConfig(newText) != null) {
                            return Messages.msgRenameAlreadyExists;
                        }
                        return null;
                    }
                });
                if (dialog.open() == IDialogConstants.OK_ID) {
                    String newName = dialog.getValue();
                    model.setName(newName);
                    configManager.saveConfigs();
                    historyCombo.remove(historyName);
                    historyCombo.add(newName);
                    historyCombo.setText(newName);
                }
            }
        });
        deleteButton = new Button(historyComposite, SWT.None);
        deleteButton.setText(Messages.btnDeleteHistory);
        deleteButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
        deleteButton.setEnabled(false);
        deleteButton.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                if (!CommonUITool.openConfirmBox(Messages.confirmDeleteImportHistory)) {
                    return;
                }
                boolean result = ImportConfigManager.getInstance().removeConfig(historyCombo.getText());
                if (result) {
                    historyCombo.remove(historyCombo.getText());
                    validate();
                }
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                widgetDefaultSelected(e);
            }
        });
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) InputDialog(org.eclipse.jface.dialogs.InputDialog) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) FillLayout(org.eclipse.swt.layout.FillLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener) IInputValidator(org.eclipse.jface.dialogs.IInputValidator)

Example 53 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project cubrid-manager by CUBRID.

the class QueryRecordListComparator method createQueryCompareTab.

private void createQueryCompareTab(CTabFolder tabFolder) {
    CTabItem item = new CTabItem(tabFolder, SWT.None | SWT.MULTI | SWT.V_SCROLL);
    item.setText(Messages.tabItemQueryCompare);
    Composite composite = new Composite(tabFolder, SWT.None);
    composite.setLayout(new GridLayout());
    item.setControl(composite);
    Composite topComposite = new Composite(composite, SWT.None);
    topComposite.setLayout(new FormLayout());
    topComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 25));
    Composite leftTopComposite = new Composite(topComposite, SWT.None);
    FormData leftTopData = new FormData();
    leftTopData.top = new FormAttachment(0, 0);
    leftTopData.bottom = new FormAttachment(100, 0);
    leftTopData.left = new FormAttachment(0, 0);
    leftTopData.right = new FormAttachment(50, 0);
    leftTopComposite.setLayoutData(leftTopData);
    leftTopComposite.setLayout(new GridLayout(2, false));
    Composite rightTopComposite = new Composite(topComposite, SWT.None);
    FormData rightTopData = new FormData();
    rightTopData.top = new FormAttachment(0, 0);
    rightTopData.bottom = new FormAttachment(100, 0);
    rightTopData.left = new FormAttachment(50, 0);
    rightTopData.right = new FormAttachment(100, 0);
    rightTopComposite.setLayoutData(rightTopData);
    rightTopComposite.setLayout(new GridLayout(5, false));
    Label leftLabel = new Label(leftTopComposite, SWT.None);
    leftLabel.setText(Messages.lblQuery);
    leftLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    queryRecordLeftCombo = new Combo(leftTopComposite, SWT.READ_ONLY);
    queryRecordLeftCombo.setLayoutData(CommonUITool.createGridData(1, 1, 200, -1));
    queryRecordLeftCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            displayCompareQueryRecord();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    Label rightLabel = new Label(rightTopComposite, SWT.None);
    rightLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    rightLabel.setText(Messages.lblQuery);
    queryRecordRightCombo = new Combo(rightTopComposite, SWT.READ_ONLY);
    queryRecordRightCombo.setLayoutData(CommonUITool.createGridData(1, 1, 200, -1));
    queryRecordRightCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            displayCompareQueryRecord();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    ToolBar leftToolBar = new ToolBar(rightTopComposite, SWT.None);
    leftToolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    compareItem = new ToolItem(leftToolBar, SWT.None);
    compareItem.setImage(CommonUIPlugin.getImage("icons/action/refresh_tuning.png"));
    compareItem.setToolTipText(Messages.itemTooltipCompare);
    compareItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            displayCompareQueryRecord();
        }
    });
    delQueryRecordItem = new ToolItem(leftToolBar, SWT.None);
    delQueryRecordItem.setImage(CommonUIPlugin.getImage("icons/queryplan/delete_query.gif"));
    delQueryRecordItem.setToolTipText(Messages.itemTooltipRemoveQuery);
    delQueryRecordItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            if (CommonUITool.openConfirmBox(Messages.confirmDeleteQueryPlanOnTuner)) {
                removeQueryRecord();
            }
        }
    });
    Composite folderPlaceComposite = new Composite(rightTopComposite, SWT.None);
    folderPlaceComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    ToolBar rightToolBar = new ToolBar(rightTopComposite, SWT.None);
    rightToolBar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    multiRunItem = new ToolItem(rightToolBar, SWT.None);
    multiRunItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_multi_run.png"));
    multiRunItem.setToolTipText(Messages.itemTooltipRunAgain);
    multiRunItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            QueryRecord leftRecord = getSelectedLeftQueryRecord();
            QueryRecord rightRecord = getSelectedRightQueryRecord();
            if (leftRecord == null || rightRecord == null) {
                CommonUITool.openErrorBox(Messages.errCompareQueryEmpty);
                return;
            }
            runQueryPlanAgain(leftRecord.getQuery(), rightRecord.getQuery());
        }
    });
    sqlModeItem = new ToolItem(rightToolBar, SWT.CHECK);
    sqlModeItem.setImage(CommonUIPlugin.getImage("icons/queryplan/sql_compare.gif"));
    sqlModeItem.setToolTipText(Messages.itemTooltipQuery);
    sqlModeItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            updateCompareDisplayModel(DISPLAY_SQL);
        }
    });
    textModelItem = new ToolItem(rightToolBar, SWT.CHECK);
    textModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_raw.png"));
    textModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
    textModelItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            updateCompareDisplayModel(DISPLAY_TEXT);
        }
    });
    treeModelItem = new ToolItem(rightToolBar, SWT.CHECK);
    treeModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_tree.png"));
    treeModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
    treeModelItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            updateCompareDisplayModel(DISPLAY_TREE);
        }
    });
    graphModelItem = new ToolItem(rightToolBar, SWT.CHECK);
    graphModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_graph.png"));
    graphModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
    graphModelItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            updateCompareDisplayModel(DISPLAY_GRAPH);
        }
    });
    Composite tablesComposite = new Composite(composite, SWT.None);
    tablesComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 60));
    tablesComposite.setLayout(new FormLayout());
    /*Left composite*/
    Composite leftTableComposite = new Composite(tablesComposite, SWT.BORDER);
    leftTableComposite.setLayout(new GridLayout());
    FormData leftTableData = new FormData();
    leftTableData.top = new FormAttachment(0, 0);
    leftTableData.bottom = new FormAttachment(100, 0);
    leftTableData.left = new FormAttachment(0, 0);
    leftTableData.right = new FormAttachment(50, -2);
    leftTableComposite.setLayoutData(leftTableData);
    /*Right composite*/
    Composite rightTableComposite = new Composite(tablesComposite, SWT.BORDER);
    rightTableComposite.setLayout(new GridLayout());
    FormData rightTabelData = new FormData();
    rightTabelData.top = new FormAttachment(0, 0);
    rightTabelData.bottom = new FormAttachment(100, 0);
    rightTabelData.left = new FormAttachment(50, 2);
    rightTabelData.right = new FormAttachment(100, 0);
    rightTableComposite.setLayoutData(rightTabelData);
    compareLeftTableViewer = new TableViewer(leftTableComposite, SWT.FULL_SELECTION);
    compareLeftTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    compareLeftTableViewer.getTable().setHeaderVisible(true);
    compareLeftTableViewer.getTable().setLinesVisible(false);
    compareLeftTableViewer.setContentProvider(new QueryPlanContentProvider());
    compareLeftTableViewer.setLabelProvider(new QueryPlanLabelPrivoder(compareLeftTableViewer, false));
    TableColumn fetchColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
    fetchColumnLeft.setText(Messages.columnFetches);
    fetchColumnLeft.setWidth(60);
    TableColumn dirtyColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
    dirtyColumnLeft.setText(Messages.columnDirties);
    dirtyColumnLeft.setWidth(60);
    TableColumn ioReadColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
    ioReadColumnLeft.setText(Messages.columnIORead);
    ioReadColumnLeft.setWidth(80);
    TableColumn ioWriteColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
    ioWriteColumnLeft.setText(Messages.columnIOWrite);
    ioWriteColumnLeft.setWidth(80);
    TableColumn costColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
    costColumnLeft.setText(Messages.columnCost);
    costColumnLeft.setWidth(60);
    compareRightTableViewer = new TableViewer(rightTableComposite, SWT.FULL_SELECTION);
    compareRightTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    compareRightTableViewer.getTable().setHeaderVisible(true);
    compareRightTableViewer.getTable().setLinesVisible(false);
    compareRightTableViewer.setContentProvider(new QueryPlanContentProvider());
    compareRightTableViewer.setLabelProvider(new QueryPlanLabelPrivoder(compareRightTableViewer, false));
    TableColumn fetchColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
    fetchColumnRight.setText(Messages.columnFetches);
    fetchColumnRight.setWidth(60);
    TableColumn dirtyColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
    dirtyColumnRight.setText(Messages.columnDirties);
    dirtyColumnRight.setWidth(60);
    TableColumn ioReadColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
    ioReadColumnRight.setText(Messages.columnIORead);
    ioReadColumnRight.setWidth(80);
    TableColumn ioWriteColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
    ioWriteColumnRight.setText(Messages.columnIOWrite);
    ioWriteColumnRight.setWidth(80);
    TableColumn costColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
    costColumnRight.setText(Messages.columnCost);
    costColumnRight.setWidth(60);
    queryPlanCompareSashForm = new SashForm(composite, SWT.VERTICAL);
    queryPlanCompareSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    queryPlanCompareSashForm.setBackground(SASH_COLOR);
    queryPlanCompareSashForm.setLayout(new GridLayout());
    queryPlanCompareSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    Composite textMergeComposite = new Composite(queryPlanCompareSashForm, SWT.None);
    textMergeComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    textMergeComposite.setLayout(new FillLayout());
    textMergeConfig = new CompareConfiguration();
    textMergeConfig.setProperty(CompareConfiguration.SHOW_PSEUDO_CONFLICTS, Boolean.FALSE);
    textMergeConfig.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.TRUE);
    textMergeConfig.setLeftEditable(false);
    textMergeConfig.setRightEditable(false);
    textMergeViewer = new TextMergeViewer(textMergeComposite, SWT.BORDER, textMergeConfig);
    DiffNode queryDiffNode = new DiffNode(null, Differencer.CHANGE, null, new TextCompareInput(""), new TextCompareInput(""));
    textMergeViewer.setInput(queryDiffNode);
    Composite compareQueryPlanComposite = new Composite(queryPlanCompareSashForm, SWT.None);
    compareQueryPlanComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    compareQueryPlanComposite.setLayout(new FormLayout());
    DatabaseInfo databaseInfo = database == null ? null : database.getDatabaseInfo();
    leftComparePlanComposite = new QueryPlanComposite(compareQueryPlanComposite, SWT.BORDER, null, databaseInfo);
    FormData leftData = new FormData();
    leftData.top = new FormAttachment(0, 0);
    leftData.bottom = new FormAttachment(100, 0);
    leftData.left = new FormAttachment(0, 0);
    leftData.right = new FormAttachment(50, 0);
    leftComparePlanComposite.setLayoutData(leftData);
    rightComparePlanComposite = new QueryPlanComposite(compareQueryPlanComposite, SWT.BORDER, null, databaseInfo);
    FormData rightData = new FormData();
    rightData.top = new FormAttachment(0, 0);
    rightData.bottom = new FormAttachment(100, 0);
    rightData.left = new FormAttachment(50, 0);
    rightData.right = new FormAttachment(100, 0);
    rightComparePlanComposite.setLayoutData(rightData);
    queryPlanCompareSashForm.setWeights(new int[] { 100, 0 });
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) CompareConfiguration(org.eclipse.compare.CompareConfiguration) Label(org.eclipse.swt.widgets.Label) DiffNode(org.eclipse.compare.structuremergeviewer.DiffNode) Combo(org.eclipse.swt.widgets.Combo) CTabItem(org.eclipse.swt.custom.CTabItem) TextMergeViewer(org.eclipse.compare.contentmergeviewer.TextMergeViewer) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextCompareInput(com.cubrid.common.ui.compare.schema.control.TextCompareInput) FormAttachment(org.eclipse.swt.layout.FormAttachment) ToolItem(org.eclipse.swt.widgets.ToolItem) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) QueryPlanComposite(com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite) QueryPlanComposite(com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite) QueryRecord(com.cubrid.common.ui.query.tuner.QueryRecord) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) SashForm(org.eclipse.swt.custom.SashForm) ToolBar(org.eclipse.swt.widgets.ToolBar) TableViewer(org.eclipse.jface.viewers.TableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 54 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project bndtools by bndtools.

the class ImportBndWorkspaceWizardPageOne method createControl.

@Override
public void createControl(final Composite parent) {
    final Composite container = new Composite(parent, SWT.NONE);
    Label lblFolder = new Label(container, SWT.NONE);
    lblFolder.setText("Root Directory:");
    txtFolder = new Text(container, SWT.BORDER | SWT.SINGLE);
    txtFolder.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent event) {
            getWizard().getContainer().updateButtons();
        }
    });
    //Adding the decorator
    txtFolderErrorDecorator = new ControlDecoration(txtFolder, SWT.TOP | SWT.RIGHT);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
    Image img = fieldDecoration.getImage();
    txtFolderErrorDecorator.setImage(img);
    txtFolderErrorDecorator.setDescriptionText("Selected folder must contain valid Bnd Workspace configuration project.");
    // hiding it initially
    txtFolderErrorDecorator.hide();
    Button btnOpenDialog = new Button(container, SWT.PUSH);
    btnOpenDialog.setText("Browse...");
    btnOpenDialog.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            DirectoryDialog dirDialog = new DirectoryDialog(container.getShell());
            dirDialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
            dirDialog.setText("Select the folder containing the project.");
            txtFolder.setText(dirDialog.open());
            getWizard().getContainer().updateButtons();
        }
    });
    Label lblProjects = new Label(container, SWT.NONE);
    lblProjects.setText("Projects:");
    tableViewer = new TableViewer(container, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    tableViewer.setContentProvider(ArrayContentProvider.getInstance());
    tableViewer.setComparator(new ViewerComparator() {

        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            // configuration project always first
            if (e1 instanceof File && e2 instanceof Project) {
                return -1;
            } else if (e1 instanceof Project && e2 instanceof File) {
                return 1;
            }
            Project p1 = (Project) e1;
            Project p2 = (Project) e2;
            return super.compare(viewer, p1.getName(), p2.getName());
        }
    });
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            // Disable selection since the tableviewer should be readonly, but not disabled
            if (!event.getSelection().isEmpty()) {
                tableViewer.setSelection(StructuredSelection.EMPTY);
            }
        }
    });
    TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
    column.setLabelProvider(new ProjectsColumnLabelProvider());
    Button refreshButton = new Button(container, SWT.PUSH);
    refreshButton.setText("Refresh");
    refreshButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            getWizard().getContainer().updateButtons();
        }
    });
    deleteButton = new Button(container, SWT.CHECK);
    deleteButton.setText("Delete existing settings");
    inferExecutionEnvironmentButton = new Button(container, SWT.CHECK);
    inferExecutionEnvironmentButton.setSelection(true);
    inferExecutionEnvironmentButton.setText("Infer execution-environment (J2SE and JavaSE).");
    inferExecutionEnvironmentButton.setToolTipText("Uses the 'javac.target' from the Bnd Workspace to infer a Execution Environment to the JRE container. If nothing matches, the default JRE will be used.\nExisting containers will be removed.");
    FormLayout layout = new FormLayout();
    container.setLayout(layout);
    FormData fd_lblFolder = new FormData();
    fd_lblFolder.top = new FormAttachment(0, 10);
    fd_lblFolder.left = new FormAttachment(0, 10);
    lblFolder.setLayoutData(fd_lblFolder);
    FormData fd_txtFolder = new FormData();
    fd_txtFolder.top = new FormAttachment(lblFolder, 0, SWT.CENTER);
    fd_txtFolder.left = new FormAttachment(lblFolder, 10);
    fd_txtFolder.right = new FormAttachment(100, -100);
    txtFolder.setLayoutData(fd_txtFolder);
    FormData fd_btnDialog = new FormData();
    fd_btnDialog.top = new FormAttachment(lblFolder, 0, SWT.CENTER);
    fd_btnDialog.left = new FormAttachment(txtFolder, 10);
    fd_btnDialog.right = new FormAttachment(100, -10);
    btnOpenDialog.setLayoutData(fd_btnDialog);
    FormData fd_lblProjects = new FormData();
    fd_lblProjects.top = new FormAttachment(lblFolder, 20);
    fd_lblProjects.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
    lblProjects.setLayoutData(fd_lblProjects);
    FormData fd_table = new FormData();
    fd_table.top = new FormAttachment(lblProjects, 5);
    fd_table.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
    fd_table.right = new FormAttachment(100, -100);
    fd_table.bottom = new FormAttachment(100, -55);
    tableViewer.getTable().setLayoutData(fd_table);
    FormData fd_btnRefresh = new FormData();
    fd_btnRefresh.top = new FormAttachment(tableViewer.getTable(), 0, SWT.TOP);
    fd_btnRefresh.left = new FormAttachment(btnOpenDialog, 0, SWT.LEFT);
    fd_btnRefresh.right = new FormAttachment(100, -10);
    refreshButton.setLayoutData(fd_btnRefresh);
    FormData fd_btnDelete = new FormData();
    fd_btnDelete.top = new FormAttachment(tableViewer.getTable(), 10);
    fd_btnDelete.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
    deleteButton.setLayoutData(fd_btnDelete);
    FormData fd_btnInfer = new FormData();
    fd_btnInfer.top = new FormAttachment(deleteButton, 10);
    fd_btnInfer.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
    inferExecutionEnvironmentButton.setLayoutData(fd_btnInfer);
    getShell().setMinimumSize(470, 450);
    // required to avoid an error in the system
    setControl(parent);
    setPageComplete(false);
    txtFolder.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
}
Also used : ModifyListener(org.eclipse.swt.events.ModifyListener) FieldDecoration(org.eclipse.jface.fieldassist.FieldDecoration) Label(org.eclipse.swt.widgets.Label) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Image(org.eclipse.swt.graphics.Image) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) FormAttachment(org.eclipse.swt.layout.FormAttachment) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Text(org.eclipse.swt.widgets.Text) IProject(org.eclipse.core.resources.IProject) Project(aQute.bnd.build.Project) TableViewer(org.eclipse.jface.viewers.TableViewer) File(java.io.File)

Example 55 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project bndtools by bndtools.

the class BndContainerPage method createControl.

/*
     * (non-Javadoc)
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets .Composite)
     */
@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new FormLayout());
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    composite.setFont(parent.getFont());
    setControl(composite);
    final Button wCreate = new Button(composite, SWT.NONE);
    wCreate.setEnabled(model == null);
    final FormData fd_wCreate = new FormData();
    fd_wCreate.bottom = new FormAttachment(100, -5);
    fd_wCreate.right = new FormAttachment(100, -4);
    wCreate.setLayoutData(fd_wCreate);
    wCreate.setText("Create bnd.bnd");
    final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER);
    table = tableViewer.getTable();
    final FormData fd_table = new FormData();
    fd_table.top = new FormAttachment(0, 3);
    fd_table.left = new FormAttachment(0, 3);
    fd_table.right = new FormAttachment(100, -4);
    fd_table.bottom = new FormAttachment(100, -37);
    table.setLayoutData(fd_table);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    final TableColumn wBsn = new TableColumn(table, SWT.NONE);
    wBsn.setWidth(200);
    wBsn.setText("Bundle Symbolic Name");
    final TableColumn wVersion = new TableColumn(table, SWT.NONE);
    wVersion.setWidth(100);
    wVersion.setText("Version");
    final TableColumn wOptions = new TableColumn(table, SWT.NONE);
    wOptions.setWidth(200);
    wOptions.setText("Options");
    final TableColumn wFile = new TableColumn(table, SWT.NONE);
    wFile.setWidth(100);
    wFile.setText("File");
    tableViewer.setContentProvider(new IStructuredContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (model != null)
                try {
                    return model.getBuildpath().toArray();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            return new Object[0];
        }

        @Override
        public void dispose() {
        // TODO Auto-generated method stub
        }

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }
    });
    tableViewer.setLabelProvider(new ITableLabelProvider() {

        @Override
        public Image getColumnImage(Object element, int columnIndex) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getColumnText(Object element, int columnIndex) {
            Container c = (Container) element;
            switch(columnIndex) {
                case 0:
                    return c.getBundleSymbolicName();
                case 1:
                    return c.getVersion();
                case 2:
                    return c.getError();
                case 3:
                    return c.getFile() + " (" + (c.getFile() != null && c.getFile().exists() ? "exists" : "?") + ")";
                default:
                    break;
            }
            return null;
        }

        @Override
        public void addListener(ILabelProviderListener listener) {
        // TODO Auto-generated method stub
        }

        @Override
        public void dispose() {
        // TODO Auto-generated method stub
        }

        @Override
        public boolean isLabelProperty(Object element, String property) {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public void removeListener(ILabelProviderListener listener) {
        // TODO Auto-generated method stub
        }
    });
    tableViewer.setInput(model);
    wCreate.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            System.out.println("defw selected");
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            wCreate.setEnabled(!createBnd());
            tableViewer.setInput(model);
        }
    });
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) Image(org.eclipse.swt.graphics.Image) TableColumn(org.eclipse.swt.widgets.TableColumn) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) Container(aQute.bnd.build.Container) Button(org.eclipse.swt.widgets.Button) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) GridData(org.eclipse.swt.layout.GridData) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

FormLayout (org.eclipse.swt.layout.FormLayout)127 FormData (org.eclipse.swt.layout.FormData)97 FormAttachment (org.eclipse.swt.layout.FormAttachment)93 Composite (org.eclipse.swt.widgets.Composite)82 Button (org.eclipse.swt.widgets.Button)54 Label (org.eclipse.swt.widgets.Label)53 SelectionEvent (org.eclipse.swt.events.SelectionEvent)39 Point (org.eclipse.swt.graphics.Point)33 Group (org.eclipse.swt.widgets.Group)31 GridData (org.eclipse.swt.layout.GridData)30 Text (org.eclipse.swt.widgets.Text)30 GridLayout (org.eclipse.swt.layout.GridLayout)29 SelectionListener (org.eclipse.swt.events.SelectionListener)27 Combo (org.eclipse.swt.widgets.Combo)25 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)19 FillLayout (org.eclipse.swt.layout.FillLayout)19 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)17 StyledText (org.eclipse.swt.custom.StyledText)13 ModifyListener (org.eclipse.swt.events.ModifyListener)12 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11