Search in sources :

Example 1 with ToolLabelProvider

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

the class ExportFileBuilder method createToolsSection.

/**
 * Create "Object Tools" section
 */
private void createToolsSection() {
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText("Object Tools");
    TableWrapData td = new TableWrapData();
    td.align = TableWrapData.FILL;
    td.grabHorizontal = true;
    section.setLayoutData(td);
    Composite clientArea = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    clientArea.setLayout(layout);
    section.setClient(clientArea);
    toolsViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    toolkit.adapt(ruleViewer.getTable());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 200;
    gd.verticalSpan = 2;
    toolsViewer.getTable().setLayoutData(gd);
    toolsViewer.setContentProvider(new ArrayContentProvider());
    toolsViewer.setLabelProvider(new ToolLabelProvider());
    toolsViewer.setComparator(new ToolComparator());
    toolsViewer.getTable().setSortDirection(SWT.UP);
    final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkAdd.setText(Messages.get().ExportFileBuilder_Add);
    linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    linkAdd.setLayoutData(gd);
    linkAdd.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            addObjectTools();
        }
    });
    final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkRemove.setText(Messages.get().ExportFileBuilder_Remove);
    linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    linkRemove.setLayoutData(gd);
    linkRemove.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            removeObjects(toolsViewer, tools);
        }
    });
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ToolLabelProvider(org.netxms.ui.eclipse.serverconfig.views.helpers.ToolLabelProvider) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Section(org.eclipse.ui.forms.widgets.Section) TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) ToolComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.ToolComparator) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)1 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)1 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)1 Section (org.eclipse.ui.forms.widgets.Section)1 TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)1 ToolComparator (org.netxms.ui.eclipse.serverconfig.views.helpers.ToolComparator)1 ToolLabelProvider (org.netxms.ui.eclipse.serverconfig.views.helpers.ToolLabelProvider)1