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);
}
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);
}
});
}
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);
}
});
}
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);
}
});
}
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);
}
});
}
Aggregations