Example usage for org.eclipse.jface.viewers StructuredSelection size

List of usage examples for org.eclipse.jface.viewers StructuredSelection size

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers StructuredSelection size.

Prototype

@Override
    public int size() 

Source Link

Usage

From source file:es.cv.gvcase.mdt.common.part.DiagramElementsSelectionPage.java

License:Open Source License

/**
 * Handle remove button selected./* w w  w.  j  a  v  a 2s. c  o  m*/
 */
protected void handleRemoveButtonSelected() {
    StructuredSelection selection = getMemberElementsSelection();
    if (selection == null) {
        return;
    }

    if (selection.size() == 1) {
        getMemberElements().remove(selection.getFirstElement());
    } else {
        getMemberElements().removeAll(selection.toList());
    }

    refreshMembersViewer();
    refreshCandidatesViewer();
    // enable remove buttons depending on member elements selected
    selection = getMemberElementsSelection();
    enableRemoveButtons(selection != null && selection.size() > 0);
}

From source file:es.cv.gvcase.mdt.db.diagram.sheet.SqlmodelAbstractPropertySection.java

License:Open Source License

/**
 * Sets the input./*from  www.  j  a  v a  2  s.co  m*/
 * 
 * @param part the part
 * @param selection the selection
 * 
 * @generated NOT
 */
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
    IEditingDomainProvider provider = (IEditingDomainProvider) part.getAdapter(IEditingDomainProvider.class);
    if (provider != null) {
        EditingDomain theEditingDomain = provider.getEditingDomain();
        if (theEditingDomain instanceof TransactionalEditingDomain) {
            setEditingDomain((TransactionalEditingDomain) theEditingDomain);
        }
    }

    // Set the eObject for the section, too. The workbench part may not
    // adapt to IEditingDomainProvider, in which case the selected EObject
    // will be used to derive the editing domain.
    if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
        Object firstElement = ((IStructuredSelection) selection).getFirstElement();

        if (firstElement != null) {
            if (firstElement instanceof EditPart) {
                selectedEditPart = (EditPart) firstElement;
            }

            EObject adapted = unwrap(firstElement);

            if (adapted != null) {
                setEObject(adapted);
            }
        }
    }

    if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
        super.setInput(part, selection);
        return;
    }
    final StructuredSelection structuredSelection = ((StructuredSelection) selection);
    ArrayList transformedSelection = new ArrayList(structuredSelection.size());
    for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
        Object r = transformSelection(it.next());
        if (r != null) {
            transformedSelection.add(r);
        }
    }
    super.setInput(part, new StructuredSelection(transformedSelection));
}

From source file:eu.aniketos.wp1.ststool.diagram.sheet.StsToolPropertySection.java

License:Open Source License

/**
 * @generated// www  . j  a  v a2s  .  c o m
 */
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {

    if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
        super.setInput(part, selection);
        return;
    }
    final StructuredSelection structuredSelection = ((StructuredSelection) selection);
    ArrayList transformedSelection = new ArrayList(structuredSelection.size());
    for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
        Object r = transformSelection(it.next());
        if (r != null) {
            transformedSelection.add(r);
        }
    }
    super.setInput(part, new StructuredSelection(transformedSelection));
}

From source file:eu.geclipse.workflow.ui.sheet.WorkflowPropertySection.java

License:Open Source License

/**
 * @generated//from   w w w. j  av a2s  .  com
 */
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
    if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
        super.setInput(part, selection);
        return;
    }
    final StructuredSelection structuredSelection = ((StructuredSelection) selection);
    ArrayList transformedSelection = new ArrayList(structuredSelection.size());
    for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
        Object r = transformSelection(it.next());
        if (r != null) {
            transformedSelection.add(r);
        }
    }
    super.setInput(part, new StructuredSelection(transformedSelection));
}

From source file:ext.org.eclipse.jdt.internal.ui.wizards.SuperInterfaceSelectionDialog.java

License:Open Source License

@Override
protected void handleSelected(StructuredSelection selection) {
    super.handleSelected(selection);

    if (selection.size() == 0 && fTypeWizardPage.getSuperInterfaces().size() > fOldContent.size()) {
        // overrides updateStatus() from handleSelected() if
        // list of super interfaces was modified
        // the <code>super.handleSelected(selection)</code> has to be
        // called, because superclass implementation of this class updates
        // state of the table.

        updateStatus(Status.OK_STATUS);/* w  ww.  j  a  v a2 s .  c  o m*/

        getButton(ADD_ID).setEnabled(false);
    } else {
        // if selection isn't empty, the add button should be enabled in
        // exactly the same scenarios as the OK button
        getButton(ADD_ID).setEnabled(getButton(OK).isEnabled());
    }
}

