Example usage for org.eclipse.jface.viewers TableViewerColumn TableViewerColumn

List of usage examples for org.eclipse.jface.viewers TableViewerColumn TableViewerColumn

Introduction

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

Prototype

public TableViewerColumn(TableViewer viewer, TableColumn column) 

Source Link

Document

Creates a new viewer column for the given TableViewer on the given TableColumn .

Usage

From source file:com.hangum.tadpole.monitoring.core.dialogs.schedule.AddScheduleDialog.java

License:Open Source License

/**
 * Create contents of the dialog./*from www  .j av a2 s. c om*/
 * @param parent
 */
@Override
protected Control createDialogArea(final Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.verticalSpacing = 5;
    gridLayout.horizontalSpacing = 5;
    gridLayout.marginHeight = 5;
    gridLayout.marginWidth = 5;

    Composite compositeHead = new Composite(container, SWT.BORDER);
    compositeHead.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    compositeHead.setLayout(new GridLayout(3, false));

    Label lblTitle = new Label(compositeHead, SWT.NONE);
    lblTitle.setText(Messages.AddScheduleDialog_0);

    textTitle = new Text(compositeHead, SWT.BORDER);
    textTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(compositeHead, SWT.NONE);

    Label lblDescription = new Label(compositeHead, SWT.NONE);
    lblDescription.setText(Messages.AddScheduleDialog_1);

    textDescription = new Text(compositeHead, SWT.BORDER);
    textDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(compositeHead, SWT.NONE);

    Label lblCronExpression = new Label(compositeHead, SWT.NONE);
    lblCronExpression.setText("<a href='http://www.cronmaker.com/' target='_blank'>Cron Expression</a>"); //$NON-NLS-1$
    lblCronExpression.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    textCronExp = new Text(compositeHead, SWT.BORDER);
    textCronExp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnViewSchedule = new Button(compositeHead, SWT.NONE);
    btnViewSchedule.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            showExp();
        }
    });
    btnViewSchedule.setText(Messages.AddScheduleDialog_3);
    new Label(compositeHead, SWT.NONE);

    textViewSchedule = new Text(compositeHead, SWT.BORDER | SWT.MULTI);
    GridData gd_textViewSchedule = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd_textViewSchedule.heightHint = 60;
    textViewSchedule.setLayoutData(gd_textViewSchedule);

    Composite compositeBody = new Composite(container, SWT.BORDER);
    compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    compositeBody.setLayout(new GridLayout(1, false));

    ToolBar toolBar = new ToolBar(compositeBody, SWT.FLAT | SWT.RIGHT);

    final ToolItem tltmAdd = new ToolItem(toolBar, SWT.NONE);
    tltmAdd.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            AddSQLDialog dialog = new AddSQLDialog(parent.getShell(), listSchedule.size());
            if (Dialog.OK == dialog.open()) {
                listSchedule.add(dialog.getDao());

                tableViewer.refresh();
            }
        }
    });
    tltmAdd.setText(Messages.AddScheduleDialog_4);

    tltmModify = new ToolItem(toolBar, SWT.NONE);
    tltmModify.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection();
            if (!iss.isEmpty()) {
                ScheduleDAO dao = (ScheduleDAO) iss.getFirstElement();
                AddSQLDialog dialog = new AddSQLDialog(null, dao);
                if (Dialog.OK == dialog.open()) {
                    tableViewer.refresh(dialog.getDao());
                }
            }
        }
    });
    tltmModify.setEnabled(false);
    tltmModify.setText(Messages.AddScheduleDialog_5);

    tltmDelete = new ToolItem(toolBar, SWT.NONE);
    tltmDelete.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection();
            if (!iss.isEmpty()) {
                if (!MessageDialog.openConfirm(null, Messages.AddScheduleDialog_20,
                        Messages.AddScheduleDialog_7))
                    return;

                ScheduleDAO dao = (ScheduleDAO) iss.getFirstElement();
                listSchedule.remove(dao);
                tableViewer.refresh();
            }
        }
    });
    tltmDelete.setEnabled(false);
    tltmDelete.setText(Messages.AddScheduleDialog_8);

    tableViewer = new TableViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            tltmModify.setEnabled(true);
            tltmDelete.setEnabled(true);
        }
    });
    Table table = tableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    tableViewerColumn.setEditingSupport(new SQLOrderEditingSupport(tableViewer));
    TableColumn tblclmnSeq = tableViewerColumn.getColumn();
    tblclmnSeq.setWidth(50);

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnTitle = tableViewerColumn_1.getColumn();
    tblclmnTitle.setWidth(100);
    tblclmnTitle.setText(Messages.AddScheduleDialog_9);

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnSql = tableViewerColumn_2.getColumn();
    tblclmnSql.setWidth(273);
    tblclmnSql.setText(Messages.AddScheduleDialog_10);

    tableViewer.setContentProvider(ArrayContentProvider.getInstance());
    tableViewer.setLabelProvider(new AddScheduleLableProvider());
    tableViewer.setInput(listSchedule);

    initData();

    return container;
}

