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;
}
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();
}
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);
}
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;
}
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;
}
Aggregations