From source file:fr.gouv.mindef.safran.database.ui.actions.AbstractScaffoldHandler.java

License:Open Source License

public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
    shell = HandlerUtil.getActiveShell(event);
    if (selection instanceof StructuredSelection) {
        StructuredSelection structuredSelection = (StructuredSelection) selection;
        if (structuredSelection.size() == 2) {
            ScaffoldInfo existingScaffoldInfo = getExistingScaffoldModel(structuredSelection);
            if (existingScaffoldInfo != null) {
                MessageDialog dlg = new MessageDialog(shell, "Existing scaffold model found", null,
                        "A scaffold model already exists for these objects in file "
                                + existingScaffoldInfo.eResource().getURI().toPlatformString(true)
                                + "\n\nWhat do you want to do ?",
                        MessageDialog.QUESTION_WITH_CANCEL,
                        new String[] { "Use existing scaffold", "Create a new scaffold", "Cancel" }, 0);
                int btn = dlg.open();
                if (btn == CANCEL) {
                    return null;
                } else if (btn == CREATE_NEW_SCAFFOLD) {
                    executeScaffoldingWizard(structuredSelection);
                } else if (btn == USE_EXISTING_SCAFFOLD) {
                    executeFromScaffoldModel(existingScaffoldInfo);
                }/*  ww w  . j av a  2 s .c o  m*/
            } else {
                executeScaffoldingWizard(structuredSelection);
            }

        } else if (structuredSelection.size() == 1) {
            executeFromScaffoldModel(structuredSelection);
        }
    }
    return null;
}

From source file:fr.gouv.mindef.safran.database.ui.actions.testers.TestScaffoldingInput.java

License:Open Source License

public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if (receiver instanceof StructuredSelection) {
        StructuredSelection selection = (StructuredSelection) receiver;
        if (selection.size() == 1) {
            Object element = selection.getFirstElement();
            if (args != null && args.length >= 1) {
                String kind = (String) args[0];
                if (element instanceof Resource) {
                    Resource resource = (Resource) element;
                    if (ENTITY_TO_LOGICAL_DATABASE.equals(kind)) {
                        return handleEntityToLogicalDatabase(resource);
                    } else if (LOGICAL_DATABASE_TO_ENTITY.equals(kind)) {
                        return handleLogicalDatabaseToEntity(resource);
                    } else if (LOGICAL_DATABASE_TO_PHYSICAL_DATABASE.equals(kind)) {
                        return handleLogicalDatabaseToPhysicalDatabase(resource);
                    } else if (PHYSICAL_DATABASE_TO_LOGICAL_DATABASE.equals(kind)) {
                        return handlePhysicalDatabaseToLogicalDatabase(resource);
                    }/*from  w w w.j a v a  2  s.  c  o  m*/
                } else {
                    URI uri = getModelURI(element);
                    if (uri != null) {
                        if (ENTITY_TO_LOGICAL_DATABASE.equals(kind)) {
                            return handleEntityToLogicalDatabase(uri);
                        } else if (LOGICAL_DATABASE_TO_ENTITY.equals(kind)) {
                            return handleLogicalDatabaseToEntity(uri);
                        } else if (LOGICAL_DATABASE_TO_PHYSICAL_DATABASE.equals(kind)) {
                            return handleLogicalDatabaseToPhysicalDatabase(uri);
                        } else if (PHYSICAL_DATABASE_TO_LOGICAL_DATABASE.equals(kind)) {
                            return handlePhysicalDatabaseToLogicalDatabase(uri);
                        }
                    }

                }
            }
        }
    }
    return false;
}

From source file:gov.nasa.ensemble.core.plan.resources.ui.profile.editor.ProfileDataPointsEditor.java

License:Open Source License

