diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-05-19 07:21:44 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-05-19 07:21:44 +0000 |
commit | 7087700e5fc25362cd220990fc43f8d5b5913637 (patch) | |
tree | 01114a93d2569097aaee1af017ae0dc557796a89 /scripting | |
parent | 4b54503bc072d3d225dd431ff12436ac030b7c79 (diff) |
INTEGRATION: CWS scriptingf4 (1.2.4); FILE MERGED
2004/05/18 14:30:29 dfoster 1.2.4.5: #i26923#
Fix for delete problem on Win. Output stream not closed.
Issue number:
Submitted by:
Reviewed by:
2004/05/11 09:25:20 dfoster 1.2.4.4: #i26923#
Fixed renaming of scripts/parcels.
Issue number:
Submitted by:
Reviewed by:
2004/05/06 17:54:03 toconnor 1.2.4.3: #i28384# - implement Macro Selector spec
Issue number:
Submitted by:
Reviewed by:
2004/04/30 15:42:43 dfoster 1.2.4.2: #i26923#
Issue number:
Submitted by:
Reviewed by:
2004/04/29 14:09:22 dfoster 1.2.4.1: #i28384# - implement Macro Selector specification
Issue number:
Submitted by:
Reviewed by:
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index a6720e7f78b8..03a67b94a086 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -2,9 +2,9 @@ * * $RCSfile: ParcelDescriptor.java,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: svesik $ $Date: 2004-04-19 23:06:13 $ + * last change: $Author: rt $ $Date: 2004-05-19 08:21:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,22 @@ public class ParcelDescriptor { private String language = null; private Map languagedepprops = new Hashtable(3); + public static synchronized void removeParcelDescriptor(File parent) { + File path = new File(parent, PARCEL_DESCRIPTOR_NAME); + PARCEL_DESCRIPTOR_MAP.remove(path); + } + + public static synchronized void renameParcelDescriptor(File oldFile, File newFile) { + File oldPath = new File(oldFile, PARCEL_DESCRIPTOR_NAME); + ParcelDescriptor pd = (ParcelDescriptor)PARCEL_DESCRIPTOR_MAP.get(oldPath); + if(pd != null) { + PARCEL_DESCRIPTOR_MAP.remove(oldPath); + File newPath = new File(newFile, PARCEL_DESCRIPTOR_NAME); + pd.file = newPath; + PARCEL_DESCRIPTOR_MAP.put(newPath, pd); + } + } + // returns the ParcelDescriptor in the corresponding directory // returns null if no ParcelDescriptor is found in the directory public static synchronized ParcelDescriptor @@ -200,6 +216,7 @@ public class ParcelDescriptor { public void write(File file) throws IOException { FileOutputStream fos = new FileOutputStream(file); XMLParserFactory.getParser().write(document, fos); + fos.close(); } public void write() throws IOException { @@ -251,7 +268,7 @@ public class ParcelDescriptor { return new ScriptEntry[0]; for (int i = 0; i < len; i++) { - String language, languagename, logicalname; + String language, languagename, logicalname, description = ""; Map langProps = new HashMap(); NodeList nl; Element tmp; @@ -267,6 +284,25 @@ public class ParcelDescriptor { logicalname = tmp.getAttribute("value"); } + // get the text of the description element + nl = scriptElement.getElementsByTagName("locale"); + if (nl != null) + { + nl = nl.item(0).getChildNodes(); + if (nl != null) + { + for (int j = 0 ; j < nl.getLength(); j++) + { + if (nl.item(j).getNodeName().equals("description")) + { + CharacterData cd = + (CharacterData)nl.item(j).getFirstChild(); + description = cd.getData().trim(); + } + } + } + } + nl = scriptElement.getElementsByTagName("functionname"); if (nl == null) { languagename = ""; @@ -290,7 +326,8 @@ public class ParcelDescriptor { } } } - scripts.add(new ScriptEntry(language, languagename, logicalname, "",langProps)); + ScriptEntry entry = new ScriptEntry(language, languagename, logicalname, "",langProps, description); + scripts.add(entry); } return (ScriptEntry[])scripts.toArray(new ScriptEntry[0]); } @@ -407,9 +444,16 @@ public class ParcelDescriptor { tempitem = document.createElement("displayname"); tempitem.setAttribute("value", script.getLogicalName()); item.appendChild(tempitem); + tempitem = document.createElement("description"); - tempitem.appendChild(document.createTextNode(script.getLogicalName())); + String description = script.getDescription(); + if (description == null || description.equals("")) + { + description = script.getLogicalName(); + } + tempitem.appendChild(document.createTextNode(description)); item.appendChild(tempitem); + root.appendChild(item); item = document.createElement("logicalname"); |