Search in sources :

Example 21 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project azure-tools-for-java by Microsoft.

the class BlobExplorerFileEditor method createTable.

private Table createTable(Composite parent) {
    blobListTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
    blobListTable.setHeaderVisible(true);
    blobListTable.setLinesVisible(true);
    GridData gridData = new GridData();
    //        gridData.heightHint = 75;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    GridLayout gridLayoutTable = new GridLayout();
    gridLayoutTable.numColumns = 6;
    gridLayoutTable.marginRight = 0;
    blobListTable.setLayout(gridLayoutTable);
    blobListTable.setLayoutData(gridData);
    for (int i = 0; i < 6; i++) {
        new TableColumn(blobListTable, SWT.FILL);
    }
    blobListTable.getColumn(0).setText("");
    blobListTable.getColumn(1).setText("Name");
    blobListTable.getColumn(2).setText("Size");
    blobListTable.getColumn(3).setText("Last Modified (UTC)");
    blobListTable.getColumn(4).setText("Content Type");
    blobListTable.getColumn(5).setText("URL");
    blobListTable.getColumn(0).setWidth(25);
    blobListTable.getColumn(1).setWidth(280);
    blobListTable.getColumn(2).setWidth(60);
    blobListTable.getColumn(3).setWidth(110);
    blobListTable.getColumn(4).setWidth(140);
    blobListTable.getColumn(5).setWidth(250);
    tableViewer = new TableViewer(blobListTable);
    tableViewer.setUseHashlookup(true);
    tableViewer.setContentProvider(new BlobListContentProvider());
    tableViewer.setLabelProvider(new BlobListLabelProvider());
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
            boolean directorySelected = tableViewer.getTable().getSelectionIndex() > -1 && isDirectorySelected();
            deleteButton.setEnabled(!directorySelected);
            //                openButton.setEnabled(!directorySelected);
            saveAsButton.setEnabled(!directorySelected);
        }
    });
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            tableSelection();
        }
    });
    fillGrid();
    return blobListTable;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 22 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project azure-tools-for-java by Microsoft.

the class QueueFileEditor method createTable.

private void createTable(Composite parent) {
    queueTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
    queueTable.setHeaderVisible(true);
    queueTable.setLinesVisible(true);
    GridData gridData = new GridData();
    //        gridData.heightHint = 75;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    GridLayout gridLayoutTable = new GridLayout();
    gridLayoutTable.numColumns = 6;
    gridLayoutTable.marginRight = 0;
    queueTable.setLayout(gridLayoutTable);
    queueTable.setLayoutData(gridData);
    for (int i = 0; i < 6; i++) {
        TableColumn column = new TableColumn(queueTable, SWT.FILL);
        column.setWidth(100);
    }
    queueTable.getColumn(0).setText("Id");
    queueTable.getColumn(1).setText("Message Text Preview");
    queueTable.getColumn(2).setText("Size");
    queueTable.getColumn(3).setText("Insertion Time (UTC)");
    queueTable.getColumn(4).setText("Expiration Time (UTC)");
    queueTable.getColumn(5).setText("Dequeue count");
    tableViewer = new TableViewer(queueTable);
    tableViewer.setContentProvider(new QueueContentProvider());
    tableViewer.setLabelProvider(new QueueLabelProvider());
    fillGrid();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) GridData(org.eclipse.swt.layout.GridData) TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 23 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project tdi-studio-se by Talend.

the class BusinessAssignmentComposite method createControls.

public void createControls(Composite parent) {
    composite = widgetFactory.createFlatFormComposite(parent);
    adapterFactory = new BusinessItemProviderAdapterFactory();
    tableViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
    tableViewer.setLabelProvider(new RepositoryFactoryProxyLabelProvider(adapterFactory));
    Table table = tableViewer.getTable();
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    final String[] columnProperties = new String[] { Messages.getString("AssignmentPropertySection.Type"), Messages.getString("AssignmentPropertySection.Name"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    Messages.getString("AssignmentPropertySection.Comment") };
    TableColumn column1 = new TableColumn(table, SWT.NONE);
    tableLayout.addColumnData(new ColumnPixelData(125, true));
    column1.setText(columnProperties[0]);
    TableColumn column2 = new TableColumn(table, SWT.NONE);
    tableLayout.addColumnData(new ColumnPixelData(125, true));
    column2.setText(columnProperties[1]);
    TableColumn column3 = new TableColumn(table, SWT.NONE);
    tableLayout.addColumnData(new ColumnWeightData(1, 150, true));
    column3.setText(columnProperties[2]);
    tableViewer.setColumnProperties(columnProperties);
    final IItemPropertyDescriptor itemPropertyDescriptor = getItemPropertyDescriptor();
    tableViewer.setCellModifier(new ICellModifier() {

        @Override
        public boolean canModify(Object element, String property) {
            return property.equals(columnProperties[2]);
        }

        @Override
        public Object getValue(Object element, String property) {
            return EmfPropertyHelper.getValue(itemPropertyDescriptor, element);
        }

        @Override
        public void modify(Object element, String property, Object value) {
            if (element instanceof TableItem) {
                TableItem tableItem = (TableItem) element;
                itemPropertyDescriptor.setPropertyValue(tableItem.getData(), value);
            }
        }
    });
    CellEditor[] cellEditors = new CellEditor[3];
    cellEditors[2] = new TextCellEditor(table);
    tableViewer.setCellEditors(cellEditors);
    // createKeyListener(table);
    createSelectionListener();
    createPopupMenu();
    createDoubleClickListener();
    handleLayout(parent, table, column1, column2, column3);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) Table(org.eclipse.swt.widgets.Table) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) RepositoryFactoryProxyLabelProvider(org.talend.designer.business.diagram.custom.properties.RepositoryFactoryProxyLabelProvider) TableItem(org.eclipse.swt.widgets.TableItem) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) AdapterFactoryContentProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider) TableColumn(org.eclipse.swt.widgets.TableColumn) BusinessItemProviderAdapterFactory(org.talend.designer.business.model.business.provider.BusinessItemProviderAdapterFactory) ICellModifier(org.eclipse.jface.viewers.ICellModifier) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) IItemPropertyDescriptor(org.eclipse.emf.edit.provider.IItemPropertyDescriptor) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 24 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project tdi-studio-se by Talend.