From source file:com.hangum.tadpole.monitoring.core.editors.schedule.ScheduleEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    Composite compositeHead = new Composite(parent, SWT.NONE);
    compositeHead.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    compositeHead.setLayout(new GridLayout(1, false));

    Label lblInfo = new Label(compositeHead, SWT.NONE);
    lblInfo.setText(Messages.ScheduleEditor_1);

    SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    sashForm.setOrientation(SWT.HORIZONTAL);

    Group compositeList = new Group(sashForm, SWT.NONE);
    compositeList.setLayout(new GridLayout(1, false));
    compositeList.setText("Schedule List");

    ToolBar toolBar = new ToolBar(compositeList, SWT.FLAT | SWT.RIGHT);

    ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE);
    tltmRefresh.addSelectionListener(new SelectionAdapter() {
        @Override//from  w  w  w .ja va2 s. com
        public void widgetSelected(SelectionEvent e) {
            refreshSchedule();
        }
    });
    tltmRefresh.setText(Messages.ScheduleEditor_2);

    tltmModify = new ToolItem(toolBar, SWT.NONE);
    tltmModify.setEnabled(false);
    tltmModify.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewerList.getSelection();
            if (!iss.isEmpty()) {
                try {
                    ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement();
                    UserDBDAO userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(dao.getDb_seq());
                    AddScheduleDialog dialog = new AddScheduleDialog(null, userDB, dao);
                    dialog.open();

                } catch (Exception e1) {
                    logger.error("modify schedule", e1);
                }
            }
        }
    });
    tltmModify.setText(Messages.ScheduleEditor_tltmModify_text);

    tltmDelete = new ToolItem(toolBar, SWT.NONE);
    tltmDelete.setEnabled(false);
    tltmDelete.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewerList.getSelection();
            if (!iss.isEmpty()) {

                ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement();

                if (!MessageDialog.openQuestion(null, Messages.ScheduleEditor_3, Messages.ScheduleEditor_4))
                    return;
                try {
                    UserDBDAO userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(dao.getDb_seq());
                    ScheduleManager.getInstance().deleteJob(userDB, dao);

                    TadpoleSystem_Schedule.deleteSchedule(dao.getSeq());

                    refreshSchedule();
                } catch (Exception e1) {
                    logger.error("delete schedule", e1); //$NON-NLS-1$
                }
            }
        }
    });
    tltmDelete.setText(Messages.ScheduleEditor_6);

    tableViewerList = new TableViewer(compositeList, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewerList.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection iss = (IStructuredSelection) event.getSelection();
            if (!iss.isEmpty()) {
                tltmDelete.setEnabled(true);
                tltmModify.setEnabled(true);

                ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement();
                try {
                    List<ScheduleResultDAO> listResult = TadpoleSystem_Schedule.getScheduleResult(dao.getSeq());
                    tvResult.setInput(listResult);
                } catch (Exception e) {
                    logger.error("get schedule result", e); //$NON-NLS-1$
                }
            }
        }
    });
    Table tableList = tableViewerList.getTable();
    tableList.setLinesVisible(true);
    tableList.setHeaderVisible(true);
    tableList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewerList, SWT.NONE);
    TableColumn tblclmnName = tableViewerColumn.getColumn();
    tblclmnName.setWidth(100);
    tblclmnName.setText(Messages.ScheduleEditor_8);

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewerList, SWT.NONE);
    TableColumn tblclmnDescription = tableViewerColumn_2.getColumn();
    tblclmnDescription.setWidth(100);
    tblclmnDescription.setText(Messages.ScheduleEditor_9);

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewerList, SWT.NONE);
    TableColumn tblclmnCreateDate = tableViewerColumn_1.getColumn();
    tblclmnCreateDate.setWidth(200);
    tblclmnCreateDate.setText(Messages.ScheduleEditor_10);

    Group compositeResult = new Group(sashForm, SWT.NONE);
    compositeResult.setLayout(new GridLayout(1, false));
    compositeResult.setText("Schedule Result");

    tvResult = new TableViewer(compositeResult, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tvResult.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tvResult, SWT.NONE);
    TableColumn tblclmnResult = tableViewerColumn_3.getColumn();
    tblclmnResult.setWidth(52);
    tblclmnResult.setText(Messages.ScheduleEditor_11);

    TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tvResult, SWT.NONE);
    TableColumn tblclmnMessage = tableViewerColumn_4.getColumn();
    tblclmnMessage.setWidth(240);
    tblclmnMessage.setText(Messages.ScheduleEditor_12);

    TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tvResult, SWT.NONE);
    TableColumn tblclmnDate = tableViewerColumn_5.getColumn();
    tblclmnDate.setWidth(140);
    tblclmnDate.setText(Messages.ScheduleEditor_13);

    tableViewerList.setContentProvider(ArrayContentProvider.getInstance());
    tableViewerList.setLabelProvider(new ScheduleLabelProvider());

    tvResult.setContentProvider(ArrayContentProvider.getInstance());
    tvResult.setLabelProvider(new ResultLabelProvider());

    initUI();

    sashForm.setWeights(new int[] { 4, 6 });

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

}

From source file:com.hangum.tadpole.notes.core.views.list.NoteListViewPart.java

