Search in sources :

Example 6 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.

the class LogParserEditor method createForm.

/**
 * Create policy edit form
 */
private void createForm() {
    /* FORM */
    toolkit = new FormToolkit(getDisplay());
    form = toolkit.createScrolledForm(tabFolder);
    form.setText(Messages.get().LogParserEditor_LogParser);
    final CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
    tabItem.setText(Messages.get().LogParserEditor_Editor);
    tabItem.setImage(SharedIcons.IMG_EDIT);
    tabItem.setControl(form);
    tabItem.setData(TAB_BUILDER);
    TableWrapLayout layout = new TableWrapLayout();
    layout.numColumns = 2;
    form.getBody().setLayout(layout);
    /* General section */
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText("General");
    TableWrapData td = new TableWrapData();
    td.align = TableWrapData.FILL;
    td.grabHorizontal = true;
    td.colspan = 2;
    section.setLayoutData(td);
    final Composite generalArea = toolkit.createComposite(section);
    createGeneralArea(generalArea);
    section.setClient(generalArea);
    /* Rules section */
    section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.COMPACT | Section.TWISTIE | Section.EXPANDED);
    section.setText(Messages.get().LogParserEditor_Rules);
    td = new TableWrapData();
    td.align = TableWrapData.FILL;
    td.grabHorizontal = true;
    section.setLayoutData(td);
    rulesArea = toolkit.createComposite(section);
    GridLayout rulesAreaLayout = new GridLayout();
    rulesAreaLayout.marginHeight = 0;
    rulesAreaLayout.marginWidth = 0;
    rulesAreaLayout.verticalSpacing = 1;
    rulesArea.setLayout(rulesAreaLayout);
    section.setClient(rulesArea);
    addColumnLink = toolkit.createImageHyperlink(rulesArea, SWT.NONE);
    addColumnLink.setText(Messages.get().LogParserEditor_AddRule);
    addColumnLink.setImage(SharedIcons.IMG_ADD_OBJECT);
    addColumnLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            addRule();
        }
    });
    /* Macros section */
    section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.COMPACT | Section.TWISTIE);
    section.setText(Messages.get().LogParserEditor_Macros);
    td = new TableWrapData();
    td.align = TableWrapData.FILL;
    section.setLayoutData(td);
    final Composite macroArea = toolkit.createComposite(section);
    createMacroSection(macroArea);
    section.setClient(macroArea);
    form.reflow(true);
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) CTabItem(org.eclipse.swt.custom.CTabItem) Section(org.eclipse.ui.forms.widgets.Section) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 7 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.

the class ExportFileBuilder method createScriptSection.

/**
 * Create "Scripts" section
 */
private void createScriptSection() {
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText("Scripts");
    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);
    scriptViewer = 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;
    scriptViewer.getTable().setLayoutData(gd);
    scriptViewer.setContentProvider(new ArrayContentProvider());
    scriptViewer.setLabelProvider(new ScriptLabelProvider());
    scriptViewer.setComparator(new ScriptComparator());
    scriptViewer.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) {
            addScripts();
        }
    });
    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(scriptViewer, scripts);
        }
    });
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Section(org.eclipse.ui.forms.widgets.Section) ScriptLabelProvider(org.netxms.ui.eclipse.serverconfig.views.helpers.ScriptLabelProvider) 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) ScriptComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.ScriptComparator) TableViewer(org.eclipse.jface.viewers.TableViewer) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 8 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.

the class ExportFileBuilder method createRuleSection.

/**
 * Create "Rules" section
 */
private void createRuleSection() {
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText(Messages.get().ExportFileBuilder_SectionRules);
    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);
    ruleViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    ruleViewer.getTable().setLinesVisible(true);
    ruleViewer.getTable().setHeaderVisible(true);
    TableColumn column = new TableColumn(ruleViewer.getTable(), SWT.LEFT);
    column.setText("Rule #");
    column.setWidth(60);
    column = new TableColumn(ruleViewer.getTable(), SWT.LEFT);
    column.setText("Rule Name");
    column.setWidth(250);
    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;
    ruleViewer.getTable().setLayoutData(gd);
    ruleViewer.setContentProvider(new ArrayContentProvider());
    ruleViewer.setLabelProvider(new RuleLabelProvider());
    ruleViewer.setComparator(new RuleComparator());
    ruleViewer.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) {
            if (rulesCache == null) {
                new ConsoleJob(Messages.get().ExportFileBuilder_EPPLoadJobName, ExportFileBuilder.this, Activator.PLUGIN_ID, null) {

                    @Override
                    protected void runInternal(IProgressMonitor monitor) throws Exception {
                        rulesCache = session.getEventProcessingPolicy().getRules();
                        runInUIThread(new Runnable() {

                            @Override
                            public void run() {
                                addRules();
                            }
                        });
                    }

                    @Override
                    protected String getErrorMessage() {
                        return Messages.get().ExportFileBuilder_EPPLoadJobError;
                    }
                }.start();
            } else {
                addRules();
            }
        }
    });
    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(ruleViewer, rules);
        }
    });
}
Also used : RuleComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.RuleComparator) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Section(org.eclipse.ui.forms.widgets.Section) TableColumn(org.eclipse.swt.widgets.TableColumn) TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RuleLabelProvider(org.netxms.ui.eclipse.serverconfig.views.helpers.RuleLabelProvider) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) TableViewer(org.eclipse.jface.viewers.TableViewer) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 9 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.

the class ExportFileBuilder method createEventSection.

/**
 * Create "Events" section
 */
private void createEventSection() {
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText(Messages.get().ExportFileBuilder_SectionEvents);
    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);
    eventViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    toolkit.adapt(eventViewer.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;
    eventViewer.getTable().setLayoutData(gd);
    eventViewer.setContentProvider(new ArrayContentProvider());
    eventViewer.setLabelProvider(new WorkbenchLabelProvider());
    eventViewer.setComparator(new ObjectLabelComparator((ILabelProvider) eventViewer.getLabelProvider()));
    eventViewer.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) {
            addEvents();
        }
    });
    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(eventViewer, events);
        }
    });
}
Also used : WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) ObjectLabelComparator(org.netxms.ui.eclipse.tools.ObjectLabelComparator) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) 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) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 10 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData 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

TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)38 GridLayout (org.eclipse.swt.layout.GridLayout)32 Composite (org.eclipse.swt.widgets.Composite)29 Section (org.eclipse.ui.forms.widgets.Section)29 GridData (org.eclipse.swt.layout.GridData)25 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)20 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)19 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)16 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)14 TableViewer (org.eclipse.jface.viewers.TableViewer)14 TableWrapLayout (org.eclipse.ui.forms.widgets.TableWrapLayout)12 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)5 FormText (org.eclipse.ui.forms.widgets.FormText)5 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)5 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)3 SectionPart (org.eclipse.ui.forms.SectionPart)3 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)3 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)3 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)2 Date (java.util.Date)2