Example usage for org.eclipse.jface.viewers TableViewer remove

List of usage examples for org.eclipse.jface.viewers TableViewer remove

Introduction

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

Prototype

@Override
    public void remove(Object[] elements) 

Source Link

Usage

From source file:org.drools.eclipse.flow.common.editor.editpart.work.HumanTaskCustomEditor.java

License:Apache License

private void createReassignmentTab(TabFolder tabFolder) {
    Work work = (Work) getValue();/* w w w.j ava2 s . com*/

    String notStartedReassign = (String) work.getParameter("NotStartedReassign");
    String notCompletedReassign = (String) work.getParameter("NotCompletedReassign");

    if (notStartedReassign != null) {
        String[] reassigns = notStartedReassign.split(COMPONENT_SEPARATOR_ESCAPED);

        for (String reassign : reassigns) {
            if (reassign != null && reassign.length() > 0) {
                reassignments.add(new Reassignment(reassign, "not-started"));
            }
        }
    }

    if (notCompletedReassign != null) {
        String[] reassigns = notCompletedReassign.split(COMPONENT_SEPARATOR_ESCAPED);

        for (String reassign : reassigns) {
            if (reassign != null && reassign.length() > 0) {
                reassignments.add(new Reassignment(reassign, "not-completed"));
            }
        }
    }

    final TabItem headersTabItem = new TabItem(tabFolder, SWT.NONE);
    headersTabItem.setText("Reassignment");

    final Composite container = new Composite(tabFolder, SWT.NONE);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.horizontalSpacing = 2;
    container.setLayout(gridLayout);
    headersTabItem.setControl(container);

    final TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);

    TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
    column.setLabelProvider(new ReassignmentUsersLabelProvider());
    column.setEditingSupport(new ReassignmentUsersEditing(tableViewer));
    column.getColumn().setText("Users");
    column.getColumn().setWidth(100);
    column.getColumn().setMoveable(true);

    TableViewerColumn column2 = new TableViewerColumn(tableViewer, SWT.NONE);
    column2.setLabelProvider(new ReassignmentGroupsLabelProvider());
    column2.setEditingSupport(new ReassignmentGroupsEditing(tableViewer));
    column2.getColumn().setText("Groups");
    column2.getColumn().setWidth(100);
    column2.getColumn().setMoveable(true);

    TableViewerColumn column3 = new TableViewerColumn(tableViewer, SWT.NONE);
    column3.setLabelProvider(new ReassignmentExpiresAtLabelProvider());
    column3.setEditingSupport(new ReassignmentExpiresAtEditing(tableViewer));
    column3.getColumn().setText("Expires At");
    column3.getColumn().setWidth(100);
    column3.getColumn().setMoveable(true);

    TableViewerColumn column4 = new TableViewerColumn(tableViewer, SWT.NONE);
    column4.setLabelProvider(new ReassignmentTypeLabelProvider());
    column4.setEditingSupport(new ReassignmentTypeEditing(tableViewer));
    column4.getColumn().setText("Type");
    column4.getColumn().setWidth(100);
    column4.getColumn().setMoveable(true);

    final Table table = tableViewer.getTable();
    final GridData gd_table = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    gd_table.heightHint = 128;
    table.setLayoutData(gd_table);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    tableViewer.setContentProvider(new ReassignmentContentProvider());
    tableViewer.setInput(reassignments);

    // add/delete buttons
    final Composite composite = new Composite(container, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    composite.setLayout(new RowLayout());
    final Button addButton = new Button(composite, SWT.NONE);
    addButton.setText("Add");
    addButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
            Reassignment reassignment = new Reassignment();
            reassignments.add(reassignment);
            tableViewer.add(reassignment);
            tableViewer.refresh();
        }

        public void widgetSelected(SelectionEvent e) {
            Reassignment reassignment = new Reassignment();
            reassignments.add(reassignment);
            tableViewer.add(reassignment);
            tableViewer.refresh();
        }
    });
    final Button deleteButton = new Button(composite, SWT.NONE);
    deleteButton.setText("Remove");
    deleteButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent event) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                reassignments.remove((Reassignment) items[0].getData());
                tableViewer.remove(items[0]);
                tableViewer.refresh();
            }
        }

        public void widgetDefaultSelected(SelectionEvent event) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                reassignments.remove((Reassignment) items[0].getData());
                tableViewer.remove(items[0]);
                tableViewer.refresh();
            }
        }
    });
}

From source file:org.drools.eclipse.flow.common.editor.editpart.work.HumanTaskCustomEditor.java

License:Apache License

