List of usage examples for org.eclipse.jface.viewers TableViewer remove
@Override public void remove(Object[] elements)
From source file:org.kalypso.ogc.gml.om.table.TupleResultContentProvider2.java
License:Open Source License
protected void handleRecordsChanged(final IRecord[] records, final TYPE type) { // TODO: Performance optimization needed for lots of single changes... final TableViewer tableViewer = m_viewer; final Control control = tableViewer.getControl(); if (control.isDisposed()) return;/*from w w w .ja v a2 s . c o m*/ control.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (!control.isDisposed()) switch (type) { case ADDED: // TODO: optimize, depending on event (events must deliver more information) // we need the insert positions here... or the viewer should have an sorter? // tableViewer.add( records ); // tableViewer.reveal( records[records.length - 1] ); scheduleRefresh(); break; case REMOVED: tableViewer.remove(records); break; case CHANGED: { if (records == null) scheduleRefresh(); else tableViewer.update(records, null); } break; } } }); }
From source file:org.l2x6.eircc.ui.search.IrcSearchResultTableContentProvider.java
License:Open Source License
public void elementsChanged(Object[] updatedElements) { TableViewer viewer = getViewer(); int elementLimit = getElementLimit(); boolean tableLimited = elementLimit != -1; for (int i = 0; i < updatedElements.length; i++) { if (searchResult.getMatchCount(updatedElements[i]) > 0) { if (viewer.testFindItem(updatedElements[i]) != null) viewer.update(updatedElements[i], null); else { if (!tableLimited || viewer.getTable().getItemCount() < elementLimit) viewer.add(updatedElements[i]); }/* w w w .ja v a 2 s . c o m*/ } else viewer.remove(updatedElements[i]); } }
From source file:org.nuxeo.ide.sdk.userlibs.UserLibPreferencePage.java
License:Open Source License
protected void removeLib(UserLib lib) { TableViewer tv = getTable().getTableViewer(); prefs.removeUserLib(lib);/*w w w . j a v a 2s.c o m*/ int i = tv.getTable().getSelectionIndex(); tv.remove(lib); UserLib slib = null; if (i == 0) { slib = (UserLib) tv.getElementAt(0); } else if (i > 0) { slib = (UserLib) tv.getElementAt(i - 1); } if (slib != null) { tv.setSelection(new StructuredSelection(slib)); } }
From source file:org.talend.designer.alfrescooutput.ui.AlfrescoModelDialog.java
License:Open Source License
private Table createAlfrescoModelElementTable(Composite composite, AlfrescoModelElements modelElements) { Table table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); table.setLinesVisible(true);/*from w w w.jav a 2 s. c o m*/ table.setHeaderVisible(true); TableColumn titleColumn = new TableColumn(table, SWT.LEFT, 0); titleColumn.setText(Messages.getString("AlfrescoModelDialog.modelTable.title")); //$NON-NLS-1$ titleColumn.setWidth(300); TableColumn nameColumn = new TableColumn(table, SWT.LEFT, 1); nameColumn.setText(Messages.getString("AlfrescoModelDialog.modelTable.name")); //$NON-NLS-1$ nameColumn.setWidth(300); // createTableViewer final TableViewer tableViewer = new TableViewer(table); tableViewer.setUseHashlookup(true); String[] tableColumnNames = new String[] { Messages.getString("AlfrescoModelDialog.modelTable.title"), //$NON-NLS-1$ Messages.getString("AlfrescoModelDialog.modelTable.name") }; //$NON-NLS-1$ tableViewer.setColumnProperties(tableColumnNames); // NB. no cell editors for tableViewer tableViewer.setContentProvider(new AlfrescoModelContentProvider() { public void alfrescoModelElementAdded(Element alfrescoModelElement) { tableViewer.add(alfrescoModelElement); } public void alfrescoModelElementRemoved(Element alfrescoModelElement) { tableViewer.remove(alfrescoModelElement); } }); tableViewer.setLabelProvider(new AlfrescoModelTableLabelProvider()); tableViewer.setInput(modelElements); return table; }
From source file:pspnetparty.client.swt.LobbyWindow.java
License:Open Source License
private void renameLobbyUser(final String oldName, final String newName) { try {//from ww w .j a v a 2 s. c om if (SwtUtils.isNotUIThread()) { SwtUtils.DISPLAY.asyncExec(new Runnable() { @Override public void run() { renameLobbyUser(oldName, newName); } }); return; } LobbyUser user = lobbyUserMap.get(oldName); if (user == null) return; if (oldName.equals(userNameLabel.getText())) { setLobbyLoginUserName(newName); InfoLog log = new InfoLog(newName + " ?? "); chatLogViewer.appendMessage(log); } else { InfoLog log = new InfoLog(oldName + " " + newName + " ?? "); chatLogViewer.appendMessage(log); } user.setName(newName); lobbyUserMap.remove(oldName); lobbyUserMap.put(newName, user); TableViewer viewer = userListTableViewer; viewer.remove(user); viewer.add(user); viewer.refresh(); } catch (SWTException e) { } }
From source file:pspnetparty.client.swt.RoomWindow.java
License:Open Source License
private void removeRoomPlayer(final String name) { try {//from w w w. ja va2 s . com if (SwtUtils.isNotUIThread()) { SwtUtils.DISPLAY.asyncExec(new Runnable() { @Override public void run() { removeRoomPlayer(name); } }); return; } TableViewer viewer = widgets.roomPlayerListTable; Player player = roomPlayerMap.remove(name); if (player == null) return; viewer.remove(player); viewer.refresh(); sendMyRoomPlayerCountChange(); } catch (SWTException e) { } }
From source file:telasi.recutil.gui.comp.recalc.charge_pane_views.ViewUtils.java
License:Open Source License
public static void createCommonTable(TableViewer viewer) { TableColumn cols[] = viewer.getTable().getColumns(); if (cols != null) { viewer.remove(viewer.getTable().getColumns()); for (int i = 0; i < cols.length; i++) { cols[i].dispose();//w w w .ja va 2 s . c o m cols[i] = null; } } { TableColumn colImage = new TableColumn(viewer.getTable(), SWT.NONE); colImage.setWidth(20); colImage.setResizable(false); } { TableColumn colChangeImage = new TableColumn(viewer.getTable(), SWT.NONE); colChangeImage.setWidth(20); colChangeImage.setResizable(false); } { TableColumn colItemDate = new TableColumn(viewer.getTable(), SWT.NONE); colItemDate.setText(GUIMessages.getMessage("comp.general.itemdate")); colItemDate.setWidth(75); } { TableColumn colAccount = new TableColumn(viewer.getTable(), SWT.NONE); colAccount.setText(GUIMessages.getMessage("comp.general.account")); colAccount.setWidth(75); } { TableColumn colOperation = new TableColumn(viewer.getTable(), SWT.NONE); colOperation.setText(GUIMessages.getMessage("comp.general.operation")); colOperation.setWidth(200); } { TableColumn colCycle = new TableColumn(viewer.getTable(), SWT.NONE); colCycle.setWidth(20); colCycle.setResizable(false); } { TableColumn colReading = new TableColumn(viewer.getTable(), SWT.RIGHT); colReading.setText(GUIMessages.getMessage("comp.general.reading")); colReading.setWidth(75); } { TableColumn colKwh = new TableColumn(viewer.getTable(), SWT.RIGHT); colKwh.setText(GUIMessages.getMessage("comp.general.kwh")); colKwh.setWidth(75); } { TableColumn colGel = new TableColumn(viewer.getTable(), SWT.RIGHT); colGel.setText(GUIMessages.getMessage("comp.general.gel")); colGel.setWidth(75); } { TableColumn colBalance = new TableColumn(viewer.getTable(), SWT.RIGHT); colBalance.setText(GUIMessages.getMessage("comp.general.balance")); colBalance.setWidth(75); } // { // TableColumn colBalanceGap = new TableColumn(viewer.getTable(), // SWT.RIGHT); // colBalanceGap.setText(GUIMessages.getMessage("comp.general.balance_gap")); // colBalanceGap.setWidth(75); // } { TableColumn colSubacc = new TableColumn(viewer.getTable(), SWT.NONE); colSubacc.setText(GUIMessages.getMessage("comp.general.subaccount")); colSubacc.setWidth(75); } { TableColumn colEnterDate = new TableColumn(viewer.getTable(), SWT.NONE); colEnterDate.setText(GUIMessages.getMessage("comp.general.enterdate")); colEnterDate.setWidth(75); } { TableColumn colItemNumber = new TableColumn(viewer.getTable(), SWT.NONE); colItemNumber.setText(GUIMessages.getMessage("comp.general.document")); colItemNumber.setWidth(150); } viewer.getTable().layout(true); }
From source file:x10dt.ui.launch.cpp.launching.CommunicationInterfaceTab.java
License:Open Source License
public void createControl(final Composite parent) { this.fTransport = getTransport(); final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setFont(parent.getFont()); mainComposite.setLayout(new GridLayout(1, false)); mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite placesCompo = new Composite(mainComposite, SWT.NONE); placesCompo.setFont(mainComposite.getFont()); placesCompo.setLayout(new GridLayout(2, false)); placesCompo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true, false)); new Label(placesCompo, SWT.NONE).setText(Messages.SRMLCDT_PlacesNumber); this.fNumPlacesSpinner = new Spinner(placesCompo, SWT.BORDER); this.fNumPlacesSpinner.setSelection(DEFAULT_NUM_PLACES); this.fNumPlacesSpinner.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateLaunchConfigurationDialog(); }/*from w w w. j av a2s . c o m*/ public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Group hostsGroup = new Group(mainComposite, SWT.NONE); hostsGroup.setFont(mainComposite.getFont()); hostsGroup.setLayout(new GridLayout(2, false)); hostsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); hostsGroup.setText(Messages.SRMLCDT_HostsGroupName); this.fHostFileBt = new Button(hostsGroup, SWT.RADIO); this.fHostFileBt.setText(Messages.SRMLCDT_HostFileBt); this.fHostFileBt.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 2, 1)); this.fHostFileBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateSelectionState(HOST_FILE, CommunicationInterfaceTab.this.fTransport); updateLaunchConfigurationDialog(); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Text hostFileText = new Text(hostsGroup, SWT.BORDER); this.fHostFileText = hostFileText; final GridData hostFileGData = new GridData(SWT.FILL, SWT.CENTER, true, false); hostFileGData.horizontalIndent = 30; this.fHostFileText.setLayoutData(hostFileGData); this.fHostFileText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent event) { updateLaunchConfigurationDialog(); } }); this.fHostFileBrowseBt = new Button(hostsGroup, SWT.PUSH); this.fHostFileBrowseBt.setText(Messages.SRMLCDT_BrowseBt); this.fHostFileBrowseBt.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.fHostFileBrowseBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { try { final String path; ILaunchConfiguration compilationConf = ConfUtils .getConfiguration(CommunicationInterfaceTab.this.fProjectName); if (ConfUtils.isLocalConnection(compilationConf)) { final FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.SRMLCDT_SelectHostFileDialogTitle); path = dialog.open(); } else { final IRemoteServices remoteServices = RemoteServices .getRemoteServices(REMOTE_CONN_SERVICE_ID); final IRemoteConnection connection = remoteServices.getConnectionManager() .getConnection(ConfUtils.getConnectionName(compilationConf)); path = remoteBrowse(parent.getShell(), connection, Messages.SRMLCDT_SelectHostFileDialogTitle, Constants.EMPTY_STR); } if (path != null) { hostFileText.setText(path); } } catch (CoreException e) { CppLaunchCore.getInstance().getLog().log(e.getStatus()); } } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); this.fHostListBt = new Button(hostsGroup, SWT.RADIO); this.fHostListBt.setText(Messages.SRMLCDT_HostListBt); this.fHostListBt.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 2, 1)); this.fHostListBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateSelectionState(HOST_LIST, CommunicationInterfaceTab.this.fTransport); updateLaunchConfigurationDialog(); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Composite tableComposite = new Composite(hostsGroup, SWT.NONE); tableComposite.setFont(hostsGroup.getFont()); final GridData tableGData = new GridData(SWT.FILL, SWT.FILL, true, true); tableGData.verticalSpan = 2; tableGData.horizontalIndent = 30; tableComposite.setLayoutData(tableGData); final TableViewer viewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); this.fHostListViewer = viewer; this.fHostListViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final TableViewerColumn column = new TableViewerColumn(this.fHostListViewer, SWT.NONE); column.setLabelProvider(new ColumnLabelProvider() { public String getText(final Object element) { return (String) element; } }); final TextCellEditor editor = new TextCellEditor(viewer.getTable()); ; column.setEditingSupport(new EditingSupport(this.fHostListViewer) { protected CellEditor getCellEditor(final Object element) { return editor; } @SuppressWarnings("unqualified-field-access") protected boolean canEdit(final Object element) { return viewer.getTable().getSelectionIndex() < fHosts.size(); } protected Object getValue(final Object element) { return element; } @SuppressWarnings("unqualified-field-access") protected void setValue(final Object element, final Object value) { final int index = fHosts.indexOf(element); fHosts.remove(element); fHosts.add(index, (String) value); viewer.refresh(); updateLaunchConfigurationDialog(); } }); final TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(100)); tableComposite.setLayout(tableColumnLayout); this.fHostListViewer.setContentProvider(new IStructuredContentProvider() { public void inputChanged(final Viewer curViewer, final Object oldInput, final Object newInput) { } public void dispose() { } @SuppressWarnings("unqualified-field-access") public Object[] getElements(final Object inputElement) { return fHosts.toArray(new String[fHosts.size()]); } }); this.fHostListViewer.setInput(this.fHosts); this.fHostListViewer.getTable().setLinesVisible(true); final Button addButton = new Button(hostsGroup, SWT.PUSH); this.fAddButton = addButton; addButton.setText(Messages.SRMLCDT_AddBt); addButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); addButton.addSelectionListener(new SelectionListener() { @SuppressWarnings("unqualified-field-access") public void widgetSelected(final SelectionEvent event) { fHosts.add(Constants.EMPTY_STR); viewer.getTable().select(viewer.getTable().getItemCount() - 1); viewer.add(Constants.EMPTY_STR); viewer.editElement(Constants.EMPTY_STR, 0); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Button removeButton = new Button(hostsGroup, SWT.PUSH); this.fRemoveButton = removeButton; removeButton.setText(Messages.SRMLCDT_RemoveBt); removeButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); removeButton.addSelectionListener(new SelectionListener() { @SuppressWarnings("unqualified-field-access") public void widgetSelected(final SelectionEvent event) { final Object hostName = viewer.getElementAt(viewer.getTable().getSelectionIndex()); if (hostName != null) { fHosts.remove(hostName); viewer.remove(hostName); updateLaunchConfigurationDialog(); } } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); this.fLoadLevelerBt = new Button(hostsGroup, SWT.RADIO); this.fLoadLevelerBt.setText(Messages.SRMLCDT_LLBt); this.fLoadLevelerBt.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 2, 1)); this.fLoadLevelerBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateSelectionState(LOAD_LEVELER, CommunicationInterfaceTab.this.fTransport); updateLaunchConfigurationDialog(); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); this.fLoadLevelerText = new Text(hostsGroup, SWT.BORDER); this.fLoadLevelerText.setText(Constants.EMPTY_STR); final GridData loadLevelerGData = new GridData(SWT.FILL, SWT.CENTER, true, false); loadLevelerGData.horizontalIndent = 30; this.fLoadLevelerText.setLayoutData(loadLevelerGData); this.fLoadLevelerText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent event) { updateLaunchConfigurationDialog(); } }); this.fLoadLevelerBrowseBt = new Button(hostsGroup, SWT.PUSH); this.fLoadLevelerBrowseBt.setText(Messages.SRMLCDT_BrowseBt); this.fLoadLevelerBrowseBt.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.fLoadLevelerBrowseBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { try { final String path; ILaunchConfiguration compilationConf = ConfUtils .getConfiguration(CommunicationInterfaceTab.this.fProjectName); if (ConfUtils.isLocalConnection(compilationConf)) { final FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.SRMLCDT_SelectHostFileDialogTitle); path = dialog.open(); } else { final IRemoteServices remoteServices = RemoteServices .getRemoteServices(REMOTE_CONN_SERVICE_ID); final IRemoteConnection connection = remoteServices.getConnectionManager() .getConnection(ConfUtils.getConnectionName(compilationConf)); path = remoteBrowse(parent.getShell(), connection, Messages.SRMLCDT_SelectHostFileDialogTitle, Constants.EMPTY_STR); } if (path != null) { hostFileText.setText(path); } } catch (CoreException e) { CppLaunchCore.getInstance().getLog().log(e.getStatus()); } } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); setControl(mainComposite); updateSelectionState(HOST_FILE, this.fTransport); }
From source file:x10dt.ui.launch.java.launching.CommunicationInterfaceTab.java
License:Open Source License
public void createControl(final Composite parent) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setFont(parent.getFont()); mainComposite.setLayout(new GridLayout(1, false)); mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite placesCompo = new Composite(mainComposite, SWT.NONE); placesCompo.setFont(mainComposite.getFont()); placesCompo.setLayout(new GridLayout(2, false)); placesCompo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true, false)); new Label(placesCompo, SWT.NONE).setText(Messages.SRMLCDT_PlacesNumber); this.fNumPlacesSpinner = new Spinner(placesCompo, SWT.BORDER); this.fNumPlacesSpinner.setSelection(DEFAULT_NUM_PLACES); this.fNumPlacesSpinner.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateLaunchConfigurationDialog(); }//from w w w .j ava 2s.com public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Group hostsGroup = new Group(mainComposite, SWT.NONE); hostsGroup.setFont(mainComposite.getFont()); hostsGroup.setLayout(new GridLayout(2, false)); hostsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); hostsGroup.setText(Messages.SRMLCDT_HostsGroupName); this.fHostFileBt = new Button(hostsGroup, SWT.RADIO); this.fHostFileBt.setText(Messages.SRMLCDT_HostFileBt); this.fHostFileBt.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 2, 1)); this.fHostFileBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateSelectionState(true); updateLaunchConfigurationDialog(); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Text hostFileText = new Text(hostsGroup, SWT.BORDER); this.fHostFileText = hostFileText; final GridData hostFileGData = new GridData(SWT.FILL, SWT.CENTER, true, false); hostFileGData.horizontalIndent = 30; this.fHostFileText.setLayoutData(hostFileGData); this.fHostFileText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent event) { updateLaunchConfigurationDialog(); } }); this.fHostFileBrowseBt = new Button(hostsGroup, SWT.PUSH); this.fHostFileBrowseBt.setText(Messages.SRMLCDT_BrowseBt); this.fHostFileBrowseBt.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.fHostFileBrowseBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { final String path; if (CommunicationInterfaceTab.this.fIsLocal) { final FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.SRMLCDT_SelectHostFileDialogTitle); path = dialog.open(); } else { final IRemoteServices remoteServices = RemoteServices.getRemoteServices(REMOTE_CONN_SERVICE_ID); final IRemoteConnection connection = remoteServices.getConnectionManager().getConnection( ConfUtils.getConnectionName(CommunicationInterfaceTab.this.fConfiguration)); path = remoteBrowse(parent.getShell(), connection, Messages.SRMLCDT_SelectHostFileDialogTitle, Constants.EMPTY_STR); } if (path != null) { hostFileText.setText(path); } } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); this.fHostListBt = new Button(hostsGroup, SWT.RADIO); this.fHostListBt.setText(Messages.SRMLCDT_HostListBt); this.fHostListBt.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 2, 1)); this.fHostListBt.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent event) { updateLaunchConfigurationDialog(); updateSelectionState(false); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Composite tableComposite = new Composite(hostsGroup, SWT.NONE); tableComposite.setFont(hostsGroup.getFont()); final GridData tableGData = new GridData(SWT.FILL, SWT.FILL, true, true); tableGData.verticalSpan = 2; tableGData.horizontalIndent = 30; tableComposite.setLayoutData(tableGData); final TableViewer viewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); this.fHostListViewer = viewer; this.fHostListViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final TableViewerColumn column = new TableViewerColumn(this.fHostListViewer, SWT.NONE); column.setLabelProvider(new ColumnLabelProvider() { public String getText(final Object element) { return (String) element; } }); final TextCellEditor editor = new TextCellEditor(viewer.getTable()); ; column.setEditingSupport(new EditingSupport(this.fHostListViewer) { protected CellEditor getCellEditor(final Object element) { return editor; } @SuppressWarnings("unqualified-field-access") protected boolean canEdit(final Object element) { return viewer.getTable().getSelectionIndex() < fHosts.size(); } protected Object getValue(final Object element) { return element; } @SuppressWarnings("unqualified-field-access") protected void setValue(final Object element, final Object value) { final int index = fHosts.indexOf(element); fHosts.remove(element); fHosts.add(index, (String) value); viewer.refresh(); updateLaunchConfigurationDialog(); } }); final TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(100)); tableComposite.setLayout(tableColumnLayout); this.fHostListViewer.setContentProvider(new IStructuredContentProvider() { public void inputChanged(final Viewer curViewer, final Object oldInput, final Object newInput) { } public void dispose() { } @SuppressWarnings("unqualified-field-access") public Object[] getElements(final Object inputElement) { return fHosts.toArray(new String[fHosts.size()]); } }); this.fHostListViewer.setInput(this.fHosts); this.fHostListViewer.getTable().setLinesVisible(true); final Button addButton = new Button(hostsGroup, SWT.PUSH); this.fAddButton = addButton; addButton.setText(Messages.SRMLCDT_AddBt); addButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); addButton.addSelectionListener(new SelectionListener() { @SuppressWarnings("unqualified-field-access") public void widgetSelected(final SelectionEvent event) { fHosts.add(Constants.EMPTY_STR); viewer.getTable().select(viewer.getTable().getItemCount() - 1); viewer.add(Constants.EMPTY_STR); viewer.editElement(Constants.EMPTY_STR, 0); } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); final Button removeButton = new Button(hostsGroup, SWT.PUSH); this.fRemoveButton = removeButton; removeButton.setText(Messages.SRMLCDT_RemoveBt); removeButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); removeButton.addSelectionListener(new SelectionListener() { @SuppressWarnings("unqualified-field-access") public void widgetSelected(final SelectionEvent event) { final Object hostName = viewer.getElementAt(viewer.getTable().getSelectionIndex()); if (hostName != null) { fHosts.remove(hostName); viewer.remove(hostName); updateLaunchConfigurationDialog(); } } public void widgetDefaultSelected(final SelectionEvent event) { widgetSelected(event); } }); setControl(mainComposite); initState(); }