License:Open Source License

/**
 * create columns/*  ww  w . j av a  2  s . c o m*/
 */
private void createColumns() {
    String[] names = { Messages.NoteListViewPart_14, Messages.NoteListViewPart_15,
            Messages.NoteListViewPart_16 };
    int[] sizes = { 150, 300, 150 };

    for (int i = 0; i < names.length; i++) {
        String name = names[i];
        int size = sizes[i];

        TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
        TableColumn tblclmnEngine = tableViewerColumn.getColumn();
        tblclmnEngine.setWidth(size);
        tblclmnEngine.setText(name);
    }
}

From source file:com.hangum.tadpole.rdb.core.actions.oracle.TableSapceManageEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    GridLayout gl_parent = new GridLayout(1, false);
    gl_parent.verticalSpacing = 1;//from   w  ww . j  av a2 s .c  o  m
    gl_parent.marginHeight = 1;
    gl_parent.horizontalSpacing = 1;
    gl_parent.marginWidth = 1;
    parent.setLayout(gl_parent);

    Composite compositeToolbar = new Composite(parent, SWT.NONE);
    compositeToolbar.setLayout(new GridLayout(2, false));
    compositeToolbar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    ToolBar toolBar = new ToolBar(compositeToolbar, SWT.FLAT | SWT.RIGHT);
    GridData gd_toolBar = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_toolBar.widthHint = 267;
    toolBar.setLayoutData(gd_toolBar);

    ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE);
    tltmRefresh.setToolTipText(CommonMessages.get().Refresh);
    tltmRefresh.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/refresh.png")); //$NON-NLS-1$

    tltmRefresh.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            refreshTablespaceList();
        }
    });

    lblDbname = new Label(compositeToolbar, SWT.NONE);
    lblDbname.setText(""); //$NON-NLS-1$

    columnFilter = new DefaultTableColumnFilter();

    Composite compositeTablespaceList = new Composite(parent, SWT.NONE);
    GridData gd_compositeTablespaceList = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_compositeTablespaceList.minimumHeight = 200;
    compositeTablespaceList.setLayoutData(gd_compositeTablespaceList);
    compositeTablespaceList.setLayout(new GridLayout(1, false));

    tableViewer = new TableViewer(compositeTablespaceList, SWT.BORDER | SWT.FULL_SELECTION);
    Table tableTablespace = tableViewer.getTable();
    tableTablespace.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    tableTablespace.setHeaderVisible(true);
    tableTablespace.setLinesVisible(true);
    tableViewer.addFilter(columnFilter);

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (tableViewer.getSelection().isEmpty()) {
                return;
            }

            StructuredSelection ss = (StructuredSelection) tableViewer.getSelection();
            tablespaceDao = (OracleTablespaceDAO) ss.getFirstElement();

            List<HashMap<String, String>> datafileList = new ArrayList<HashMap<String, String>>();
            try {

                SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDB);
                datafileList = (List<HashMap<String, String>>) sqlClient
                        .queryForList("getTablespaceDataFileList", tablespaceDao.getTablespace_name()); //$NON-NLS-1$

            } catch (Exception e) {
                logger.error("Tablespace detail information loading...", e); //$NON-NLS-1$
            }

            textDropScript.setText(StringUtils.trimToEmpty(getDropScript()));
            makeCreateScript();

            tableViewer_datafiles.setInput(datafileList);
            tableViewer_datafiles.refresh();

            if (datafileList.size() > 0) {
                tableViewer_datafiles
                        .setSelection(new StructuredSelection(tableViewer_datafiles.getElementAt(0)), true);

                refreshDatafileInformation();
            } else {
                // ?? ??  ??  .
                tableViewer_property.setInput(new ArrayList<Map<String, String>>());
                tableViewer_property.refresh();
            }
        }
    });

    Group grpQuery = new Group(parent, SWT.NONE);
    grpQuery.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    grpQuery.setText("Detail Information");
    GridLayout gl_grpQuery = new GridLayout(1, false);
    gl_grpQuery.verticalSpacing = 1;
    gl_grpQuery.horizontalSpacing = 1;
    gl_grpQuery.marginHeight = 1;
    gl_grpQuery.marginWidth = 1;
    grpQuery.setLayout(gl_grpQuery);

    Composite composite = new Composite(grpQuery, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));

    SashForm sashForm = new SashForm(composite, SWT.NONE);

    SashForm sashForm_1 = new SashForm(sashForm, SWT.VERTICAL);

    Composite composite_2 = new Composite(sashForm_1, SWT.BORDER);
    GridLayout gl_composite_2 = new GridLayout(1, false);
    gl_composite_2.verticalSpacing = 0;
    gl_composite_2.horizontalSpacing = 0;
    gl_composite_2.marginHeight = 0;
    gl_composite_2.marginWidth = 0;
    composite_2.setLayout(gl_composite_2);

    tableViewer_datafiles = new TableViewer(composite_2, SWT.BORDER | SWT.FULL_SELECTION);
    table_datafiles = tableViewer_datafiles.getTable();
    table_datafiles.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table_datafiles.setLinesVisible(true);
    table_datafiles.setHeaderVisible(true);

    tableViewer_datafiles.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            if (tableViewer_datafiles.getSelection().isEmpty()) {
                return;
            }
            refreshDatafileInformation();
            makeCreateScript();
        }
    });

    Composite composite_6 = new Composite(composite_2, SWT.NONE);
    composite_6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_composite_6 = new GridLayout(2, false);
    composite_6.setLayout(gl_composite_6);

    btnDatafileName = new Button(composite_6, SWT.CHECK);
    btnDatafileName.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            textDataFileName.setEnabled(btnDatafileName.getSelection());
            if (btnDatafileName.getSelection()) {
                StructuredSelection ss = (StructuredSelection) tableViewer_datafiles.getSelection();
                if (ss != null) {
                    HashMap<String, Object> datafileMap = (HashMap<String, Object>) ss.getFirstElement();
                    String fileName = (String) datafileMap.get("FILE_NAME");

                    int cnt = tableViewer_datafiles.getTable().getItemCount() + 1;

                    fileName = StringUtils.replaceOnce(fileName, ".", "_Copy" + cnt + ".");
                    textDataFileName.setText(fileName);
                } else {
                    textDataFileName.setFocus();
                }
            }
            makeAddDatafileScript();
        }
    });
    btnDatafileName.setText("Datafile Name");
    textDataFileName = new Text(composite_6, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
    textDataFileName.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent event) {
            makeAddDatafileScript();
        }
    });
    textDataFileName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textDataFileName.setText("Auto");
    textDataFileName.setEnabled(false);

    Label lblNewLabel_2 = new Label(composite_6, SWT.NONE);
    lblNewLabel_2.setText("Datafile Size(MB)");

    Composite composite_7 = new Composite(composite_6, SWT.NONE);
    GridLayout gl_composite_7 = new GridLayout(2, false);
    gl_composite_7.verticalSpacing = 0;
    gl_composite_7.horizontalSpacing = 0;
    gl_composite_7.marginWidth = 0;
    gl_composite_7.marginHeight = 0;
    composite_7.setLayout(gl_composite_7);

    textDatafileSize = new Text(composite_7, SWT.BORDER | SWT.RIGHT);
    textDatafileSize.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent event) {
            makeAddDatafileScript();
        }
    });
    GridData gd_textDatafileSize = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_textDatafileSize.widthHint = 60;
    textDatafileSize.setLayoutData(gd_textDatafileSize);
    textDatafileSize.setText("5");

    btnReuse = new Button(composite_7, SWT.CHECK);
    btnReuse.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            makeAddDatafileScript();
        }
    });
    btnReuse.setText("Reuse");

    Composite composite_5 = new Composite(composite_2, SWT.NONE);
    composite_5.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    composite_5.setLayout(new GridLayout(4, false));

    btnAutoExtend = new Button(composite_5, SWT.CHECK);
    btnAutoExtend.setSelection(true);
    btnAutoExtend.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            textAutoExtendSize.setEnabled(btnAutoExtend.getSelection());
            btnMaximumSize.setEnabled(btnAutoExtend.getSelection());
            textMaximumSize.setEnabled(btnAutoExtend.getSelection());

            makeAddDatafileScript();
        }
    });
    btnAutoExtend.setText("Auto Extend");

    Label lblExtendSize = new Label(composite_5, SWT.NONE);
    lblExtendSize.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblExtendSize.setText("Extend Size(MB)");

    textAutoExtendSize = new Text(composite_5, SWT.BORDER | SWT.RIGHT);
    textAutoExtendSize.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent event) {
            makeAddDatafileScript();
        }
    });
    textAutoExtendSize.setText("5");
    textAutoExtendSize.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(composite_5, SWT.NONE);

    btnMaximumSize = new Button(composite_5, SWT.CHECK);
    btnMaximumSize.setSelection(true);
    btnMaximumSize.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            textMaximumSize.setEnabled(!btnMaximumSize.getSelection());
            textMaximumSize.setText((1024 * 5) + ""); //5GB
            textMaximumSize.setFocus();
            textMaximumSize.setSelection(0, textMaximumSize.getText().length());
            makeAddDatafileScript();
        }
    });
    btnMaximumSize.setText("Maximum Unlimited");

    Label lblMaximumSizemb = new Label(composite_5, SWT.NONE);
    lblMaximumSizemb.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblMaximumSizemb.setText("Maximum Size(MB)");

    textMaximumSize = new Text(composite_5, SWT.BORDER | SWT.RIGHT);
    textMaximumSize.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent event) {
            makeAddDatafileScript();
        }
    });
    textMaximumSize.setEnabled(false);
    textMaximumSize.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnAddDatafile = new Button(composite_5, SWT.NONE);
    btnAddDatafile.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            makeAddDatafileScript();
        }
    });
    btnAddDatafile.setText("Add Datafile");

    tableViewer_property = new TableViewer(sashForm_1, SWT.BORDER | SWT.FULL_SELECTION);
    table = tableViewer_property.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    TableViewerColumn tvPropertyName = new TableViewerColumn(tableViewer_property, SWT.NONE);
    TableColumn tcPropertyName = tvPropertyName.getColumn();
    tcPropertyName.setWidth(180);
    tcPropertyName.setText("Property");

    TableViewerColumn tvPropertyValue = new TableViewerColumn(tableViewer_property, SWT.NONE);
    TableColumn tcPropertyValue = tvPropertyValue.getColumn();
    tcPropertyValue.setWidth(300);
    tcPropertyValue.setText("Value");

    tableViewer_property.setContentProvider(new ArrayContentProvider());
    tableViewer_property.setLabelProvider(new TablespaceExtInfoLabelProvider());
    sashForm_1.setWeights(new int[] { 1, 1 });

    Composite composite_1 = new Composite(sashForm, SWT.BORDER);
    composite_1.setLayout(new GridLayout(1, false));

    Label lblNewLabel_1 = new Label(composite_1, SWT.NONE);
    lblNewLabel_1.setText("Drop Tablespace");

    textDropScript = new Text(composite_1, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    textDropScript.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
    GridData gd_textDropScript = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_textDropScript.minimumHeight = 20;
    textDropScript.setLayoutData(gd_textDropScript);

    Composite composite_4 = new Composite(composite_1, SWT.NONE);
    composite_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    composite_4.setLayout(new GridLayout(3, false));

    btnIncludingContents = new Button(composite_4, SWT.CHECK);
    btnIncludingContents.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // ?? ??  .
            btnCascadeConstraints.setEnabled(btnIncludingContents.getSelection());
            textDropScript.setText(getDropScript());
        }
    });
    btnIncludingContents.setText("Including Contents?");

    btnCascadeConstraints = new Button(composite_4, SWT.CHECK);
    btnCascadeConstraints.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // ?  .
            textDropScript.setText(getDropScript());
        }
    });
    btnCascadeConstraints.setEnabled(false);
    btnCascadeConstraints.setText("Cascade Constraints?");

    Button btnDrop = new Button(composite_4, SWT.NONE);
    btnDrop.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            //Excute script
            RequestResultDAO reqReResultDAO = new RequestResultDAO();
            try {
                ExecuteDDLCommand.executSQL(userDB, reqReResultDAO, textDropScript.getText().trim());
            } catch (Exception ex) {
                logger.error(ex);
            } //$NON-NLS-1$
            if (PublicTadpoleDefine.SUCCESS_FAIL.F.name().equals(reqReResultDAO.getResult())) {
                MessageDialog.openError(getSite().getShell(), CommonMessages.get().Error,
                        Messages.get().RiseError + reqReResultDAO.getMesssage()
                                + reqReResultDAO.getException().getMessage());
            } else {
                MessageDialog.openInformation(getSite().getShell(), CommonMessages.get().Information,
                        Messages.get().WorkHasCompleted);
                refreshTablespaceList();
            }

        }
    });
    btnDrop.setSize(94, 28);
    btnDrop.setText("Drop Tablespace");

    Label lblNewLabel = new Label(composite_1, SWT.NONE);
    lblNewLabel.setText("Create Tablespace && Add Datafile");

    textScript = new Text(composite_1, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
    textScript.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite composite_3 = new Composite(composite_1, SWT.NONE);
    composite_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    Button btnExecute = new Button(composite_3, SWT.NONE);
    btnExecute.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            //Excute script
            RequestResultDAO reqReResultDAO = new RequestResultDAO();
            try {
                ExecuteDDLCommand.executSQL(userDB, reqReResultDAO, textScript.getText().trim());
            } catch (Exception ex) {
                logger.error(ex);
            } //$NON-NLS-1$
            if (PublicTadpoleDefine.SUCCESS_FAIL.F.name().equals(reqReResultDAO.getResult())) {
                MessageDialog.openError(getSite().getShell(), CommonMessages.get().Error,
                        Messages.get().RiseError + reqReResultDAO.getMesssage()
                                + reqReResultDAO.getException().getMessage());
            } else {
                MessageDialog.openInformation(getSite().getShell(), CommonMessages.get().Information,
                        Messages.get().WorkHasCompleted);
                refreshTablespaceList();
                refreshDatafileInformation();
            }
        }
    });
    btnExecute.setBounds(0, 0, 150, 28);
    btnExecute.setText("Execute Script");
    sashForm.setWeights(new int[] { 1, 1 });

    createTableColumn();
    createTableDataFileColumn();

    initUI();

}

