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.netxforge.netxstudio.screens.f4.Jobs.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmScheduledJobs = toolkit.createForm(this);

    frmScheduledJobs.getToolBarManager().add(new ListScheduleAction("Update scheduler information"));
    frmScheduledJobs.getToolBarManager().add(new SchedulerStartStopAction("Start"));

    frmScheduledJobs.getToolBarManager().update(true);
    frmScheduledJobs.setToolBarVerticalAlignment(SWT.TOP);

    frmScheduledJobs.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmScheduledJobs);
    frmScheduledJobs.setText("Scheduled Jobs");
    frmScheduledJobs.getBody().setLayout(new GridLayout(3, false));

    Label lblFilterLabel = toolkit.createLabel(frmScheduledJobs.getBody(), "Filter:", SWT.NONE);
    GridData gd_lblFilterLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblFilterLabel.widthHint = 44;//w  ww.  j ava 2  s . c o  m
    lblFilterLabel.setLayoutData(gd_lblFilterLabel);

    txtFilterText = toolkit.createText(frmScheduledJobs.getBody(), "New Text",
            SWT.H_SCROLL | SWT.SEARCH | SWT.CANCEL);
    txtFilterText.setText("");
    GridData gd_txtFilterText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFilterText.widthHint = 200;
    txtFilterText.setLayoutData(gd_txtFilterText);
    txtFilterText.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent ke) {
            ViewerFilter[] filters = jobsTableViewer.getFilters();
            for (ViewerFilter viewerFilter : filters) {
                if (viewerFilter instanceof ISearchFilter) {
                    ((ISearchFilter) viewerFilter).setSearchText(txtFilterText.getText());
                }
            }
            jobsTableViewer.refresh();
        }
    });

    jobsTableViewer = new TableViewer(frmScheduledJobs.getBody(), SWT.BORDER | SWT.FULL_SELECTION);
    jobsTableViewer.setComparer(new CDOElementComparer());
    jobsTableViewer.addFilter(new CDOSearchFilter());

    jobsTable = jobsTableViewer.getTable();
    jobsTable.setLinesVisible(true);
    jobsTable.setHeaderVisible(true);
    jobsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 4));
    toolkit.paintBordersFor(jobsTable);

    TableViewerColumn tblViewerClmType = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnJobType = tblViewerClmType.getColumn();
    tblclmnJobType.setWidth(100);
    tblclmnJobType.setText("Job Type");

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

    tblViewerClmnState = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnState = tblViewerClmnState.getColumn();
    tblclmnState.setWidth(76);
    tblclmnState.setText("Enabled");

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnStarttime = tableViewerColumn_2.getColumn();
    tblclmnStarttime.setWidth(130);
    tblclmnStarttime.setText("Scheduled start");

    TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnType = tableViewerColumn_3.getColumn();
    tblclmnType.setWidth(130);
    tblclmnType.setText("End");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnRepeat = tableViewerColumn_1.getColumn();
    tblclmnRepeat.setWidth(100);
    tblclmnRepeat.setText("Repeats");

    TableViewerColumn tableViewerColumn_6 = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnInterval = tableViewerColumn_6.getColumn();
    tblclmnInterval.setWidth(100);
    tblclmnInterval.setText("Interval");

    TableViewerColumn tableViewerColumn_7 = new TableViewerColumn(jobsTableViewer, SWT.NONE);
    TableColumn tblclmnUpdate = tableViewerColumn_7.getColumn();
    tblclmnUpdate.setWidth(100);
    tblclmnUpdate.setText("Update");

    jobsTable.setFocus();
}

