public Composite configSectionCreate(final Composite parent) {
ImageLoader imageLoader = ImageLoader.getInstance();
Image imgOpenFolder = imageLoader.getImage("openFolderButton");
GridData gridData;
GridLayout layout;
Composite gLogging = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
gLogging.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
gLogging.setLayout(layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
BooleanParameter enable_logger = new BooleanParameter(gLogging, "Logger.Enabled", CFG_PREFIX + "loggerenable");
gridData = new GridData();
gridData.horizontalSpan = 2;
enable_logger.setLayoutData(gridData);
// row
final BooleanParameter enableLogging =
new BooleanParameter(gLogging,
"Logging Enable",
CFG_PREFIX + "enable");
gridData = new GridData();
gridData.horizontalSpan = 2;
enableLogging.setLayoutData(gridData);
Composite cArea = new Composite(gLogging, SWT.NULL);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 3;
cArea.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
cArea.setLayoutData(gridData);
// row
Label lStatsPath = new Label(cArea, SWT.NULL);
Messages.setLanguageText(lStatsPath, CFG_PREFIX + "logdir"); //$NON-NLS-1$
gridData = new GridData();
gridData.widthHint = 150;
final StringParameter pathParameter = new StringParameter(cArea, "Logging Dir"); //$NON-NLS-1$ //$NON-NLS-2$
pathParameter.setLayoutData(gridData);
Button browse = new Button(cArea, SWT.PUSH);
browse.setImage(imgOpenFolder);
imgOpenFolder.setBackground(browse.getBackground());
browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
browse.addListener(SWT.Selection, new Listener() {
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
*/
public void handleEvent(Event event) {
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
dialog.setFilterPath(pathParameter.getValue());
dialog.setText(MessageText.getString(CFG_PREFIX + "choosedefaultsavepath")); //$NON-NLS-1$
String path = dialog.open();
if (path != null) {
pathParameter.setValue(path);
}
}
});
Label lMaxLog = new Label(cArea, SWT.NULL);
Messages.setLanguageText(lMaxLog, CFG_PREFIX + "maxsize");
final String lmLabels[] = new String[logFileSizes.length];
final int lmValues[] = new int[logFileSizes.length];
for (int i = 0; i < logFileSizes.length; i++) {
int num = logFileSizes[i];
lmLabels[i] = " " + num + " MB";
lmValues[i] = num;
}
IntListParameter paramMaxSize = new IntListParameter(cArea, "Logging Max Size", lmLabels, lmValues);
gridData = new GridData();
gridData.horizontalSpan = 2;
paramMaxSize.setLayoutData(gridData);
if(userMode > 1)
{
Label timeStampLbl = new Label(cArea, SWT.NULL);
Messages.setLanguageText(timeStampLbl, CFG_PREFIX+"timestamp");
timeStampLbl.setLayoutData(new GridData());
StringParameter timeStamp = new StringParameter(cArea,"Logging Timestamp");
gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.widthHint = 150;
timeStamp.setLayoutData(gridData);
}
/** FileLogging filter, consisting of a List of types (info, warning, error)
* and a checkbox Table of component IDs.
*/
final String sFilterPrefix = CFG_PREFIX + "filter";
Group gLogIDs = new Group(gLogging, SWT.NULL);
Messages.setLanguageText(gLogIDs, sFilterPrefix);
layout = new GridLayout();
layout.numColumns = 2;
gLogIDs.setLayout(layout);
gridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
gridData.horizontalSpan = 2;
gLogIDs.setLayoutData(gridData);
final List listLogTypes = new List(gLogIDs, SWT.BORDER | SWT.SINGLE
| SWT.V_SCROLL);
gridData = new GridData(SWT.NULL, SWT.BEGINNING, false, false);
listLogTypes.setLayoutData(gridData);
final int[] logTypes = { LogEvent.LT_INFORMATION, LogEvent.LT_WARNING,
LogEvent.LT_ERROR };
for (int i = 0; i < logTypes.length; i++)
listLogTypes.add(MessageText.getString(CFG_PREFIX + "log" + i + "type"));
listLogTypes.select(0);
final LogIDs[] logIDs = FileLogging.configurableLOGIDs;
//Arrays.sort(logIDs);
final Table tableLogIDs = new Table(gLogIDs, SWT.CHECK | SWT.BORDER
| SWT.SINGLE | SWT.FULL_SELECTION);
gridData = new GridData(GridData.FILL_BOTH);
tableLogIDs.setLayoutData(gridData);
tableLogIDs.setLinesVisible (false);
tableLogIDs.setHeaderVisible(false);
TableColumn column = new TableColumn(tableLogIDs, SWT.NONE);