@SuppressWarnings("unchecked")
private TreeTableViewer createTreeTableViewer(final Composite parent, FormToolkit toolkit,
        final Profile profile) {
    boolean isProfileEditable = isProfileEditable(profile);
    //create tree viewer
    List<AbstractTreeTableColumn> columns = new ProfileDataPointColumnProvider(profile, isProfileEditable)
            .getColumns();/*  w  w  w  . ja  va2s  .co m*/
    TreeTableColumnConfiguration config = new TreeTableColumnConfiguration(columns.get(0), columns,
            columns.get(0));
    TreeTableComposite ttc = new TreeTableComposite(parent, config, false);
    ttc.setLayout(new TreeTableColumnLayout(false));
    final TreeTableViewer viewer = new TreeTableViewer(ttc, config, null);

    //set providers
    viewer.setContentProvider(new ProfileEditorContentProvider());
    viewer.setLabelProvider(new TreeTableLabelProvider() {
        @Override
        public boolean needsUpdate(Object feature) {
            return false;
        }

        @Override
        public Font getFont(Object element) {
            return null;
        }

        @Override
        public Color getBackground(Object element) {
            return null;
        }
    });

    //if there's any changes in the profile data points... refresh viewer!
    final TransactionalEditingDomain domain = gov.nasa.ensemble.emf.transaction.TransactionUtils
            .getDomain(profile);
    final ResourceSetListenerImpl viewerRefreshListener = new ResourceSetListenerImpl() {
        @Override
        public void resourceSetChanged(ResourceSetChangeEvent event) {
            for (Notification notification : event.getNotifications()) {
                if (notification.getNotifier() == profile
                        && notification.getFeature() == JSciencePackage.Literals.PROFILE__DATA_POINTS) {
                    WidgetUtils.runInDisplayThread(viewer.getTree(), new Runnable() {
                        @Override
                        public void run() {
                            viewer.refresh();
                            parent.getParent().getParent().layout();
                        }
                    });
                }
            }
        }
    };
    if (domain != null) {
        domain.addResourceSetListener(viewerRefreshListener);
    }

    if (isProfileEditable) {
        Composite buttonsComposite = toolkit.createComposite(parent);
        buttonsComposite.setLayout(new GridLayout(2, false));
        buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1));

        //insert new DataPoint
        final Button insertButton = toolkit.createButton(buttonsComposite, INSERT_BUTTON_TEXT, SWT.PUSH);
        insertButton.setToolTipText(INSERT_TOOLTIP_MESSAGE);
        final SelectionAdapter insertButtonSelectionListener = new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
                EList<DataPoint> dataPoints = profile.getDataPoints();
                DataPoint newDataPoint;
                if (dataPoints.isEmpty()) {
                    EPlan ePlan = EPlanUtils.getPlanFromResourceSet(profile);
                    Date date = (ePlan != null ? ePlan.getMember(TemporalMember.class).getStartTime()
                            : new Date());
                    newDataPoint = JScienceFactory.eINSTANCE.createEDataPoint(date, null);
                } else {
                    Date date;
                    ISelection selection = viewer.getSelection();
                    if (selection == null || selection.isEmpty()) {
                        date = dataPoints.get(dataPoints.size() - 1).getDate();
                    } else if (selection instanceof StructuredSelection) {
                        Object[] array = ((StructuredSelection) selection).toArray();
                        date = ((DataPoint) array[array.length - 1]).getDate();
                    } else {
                        date = new Date(); //if everything fails... just set to now
                    }
                    newDataPoint = JScienceFactory.eINSTANCE.createEDataPoint(DateUtils.addSeconds(date, 1),
                            null);
                }
                if (!dataPoints.contains(newDataPoint)) {
                    try {
                        AddProfileDataPointOperation op = new AddProfileDataPointOperation(profile,
                                newDataPoint);
                        op.addContext(viewer.getModel().getUndoContext());
                        IOperationHistory history = OperationHistoryFactory.getOperationHistory();
                        history.execute(op, null, null);
                        viewer.setSelection(new StructuredSelection(newDataPoint));
                    } catch (Exception e) {
                        LogUtil.error(e);
                    }
                } else {
                    showOperationError();
                    viewer.setSelection(new StructuredSelection(newDataPoint));
                }

            }
        };
        insertButton.addSelectionListener(insertButtonSelectionListener);

        //remove Data Point
        final Button removeButton = toolkit.createButton(buttonsComposite, REMOVE_BUTTON_TEXT, SWT.PUSH);
        removeButton.setToolTipText(REMOVE_TOOLTIP_MESSAGE);
        removeButton.setEnabled(!viewer.getSelection().isEmpty());
        final SelectionAdapter removeButtonSelectionListener = new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
                ISelection selection = viewer.getSelection();
                if (!selection.isEmpty()) {
                    if (selection instanceof StructuredSelection) {
                        StructuredSelection ss = (StructuredSelection) selection;
                        int selectionSize = ss.size();
                        DataPoint[] dps = new DataPoint[selectionSize];
                        Iterator<DataPoint> iterator = ss.iterator();
                        int i = 0;
                        while (iterator.hasNext()) {
                            dps[i++] = iterator.next();
                        }
                        RemoveProfileDataPointsOperation op = new RemoveProfileDataPointsOperation(profile,
                                dps);
                        op.addContext(EMFUtils.getUndoContext(profile));
                        IOperationHistory history = OperationHistoryFactory.getOperationHistory();
                        try {
                            history.execute(op, null, null);
                            viewer.setSelection(StructuredSelection.EMPTY);
                        } catch (Exception e) {
                            LogUtil.error(e);
                        }
                    }
                }
            }
        };
        removeButton.addSelectionListener(removeButtonSelectionListener);
        final ISelectionChangedListener removeButtonEnablementListener = new ISelectionChangedListener() {
            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                removeButton.setEnabled(!viewer.getSelection().isEmpty());
            }
        };
        viewer.addSelectionChangedListener(removeButtonEnablementListener);

        //set dispose listener for editable profiles
        viewer.getControl().addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent e) {
                if (domain != null) {
                    domain.removeResourceSetListener(viewerRefreshListener);
                }
                insertButton.removeSelectionListener(insertButtonSelectionListener);
                removeButton.removeSelectionListener(removeButtonSelectionListener);
                viewer.removeSelectionChangedListener(removeButtonEnablementListener);
                dispose(viewer);
            }
        });
    } else {
        //set dispose listener for non-editable profiles
        viewer.getControl().addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent e) {
                if (domain != null) {
                    domain.removeResourceSetListener(viewerRefreshListener);
                }
                dispose(viewer);
            }
        });
    }
    return viewer;
}