From source file:com.netxforge.netxstudio.screens.f4.MappingStatistics.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmMappingStatistics = toolkit.createForm(this);
    frmMappingStatistics.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmMappingStatistics);
    frmMappingStatistics.setText("Mapping Statistics: " + metricSource.getName());
    frmMappingStatistics.getBody().setLayout(new FormLayout());

    cleanStatsAction = new CleanStatsAction("Clean up...");

    frmMappingStatistics.getMenuManager().add(cleanStatsAction);

    SashForm sashForm = new SashForm(frmMappingStatistics.getBody(), SWT.NONE);
    FormData fd_sashForm = new FormData();
    fd_sashForm.bottom = new FormAttachment(100, -12);
    fd_sashForm.right = new FormAttachment(100, -12);
    fd_sashForm.top = new FormAttachment(0, 12);
    fd_sashForm.left = new FormAttachment(0, 12);
    sashForm.setLayoutData(fd_sashForm);
    toolkit.adapt(sashForm);//from   w  w  w.  jav  a2 s .  c  om
    toolkit.paintBordersFor(sashForm);

    Section sctnStatistics = toolkit.createSection(sashForm, Section.EXPANDED | Section.TITLE_BAR);
    toolkit.paintBordersFor(sctnStatistics);
    sctnStatistics.setText("Statistics");

    Composite cmpSelector = toolkit.createComposite(sctnStatistics, SWT.NONE);
    toolkit.paintBordersFor(cmpSelector);
    sctnStatistics.setClient(cmpSelector);
    cmpSelector.setLayout(new FillLayout(SWT.HORIZONTAL));

    statisticsTreeViewer = new TreeViewer(cmpSelector, SWT.BORDER | SWT.MULTI);
    statisticsTreeViewer.setUseHashlookup(true);
    statisticsTreeViewer.setComparer(new CDOElementComparer());
    statisticsTree = statisticsTreeViewer.getTree();
    toolkit.paintBordersFor(statisticsTree);

    // statisticsListViewer = new ListViewer(cmpSelector, SWT.BORDER
    // | SWT.V_SCROLL);

    // TODO, convert to an action.
    Menu menu = new Menu(statisticsTreeViewer.getTree());
    statisticsTreeViewer.getTree().setMenu(menu);

    MenuItem mntmMore = new MenuItem(menu, SWT.NONE);
    mntmMore.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Show the period etc..
            ISelection selection = statisticsTreeViewer.getSelection();
            if (selection instanceof IStructuredSelection) {
                Object o = ((IStructuredSelection) selection).getFirstElement();
                if (o instanceof MappingStatistic) {

                    // Create a predicate for filtering the values within a
                    // range.
                    MappingStatistic mappingStatistics = (MappingStatistic) o;

                    final int targetIntervalHint = mappingStatistics.getIntervalEstimate();

                    Resource metricResource = editingService.getData(MetricsPackage.Literals.METRIC);
                    List<NetXResource> resourcesInMetricSource = StudioUtils
                            .resourcesInMetricSource(metricResource.getContents(), metricSource);
                    if (resourcesInMetricSource.isEmpty()) {
                        System.out.println("No resources for this metricsource");
                        return;
                    }

                    DateTimeRange dtr = mappingStatistics.getPeriodEstimate();

                    System.out.println("VALUES FOR PERIOD:");

                    System.out.println("FROM=" + NonModelUtils.dateAndTime(dtr.getBegin()));
                    System.out.println("TO=" + NonModelUtils.dateAndTime(dtr.getEnd()));

                    int valueCount = 0;
                    for (NetXResource res : resourcesInMetricSource) {
                        System.out.println("values for resource: " + res.getShortName() + "on Component"
                                + res.getComponentRef().getName());

                        List<Value> values = StudioUtils.valuesForIntervalKindAndPeriod(res, targetIntervalHint,
                                null, dtr);
                        if (values.size() > 0) {
                            valueCount += values.size();
                            System.out.println("number of values " + Iterables.size(values));
                            for (Value v : values) {
                                System.out.println(
                                        NonModelUtils.fromXMLDate(v.getTimeStamp()) + ":" + v.getValue());
                            }
                        }
                    }
                    System.out.println("total values for this import = " + valueCount);

                }
            }
        }
    });
    mntmMore.setText("Values...");

    MenuItem mntmDelete = new MenuItem(menu, SWT.NONE);
    mntmDelete.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Show the period etc..
            ISelection selection = statisticsTreeViewer.getSelection();
            if (selection instanceof IStructuredSelection) {
                Object o = ((IStructuredSelection) selection).getFirstElement();
                if (o instanceof MappingStatistic) {
                    MappingStatistic mappingStatistics = (MappingStatistic) o;
                    final int targetIntervalHint = mappingStatistics.getIntervalEstimate();
                    Resource metricResource = editingService.getData(MetricsPackage.Literals.METRIC);
                    List<NetXResource> resourcesInMetricSource = StudioUtils
                            .resourcesInMetricSource(metricResource.getContents(), metricSource);
                    DateTimeRange dtr = mappingStatistics.getPeriodEstimate();

                    for (NetXResource res : resourcesInMetricSource) {
                        List<Value> values = StudioUtils.valuesForIntervalKindAndPeriod(res, targetIntervalHint,
                                null, dtr);
                        if (values.size() > 0) {
                            WarningDeleteCommand dc = new WarningDeleteCommand(
                                    editingService.getEditingDomain(), values);
                            editingService.getEditingDomain().getCommandStack().execute(dc);
                        }
                    }
                }
            }
        }
    });
    mntmDelete.setText("Purge import...");

    Section sctnSummary = toolkit.createSection(sashForm, Section.EXPANDED | Section.TITLE_BAR);
    toolkit.paintBordersFor(sctnSummary);
    sctnSummary.setText("Summary");

    Composite composite = toolkit.createComposite(sctnSummary, SWT.NONE);
    toolkit.paintBordersFor(composite);
    sctnSummary.setClient(composite);
    composite.setLayout(new GridLayout(2, false));

    Label lblStatus = toolkit.createLabel(composite, "Status:", SWT.NONE);
    lblStatus.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));

    txtMessage = toolkit.createText(composite, "New Text", SWT.READ_ONLY | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
    txtMessage.setText("");
    GridData gd_txtMessage = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
    gd_txtMessage.heightHint = 93;
    txtMessage.setLayoutData(gd_txtMessage);

    // RUN PERIOD

    Label lblStartDatetime = toolkit.createLabel(composite, "Start Date/Time:", SWT.NONE);
    lblStartDatetime.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    txtStartDateTime = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtStartDateTime.setText("");
    txtStartDateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblEndDatetime = toolkit.createLabel(composite, "End Date/Time:", SWT.NONE);
    lblEndDatetime.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    txtEndDateTime = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtEndDateTime.setText("");
    txtEndDateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    // METRIC PERIOD ESTIMATE.
    Label lblStartMetricDatetime = toolkit.createLabel(composite, "Metrics start:", SWT.NONE);
    lblStartMetricDatetime.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    txtMetricStartDateTime = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtMetricStartDateTime.setText("");
    txtMetricStartDateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblEndMetricDatetime = toolkit.createLabel(composite, "Metrics end:", SWT.NONE);
    lblEndMetricDatetime.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    txtMetricEndDateTime = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtMetricEndDateTime.setText("");
    txtMetricEndDateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    // RECORDS
    Label lblTotalRecordsProcessed = toolkit.createLabel(composite, "Total rows processed: ", SWT.NONE);
    lblTotalRecordsProcessed.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    txtTotalRecords = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtTotalRecords.setText("");
    txtTotalRecords.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblTotalExpectedValues = toolkit.createLabel(composite, "Total values:", SWT.NONE);

    lblTotalExpectedValues.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    txtTotalValues = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtTotalValues.setText("");
    txtTotalValues.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtTotalValues.setToolTipText("Total values is the # of metrics * the number of rows");

    Label lblTotalFailedValues = toolkit.createLabel(composite, "Total Failed Values", SWT.NONE);
    lblTotalFailedValues.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    txtTotalFailedValues = toolkit.createText(composite, "New Text", SWT.READ_ONLY);
    txtTotalFailedValues.setText("");
    txtTotalFailedValues.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    // Composite filler = toolkit.createComposite(composite, SWT.NONE);
    // GridData gd_filler = new GridData(SWT.LEFT, SWT.CENTER, false, false,
    // 2, 1);
    // gd_filler.heightHint = 30;
    // filler.setLayoutData(gd_filler);
    // toolkit.paintBordersFor(filler);

    tblViewerRecords = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);

    recordsTable = tblViewerRecords.getTable();
    recordsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1));
    recordsTable.setLinesVisible(true);
    recordsTable.setHeaderVisible(true);
    toolkit.paintBordersFor(recordsTable);

    MappingRecordErrorToolTipSupport.enableFor(tblViewerRecords, ToolTip.NO_RECREATE);

    TableViewerColumn tableViewerColumn = new TableViewerColumn(tblViewerRecords, SWT.NONE);
    TableColumn tblclmnNewColumn = tableViewerColumn.getColumn();
    tblclmnNewColumn.setWidth(40);
    tblclmnNewColumn.setText("Count");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tblViewerRecords, SWT.NONE);
    TableColumn tblclmnColumn = tableViewerColumn_1.getColumn();
    tblclmnColumn.setWidth(40);
    tblclmnColumn.setText("Column");

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tblViewerRecords, SWT.NONE);
    TableColumn tblclmnMessage = tableViewerColumn_2.getColumn();
    tblclmnMessage.setWidth(400);
    tblclmnMessage.setText("Message");

    sashForm.setWeights(new int[] { 3, 7 });
}