From source file:com.hangum.tadpole.rdb.core.dialog.commons.MapViewerDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//from   www.  jav a  2  s. c  om
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.verticalSpacing = 3;
    gridLayout.horizontalSpacing = 3;
    gridLayout.marginHeight = 3;
    gridLayout.marginWidth = 3;

    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    composite.setLayout(new GridLayout(1, false));

    tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnName = tableViewerColumn.getColumn();
    tblclmnName.setWidth(100);
    tblclmnName.setText("Name");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnValue = tableViewerColumn_1.getColumn();
    tblclmnValue.setWidth(312);
    tblclmnValue.setText("Value");

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new MapLabelProvider());
    initData();

    return container;
}

From source file:com.hangum.tadpole.rdb.core.dialog.db.UpdateDeleteConfirmDialog.java

License:Open Source License

/**
 * table? Column? ?./* w  w  w.  j a va  2 s.c  om*/
 */
public static void createTableColumn(final RequestQuery reqQuery, final TableViewer tableViewer,
        final ResultSetUtilDTO rsDAO, final boolean isEditable) {
    //  column? .
    Table table = tableViewer.getTable();
    int columnCount = table.getColumnCount();
    for (int i = 0; i < columnCount; i++) {
        table.getColumn(0).dispose();
    }

    if (rsDAO.getColumnName() == null)
        return;

    try {
        for (int i = 0; i < rsDAO.getColumnName().size(); i++) {
            final int columnAlign = RDBTypeToJavaTypeUtils.isNumberType(rsDAO.getColumnType().get(i))
                    ? SWT.RIGHT
                    : SWT.LEFT;
            String strColumnName = rsDAO.getColumnLabelName().get(i);

            /**  ? ? ?   */
            if (StringUtils.startsWithIgnoreCase(strColumnName,
                    PublicTadpoleDefine.SPECIAL_USER_DEFINE_HIDE_COLUMN))
                continue;

            final TableViewerColumn tv = new TableViewerColumn(tableViewer, columnAlign);
            final TableColumn tc = tv.getColumn();

            tc.setText(strColumnName);
            tc.setResizable(true);
            tc.setMoveable(true);
        } // end for

    } catch (Exception e) {
        logger.error("SQLResult TableViewer", e);
    }
}

