public Composite configSectionCreate(final Composite parent) {
ImageLoader imageLoader = ImageLoader.getInstance();
Image imgOpenFolder = imageLoader.getImage("openFolderButton");
GridData gridData;
GridLayout layout;
// Sub-Section: File -> Torrent
// ----------------------------
Composite cTorrent = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
cTorrent.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
cTorrent.setLayout(layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
// Save .Torrent files to..
BooleanParameter saveTorrents = new BooleanParameter(cTorrent, "Save Torrent Files",
"ConfigView.label.savetorrents");
Composite gSaveTorrents = new Composite(cTorrent, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalIndent = 25;
gridData.horizontalSpan = 2;
gSaveTorrents.setLayoutData(gridData);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 3;
gSaveTorrents.setLayout(layout);
Label lSaveDir = new Label(gSaveTorrents, SWT.NULL);
Messages.setLanguageText(lSaveDir, "ConfigView.label.savedirectory");
gridData = new GridData(GridData.FILL_HORIZONTAL);
final StringParameter torrentPathParameter = new StringParameter(gSaveTorrents,
"General_sDefaultTorrent_Directory");
torrentPathParameter.setLayoutData(gridData);
Button browse2 = new Button(gSaveTorrents, SWT.PUSH);
browse2.setImage(imgOpenFolder);
imgOpenFolder.setBackground(browse2.getBackground());
browse2.setToolTipText(MessageText.getString("ConfigView.button.browse"));
browse2.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(torrentPathParameter.getValue());
dialog.setText(MessageText.getString("ConfigView.dialog.choosedefaulttorrentpath"));
String path = dialog.open();
if (path != null) {
torrentPathParameter.setValue(path);
}
}
});
browse2.setLayoutData(new GridData());
gridData = new GridData();
gridData.horizontalSpan = 2;
new BooleanParameter(gSaveTorrents, "Save Torrent Backup",
"ConfigView.label.savetorrentbackup").setLayoutData(gridData);
Control[] controls = new Control[]{ gSaveTorrents };
IAdditionalActionPerformer grayPathAndButton1 = new ChangeSelectionActionPerformer(controls);
saveTorrents.setAdditionalActionPerformer(grayPathAndButton1);
gridData = new GridData();
gridData.horizontalSpan = 2;
new BooleanParameter(
cTorrent,
"Default Start Torrents Stopped",
"ConfigView.label.defaultstarttorrentsstopped").setLayoutData(gridData);
// Watch Folder
BooleanParameter watchFolder = new BooleanParameter(cTorrent, "Watch Torrent Folder",
"ConfigView.label.watchtorrentfolder");
Composite gWatchFolder = new Composite(cTorrent, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalIndent = 25;
gridData.horizontalSpan = 2;
gWatchFolder.setLayoutData(gridData);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 3;
gWatchFolder.setLayout(layout);
Label lImportDir = new Label(gWatchFolder, SWT.NULL);
Messages.setLanguageText(lImportDir, "ConfigView.label.importdirectory");
gridData = new GridData(GridData.FILL_HORIZONTAL);
final StringParameter watchFolderPathParameter = new StringParameter(gWatchFolder,
"Watch Torrent Folder Path", "");
watchFolderPathParameter.setLayoutData(gridData);
Button browse4 = new Button(gWatchFolder, SWT.PUSH);
browse4.setImage(imgOpenFolder);
imgOpenFolder.setBackground(browse4.getBackground());
browse4.setToolTipText(MessageText.getString("ConfigView.button.browse"));
browse4.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);