diff options
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java')
-rw-r--r-- | scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java index ab05d89d687d..381be44ccadb 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java @@ -44,8 +44,7 @@ import org.openoffice.netbeans.modules.office.utils.NagDialog; import org.openoffice.netbeans.modules.office.utils.ZipMounter; import org.openoffice.netbeans.modules.office.utils.ManifestParser; -public class ParcelSupport implements ParcelCookie -{ +public class ParcelSupport implements ParcelCookie { private FileObject fo; private ParcelZipper zipper = ParcelZipper.getParcelZipper(); private String language = null; @@ -62,26 +61,23 @@ public class ParcelSupport implements ParcelCookie if (language == null) { try { language = zipper.getParcelLanguage(getFile()); - } - catch (IOException ioe) { + } catch (IOException ioe) { return null; } } + return language; } - public void mount() - { + public void mount() { File parcel = FileUtil.toFile(fo); if (parcel != null) { try { ZipMounter.getZipMounter().mountZipFile(parcel); - } - catch (IOException ioe) { + } catch (IOException ioe) { ErrorManager.getDefault().notify(ioe); - } - catch (PropertyVetoException pve) { + } catch (PropertyVetoException pve) { ErrorManager.getDefault().notify(pve); } } @@ -93,12 +89,12 @@ public class ParcelSupport implements ParcelCookie if (!target.isDirectory()) { OfficeSettings settings = OfficeSettings.getDefault(); String message = "If you already have this document open in " + - "Office, please close it before continuing. Click OK to " + - "continue deployment."; + "Office, please close it before continuing. Click OK to " + + "continue deployment."; if (settings.getWarnBeforeDocDeploy()) { NagDialog warning = NagDialog.createConfirmationDialog( - message, "Show this message in future", true); + message, "Show this message in future", true); boolean result = warning.show(); @@ -117,36 +113,35 @@ public class ParcelSupport implements ParcelCookie if (!zipper.isOverwriteNeeded(source, target)) if (!promptForOverwrite(source, target)) return false; - } - catch (IOException ioe) { - out.println("DEPLOYMENT FAILED: reason: " + - ioe.getClass().getName() + ": "+ ioe.getMessage()); - return false; + } catch (IOException ioe) { + out.println("DEPLOYMENT FAILED: reason: " + + ioe.getClass().getName() + ": " + ioe.getMessage()); + return false; } try { out.println("Deploying: " + fo.getName() + - "\nTo: " + target.getAbsolutePath(), null); + "\nTo: " + target.getAbsolutePath(), null); zipper.deployParcel(source, target); out.println("\nDEPLOYMENT SUCCESSFUL."); FileObject[] fileobjs = FileUtil.fromFile(target); + if (fileobjs != null) { for (int i = 0; i < fileobjs.length; i++) fileobjs[i].refresh(true); } - } - catch (IOException ioe) { - out.println("DEPLOYMENT FAILED: reason: " + - ioe.getClass().getName() + ": "+ ioe.getMessage()); - return false; - } - finally { - if( out != null) + } catch (IOException ioe) { + out.println("DEPLOYMENT FAILED: reason: " + + ioe.getClass().getName() + ": " + ioe.getMessage()); + return false; + } finally { + if (out != null) out.close(); } + return true; } @@ -156,19 +151,20 @@ public class ParcelSupport implements ParcelCookie io.setOutputVisible(true); OutputWriter out = io.getOut(); + try { out.reset(); - } - catch( IOException e) { + } catch (IOException e) { e.printStackTrace(System.err); } + out.println(Calendar.getInstance().getTime() + ":\n"); return out; } private boolean promptForOverwrite(File source, File target) { String message = source.getName() + " has already been deployed " + - "to this target. Do you wish to overwrite it?"; + "to this target. Do you wish to overwrite it?"; NotifyDescriptor d = new NotifyDescriptor.Confirmation( message, NotifyDescriptor.OK_CANCEL_OPTION); |