From c50915609ca9ccea4f15bc96e8e18e21dda63bc4 Mon Sep 17 00:00:00 2001 From: dantam Date: Thu, 5 Dec 2013 11:46:48 +0100 Subject: [PATCH] IDEMPIERE-1605 - Save path when working with attachments. --- .../src/org/compiere/apps/Attachment.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java b/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java index 0d3522c50b..70ac94da50 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/Attachment.java @@ -64,6 +64,11 @@ public final class Attachment extends CDialog */ private static final long serialVersionUID = 2497487523050526742L; + /** + * Save the last path selected + */ + private static String lastPath = null; + /** * Constructor. * loads Attachment, if ID <> 0 @@ -424,7 +429,8 @@ public final class Attachment extends CDialog private void loadFile() { log.info(""); - JFileChooser chooser = new JFileChooser(); + JFileChooser chooser = new JFileChooser(lastPath); + chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentNew")); chooser.setMultiSelectionEnabled(true); @@ -463,6 +469,10 @@ public final class Attachment extends CDialog } } } + // Save path of file + if (files.length>0) { + lastPath = files[0].getParentFile().getAbsolutePath(); + } } // getFileName /**