From source file:gov.redhawk.eclipsecorba.library.ui.IdlInterfaceSelectionDialog.java

License:Open Source License

/**
 * Handle a selection change in the viewer.  Ensures that the correct number of items
 * of the correct type are selected./*from   w w w .  j a  v  a  2  s.c  om*/
 */
protected void handleSelected(StructuredSelection selection) {
    IStatus s = new Status(IStatus.OK, LibraryUIPlugin.PLUGIN_ID, IStatus.OK, "", null);

    // You can only select one item and it must be an interface
    if (selection.size() != 1) {
        s = new Status(IStatus.ERROR, LibraryUIPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
    } else {
        if (!(selection.getFirstElement() instanceof IdlInterfaceDcl)) {
            s = new Status(IStatus.ERROR, LibraryUIPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
        }
    }
    updateStatus(s);
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.schema.ELTSchemaGridWidget.java

License:Apache License

/**
 * //from www .  ja  v  a 2  s  .com
 * Creates schema grid section
 * 
 * @param {@link Composite}
 * @return {@link TableViewer}
 */
public TableViewer createSchemaGridSection(Composite container, int height, int width) {

    ELTSchemaTableComposite gridSubGroup = new ELTSchemaTableComposite(container);
    gridSubGroup.createContainerWidget();

    //compositeOfOutsideTable = new ColumnLayoutData();
    compositeOfOutsideTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    compositeOfOutsideTable.heightHint = 260;
    compositeOfOutsideTable.widthHint = 400;
    gridSubGroup.getContainerControl().setLayoutData(compositeOfOutsideTable);

    Composite composite = new Composite(gridSubGroup.getContainerControl(), SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);

    composite.setLayoutData(gd_composite);

    tableViewerComposite = new Composite(composite, SWT.BORDER);
    GridLayout gd_layoutTable = (new GridLayout(1, false));
    gd_layoutTable.marginHeight = 0;
    gd_layoutTable.marginWidth = 0;
    tableViewerComposite.setLayout(gd_layoutTable);
    GridData gd_tableViewerComposite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    tableViewerComposite.setLayoutData(gd_tableViewerComposite);

    tableComposite = new Composite(tableViewerComposite, SWT.NONE);
    GridLayout gl_composite_2 = new GridLayout(1, false);
    gl_composite_2.marginWidth = 0;
    gl_composite_2.marginHeight = 0;
    gl_composite_2.horizontalSpacing = 0;
    tableComposite.setLayout(gl_composite_2);

    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    AbstractELTWidget eltTableViewer = new ELTTableViewer(getContentProvider(), getLableProvider());
    eltTableViewer.attachWidget(tableComposite);

    tableViewer = (TableViewer) eltTableViewer.getJfaceWidgetControl();
    tableViewer.setInput(schemaGridRowList);

    addGridRowsCopyPasteContextMenu();

    // Set the editors, cell modifier, and column properties
    tableViewer.setColumnProperties(PROPS);
    tableViewer.setCellModifier(getCellModifier());
    ELTTable eltTable = new ELTTable(tableViewer, height, width);
    gridSubGroup.attachWidget(eltTable);

    table = (Table) eltTable.getSWTWidgetControl();

    // Create Table column
    WidgetUtility.createTableColumns(table, PROPS);
    // Set up the table
    for (int columnIndex = 0, n = table.getColumnCount(); columnIndex < n; columnIndex++) {
        table.getColumn(columnIndex).pack();
        table.getColumn(columnIndex).setWidth(COLUMN_WIDTH);
    }
    editors = gridWidgetBuilder.createCellEditorList(table, columns);
    tableViewer.setCellEditors(editors);

    // enables the tab functionality
    TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
            ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
                    | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);

    if (StringUtils.equalsIgnoreCase(getComponent().getCategory(), Constants.STRAIGHTPULL)
            || (StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.FILTER_COMPONENT)
                    || (StringUtils.equalsIgnoreCase(getComponent().getComponentName(),
                            Constants.UNIQUE_SEQUENCE_COMPONENT))
                    || (StringUtils.equalsIgnoreCase(getComponent().getComponentName(),
                            Constants.PARTITION_BY_EXPRESSION))))

    {
        //table.setEnabled(false);
        for (CellEditor cellEditor : editors) {
            tableViewerComposite.setToolTipText("Non-editable");
            cellEditor.getControl().setEnabled(false);
        }
    }
    helper = getListenerHelper();

    // Adding the decorator to show error message when field name same.
    setDecorator();

    addValidators();
    if (addButton != null) {
        try {

            eltTable.attachListener(ListenerFactory.Listners.GRID_MOUSE_DOUBLE_CLICK.getListener(),
                    propertyDialogButtonBar, helper, table, deleteButton.getSWTWidgetControl(),
                    upButton.getSWTWidgetControl(), downButton.getSWTWidgetControl());
            eltTable.attachListener(ListenerFactory.Listners.MOUSE_HOVER_LISTENER.getListener(),
                    propertyDialogButtonBar, helper, table);

            eltTable.attachListener(ListenerFactory.Listners.MOUSE_MOVE_LISTENER.getListener(),
                    propertyDialogButtonBar, helper, table);
            eltTable.attachListener(ListenerFactory.Listners.DISPOSE_LISTENER.getListener(),
                    propertyDialogButtonBar, helper, table);

            eltTable.attachListener(ListenerFactory.Listners.KEY_DOWN_LISTENER.getListener(),
                    propertyDialogButtonBar, helper, table);

            eltTable.attachListener(ListenerFactory.Listners.GRID_MOUSE_DOWN.getListener(),
                    propertyDialogButtonBar, helper, editors[0].getControl());

            eltTable.attachListener(ListenerFactory.Listners.GRID_KEY_LISTENER.getListener(),
                    propertyDialogButtonBar, helper, table, deleteButton.getSWTWidgetControl(),
                    upButton.getSWTWidgetControl(), downButton.getSWTWidgetControl());

            addButton.attachListener(ListenerFactory.Listners.GRID_ADD_SELECTION.getListener(),
                    propertyDialogButtonBar, helper, table, deleteButton.getSWTWidgetControl(),
                    upButton.getSWTWidgetControl(), downButton.getSWTWidgetControl());

            deleteButton.attachListener(ListenerFactory.Listners.GRID_DELETE_SELECTION.getListener(),
                    propertyDialogButtonBar, helper, table, deleteButton.getSWTWidgetControl(),
                    upButton.getSWTWidgetControl(), downButton.getSWTWidgetControl());

            for (CellEditor editor : editors) {
                addShortcutKeyListener(editor.getControl());
            }
            addShortcutKeyListener(table);

        } catch (Exception e) {
            logger.error(Messages.ATTACH_LISTENER_ERROR, e);
            throw new RuntimeException(Messages.ATTACH_LISTENER_ERROR);

        }

        gridListener(editors);
        upButton.setEnabled(false);
        downButton.setEnabled(false);
        deleteButton.setEnabled(false);
    }
    TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
            ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
                    | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.TABBING_HORIZONTAL);

    tableViewer.getControl().addKeyListener(new KeyListener() {

        @Override
        public void keyReleased(KeyEvent e) {
            // Do - Nothing
        }

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.F2) {
                if (tableViewer.getSelection() != null) {
                    StructuredSelection selection = (StructuredSelection) tableViewer.getSelection();
                    if (selection.size() == 1) {
                        GridRow gridRow = (GridRow) selection.getFirstElement();
                        int index = schemaGridRowList.indexOf(gridRow);
                        if (index > -1) {
                            tableViewer.editElement(tableViewer.getElementAt(index), 0);
                        }
                    }
                }
            }
        }
    });

    populateWidget();

    arrangeTableViewerColumns();

    return tableViewer;
}