From source file:com.netxforge.netxstudio.screens.f4.MetricSources.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmMetricSources = toolkit.createForm(this);
    frmMetricSources.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmMetricSources);
    frmMetricSources.setText("Metric Sources");
    frmMetricSources.getBody().setLayout(new GridLayout(3, false));

    @SuppressWarnings("unused")
    Label lblFilterLabel = toolkit.createLabel(frmMetricSources.getBody(), "Filter:", SWT.NONE);

    txtFilterText = toolkit.createText(frmMetricSources.getBody(), "New Text",
            SWT.H_SCROLL | SWT.SEARCH | SWT.CANCEL);
    txtFilterText.setText("");
    GridData gd_txtFilterText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFilterText.widthHint = 200;//from ww  w.  ja va  2  s. co m
    txtFilterText.setLayoutData(gd_txtFilterText);

    txtFilterText.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent ke) {
            ViewerFilter[] filters = metricSourceTableViewer.getFilters();
            for (ViewerFilter viewerFilter : filters) {
                if (viewerFilter instanceof ISearchFilter) {
                    ((ISearchFilter) viewerFilter).setSearchText(txtFilterText.getText());
                }
            }
            metricSourceTableViewer.refresh();
        }
    });

    ImageHyperlink mghprlnkNewImagehyperlink = toolkit.createImageHyperlink(frmMetricSources.getBody(),
            SWT.NONE);
    mghprlnkNewImagehyperlink.addHyperlinkListener(new IHyperlinkListener() {
        public void linkActivated(HyperlinkEvent e) {
            NewEditMetricSource msScreen = new NewEditMetricSource(screenService.getScreenContainer(),
                    SWT.NONE);
            msScreen.setOperation(ScreenUtil.OPERATION_NEW);
            msScreen.setScreenService(screenService);

            msScreen.injectData(msResource, MetricsFactory.eINSTANCE.createMetricSource());
            screenService.setActiveScreen(msScreen);

        }

        public void linkEntered(HyperlinkEvent e) {
        }

        public void linkExited(HyperlinkEvent e) {
        }
    });
    mghprlnkNewImagehyperlink.setImage(ResourceManager.getPluginImage("com.netxforge.netxstudio.models.edit",
            "icons/full/ctool16/Metricsource_E.png"));
    mghprlnkNewImagehyperlink.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    toolkit.paintBordersFor(mghprlnkNewImagehyperlink);
    mghprlnkNewImagehyperlink.setText("New");

    metricSourceTableViewer = new TableViewer(frmMetricSources.getBody(),
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL);
    metricSourceTableViewer.setUseHashlookup(true);
    metricSourceTableViewer.setComparer(new CDOElementComparer());
    metricSourceTableViewer.addFilter(new CDOSearchFilter());

    metricSourceTable = metricSourceTableViewer.getTable();
    metricSourceTable.setLinesVisible(true);
    metricSourceTable.setHeaderVisible(true);
    metricSourceTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 4));

    toolkit.paintBordersFor(metricSourceTable);

    TableViewerColumn tableViewerColumn = new TableViewerColumn(metricSourceTableViewer, SWT.NONE);
    TableColumn tblclmnNewColumn = tableViewerColumn.getColumn();
    tblclmnNewColumn.setWidth(300);
    tblclmnNewColumn.setText("Name");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(metricSourceTableViewer, SWT.NONE);
    TableColumn tblclmnLocationUrl = tableViewerColumn_1.getColumn();
    tblclmnLocationUrl.setWidth(300);
    tblclmnLocationUrl.setText("Location URL");

    TableViewerColumn tableViewerType = new TableViewerColumn(metricSourceTableViewer, SWT.NONE);
    TableColumn tblclmnType = tableViewerType.getColumn();
    tblclmnType.setWidth(60);
    tblclmnType.setText("Mapping Type");

    TableViewerColumn tableViewerFilterPattern = new TableViewerColumn(metricSourceTableViewer, SWT.NONE);
    TableColumn tblclmnFilterPattern = tableViewerFilterPattern.getColumn();
    tblclmnFilterPattern.setWidth(300);
    tblclmnFilterPattern.setText("File pattern");

    metricSourceTable.setFocus();
}