From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.composite.AWSRDSLoginComposite.java

License:Open Source License

/**
 * create columns//  w ww .j  av a  2s. c o m
 */
private void createColumns() {
    String[] columnNames = { "Engine", "IP", "Port", "Instance", "Charset", "User", "Password" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    int[] columnSize = { 50, 200, 50, 100, 80, 80, 50 };

    for (int i = 0; i < columnNames.length; i++) {
        String name = columnNames[i];
        int size = columnSize[i];

        TableViewerColumn tableViewerColumn = new TableViewerColumn(tvRDS, SWT.NONE);
        TableColumn tblclmnEngine = tableViewerColumn.getColumn();
        tblclmnEngine.setWidth(size);
        tblclmnEngine.setText(name);
    }

}

From source file:com.hangum.tadpole.rdb.core.dialog.dml.GenerateStatmentDMLDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//from   www .ja  v  a  2  s.  com
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.verticalSpacing = 2;
    gridLayout.horizontalSpacing = 2;
    gridLayout.marginHeight = 2;
    gridLayout.marginWidth = 2;

    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new GridLayout(5, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblDml = new Label(composite, SWT.NONE);
    lblDml.setText("DML");

    rdoSelect = new Button(composite, SWT.RADIO);
    rdoSelect.setSelection(true);
    rdoSelect.setText("SELECT");

    rdoUpdate = new Button(composite, SWT.RADIO);
    rdoUpdate.setText("UPDATE");

    rdoInsert = new Button(composite, SWT.RADIO);
    rdoInsert.setText("INSERT");

    rdoDelete = new Button(composite, SWT.RADIO);
    rdoDelete.setText("DELETE");

    assignSelectionAdapter(rdoSelect);
    assignSelectionAdapter(rdoUpdate);
    assignSelectionAdapter(rdoInsert);
    assignSelectionAdapter(rdoDelete);

    Composite composite_1 = new Composite(container, SWT.NONE);
    GridLayout gl_composite_1 = new GridLayout(1, false);
    gl_composite_1.verticalSpacing = 2;
    gl_composite_1.horizontalSpacing = 2;
    gl_composite_1.marginHeight = 2;
    gl_composite_1.marginWidth = 2;
    composite_1.setLayout(gl_composite_1);
    composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite composite_2 = new Composite(composite_1, SWT.NONE);
    GridData gd_composite_2 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
    gd_composite_2.heightHint = 28;
    composite_2.setLayoutData(gd_composite_2);
    composite_2.setLayout(new GridLayout(4, false));

    Label lblTable = new Label(composite_2, SWT.NONE);
    lblTable.setText("Table");

    lblTableName = new Label(composite_2, SWT.NONE);
    lblTableName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblTableName.setText("table name");

    Label lblAs = new Label(composite_2, SWT.NONE);
    lblAs.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblAs.setText(" as ");

    textTableAlias = new Text(composite_2, SWT.BORDER);
    textTableAlias.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent event) {
            if (tableViewer.getInput() != null) {
                for (ExtendTableColumnDAO dao : (List<ExtendTableColumnDAO>) tableViewer.getInput()) {

                    dao.setTableAlias(textTableAlias.getText());
                }
                tableViewer.refresh();
                queryGenetation();
            }
        }
    });
    textTableAlias.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);
    new Label(composite_2, SWT.NONE);

    tableViewer = new TableViewer(composite_1, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    TableViewerColumn tvColumnName = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tcColumnName = tvColumnName.getColumn();
    tcColumnName.setWidth(150);
    tcColumnName.setText("Column Name");
    tvColumnName.setEditingSupport(new DMLColumnEditingSupport(tableViewer, 0, this));

    TableViewerColumn tvColumnDataType = new TableViewerColumn(tableViewer, SWT.LEFT);
    TableColumn tcDataType = tvColumnDataType.getColumn();
    tcDataType.setWidth(120);
    tcDataType.setText("Data Type");

    TableViewerColumn tvColumnKey = new TableViewerColumn(tableViewer, SWT.CENTER);
    TableColumn tcKey = tvColumnKey.getColumn();
    tcKey.setWidth(50);
    tcKey.setText("Key");

    TableViewerColumn tvColumnAlias = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tcAlias = tvColumnAlias.getColumn();
    tcAlias.setWidth(100);
    tcAlias.setText("Alias");
    tvColumnAlias.setEditingSupport(new DMLColumnEditingSupport(tableViewer, 3, this));

    Composite composite_3 = new Composite(composite_1, SWT.NONE);
    composite_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_composite_3 = new GridLayout(2, false);
    gl_composite_3.verticalSpacing = 2;
    gl_composite_3.horizontalSpacing = 2;
    gl_composite_3.marginHeight = 2;
    gl_composite_3.marginWidth = 2;
    composite_3.setLayout(gl_composite_3);

    final Button btnAllCheck = new Button(composite_3, SWT.CHECK);
    btnAllCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            for (ExtendTableColumnDAO dao : (List<ExtendTableColumnDAO>) tableViewer.getInput()) {
                if ("*".equals(dao.getField())) {
                    dao.setCheck(!btnAllCheck.getSelection());
                } else {
                    dao.setCheck(btnAllCheck.getSelection());
                }
            }
            tableViewer.refresh();
            queryGenetation();
        }
    });
    btnAllCheck.setText("All Columns");

    chkComment = new Button(composite_3, SWT.CHECK);
    chkComment.setText("Include Comment");
    assignSelectionAdapter(chkComment);

    Composite previewComposite = new Composite(composite_1, SWT.BORDER);
    previewComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_previewComposite = new GridLayout(1, false);
    gl_previewComposite.verticalSpacing = 2;
    gl_previewComposite.horizontalSpacing = 2;
    gl_previewComposite.marginHeight = 2;
    gl_previewComposite.marginWidth = 2;
    previewComposite.setLayout(gl_previewComposite);

    textQuery = new Text(previewComposite,
            SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    GridData gd_textQuery = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_textQuery.minimumHeight = 120;
    textQuery.setLayoutData(gd_textQuery);

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new GenerateLabelProvider());

    initData();
    queryGenetation();

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return container;
}

