public void performApply(ILaunchConfigurationWorkingCopy config) { config.setAttribute(ATTR_COPROC_HOST, coprocHostText.getText()); config.setAttribute(ATTR_COPROC_PORT, coprocPortText.getText()); config.setAttribute(ATTR_INPUT_XML, xmlFileText.getText()); config.setAttribute(ATTR_INPUT_XSL, xslFileText.getText()); config.setAttribute(ATTR_NULL_XML, setXmlInputNull.getSelection()); config.setAttribute(ATTR_HEADER_VALUES, headerTable.getEntries()); }
private void addHeaderGroup(Composite parent) { Group group = new Group(parent, SWT.NONE); group.setText(Messages.CoProc2LaunchConfigurationMainTab_HeaderGroupTitle); GridLayout layout = new GridLayout(); layout.numColumns = 2; group.setLayout(layout); GridData gd = new GridData(); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = SWT.FILL; group.setLayoutData(gd); headerTable = new HeaderTable(group); headerTable.addModifyListener(modifyListener); }
public void initializeFrom(ILaunchConfiguration config) { String propStr = null; try { propStr = config.getAttribute(ATTR_COPROC_HOST, DFLT_COPROC_HOST); } catch (CoreException ce) { propStr = DFLT_COPROC_HOST; } coprocHostText.setText(propStr); try { propStr = config.getAttribute(ATTR_COPROC_PORT, DFLT_COPROC_PORT); } catch (CoreException ce) { propStr = DFLT_COPROC_PORT; } coprocPortText.setText(propStr); try { propStr = config.getAttribute(ATTR_INPUT_XML, DFLT_INPUT_XML); } catch (CoreException ce) { propStr = DFLT_INPUT_XML; } xmlFileText.setText(propStr); try { propStr = config.getAttribute(ATTR_INPUT_XSL, DFLT_INPUT_XSL); } catch (CoreException ce) { propStr = DFLT_INPUT_XSL; } xslFileText.setText(propStr); boolean noXml = DFLT_NULL_XML; try { noXml = config.getAttribute(ATTR_NULL_XML, DFLT_NULL_XML); } catch (CoreException ce) { noXml = DFLT_NULL_XML; } setXmlInputNull.setSelection(noXml); xmlFileText.setEnabled(!noXml); browseXmlButton.setEnabled(!noXml); ArrayList<HeaderEntry> entries = new ArrayList<HeaderEntry>(); HeaderEntry entry = null; boolean enabled = true; try { Map<String, String> values = config.getAttribute(ATTR_HEADER_VALUES, defaultHeaderValues); Map<String, String> status = config.getAttribute(ATTR_HEADER_STATUS, defaultHeaderStatus); for (String name : values.keySet()) { enabled = Boolean.valueOf(status.get(name)); entry = new HeaderEntry(name, values.get(name), enabled); entries.add(entry); } } catch (CoreException ce) { // If there is a core exception from the configuration. // set values to their defaults. // Map<String, String> values = defaultHeaderValues; Map<String, String> status = defaultHeaderStatus; for (String name : values.keySet()) { enabled = Boolean.valueOf(status.get(name)); entry = new HeaderEntry(name, values.get(name), enabled); entries.add(entry); } } headerTable.setInput(entries); }