From source file:com.netxforge.netxstudio.screens.f4.NewEditJob.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmNewJob = toolkit.createForm(this);
    frmNewJob.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmNewJob);/*  ww w  .  j a v a2  s  .  c o  m*/
    frmNewJob.getBody().setLayout(new FormLayout());

    Section sctnDetails = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    FormData fd_sctnDetails = new FormData();
    fd_sctnDetails.top = new FormAttachment(0, 12);
    fd_sctnDetails.left = new FormAttachment(0, 12);
    sctnDetails.setLayoutData(fd_sctnDetails);
    toolkit.paintBordersFor(sctnDetails);
    sctnDetails.setText("Job Details");

    Composite compositeDetails = toolkit.createComposite(sctnDetails, SWT.NONE);
    toolkit.paintBordersFor(compositeDetails);
    sctnDetails.setClient(compositeDetails);
    compositeDetails.setLayout(new GridLayout(2, false));

    btnActive = toolkit.createButton(compositeDetails, "Active", SWT.CHECK);
    btnActive.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));

    Label lblJobName = toolkit.createLabel(compositeDetails, "Name:", SWT.NONE);
    lblJobName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblJobName.setAlignment(SWT.RIGHT);

    txtJobName = toolkit.createText(compositeDetails, "New Text", SWT.NONE);
    txtJobName.setText("");
    GridData gd_txtJobName = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_txtJobName.widthHint = 100;
    txtJobName.setLayoutData(gd_txtJobName);

    // SECTION START OF JOB

    Section sctnRecurrence = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    fd_sctnDetails.right = new FormAttachment(sctnRecurrence, -6);
    FormData fd_sctnRecurrence = new FormData();
    fd_sctnRecurrence.right = new FormAttachment(100, -12);
    fd_sctnRecurrence.left = new FormAttachment(0, 295);
    fd_sctnRecurrence.bottom = new FormAttachment(0, 129);
    fd_sctnRecurrence.top = new FormAttachment(0, 12);
    sctnRecurrence.setLayoutData(fd_sctnRecurrence);
    toolkit.paintBordersFor(sctnRecurrence);
    sctnRecurrence.setText("Start");

    Composite compositeRecurrence = toolkit.createComposite(sctnRecurrence, SWT.NONE);
    toolkit.paintBordersFor(compositeRecurrence);
    sctnRecurrence.setClient(compositeRecurrence);
    compositeRecurrence.setLayout(new GridLayout(6, false));

    Label lblOn = toolkit.createLabel(compositeRecurrence, "On:", SWT.NONE);
    lblOn.setAlignment(SWT.RIGHT);
    GridData gd_lblOn = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblOn.widthHint = 70;
    lblOn.setLayoutData(gd_lblOn);

    comboViewerOn = new ComboViewer(compositeRecurrence, SWT.NONE);
    Combo comboOn = comboViewerOn.getCombo();
    GridData gd_comboOn = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1);
    gd_comboOn.widthHint = 150;
    comboOn.setLayoutData(gd_comboOn);
    toolkit.paintBordersFor(comboOn);

    Label lblAt = toolkit.createLabel(compositeRecurrence, "At:", SWT.NONE);
    lblAt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    cdateTimeStartTime = new CDateTime(compositeRecurrence, CDT.BORDER | CDT.CLOCK_24_HOUR | CDT.DROP_DOWN);
    GridData gd_cdateTimeStartTime = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_cdateTimeStartTime.widthHint = 150;
    cdateTimeStartTime.setLayoutData(gd_cdateTimeStartTime);
    cdateTimeStartTime.setPattern("HH:mm");

    toolkit.adapt(cdateTimeStartTime);
    toolkit.paintBordersFor(cdateTimeStartTime);

    Label lblEvery = toolkit.createLabel(compositeRecurrence, "Every:", SWT.NONE);
    lblEvery.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblEvery.setAlignment(SWT.RIGHT);

    comboViewerEvery = new ComboViewer(compositeRecurrence, SWT.NONE);
    Combo comboEvery = comboViewerEvery.getCombo();
    GridData gd_comboEvery = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1);
    gd_comboEvery.widthHint = 150;
    comboEvery.setLayoutData(gd_comboEvery);
    toolkit.paintBordersFor(comboEvery);
    new Label(compositeRecurrence, SWT.NONE);
    new Label(compositeRecurrence, SWT.NONE);

    Label lblStartsOn = toolkit.createLabel(compositeRecurrence, "From:", SWT.NONE);
    GridData gd_lblStartsOn = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblStartsOn.widthHint = 70;
    lblStartsOn.setLayoutData(gd_lblStartsOn);
    lblStartsOn.setAlignment(SWT.RIGHT);

    dateChooserStartsOn = new DateChooserCombo(compositeRecurrence, SWT.BORDER | SWT.FLAT);
    GridData gd_dateChooserStartsOn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
    gd_dateChooserStartsOn.heightHint = 19;
    gd_dateChooserStartsOn.widthHint = 150;
    dateChooserStartsOn.setLayoutData(gd_dateChooserStartsOn);
    toolkit.adapt(dateChooserStartsOn);
    toolkit.paintBordersFor(dateChooserStartsOn);
    new Label(compositeRecurrence, SWT.NONE);
    new Label(compositeRecurrence, SWT.NONE);

    // SECTION END OF JOB

    Section sctnJobEnd = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    FormData fd_sctnJobEnd = new FormData();
    fd_sctnJobEnd.top = new FormAttachment(sctnRecurrence, 12);
    fd_sctnJobEnd.left = new FormAttachment(0, 295);
    fd_sctnJobEnd.right = new FormAttachment(100, -12);
    sctnJobEnd.setLayoutData(fd_sctnJobEnd);
    toolkit.paintBordersFor(sctnJobEnd);
    sctnJobEnd.setText("End");
    sctnJobEnd.setExpanded(true);

    Composite compositeEndsOn = toolkit.createComposite(sctnJobEnd, SWT.NONE);
    toolkit.paintBordersFor(compositeEndsOn);
    sctnJobEnd.setClient(compositeEndsOn);
    compositeEndsOn.setLayout(new GridLayout(3, false));

    btnOn = toolkit.createButton(compositeEndsOn, "On: ", SWT.RADIO);
    // btnOn.addSelectionListener(new SelectionAdapter() {
    // @Override
    // public void widgetSelected(SelectionEvent e) {
    //
    // }
    // });

    GridData gd_btnOn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnOn.widthHint = 70;
    btnOn.setLayoutData(gd_btnOn);

    dateChooserEndsOn = new DateChooserCombo(compositeEndsOn, SWT.BORDER | SWT.FLAT);
    GridData gd_dateChooserEndsOn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateChooserEndsOn.heightHint = 19;
    gd_dateChooserEndsOn.widthHint = 150;
    dateChooserEndsOn.setLayoutData(gd_dateChooserEndsOn);
    toolkit.adapt(dateChooserEndsOn);
    toolkit.paintBordersFor(dateChooserEndsOn);

    btnAfter = toolkit.createButton(compositeEndsOn, "After:", SWT.RADIO);

    txtOccurences = toolkit.createText(compositeEndsOn, "New Text", SWT.NONE);
    GridData gd_txtOccurences = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_txtOccurences.widthHint = 15;
    txtOccurences.setLayoutData(gd_txtOccurences);
    txtOccurences.setText("");

    toolkit.createLabel(compositeEndsOn, "Repeats", SWT.NONE);

    btnNever = toolkit.createButton(compositeEndsOn, "Never", SWT.RADIO);
    btnNever.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    new Label(compositeEndsOn, SWT.NONE);
    btnNever.setSelection(true);

    // SECTION SUMMARY

    Section sctnSummary = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    fd_sctnDetails.bottom = new FormAttachment(sctnSummary, -12);
    fd_sctnJobEnd.bottom = new FormAttachment(sctnSummary, -12);
    FormData fd_sctnSummary = new FormData();
    fd_sctnSummary.top = new FormAttachment(0, 260);
    fd_sctnSummary.bottom = new FormAttachment(100, -12);
    fd_sctnSummary.left = new FormAttachment(0, 12);
    fd_sctnSummary.right = new FormAttachment(100, -12);
    sctnSummary.setLayoutData(fd_sctnSummary);
    toolkit.paintBordersFor(sctnSummary);
    sctnSummary.setText("Summary");

    Composite composite_3 = toolkit.createComposite(sctnSummary, SWT.NONE);
    toolkit.paintBordersFor(composite_3);
    sctnSummary.setClient(composite_3);
    composite_3.setLayout(new GridLayout(1, false));

    occurencesTableViewer = new TableViewer(composite_3, SWT.BORDER | SWT.FULL_SELECTION);
    table = occurencesTableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
    toolkit.paintBordersFor(table);

    TableViewerColumn tableViewerColumn = new TableViewerColumn(occurencesTableViewer, SWT.NONE);
    TableColumn tblclmnDate = tableViewerColumn.getColumn();
    tblclmnDate.setWidth(100);
    tblclmnDate.setText("Date");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(occurencesTableViewer, SWT.NONE);
    TableColumn tblclmnTime = tableViewerColumn_1.getColumn();
    tblclmnTime.setWidth(100);
    tblclmnTime.setText("Time");

    occurencesTableViewer.setContentProvider(new ArrayContentProvider());
    occurencesTableViewer.setLabelProvider(new OccurenceLabelProvider());

    tableViewerJobObjects = new TableViewer(compositeDetails, SWT.BORDER | SWT.FULL_SELECTION);
    tableJobObjects = tableViewerJobObjects.getTable();
    tableJobObjects.setHeaderVisible(true);
    tableJobObjects.setLinesVisible(true);
    tableJobObjects.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    toolkit.paintBordersFor(tableJobObjects);

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewerJobObjects, SWT.NONE);
    TableColumn tblclmnObject = tableViewerColumn_2.getColumn();
    tblclmnObject.setWidth(135);
    tblclmnObject.setText("Object");

    TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tableViewerJobObjects, SWT.NONE);
    TableColumn tblclmnId = tableViewerColumn_3.getColumn();
    tblclmnId.setWidth(120);
    tblclmnId.setText("ID");
}