From source file:com.hangum.tadpole.rdb.core.dialog.dml.IndexInformationDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//from ww  w .j a  va  2s.  c o  m
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.verticalSpacing = 2;
    gridLayout.horizontalSpacing = 2;
    gridLayout.marginHeight = 2;
    gridLayout.marginWidth = 2;

    Composite compositeBody = new Composite(container, SWT.NONE);
    GridLayout gl_compositeBody = new GridLayout(1, false);
    gl_compositeBody.verticalSpacing = 2;
    gl_compositeBody.horizontalSpacing = 2;
    gl_compositeBody.marginHeight = 2;
    gl_compositeBody.marginWidth = 2;
    compositeBody.setLayout(gl_compositeBody);
    compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeTable = new Composite(compositeBody, SWT.NONE);
    compositeTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    compositeTable.setLayout(new GridLayout(2, false));

    lblTableName = new Label(compositeTable, SWT.NONE);
    lblTableName.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
    lblTableName.setText(SQLUtil.getIndexName(indexDAO));

    textTBNameCmt = new Text(compositeTable, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    GridData gd_textTBNameCmt = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_textTBNameCmt.heightHint = 33;
    textTBNameCmt.setLayoutData(gd_textTBNameCmt);
    textTBNameCmt.setText(indexDAO.getCOMMENT());

    Composite compositeDML = new Composite(compositeBody, SWT.NONE);
    compositeDML.setLayout(new GridLayout(5, false));
    compositeDML.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    indexTableViewer = new TableViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = indexTableViewer.getTable();
    GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_table.minimumHeight = 160;
    table.setLayoutData(gd_table);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    TableViewerColumn tvColumnName = new TableViewerColumn(indexTableViewer, SWT.NONE);
    TableColumn tcColumnName = tvColumnName.getColumn();
    tcColumnName.setWidth(120);
    tcColumnName.setText(Messages.get().ColumnName);

    TableViewerColumn tvColumnDataType = new TableViewerColumn(indexTableViewer, SWT.CENTER);
    TableColumn tcDataType = tvColumnDataType.getColumn();
    tcDataType.setWidth(60);
    tcDataType.setText("Order");

    TableViewerColumn tvColumnKey = new TableViewerColumn(indexTableViewer, SWT.RIGHT);
    TableColumn tcKey = tvColumnKey.getColumn();
    tcKey.setWidth(60);
    tcKey.setText("Position");

    TableViewerColumn tvColumnCmt = new TableViewerColumn(indexTableViewer, SWT.RIGHT);
    TableColumn tcCmt = tvColumnCmt.getColumn();
    tcCmt.setWidth(50);
    tcCmt.setText("Length");

    TableViewerColumn tvTableName = new TableViewerColumn(indexTableViewer, SWT.NONE);
    TableColumn tcTableName = tvTableName.getColumn();
    tcTableName.setWidth(90);
    tcTableName.setText("Table Name");

    TableViewerColumn tvTableOwner = new TableViewerColumn(indexTableViewer, SWT.NONE);
    TableColumn tcTableOwner = tvTableOwner.getColumn();
    tcTableOwner.setWidth(90);
    tcTableOwner.setText("Table Owner");

    Composite composite_3 = new Composite(compositeBody, SWT.NONE);
    composite_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_composite_3 = new GridLayout(2, false);
    gl_composite_3.verticalSpacing = 2;
    gl_composite_3.horizontalSpacing = 2;
    gl_composite_3.marginHeight = 2;
    gl_composite_3.marginWidth = 2;
    composite_3.setLayout(gl_composite_3);

    Composite previewComposite = new Composite(compositeBody, SWT.BORDER);
    previewComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    GridLayout gl_previewComposite = new GridLayout(1, false);
    gl_previewComposite.verticalSpacing = 2;
    gl_previewComposite.horizontalSpacing = 2;
    gl_previewComposite.marginHeight = 2;
    gl_previewComposite.marginWidth = 2;
    previewComposite.setLayout(gl_previewComposite);

    tableViewer_ext = new TableViewer(previewComposite, SWT.BORDER | SWT.FULL_SELECTION);
    Table table_ext = tableViewer_ext.getTable();
    GridData gd_table_ext = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_table_ext.minimumHeight = 150;
    table_ext.setLayoutData(gd_table_ext);
    table_ext.setLinesVisible(true);
    table_ext.setHeaderVisible(true);

    TableViewerColumn tvPropertyName = new TableViewerColumn(tableViewer_ext, SWT.NONE);
    TableColumn tcPropertyName = tvPropertyName.getColumn();
    tcPropertyName.setWidth(160);
    tcPropertyName.setText("Property");

    TableViewerColumn tvPropertyValue = new TableViewerColumn(tableViewer_ext, SWT.NONE);
    TableColumn tcPropertyValue = tvPropertyValue.getColumn();
    tcPropertyValue.setWidth(250);
    tcPropertyValue.setText("Value");

    indexTableViewer.setContentProvider(new ArrayContentProvider());
    indexTableViewer.setLabelProvider(new IndexInformationLabelProvider());

    initData();

    tableViewer_ext.setContentProvider(new ArrayContentProvider());
    tableViewer_ext.setLabelProvider(new TableStatisticsLabelProvider());
    initExtendedData();

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return container;
}