private void createNotificationTab(TabFolder tabFolder) {
    Work work = (Work) getValue();/*www  .ja  v  a 2s.  c  om*/

    String notStartedNotify = (String) work.getParameter("NotStartedNotify");
    String notCompletedNotify = (String) work.getParameter("NotCompletedNotify");

    if (notStartedNotify != null) {
        String[] notifies = notStartedNotify.split(COMPONENT_SEPARATOR_ESCAPED);

        for (String notification : notifies) {
            if (notification != null && notification.length() > 0) {
                notifications.add(new Notification(notification, "not-started"));
            }
        }
    }

    if (notCompletedNotify != null) {
        String[] notifies = notCompletedNotify.split(COMPONENT_SEPARATOR_ESCAPED);

        for (String notification : notifies) {
            if (notification != null && notification.length() > 0) {
                notifications.add(new Notification(notification, "not-completed"));
            }
        }
    }

    final TabItem headersTabItem = new TabItem(tabFolder, SWT.NONE);
    headersTabItem.setText("Notifications");

    final Composite container = new Composite(tabFolder, SWT.NONE);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.horizontalSpacing = 2;
    container.setLayout(gridLayout);
    headersTabItem.setControl(container);

    final TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);

    TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
    column.setLabelProvider(new NotificationsLabelProvider());
    column.setEditingSupport(new NotificationsEditing(tableViewer));
    column.getColumn().setText("Notifications");
    column.getColumn().setWidth(400);
    column.getColumn().setMoveable(true);

    final Label typeLabel = new Label(container, SWT.NONE);
    typeLabel.setLayoutData(new GridData());
    typeLabel.setText("Type");

    notifyTypeText = new Combo(container, SWT.NONE);
    notifyTypeText.add("not-started");
    notifyTypeText.add("not-completed");
    notifyTypeText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label expiresAtLabel = new Label(container, SWT.NONE);
    expiresAtLabel.setLayoutData(new GridData());
    expiresAtLabel.setText("ExpiresAt");

    notifyExpiresAtText = new Text(container, SWT.NONE);
    notifyExpiresAtText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label notifyFromLabel = new Label(container, SWT.NONE);
    notifyFromLabel.setLayoutData(new GridData());
    notifyFromLabel.setText("From");

    notifyFromText = new Text(container, SWT.NONE);
    notifyFromText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label notifyToLabel = new Label(container, SWT.NONE);
    notifyToLabel.setText("To Users");

    notifyToText = new Text(container, SWT.NONE);
    notifyToText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label notifyToGroupsLabel = new Label(container, SWT.NONE);
    notifyToGroupsLabel.setText("To Groups");

    notifyToGroupsText = new Text(container, SWT.NONE);
    notifyToGroupsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label notifyReplyToLabel = new Label(container, SWT.NONE);
    notifyReplyToLabel.setText("Reply To");

    notifyReplyToText = new Text(container, SWT.NONE);
    notifyReplyToText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label subjectLabel = new Label(container, SWT.NONE);
    subjectLabel.setLayoutData(new GridData());
    subjectLabel.setText("Subject");

    notifySubjectText = new Text(container, SWT.NONE);
    notifySubjectText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label bodyLabel = new Label(container, SWT.NONE);
    bodyLabel.setText("Body");

    notifyBodyText = new Text(container, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    final GridData gd_bodyText = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_bodyText.heightHint = 100;
    notifyBodyText.setLayoutData(gd_bodyText);

    final Table table = tableViewer.getTable();
    final GridData gd_table = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    gd_table.heightHint = 100;
    table.setLayoutData(gd_table);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    table.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                int index = notifications.indexOf((Notification) items[0].getData());
                Notification notification = notifications.get(index);

                notifyFromText.setText(notification.getFrom());
                notifyToText.setText(notification.getTo());
                notifyToGroupsText.setText(notification.getToGroups());
                notifyReplyToText.setText(notification.getReplyTo());
                notifySubjectText.setText(notification.getSubject());
                notifyBodyText.setText(notification.getBody());
                notifyTypeText.setText(notification.getType());
                notifyExpiresAtText.setText(notification.getExpiresAt());
            } else {
                notifyFromText.setText("");
                notifyToText.setText("");
                notifyToGroupsText.setText("");
                notifyReplyToText.setText("");
                notifySubjectText.setText("");
                notifyBodyText.setText("");
                notifyTypeText.setText("");
                notifyExpiresAtText.setText("");
            }

        }

        public void widgetDefaultSelected(SelectionEvent e) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                int index = notifications.indexOf((Notification) items[0].getData());
                Notification notification = notifications.get(index);

                notifyFromText.setText(notification.getFrom());
                notifyToText.setText(notification.getTo());
                notifyToGroupsText.setText(notification.getToGroups());
                notifyReplyToText.setText(notification.getReplyTo());
                notifySubjectText.setText(notification.getSubject());
                notifyBodyText.setText(notification.getBody());
                notifyTypeText.setText(notification.getType());
                notifyExpiresAtText.setText(notification.getExpiresAt());
            } else {
                notifyFromText.setText("");
                notifyToText.setText("");
                notifyToGroupsText.setText("");
                notifyReplyToText.setText("");
                notifySubjectText.setText("");
                notifyBodyText.setText("");
                notifyTypeText.setText("");
                notifyExpiresAtText.setText("");
            }
        }
    });

    tableViewer.setContentProvider(new NotificationsContentProvider());
    tableViewer.setInput(notifications);
    // add/delete buttons
    final Composite composite = new Composite(container, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    composite.setLayout(new RowLayout());
    final Button addButton = new Button(composite, SWT.NONE);
    addButton.setText("Add");
    addButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
            Notification notification = new Notification();
            notification.setFrom(notifyFromText.getText());
            notification.setTo(notifyToText.getText());
            notification.setToGroups(notifyToGroupsText.getText());
            notification.setReplyTo(notifyReplyToText.getText());
            notification.setSubject(notifySubjectText.getText());
            notification.setBody(notifyBodyText.getText());
            notification.setType(notifyTypeText.getText());
            notification.setExpiresAt(notifyExpiresAtText.getText());
            notifications.add(notification);
            tableViewer.add(notification);
            tableViewer.refresh();
            // clear fields after add operation
            notifyFromText.setText("");
            notifyToText.setText("");
            notifyToGroupsText.setText("");
            notifyReplyToText.setText("");
            notifySubjectText.setText("");
            notifyBodyText.setText("");
            notifyTypeText.setText("");
            notifyExpiresAtText.setText("");

        }

        public void widgetSelected(SelectionEvent e) {
            Notification notification = new Notification();
            notification.setFrom(notifyFromText.getText());
            notification.setTo(notifyToText.getText());
            notification.setToGroups(notifyToGroupsText.getText());
            notification.setReplyTo(notifyReplyToText.getText());
            notification.setSubject(notifySubjectText.getText());
            notification.setBody(notifyBodyText.getText());
            notification.setType(notifyTypeText.getText());
            notification.setExpiresAt(notifyExpiresAtText.getText());
            notifications.add(notification);
            tableViewer.add(notification);
            tableViewer.refresh();
            // clear fields after add operation
            notifyFromText.setText("");
            notifyToText.setText("");
            notifyToGroupsText.setText("");
            notifyReplyToText.setText("");
            notifySubjectText.setText("");
            notifyBodyText.setText("");
            notifyTypeText.setText("");
            notifyExpiresAtText.setText("");
        }
    });
    final Button deleteButton = new Button(composite, SWT.NONE);
    deleteButton.setText("Remove");
    deleteButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent event) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                notifications.remove((Notification) items[0].getData());
                tableViewer.remove(items[0]);
                tableViewer.refresh();
            }
        }

        public void widgetDefaultSelected(SelectionEvent event) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                notifications.remove((Notification) items[0].getData());
                tableViewer.remove(items[0]);
                tableViewer.refresh();
            }
        }
    });

    final Button updateButton = new Button(composite, SWT.NONE);
    updateButton.setText("Update");
    updateButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent event) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                int index = notifications.indexOf((Notification) items[0].getData());
                Notification notification = notifications.get(index);
                notification.setFrom(notifyFromText.getText());
                notification.setTo(notifyToText.getText());
                notification.setToGroups(notifyToGroupsText.getText());
                notification.setReplyTo(notifyReplyToText.getText());
                notification.setSubject(notifySubjectText.getText());
                notification.setBody(notifyBodyText.getText());
                notification.setType(notifyTypeText.getText());
                notification.setExpiresAt(notifyExpiresAtText.getText());
                tableViewer.refresh();
                // clear fields after add operation
                notifyFromText.setText("");
                notifyToText.setText("");
                notifyToGroupsText.setText("");
                notifyReplyToText.setText("");
                notifySubjectText.setText("");
                notifyBodyText.setText("");
                notifyTypeText.setText("");
                notifyExpiresAtText.setText("");
            }
        }

        public void widgetDefaultSelected(SelectionEvent event) {
            TableItem[] items = table.getSelection();
            if (items != null && items.length > 0) {
                int index = notifications.indexOf((Notification) items[0].getData());
                Notification notification = notifications.get(index);
                notification.setFrom(notifyFromText.getText());
                notification.setTo(notifyToText.getText());
                notification.setToGroups(notifyToGroupsText.getText());
                notification.setReplyTo(notifyReplyToText.getText());
                notification.setSubject(notifySubjectText.getText());
                notification.setBody(notifyBodyText.getText());
                notification.setType(notifyTypeText.getText());
                notification.setExpiresAt(notifyExpiresAtText.getText());
                tableViewer.refresh();
                // clear fields after add operation
                notifyFromText.setText("");
                notifyToText.setText("");
                notifyToGroupsText.setText("");
                notifyReplyToText.setText("");
                notifySubjectText.setText("");
                notifyBodyText.setText("");
                notifyTypeText.setText("");
                notifyExpiresAtText.setText("");
            }
        }
    });

    final Button clearButton = new Button(composite, SWT.NONE);
    clearButton.setText("Clear");
    clearButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent event) {
            // clear fields after add operation
            notifyFromText.setText("");
            notifyToText.setText("");
            notifyToGroupsText.setText("");
            notifyReplyToText.setText("");
            notifySubjectText.setText("");
            notifyBodyText.setText("");
            notifyTypeText.setText("");
            notifyExpiresAtText.setText("");
        }

        public void widgetDefaultSelected(SelectionEvent event) {
            // clear fields after add operation
            notifyFromText.setText("");
            notifyToText.setText("");
            notifyToGroupsText.setText("");
            notifyReplyToText.setText("");
            notifySubjectText.setText("");
            notifyBodyText.setText("");
            notifyTypeText.setText("");
            notifyExpiresAtText.setText("");
        }
    });

}

