IDEMPIERE-782 iDempiere log button on About window not working

This commit is contained in:
Carlos Ruiz 2013-03-20 13:42:31 -05:00
parent d4fe22d6b8
commit 2bc43e3b6d
1 changed files with 18 additions and 12 deletions

View File

@ -35,6 +35,7 @@ import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs; import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.FeedbackManager; import org.adempiere.webui.util.FeedbackManager;
import org.compiere.Adempiere; import org.compiere.Adempiere;
@ -70,7 +71,7 @@ public class AboutWindow extends Window implements EventListener<Event> {
/** /**
* *
*/ */
private static final long serialVersionUID = -2600883713422452076L; private static final long serialVersionUID = 6573804051552633150L;
private Checkbox bErrorsOnly; private Checkbox bErrorsOnly;
private Listbox logTable; private Listbox logTable;
@ -479,18 +480,23 @@ public class AboutWindow extends Window implements EventListener<Event> {
private void downloadAdempiereLogFile() { private void downloadAdempiereLogFile() {
String path = Ini.getAdempiereHome() + File.separator + "log"; String path = Ini.getAdempiereHome() + File.separator + "log";
FolderBrowser fileBrowser = new FolderBrowser(path, false); final FolderBrowser fileBrowser = new FolderBrowser(path, false);
String selected = fileBrowser.getPath(); fileBrowser.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
if (selected != null && selected.trim().length() > 0) { @Override
File file = new File(selected); public void onEvent(Event event) throws Exception {
if (file.exists() && file.isFile() && file.canRead()) { String selected = fileBrowser.getPath();
try { if (selected != null && selected.trim().length() > 0) {
AMedia media = new AMedia(file, "text/plain", null); File file = new File(selected);
Filedownload.save(media); if (file.exists() && file.isFile() && file.canRead()) {
} catch (FileNotFoundException e) { try {
AMedia media = new AMedia(file, "text/plain", null);
Filedownload.save(media);
} catch (FileNotFoundException e) {
}
}
} }
} }
} });
} }
private void downloadLog() { private void downloadLog() {