From source file:com.netxforge.netxstudio.screens.f4.ResourceMonitors.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmResourceMonitors = toolkit.createForm(this);
    frmResourceMonitors.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmResourceMonitors);
    frmResourceMonitors.setText("Resource Monitors");
    frmResourceMonitors.getBody().setLayout(new GridLayout(3, false));

    Label lblFilterLabel = toolkit.createLabel(frmResourceMonitors.getBody(), "Filter:", SWT.NONE);
    GridData gd_lblFilterLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblFilterLabel.widthHint = 44;/*from w w w.  jav a2 s.  c o m*/
    lblFilterLabel.setLayoutData(gd_lblFilterLabel);

    txtFilterText = toolkit.createText(frmResourceMonitors.getBody(), "New Text",
            SWT.H_SCROLL | SWT.SEARCH | SWT.CANCEL);
    txtFilterText.setText("");
    GridData gd_txtFilterText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFilterText.widthHint = 200;
    txtFilterText.setLayoutData(gd_txtFilterText);
    new Label(frmResourceMonitors.getBody(), SWT.NONE);

    resourceMonitorsTableViewer = new TableViewer(frmResourceMonitors.getBody(),
            SWT.BORDER | SWT.FULL_SELECTION);
    table = resourceMonitorsTableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 4));
    toolkit.paintBordersFor(table);

    TableViewerColumn tblViewerClmType = new TableViewerColumn(resourceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnNode = tblViewerClmType.getColumn();
    tblclmnNode.setWidth(76);
    tblclmnNode.setText("Node");

    TableViewerColumn tableViewerColumn = new TableViewerColumn(resourceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnResource = tableViewerColumn.getColumn();
    tblclmnResource.setWidth(104);
    tblclmnResource.setText("Resource");

    tblViewerClmnState = new TableViewerColumn(resourceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnMarkers = tblViewerClmnState.getColumn();
    tblclmnMarkers.setWidth(207);
    tblclmnMarkers.setText("Markers");

    TableViewerColumn tblViewerClmnStart = new TableViewerColumn(resourceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnStart = tblViewerClmnStart.getColumn();
    tblclmnStart.setWidth(150);
    tblclmnStart.setText("Start");

    TableViewerColumn tblViewerClmnEnd = new TableViewerColumn(resourceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnEnd = tblViewerClmnEnd.getColumn();
    tblclmnEnd.setWidth(150);
    tblclmnEnd.setText("End");
}

From source file:com.netxforge.netxstudio.screens.f4.ServiceMonitors.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmServiceMonitors = toolkit.createForm(this);
    frmServiceMonitors.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmServiceMonitors);
    frmServiceMonitors.setText("Service Monitoring");
    frmServiceMonitors.getBody().setLayout(new GridLayout(3, false));

    Label lblFilterLabel = toolkit.createLabel(frmServiceMonitors.getBody(), "Filter:", SWT.NONE);
    GridData gd_lblFilterLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblFilterLabel.widthHint = 44;//from w  w w .  j a  v a  2s  . c  o  m
    lblFilterLabel.setLayoutData(gd_lblFilterLabel);

    txtFilterText = toolkit.createText(frmServiceMonitors.getBody(), "New Text",
            SWT.H_SCROLL | SWT.SEARCH | SWT.CANCEL);
    txtFilterText.setText("");
    GridData gd_txtFilterText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFilterText.widthHint = 200;
    txtFilterText.setLayoutData(gd_txtFilterText);
    new Label(frmServiceMonitors.getBody(), SWT.NONE);

    serviceMonitorsTableViewer = new TableViewer(frmServiceMonitors.getBody(),
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    serviceMonitorsTableViewer.setComparer(new CDOElementComparer());

    table = serviceMonitorsTableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
    toolkit.paintBordersFor(table);

    TableViewerColumn tblViewerClmType = new TableViewerColumn(serviceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnName = tblViewerClmType.getColumn();
    tblclmnName.setWidth(106);
    tblclmnName.setText("Name");

    TableViewerColumn tableViewerColumn = new TableViewerColumn(serviceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnRevision = tableViewerColumn.getColumn();
    tblclmnRevision.setWidth(104);
    tblclmnRevision.setText("Revision");

    tblViewerClmnState = new TableViewerColumn(serviceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnStart = tblViewerClmnState.getColumn();
    tblclmnStart.setWidth(139);
    tblclmnStart.setText("Start");

    // Menu menu = new Menu(table);
    // table.setMenu(menu);
    //
    // MenuItem mntmEdit = new MenuItem(menu, SWT.NONE);
    // mntmEdit.addSelectionListener(new SelectionAdapter() {
    // @Override
    // public void widgetSelected(SelectionEvent e) {
    //
    // ISelection selection = getViewer().getSelection();
    // if (selection instanceof IStructuredSelection) {
    // Object o = ((IStructuredSelection) selection)
    // .getFirstElement();
    // ResourceMonitors rmScreen = new ResourceMonitors(
    // screenService.getScreenContainer(), SWT.NONE);
    // rmScreen.setOperation(Screens.OPERATION_READ_ONLY);
    // rmScreen.setScreenService(screenService);
    // rmScreen.injectData(null,o);
    // screenService.setActiveScreen(rmScreen);
    // }
    // }
    // });
    // mntmEdit.setText("View...");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(serviceMonitorsTableViewer, SWT.NONE);
    TableColumn tblclmnEnd = tableViewerColumn_1.getColumn();
    tblclmnEnd.setWidth(185);
    tblclmnEnd.setText("End");
}

From source file:com.netxforge.netxstudio.screens.f4.smarts.SmartMetricSources.java

License:Open Source License

protected void delegateBuildColumns(TableViewer viewer) {

    TableViewerColumn tableViewerColumn = new TableViewerColumn(viewer, SWT.NONE);
    TableColumn tblclmnNewColumn = tableViewerColumn.getColumn();
    tblclmnNewColumn.setWidth(300);/*from   w w w .j  a  va2 s. c o m*/
    tblclmnNewColumn.setText("Name");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(viewer, SWT.NONE);
    TableColumn tblclmnLocationUrl = tableViewerColumn_1.getColumn();
    tblclmnLocationUrl.setWidth(300);
    tblclmnLocationUrl.setText("Location URL");

    TableViewerColumn tableViewerType = new TableViewerColumn(viewer, SWT.NONE);
    TableColumn tblclmnType = tableViewerType.getColumn();
    tblclmnType.setWidth(60);
    tblclmnType.setText("Mapping Type");

    TableViewerColumn tableViewerFilterPattern = new TableViewerColumn(viewer, SWT.NONE);
    TableColumn tblclmnFilterPattern = tableViewerFilterPattern.getColumn();
    tblclmnFilterPattern.setWidth(300);
    tblclmnFilterPattern.setText("File pattern");

}

From source file:com.netxforge.netxstudio.screens.nf4.UserActivity.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmActivities = toolkit.createForm(this);
    frmActivities.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmActivities);

    frmActivities.setText("");
    frmActivities.getBody().setLayout(new FormLayout());

    Section sctnInfo = toolkit.createSection(frmActivities.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    FormData fd_sctnInfo = new FormData();
    fd_sctnInfo.top = new FormAttachment(frmActivities.getBody(), 12);
    fd_sctnInfo.bottom = new FormAttachment(100, -12);
    fd_sctnInfo.right = new FormAttachment(100, -12);
    fd_sctnInfo.left = new FormAttachment(0, 12);
    sctnInfo.setLayoutData(fd_sctnInfo);
    toolkit.paintBordersFor(sctnInfo);/* w w  w.  j a v a 2s.  c  om*/
    sctnInfo.setText("Activities");

    Composite composite_1 = toolkit.createComposite(sctnInfo, SWT.NONE);
    toolkit.paintBordersFor(composite_1);
    sctnInfo.setClient(composite_1);
    GridLayout gl_composite_1 = new GridLayout(1, false);
    gl_composite_1.horizontalSpacing = 8;
    composite_1.setLayout(gl_composite_1);

    tableViewer = new TableViewer(composite_1, SWT.BORDER | SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.MULTI);
    tableViewer.setUseHashlookup(true);
    tableViewer.setComparer(new CDOElementComparer());
    table = tableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    toolkit.paintBordersFor(table);

    TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnNewColumn = tableViewerColumn.getColumn();
    tblclmnNewColumn.setWidth(150);
    tblclmnNewColumn.setText("Date / Time");

    TableViewerColumnSorter dateTimeColumnSorter = new TableViewerColumnSorter(tableViewerColumn) {
        protected int doCompare(Viewer viewer, Object e1, Object e2) {
            if (e1 instanceof CommitLogEntry && e2 instanceof CommitLogEntry) {

                CommitLogEntry re1 = (CommitLogEntry) e1;
                CommitLogEntry re2 = (CommitLogEntry) e2;

                if (re1.eIsSet(GenericsPackage.Literals.COMMIT_LOG_ENTRY__TIME_STAMP)
                        && re2.eIsSet(GenericsPackage.Literals.COMMIT_LOG_ENTRY__TIME_STAMP))

                    return Long.valueOf(re2.getTimeStamp().toGregorianCalendar().getTimeInMillis()).compareTo(
                            Long.valueOf(re1.getTimeStamp().toGregorianCalendar().getTimeInMillis()));
            }
            return 0;
        }

    };
    dateTimeColumnSorter.setSorter(TableViewerColumnSorter.ASC);

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnObject = tableViewerColumn_1.getColumn();
    tblclmnObject.setWidth(200);
    tblclmnObject.setText("Object");

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnActivity = tableViewerColumn_2.getColumn();
    tblclmnActivity.setWidth(114);
    tblclmnActivity.setText("Activity");

    TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tblclmnData = tableViewerColumn_3.getColumn();
    tblclmnData.setWidth(100);
    tblclmnData.setText("Data");
}

From source file:com.nextep.designer.sqlclient.ui.connectors.SQLResultConnector.java

License:Open Source License

@Override
public Control create(Composite parent) {
    Composite resultPane = new Composite(parent, SWT.NONE);
    sqlView = new Table(resultPane, SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL | SWT.MULTI);
    // final NextepTableEditor editor = NextepTableEditor.handle(sqlView);
    CoolBar statsBar = new CoolBar(resultPane, SWT.NONE);
    statsBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Status item for result count
    final CoolItem rowsItem = new CoolItem(statsBar, SWT.NONE);
    rowsItem.setSize(rowsItem.computeSize(150, 20));
    rowsCount = new CLabel(statsBar, SWT.NONE);
    rowsItem.setControl(rowsCount);//from   w w w .  ja  va 2  s  . c  o  m
    // Status item for query time and fetch time
    final CoolItem timeItem = new CoolItem(statsBar, SWT.NONE);
    timeLabel = new CLabel(statsBar, SWT.NONE);
    timeItem.setControl(timeLabel);
    timeItem.setSize(timeItem.computeSize(400, 20));

    sqlView.setHeaderVisible(true);
    sqlView.setLinesVisible(true);
    sqlView.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1));
    resultPane.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1));
    GridLayout grid = new GridLayout();
    grid.marginBottom = grid.marginHeight = grid.marginLeft = grid.marginRight = grid.marginTop = grid.marginWidth = 0;
    resultPane.setLayout(grid);

    // Configuring viewer
    sqlViewer = new TableViewer(sqlView);
    sqlViewer.setContentProvider(new SQLResultContentProvider());
    ColumnViewerToolTipSupport.enableFor(sqlViewer, ToolTip.NO_RECREATE);
    SQLResultLabelProvider lblProvider = new SQLResultLabelProvider(this, 0);
    final TableViewerColumn viewerCol = new TableViewerColumn(sqlViewer, SWT.NONE);
    viewerCol.setLabelProvider(lblProvider);
    // final ITableLabelProvider labelProvider = new SQLResultLabelProvider();
    // sqlViewer.setLabelProvider(labelProvider);
    modifier = new SQLRowResultCellModifier(false, sqlViewer, new IStatusAccessor() {

        @Override
        public void setStatus(String status, boolean error) {
            setStatusLabel(status, error);
        }
    });
    // Initializing comparator
    comparator = new SQLResultViewerComparator(sqlViewer);
    sqlViewer.setComparator(comparator);
    return resultPane;
}

From source file:com.nextep.designer.sqlclient.ui.connectors.SQLResultConnector.java

License:Open Source License

private void initializeTable(ISQLQuery query, long executionTime, INextepMetadata md) {
    colMaxWidth = new int[md.getColumnCount() + 1];
    // Checking columns to display
    int displayedColumns = query.getDisplayedColumnsCount();
    if (displayedColumns <= 0) {
        displayedColumns = md.getColumnCount();
    }//from w w w  . j a va 2s. c o m
    for (int i = 1; i <= displayedColumns; i++) {
        final String colName = md.getColumnName(i);
        // final int colPrecision = md.getPrecision(index);
        final int colType = md.getColumnType(i);

        final int colIndex = i - 1;
        if (!sqlView.isDisposed()) {
            TableColumn c = new TableColumn(sqlView, SWT.NONE);
            c.setText(colName);
            c.setWidth(colName.length() * 8);
            c.addListener(SWT.Selection, comparator);
            colMaxWidth[colIndex] = c.getWidth();
            SQLResultLabelProvider lblProvider = new SQLResultLabelProvider(this, colIndex);
            final TableViewerColumn viewerCol = new TableViewerColumn(sqlViewer, c);
            viewerCol.setLabelProvider(lblProvider);
            // Registering column comparator
            switch (colType) {
            case Types.BIGINT:
            case Types.BIT:
            case Types.DECIMAL:
            case Types.DOUBLE:
            case Types.FLOAT:
            case Types.INTEGER:
            case Types.NUMERIC:
            case Types.REAL:
            case Types.SMALLINT:
            case Types.TINYINT:
                c.setData(SQLResultViewerComparator.KEY_COMPARATOR, new NumberComparator());
                // Setting our deserializer which can produce number from string
                c.setData(KEY_DESERIALIZER, NUMBER_DESERIALIZER);
                break;
            case Types.DATE:
            case Types.TIME:
            case Types.TIMESTAMP:
                // Defines validation so that user will be notified about problems
                c.setData(KEY_CELL_VALIDATOR, DATE_VALIDATOR);
                // Setting our deserializer which can produce date from string
                c.setData(KEY_DESERIALIZER, DATE_DESERIALIZER);
                c.setData(SQLResultViewerComparator.KEY_COMPARATOR, new DateComparator());
                break;
            default:
                c.setData(KEY_DESERIALIZER, STRING_DESERIALIZER);
                c.setData(SQLResultViewerComparator.KEY_COMPARATOR, new StringComparator());
            }
        }
    }
    registerCellEditors();
    setStatusLabel(MessageFormat.format(SQLClientMessages.getString("sql.executionTime"), executionTime),
            false);
    sqlViewer.setInput(query.getResult());
}