Search in sources :

Example 1 with AttributeLabelProvider

use of org.netxms.ui.eclipse.widgets.helpers.AttributeLabelProvider in project netxms by netxms.

the class PersistentStorageView method createPartControl.

/* (non-Javadoc)
    * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
    */
@Override
public void createPartControl(Composite parent) {
    // GridLayout layout = new GridLayout();
    // layout.verticalSpacing = WidgetHelper.INNER_SPACING;
    // layout.marginWidth = 0;
    // layout.marginHeight = 0;
    // parent.setLayout(layout);
    final String[] setColumnNames = { "Key", "Value" };
    final int[] setColumnWidths = { 150, 200 };
    viewerSetValue = new SortableTableViewer(parent, setColumnNames, setColumnWidths, 0, SWT.UP, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    viewerSetValue.setContentProvider(new ArrayContentProvider());
    viewerSetValue.setLabelProvider(new AttributeLabelProvider());
    viewerSetValue.setComparator(new ObjectLabelComparator((ILabelProvider) viewerSetValue.getLabelProvider()));
    viewerSetValue.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            int size = ((IStructuredSelection) viewerSetValue.getSelection()).size();
            actionEdit.setEnabled(size == 1);
            actionDelete.setEnabled(size > 0);
        }
    });
    createActions();
    contributeToActionBars();
    createPopupMenu();
    refresh();
}
Also used : ObjectLabelComparator(org.netxms.ui.eclipse.tools.ObjectLabelComparator) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) AttributeLabelProvider(org.netxms.ui.eclipse.widgets.helpers.AttributeLabelProvider)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 ObjectLabelComparator (org.netxms.ui.eclipse.tools.ObjectLabelComparator)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1 AttributeLabelProvider (org.netxms.ui.eclipse.widgets.helpers.AttributeLabelProvider)1