From source file:com.hangum.tadpole.rdb.core.dialog.dml.SelectObjectDialog.java

License:Open Source License

/**
 * Create contents of the dialog./*from  w w w.ja v a 2 s  .c  o m*/
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.verticalSpacing = 2;
    gridLayout.horizontalSpacing = 2;
    gridLayout.marginHeight = 2;
    gridLayout.marginWidth = 2;

    Composite compositeBody = new Composite(container, SWT.NONE);
    GridLayout gl_compositeBody = new GridLayout(1, false);
    gl_compositeBody.verticalSpacing = 2;
    gl_compositeBody.horizontalSpacing = 2;
    gl_compositeBody.marginHeight = 2;
    gl_compositeBody.marginWidth = 2;
    compositeBody.setLayout(gl_compositeBody);
    compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Composite compositeTable = new Composite(compositeBody, SWT.NONE);
    compositeTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    compositeTable.setLayout(new GridLayout(1, false));

    lblTableName = new Label(compositeTable, SWT.NONE);
    lblTableName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblTableName.setText(object_map.get("object_name"));

    tableViewer = new TableViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    TableViewerColumn tvOwner = new TableViewerColumn(tableViewer, SWT.LEFT);
    TableColumn tcOwner = tvOwner.getColumn();
    tcOwner.setWidth(90);
    tcOwner.setText("Owner");

    TableViewerColumn tvObject = new TableViewerColumn(tableViewer, SWT.LEFT);
    TableColumn tcObject = tvObject.getColumn();
    tcObject.setWidth(150);
    tcObject.setText("Object Name");

    TableViewerColumn tvType = new TableViewerColumn(tableViewer, SWT.LEFT);
    TableColumn tcType = tvType.getColumn();
    tcType.setWidth(100);
    tcType.setText("Object Type");

    GridData gd_textQuery = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_textQuery.minimumHeight = 120;

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new ObjectSelectorLabelProvider());

    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection is = (IStructuredSelection) event.getSelection();
            map = (HashMap<String, String>) is.getFirstElement();
            okPressed();
        }
    });
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection is = (IStructuredSelection) event.getSelection();
            map = (HashMap<String, String>) is.getFirstElement();
        }
    });

    tableViewer.setInput(extendsInfoList);
    tableViewer.refresh();

    tableViewer.getTable().setSelection(0);

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return container;
}