Search in sources :

Example 1 with MappingTableEntryLabelProvider

use of org.netxms.ui.eclipse.serverconfig.views.helpers.MappingTableEntryLabelProvider in project netxms by netxms.

the class MappingTableEditor method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    final int[] widths = { 200, 200, 400 };
    final String[] names = { Messages.get().MappingTableEditor_ColKey, Messages.get().MappingTableEditor_ColValue, Messages.get().MappingTableEditor_ColComments };
    viewer = new SortableTableViewer(parent, names, widths, COLUMN_KEY, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new MappingTableEntryLabelProvider());
    viewer.setComparator(new MappingTableEntryComparator());
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    viewer.setColumnProperties(new String[] { "key", "value", "comments" });
    CellEditor[] editors = new CellEditor[] { new TextCellEditor(viewer.getTable()), new TextCellEditor(viewer.getTable()), new TextCellEditor(viewer.getTable()) };
    viewer.setCellEditors(editors);
    viewer.setCellModifier(new CellModifier());
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            actionDelete.setEnabled(selection.size() > 0);
        }
    });
    createActions();
    contributeToActionBars();
    createPopupMenu();
    activateContext();
    refresh();
}
Also used : ICellModifier(org.eclipse.jface.viewers.ICellModifier) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) MappingTableEntryComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.MappingTableEntryComparator) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) MappingTableEntryLabelProvider(org.netxms.ui.eclipse.serverconfig.views.helpers.MappingTableEntryLabelProvider)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 CellEditor (org.eclipse.jface.viewers.CellEditor)1 ICellModifier (org.eclipse.jface.viewers.ICellModifier)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)1 MappingTableEntryComparator (org.netxms.ui.eclipse.serverconfig.views.helpers.MappingTableEntryComparator)1 MappingTableEntryLabelProvider (org.netxms.ui.eclipse.serverconfig.views.helpers.MappingTableEntryLabelProvider)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1