From source file:org.eclipse.dltk.internal.ui.search.DLTKSearchTableContentProvider.java

License:Open Source License

public void elementsChanged(Object[] updatedElements) {
    if (fResult == null)
        return;//from www. j av a 2  s.  c o m
    int addCount = 0;
    int removeCount = 0;
    int addLimit = getAddLimit();

    TableViewer viewer = (TableViewer) getPage().getViewer();
    Set<Object> updated = new HashSet<Object>();
    Set<Object> added = new HashSet<Object>();
    Set<Object> removed = new HashSet<Object>();
    for (int i = 0; i < updatedElements.length; i++) {
        if (getPage().getDisplayedMatchCount(updatedElements[i]) > 0) {
            if (viewer.testFindItem(updatedElements[i]) != null)
                updated.add(updatedElements[i]);
            else {
                if (addLimit > 0) {
                    added.add(updatedElements[i]);
                    addLimit--;
                    addCount++;
                }
            }
        } else {
            removed.add(updatedElements[i]);
            removeCount++;
        }
    }

    viewer.add(added.toArray());
    viewer.update(updated.toArray(), new String[] { SearchLabelProvider.PROPERTY_MATCH_COUNT });
    viewer.remove(removed.toArray());
}

From source file:org.eclipse.dltk.mod.internal.ui.search.DLTKSearchTableContentProvider.java

