use of org.eclipse.titan.common.parsers.cfg.indices.LoggingSectionHandler.PluginSpecificParam in project titan.EclipsePlug-ins by eclipse.
the class ParamDialog method validate.
/**
* Validate the contents of the dialog
*/
private void validate() {
if (nameField == null || !NAME_PATTERN.matcher(nameField).matches()) {
getButton(OK).setEnabled(false);
setErrorMessage("The name of the parameter must be a valid identifier.");
return;
}
if (valueField == null || !VALUE_PATTERN.matcher(valueField).matches()) {
getButton(OK).setEnabled(false);
setErrorMessage("The value of the parameter must be a valid string.");
return;
}
if (nameField.length() > 0) {
if (isAddition) {
List<PluginSpecificParam> params = logentry.getPluginSpecificParam();
if (params != null) {
Iterator<PluginSpecificParam> i = params.iterator();
while (i.hasNext()) {
PluginSpecificParam p = i.next();
if (nameField.equals(p.getParamName())) {
getButton(OK).setEnabled(false);
setErrorMessage("A parameter with this name already exists!");
return;
}
}
}
}
}
getButton(OK).setEnabled((nameField.length() > 0) && (valueField != null && valueField.length() > 0));
setErrorMessage(null);
}
use of org.eclipse.titan.common.parsers.cfg.indices.LoggingSectionHandler.PluginSpecificParam in project titan.EclipsePlug-ins by eclipse.
the class GeneralOptionsSubPage method pluginRenamed.
public void pluginRenamed() {
LoggingSectionHandler.LoggerTreeElement lte = loggingPage.getSelectedTreeElement();
if (selectedLogEntry.getLogFileRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogFileRoot());
createLogFileNode(lte, selectedLogEntry, logFileText.getText().trim());
}
if (selectedLogEntry.getTimestampFormatRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getTimestampFormatRoot());
createTimeStampFormatNode(lte, selectedLogEntry, timeStampFormat.getText().trim());
}
if (selectedLogEntry.getConsoleTimestampFormatRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getConsoleTimestampFormatRoot());
createConsoleTimeStampFormatNode(lte, selectedLogEntry, consoleTimeStampFormat.getText().trim());
}
if (selectedLogEntry.getSourceInfoFormatRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getSourceInfoFormatRoot());
createSourceInfoFormatNode(lte, selectedLogEntry, sourceInfoFormat.getText().trim());
}
if (selectedLogEntry.getAppendFileRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getAppendFileRoot());
createAppendFileNode(lte, selectedLogEntry, appendFile.getText().trim());
}
if (selectedLogEntry.getLogeventTypesRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogeventTypesRoot());
createLogEventTypesNode(lte, selectedLogEntry, logEventTypes.getText().trim());
}
if (selectedLogEntry.getLogEntityNameRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogEntityNameRoot());
createLogEntityNameNode(lte, selectedLogEntry, logEntityName.getText().trim());
}
if (selectedLogEntry.getLogfileSizeRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogfileSizeRoot());
createLogFileSizeNode(lte, selectedLogEntry, actualLogFileSizeText.getText().trim());
}
if (selectedLogEntry.getLogfileNumberRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogfileNumberRoot());
createLogFileNumberNode(lte, selectedLogEntry, actualLogFileNumberText.getText().trim());
}
if (selectedLogEntry.getDiskFullActionRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getDiskFullActionRoot());
createDiskFullActionNode(lte, selectedLogEntry, actualDiskFullAction.getText().trim());
}
List<PluginSpecificParam> list = new ArrayList<PluginSpecificParam>(selectedLogEntry.getPluginSpecificParam());
for (PluginSpecificParam param : list) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), param.getParam());
}
selectedLogEntry.getPluginSpecificParam().clear();
for (PluginSpecificParam param : list) {
createPluginSpecificParamNode(param.getParamName(), param.getValue().getText());
}
paramViewer.setInput(selectedLogEntry);
}
use of org.eclipse.titan.common.parsers.cfg.indices.LoggingSectionHandler.PluginSpecificParam in project titan.EclipsePlug-ins by eclipse.
the class GeneralOptionsSubPage method createSectionGeneral.
void createSectionGeneral(final FormToolkit toolkit, final Composite parent) {
Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
section.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
section.setText("Logging options for the selected component/plugin");
// TODO the description should mention the selected
// configuration.
// section.setDescription("Specify the general logging options that are valid for all components.");
section.marginWidth = 10;
section.marginHeight = 0;
Composite client = toolkit.createComposite(section, SWT.WRAP);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginWidth = 2;
layout.marginHeight = 2;
client.setLayout(layout);
section.setClient(client);
Composite generalOptions = toolkit.createComposite(client);
generalOptions.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
GridLayout layoutGeneral = new GridLayout(2, false);
generalOptions.setLayout(layoutGeneral);
toolkit.paintBordersFor(generalOptions);
valueChanged = true;
toolkit.createLabel(generalOptions, "LogFile:");
logFileText = toolkit.createText(generalOptions, "", SWT.SINGLE);
logFileText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
logFileText.setEnabled(false);
logFileText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = logFileText.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getLogFileRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogFileRoot());
}
selectedLogEntry.setLogFile(null);
selectedLogEntry.setLogFileRoot(null);
} else if (selectedLogEntry.getLogFile() == null) {
// create the node
createLogFileNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getLogFile(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getLogFile() != null) {
if (selectedLogEntry.getLogFile().getText().length() == 0) {
String temp = ConfigTreeNodeUtilities.toString(selectedLogEntry.getLogFile());
ConfigTreeNodeUtilities.setText(selectedLogEntry.getLogFile(), temp);
}
logFileText.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getLogFile()));
}
toolkit.createLabel(generalOptions, "TimeStampFormat:");
timeStampFormat = new CCombo(generalOptions, SWT.FLAT);
timeStampFormat.setEnabled(false);
timeStampFormat.setLayoutData(new GridData(100, SWT.DEFAULT));
timeStampFormat.add("Time");
timeStampFormat.add("DateTime");
timeStampFormat.add("Seconds");
timeStampFormat.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = timeStampFormat.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getTimestampFormatRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getTimestampFormatRoot());
}
selectedLogEntry.setTimestampFormat(null);
selectedLogEntry.setTimestampFormatRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getTimestampFormat() == null) {
// create the node
createTimeStampFormatNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getTimestampFormat(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getTimestampFormat() != null) {
String temp = ConfigTreeNodeUtilities.toString(selectedLogEntry.getTimestampFormat()).trim();
timeStampFormat.setText(temp);
}
toolkit.createLabel(generalOptions, "ConsoleTimeStampFormat:");
consoleTimeStampFormat = new CCombo(generalOptions, SWT.FLAT);
consoleTimeStampFormat.setEnabled(false);
consoleTimeStampFormat.setLayoutData(new GridData(100, SWT.DEFAULT));
consoleTimeStampFormat.add("Time");
consoleTimeStampFormat.add("DateTime");
consoleTimeStampFormat.add("Seconds");
consoleTimeStampFormat.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = consoleTimeStampFormat.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getConsoleTimestampFormatRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getConsoleTimestampFormatRoot());
}
selectedLogEntry.setConsoleTimestampFormat(null);
selectedLogEntry.setConsoleTimestampFormatRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getConsoleTimestampFormat() == null) {
// create the node
createConsoleTimeStampFormatNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getConsoleTimestampFormat(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getConsoleTimestampFormat() != null) {
String temp = ConfigTreeNodeUtilities.toString(selectedLogEntry.getConsoleTimestampFormat()).trim();
consoleTimeStampFormat.setText(temp);
}
toolkit.createLabel(generalOptions, "SourceInfoFormat:");
sourceInfoFormat = new CCombo(generalOptions, SWT.FLAT);
sourceInfoFormat.setEnabled(false);
sourceInfoFormat.setLayoutData(new GridData(100, SWT.DEFAULT));
sourceInfoFormat.add("None");
sourceInfoFormat.add("Single");
sourceInfoFormat.add("Stack");
sourceInfoFormat.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = sourceInfoFormat.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getSourceInfoFormatRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getSourceInfoFormatRoot());
}
selectedLogEntry.setSourceInfoFormat(null);
selectedLogEntry.setSourceInfoFormatRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getSourceInfoFormat() == null) {
// create the node
createSourceInfoFormatNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getSourceInfoFormat(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getSourceInfoFormat() != null) {
sourceInfoFormat.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getSourceInfoFormat()).trim());
}
toolkit.createLabel(generalOptions, "AppendFile:");
appendFile = new CCombo(generalOptions, SWT.FLAT);
appendFile.setEnabled(false);
appendFile.setLayoutData(new GridData(100, SWT.DEFAULT));
appendFile.add("Yes");
appendFile.add("No");
appendFile.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = appendFile.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getAppendFileRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getAppendFileRoot());
}
selectedLogEntry.setAppendFile(null);
selectedLogEntry.setAppendFileRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getAppendFile() == null) {
// create the node
createAppendFileNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getAppendFile(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getAppendFile() != null) {
appendFile.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getAppendFile()).trim());
}
toolkit.createLabel(generalOptions, "LogEventTypes:");
logEventTypes = new CCombo(generalOptions, SWT.FLAT);
logEventTypes.setEnabled(false);
logEventTypes.setLayoutData(new GridData(100, SWT.DEFAULT));
logEventTypes.add("Yes");
logEventTypes.add("No");
logEventTypes.add("Detailed");
logEventTypes.add("Subcategories");
logEventTypes.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = logEventTypes.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getLogeventTypesRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogeventTypesRoot());
}
selectedLogEntry.setLogeventTypes(null);
selectedLogEntry.setLogeventTypesRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getLogeventTypes() == null) {
// create the node
createLogEventTypesNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getLogeventTypes(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getLogeventTypes() != null) {
logEventTypes.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getLogeventTypes()).trim());
}
toolkit.createLabel(generalOptions, "LogEntityName:");
logEntityName = new CCombo(generalOptions, SWT.FLAT);
logEntityName.setEnabled(false);
logEntityName.setLayoutData(new GridData(100, SWT.DEFAULT));
logEntityName.add("Yes");
logEntityName.add("No");
logEntityName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = logEntityName.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getLogEntityNameRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogEntityNameRoot());
}
selectedLogEntry.setLogEntityName(null);
selectedLogEntry.setLogEntityNameRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getLogEntityName() == null) {
// create the node
createLogEntityNameNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getLogEntityName(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getLogEntityName() != null) {
logEntityName.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getLogEntityName()).trim());
}
toolkit.createLabel(generalOptions, "MatchingHints");
matchingHints = new CCombo(generalOptions, SWT.FLAT);
matchingHints.setEnabled(false);
matchingHints.setLayoutData(new GridData(100, SWT.DEFAULT));
matchingHints.add("Compact");
matchingHints.add("Detailed");
matchingHints.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || loggingSectionHandler == null) {
return;
}
editor.setDirty();
String temp = matchingHints.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getMatchingHintsRoot() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getMatchingHintsRoot());
}
selectedLogEntry.setMatchingHints(null);
selectedLogEntry.setMatchingHintsRoot(null);
// loggingPage.removeLoggingSection();
} else if (selectedLogEntry.getMatchingHints() == null) {
// create the node
createMatchingHintsNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getMatchingHints(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getMatchingHints() != null) {
matchingHints.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getMatchingHints()).trim());
}
toolkit.createLabel(generalOptions, "Log file size:");
actualLogFileSizeText = toolkit.createText(generalOptions, "", SWT.SINGLE);
actualLogFileSizeText.setEnabled(false);
actualLogFileSizeText.setLayoutData(new GridData(95, SWT.DEFAULT));
actualLogFileSizeText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || selectedLogEntry == null) {
return;
}
editor.setDirty();
String temp = actualLogFileSizeText.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getLogfileSize() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogfileSizeRoot());
}
selectedLogEntry.setLogfileSize(null);
selectedLogEntry.setLogfileSizeRoot(null);
} else if (selectedLogEntry.getLogfileSize() == null) {
// create the node
createLogFileSizeNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getLogfileSize(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getLogfileSize() != null) {
actualLogFileSizeText.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getLogfileSize()));
}
toolkit.createLabel(generalOptions, "Log file number:");
actualLogFileNumberText = toolkit.createText(generalOptions, "", SWT.SINGLE);
actualLogFileNumberText.setEnabled(false);
actualLogFileNumberText.setLayoutData(new GridData(95, SWT.DEFAULT));
actualLogFileNumberText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || selectedLogEntry == null) {
return;
}
editor.setDirty();
String temp = actualLogFileNumberText.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getLogfileNumber() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getLogfileNumberRoot());
}
selectedLogEntry.setLogfileNumber(null);
selectedLogEntry.setLogfileNumberRoot(null);
} else if (selectedLogEntry.getLogfileNumber() == null) {
// create the node
createLogFileNumberNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getLogfileNumber(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getLogfileNumber() != null) {
actualLogFileNumberText.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getLogfileNumber()));
}
toolkit.createLabel(generalOptions, "Disk full action:");
actualDiskFullAction = new CCombo(generalOptions, SWT.FLAT);
actualDiskFullAction.setEnabled(false);
actualDiskFullAction.setLayoutData(new GridData(100, SWT.DEFAULT));
actualDiskFullAction.add("Stop");
actualDiskFullAction.add("Retry");
actualDiskFullAction.add("Delete");
actualDiskFullAction.add("Error");
actualDiskFullAction.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
if (valueChanged || selectedLogEntry == null) {
return;
}
editor.setDirty();
String temp = actualDiskFullAction.getText();
if (temp == null || temp.length() == 0) {
// remove the node
if (selectedLogEntry.getDiskFullAction() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getDiskFullActionRoot());
}
selectedLogEntry.setDiskFullAction(null);
selectedLogEntry.setDiskFullActionRoot(null);
} else if (selectedLogEntry.getDiskFullAction() == null) {
// create the node
createDiskFullActionNode(loggingPage.getSelectedTreeElement(), selectedLogEntry, temp.trim());
} else {
// simple modification
ConfigTreeNodeUtilities.setText(selectedLogEntry.getDiskFullAction(), temp.trim());
}
}
});
if (selectedLogEntry != null && selectedLogEntry.getDiskFullAction() != null) {
actualDiskFullAction.setText(ConfigTreeNodeUtilities.toString(selectedLogEntry.getDiskFullAction()));
}
// FIXME should not be here
toolkit.createLabel(generalOptions, "Plugin specific:");
Composite components = toolkit.createComposite(generalOptions, SWT.WRAP);
GridLayout tablelayout = new GridLayout();
tablelayout.numColumns = 2;
components.setLayout(tablelayout);
components.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
toolkit.paintBordersFor(components);
paramTable = toolkit.createTable(components, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true);
paramTable.setLayoutData(gd);
paramTable.setEnabled(loggingSectionHandler != null);
paramViewer = new TableViewer(paramTable);
paramViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
internalRefresh();
}
});
TableColumn column = new TableColumn(paramTable, SWT.LEFT, 0);
column.setText("Parameter");
column.setMoveable(false);
column.setWidth(80);
TableColumn column2 = new TableColumn(paramTable, SWT.LEFT, 0);
column2.setText("Value");
column2.setMoveable(false);
column2.setWidth(90);
paramTable.setLinesVisible(true);
paramTable.setHeaderVisible(true);
paramTable.setEnabled(false);
paramViewer.setContentProvider(new ParamDataContentProvider());
paramViewer.setLabelProvider(new ParamDataLabelProvider());
Composite buttons = toolkit.createComposite(components);
buttons.setLayout(new GridLayout());
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL));
addPluginParameter = toolkit.createButton(buttons, "Add...", SWT.PUSH);
GridData gdButton = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
addPluginParameter.setLayoutData(gdButton);
addPluginParameter.setEnabled(false);
addPluginParameter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (loggingSectionHandler == null) {
return;
}
if (loggingSectionHandler.getLastSectionRoot() == null) {
loggingPage.createLoggingSection();
}
ParamDialog d = new ParamDialog(null, selectedLogEntry, null);
if (d.open() == Window.OK) {
PluginSpecificParam psp = createPluginSpecificParamNode(d.getName(), d.getValue());
paramViewer.setInput(selectedLogEntry);
TableItem[] items = paramTable.getItems();
for (TableItem item : items) {
if (item.getData().equals(psp)) {
paramTable.setSelection(item);
paramTable.showSelection();
break;
}
}
internalRefresh();
editor.setDirty();
}
}
});
buttons.setLayout(new GridLayout());
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL));
editPluginParameter = toolkit.createButton(buttons, "Edit...", SWT.PUSH);
gdButton = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
editPluginParameter.setLayoutData(gdButton);
editPluginParameter.setEnabled(false);
editPluginParameter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (loggingSectionHandler == null) {
return;
}
if (loggingSectionHandler.getLastSectionRoot() == null) {
loggingPage.createLoggingSection();
}
StructuredSelection selection = (StructuredSelection) paramViewer.getSelection();
PluginSpecificParam psp = (PluginSpecificParam) selection.getFirstElement();
ParamDialog d = new ParamDialog(null, selectedLogEntry, psp);
if (d.open() == Window.OK) {
if (psp.getParam() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), psp.getParam());
}
selectedLogEntry.getPluginSpecificParam().remove(psp);
psp = createPluginSpecificParamNode(d.getName(), d.getValue());
TableItem[] items = paramTable.getItems();
for (TableItem item : items) {
if (item.getData().equals(psp)) {
paramTable.setSelection(item);
paramTable.showSelection();
break;
}
}
internalRefresh();
editor.setDirty();
}
}
});
removePluginParameter = toolkit.createButton(buttons, "Remove", SWT.PUSH);
gdButton = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
removePluginParameter.setLayoutData(gdButton);
removePluginParameter.setEnabled(false);
removePluginParameter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (loggingSectionHandler == null) {
return;
}
StructuredSelection selection = (StructuredSelection) paramViewer.getSelection();
PluginSpecificParam psp = (PluginSpecificParam) selection.getFirstElement();
if (psp.getParam() != null) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), psp.getParam());
}
selectedLogEntry.getPluginSpecificParam().remove(psp);
internalRefresh();
editor.setDirty();
}
});
valueChanged = false;
}
use of org.eclipse.titan.common.parsers.cfg.indices.LoggingSectionHandler.PluginSpecificParam in project titan.EclipsePlug-ins by eclipse.
the class GeneralOptionsSubPage method createPluginSpecificParamNode.
private PluginSpecificParam createPluginSpecificParamNode(final String param, final String value) {
StringBuilder name = new StringBuilder();
loggingPage.getSelectedTreeElement().writeNamePrefix(name);
name.append(param);
name.append(" := ");
final ParseTree keyAST = new AddedParseTree(name.toString());
final ParseTree valueAST = new AddedParseTree(value);
final ParseTree root = new ParserRuleContext();
ConfigTreeNodeUtilities.addChild(loggingSectionHandler.getLastSectionRoot(), root);
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("\n"));
ConfigTreeNodeUtilities.addChild(root, keyAST);
ConfigTreeNodeUtilities.addChild(root, valueAST);
PluginSpecificParam psp = new PluginSpecificParam(root, keyAST, valueAST, param);
selectedLogEntry.getPluginSpecificParam().add(psp);
return psp;
}
use of org.eclipse.titan.common.parsers.cfg.indices.LoggingSectionHandler.PluginSpecificParam in project titan.EclipsePlug-ins by eclipse.
the class LoggingTreeSubPage method removeLoggingComponents.
/**
* Remove the provided log entry (containing information on a logging
* component) from the tree built of the configuration file, so that
* once we write back the tree its nodes will be missing.
*
* @param logentry
* the entry to be removed.
*/
private void removeLoggingComponents(final LogParamEntry logentry) {
final ParseTree lastSectionRoot = loggingSectionHandler.getLastSectionRoot();
if (logentry.getAppendFile() != null && logentry.getAppendFileRoot() != null) {
logentry.setAppendFile(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getAppendFileRoot());
}
if (logentry.getConsoleMask() != null && logentry.getConsoleMaskRoot() != null) {
logentry.setConsoleMask(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getConsoleMaskRoot());
}
if (logentry.getDiskFullAction() != null && logentry.getDiskFullActionRoot() != null) {
logentry.setDiskFullAction(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getDiskFullActionRoot());
}
if (logentry.getFileMask() != null && logentry.getFileMaskRoot() != null) {
logentry.setFileMask(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getFileMaskRoot());
}
if (logentry.getLogEntityName() != null && logentry.getLogEntityNameRoot() != null) {
logentry.setLogEntityName(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getLogEntityNameRoot());
}
if (logentry.getLogeventTypes() != null && logentry.getLogeventTypesRoot() != null) {
logentry.setLogeventTypes(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getLogeventTypesRoot());
}
if (logentry.getLogFile() != null && logentry.getLogFileRoot() != null) {
logentry.setLogFile(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getLogFileRoot());
}
if (logentry.getLogfileNumber() != null && logentry.getLogfileNumberRoot() != null) {
logentry.setLogfileNumber(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getLogfileNumberRoot());
}
if (logentry.getLogfileSize() != null && logentry.getLogfileSizeRoot() != null) {
logentry.setLogfileSize(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getLogfileSizeRoot());
}
if (logentry.getMatchingHints() != null && logentry.getMatchingHintsRoot() != null) {
logentry.setMatchingHints(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getMatchingHintsRoot());
}
if (logentry.getSourceInfoFormat() != null && logentry.getSourceInfoFormatRoot() != null) {
logentry.setSourceInfoFormat(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getSourceInfoFormatRoot());
}
if (logentry.getTimestampFormat() != null && logentry.getTimestampFormatRoot() != null) {
logentry.setTimestampFormat(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getTimestampFormatRoot());
}
if (logentry.getConsoleTimestampFormat() != null && logentry.getConsoleTimestampFormatRoot() != null) {
logentry.setConsoleTimestampFormat(null);
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, logentry.getConsoleTimestampFormatRoot());
}
Iterator<PluginSpecificParam> pspit = logentry.getPluginSpecificParam().iterator();
while (pspit.hasNext()) {
PluginSpecificParam psp = pspit.next();
ConfigTreeNodeUtilities.removeChild(lastSectionRoot, psp.getRoot());
psp.setParamName(null);
}
loggingPage.removeLoggingSection();
loggingPage.refreshData(loggingSectionHandler);
}
Aggregations