the class PatternCellEditor method openDialogBox.

//TODO: when no one use repository, need to set back to "Built-in"
@Override
protected Object openDialogBox(Control cellEditorWindow) {
    ITDQPatternService service = null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQPatternService.class)) {
        service = (ITDQPatternService) GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
    }
    if (service != null) {
        IElementParameter typeParam = node.getElementParameter("TYPE");
        if (typeParam == null && node.getIncomingConnections().size() > 0) {
            IConnection iConnection = node.getIncomingConnections().get(0);
            typeParam = iConnection.getElementParameter("TYPE");
        }
        String[] patternInfo = service.selectPattern(cellEditorWindow.getShell(), typeParam);
        //modify the same row's pattern info: id, name, regex
        if (patternInfo != null) {
            int index = 0;
            TableViewer tableViewer = getTableViewer();
            if (tableViewer != null) {
                index = tableViewer.getTable().getSelectionIndex();
            }
            updatePatterInfoOnRow(index, patternInfo);
            // if any row select a pattern, set the node's PROPERTY = REPOSITORY
            IElementParameter property = node.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
            if (property != null) {
                IElementParameter repositoryParam = node.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
                if (StringUtils.isNotBlank(patternInfo[0])) {
                    property.setValue(EmfComponent.REPOSITORY);
                    if (repositoryParam != null) {
                        repositoryParam.setValue(patternInfo[0]);
                    }
                }
            }
        }
        return patternInfo[1];
    }
    return null;
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) IConnection(org.talend.core.model.process.IConnection) ITDQPatternService(org.talend.core.ITDQPatternService) TableViewer(org.eclipse.jface.viewers.TableViewer) AbstractExtendedTableViewer(org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer)

Example 25 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project tdi-studio-se by Talend.

the class JobHierarchyViewPart method createMethodViewerControl.

private Control createMethodViewerControl(Composite parent) {
    dependencyViewer = new TableViewer(parent);
    DependencyViewerProvider provider = new DependencyViewerProvider(this.fHierarchyLifeCycle);
    dependencyViewer.setContentProvider(provider);
    dependencyViewer.setLabelProvider(provider);
    Control control = dependencyViewer.getTable();
    //$NON-NLS-1$
    String popupId = "DependencyViewer_ContextMenu";
    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager menu) {
            fillDependencyViewerContextMenu(menu);
        }
    });
    Menu menu = menuMgr.createContextMenu(control);
    control.setMenu(menu);
    getSite().registerContextMenu(popupId, menuMgr, dependencyViewer);
    return control;
}
Also used : Control(org.eclipse.swt.widgets.Control) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) IMenuListener(org.eclipse.jface.action.IMenuListener)

Aggregations

TableViewer (org.eclipse.jface.viewers.TableViewer)215 GridData (org.eclipse.swt.layout.GridData)135 Composite (org.eclipse.swt.widgets.Composite)126 Table (org.eclipse.swt.widgets.Table)103 GridLayout (org.eclipse.swt.layout.GridLayout)102 SelectionEvent (org.eclipse.swt.events.SelectionEvent)99 TableColumn (org.eclipse.swt.widgets.TableColumn)85 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)77 Label (org.eclipse.swt.widgets.Label)59 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)50 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)48 Button (org.eclipse.swt.widgets.Button)48 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)47 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)45 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)44 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)33 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)33 Event (org.eclipse.swt.widgets.Event)26 Listener (org.eclipse.swt.widgets.Listener)26 Point (org.eclipse.swt.graphics.Point)25