License:Open Source License

public void elementsChanged(Object[] updatedElements) {
    if (fResult == null)
        return;//from w ww  .  j ava2s.  co m
    int addCount = 0;
    int removeCount = 0;
    TableViewer viewer = (TableViewer) getPage().getViewer();
    Set updated = new HashSet();
    Set added = new HashSet();
    Set removed = new HashSet();
    for (int i = 0; i < updatedElements.length; i++) {
        if (getPage().getDisplayedMatchCount(updatedElements[i]) > 0) {
            if (viewer.testFindItem(updatedElements[i]) != null)
                updated.add(updatedElements[i]);
            else
                added.add(updatedElements[i]);
            addCount++;
        } else {
            removed.add(updatedElements[i]);
            removeCount++;
        }
    }

    viewer.add(added.toArray());
    viewer.update(updated.toArray(), new String[] { SearchLabelProvider.PROPERTY_MATCH_COUNT });
    viewer.remove(removed.toArray());
}

From source file:org.eclipse.e4mf.edit.ui.provider.NotifyChangedToViewerRefresh.java

License:Open Source License

public void refreshTableViewer(TableViewer viewer, Object object, int eventType, Object feature,
        Object oldValue, Object newValue, int index) {
    switch (eventType) {
    case Notification.ADD: {
        viewer.insert(newValue, index);/*from  ww  w.j a  va  2 s. c  o m*/
        break;
    }
    case Notification.ADD_MANY: {
        if (index == -1) {
            viewer.add(((Collection<?>) newValue).toArray());
        } else {
            for (Object value : (Collection<?>) newValue) {
                viewer.insert(value, index++);
            }
        }
        break;
    }
    case Notification.REMOVE: {
        viewer.remove(oldValue);
        break;
    }
    case Notification.REMOVE_MANY: {
        viewer.remove(((Collection<?>) oldValue).toArray());
        break;
    }
    case Notification.MOVE:
    case Notification.UNSET:
    case Notification.SET:
    default: {
        refreshStructuredViewer(viewer, object, eventType, feature, oldValue, newValue, index);
        break;
    }
    }
}

From source file:org.eclipse.ecf.internal.example.collab.ui.LineChatClientView.java

License:Open Source License

protected boolean changeUserInTree(final IUser userdata) {
    for (int i = 0; i < users.size(); i++) {
        final IUser user = (IUser) users.get(i);
        if (user.getID().equals(userdata.getID())) {
            Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                    if (!teamChat.isDisposed()) {
                        final TableViewer view = teamChat.getTableViewer();
                        view.remove(user);
                        users.remove(user);
                        view.add(userdata);
                        users.add(userdata);
                    }/* w w  w . j  av a 2s  .c o  m*/
                }
            });
            return true;
        }
    }
    return false;
}

From source file:org.eclipse.emf.ecp.internal.ui.view.emf.NotifyChangedToViewerRefresh.java

License:Open Source License

public void refreshTableViewer(TableViewer viewer, Object object, int eventType, Object feature,
        Object oldValue, Object newValue, int index) {
    switch (eventType) {
    case Notification.ADD: {
        viewer.insert(newValue, index);/*from   www .  j  av  a 2  s  . c om*/
        break;
    }
    case Notification.ADD_MANY: {
        if (index == -1) {
            viewer.add(((Collection<?>) newValue).toArray());
        } else {
            for (final Object value : (Collection<?>) newValue) {
                viewer.insert(value, index++);
            }
        }
        break;
    }
    case Notification.REMOVE: {
        viewer.remove(oldValue);
        break;
    }
    case Notification.REMOVE_MANY: {
        viewer.remove(((Collection<?>) oldValue).toArray());
        break;
    }
    case Notification.MOVE:
    case Notification.UNSET:
    case Notification.SET:
    default: {
        refreshStructuredViewer(viewer, object, eventType, feature, oldValue, newValue, index);
        break;
    }
    }
}

From source file:org.eclipse.equinox.examples.app.selector.ApplicationView.java

License:Open Source License

public void removedService(ServiceReference reference, final Object service) {
    final TableViewer updateViewer = getViewer();
    if (updateViewer == null)
        return;/*from  w w  w. j  av a  2s.co m*/
    if (PlatformUI.getWorkbench().getDisplay().isDisposed())
        return;
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        public void run() {
            updateViewer.remove(service);
        }
    });
}

From source file:org.eclipse.imp.lpg.search.LPGSearchTableContentProvider.java

License:Open Source License

public void elementsChanged(Object[] updatedElements) {
    if (fResult == null)
        return;//from   www  . ja  va2 s.c o  m
    int addCount = 0;
    int removeCount = 0;
    TableViewer viewer = (TableViewer) getPage().getViewer();
    Set updated = new HashSet();
    Set added = new HashSet();
    Set removed = new HashSet();
    for (int i = 0; i < updatedElements.length; i++) {
        if (getPage().getDisplayedMatchCount(updatedElements[i]) > 0) {
            if (viewer.testFindItem(updatedElements[i]) != null)
                updated.add(updatedElements[i]);
            else
                added.add(updatedElements[i]);
            addCount++;
        } else {
            removed.add(updatedElements[i]);
            removeCount++;
        }
    }

    viewer.add(added.toArray());
    viewer.update(updated.toArray(), null /*new String[] { SearchLabelProvider.PROPERTY_MATCH_COUNT } */);
    viewer.remove(removed.toArray());
}

From source file:org.eclipse.linuxtools.internal.docker.ui.launch.RunImageEnvironmentTab.java

License:Open Source License

private SelectionListener onRemoveEnvironmentVariables(final TableViewer environmentVariablesTableViewer) {
    return new SelectionAdapter() {

        @Override//  w  ww.  j a v a2  s.  c  om
        public void widgetSelected(final SelectionEvent e) {
            final IStructuredSelection selection = environmentVariablesTableViewer.getStructuredSelection();
            for (@SuppressWarnings("unchecked")
            Iterator<EnvironmentVariableModel> iterator = selection.iterator(); iterator.hasNext();) {
                EnvironmentVariableModel m = iterator.next();
                model.removeEnvironmentVariable(m);
                environmentVariablesTableViewer.remove(m);
                environmentVariablesTableViewer.refresh();
            }
            updateLaunchConfigurationDialog();
        }
    };
}