summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2019-07-18 17:07:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 18:30:06 +0200
commit1223bede826d9b237a6015bfcfb8df08913a02e8 (patch)
tree8911b22ca05435cb97746b427bcca60965639e33 /scripting
parent8c26800ff823525df46d2bdc42af52ab75285cda (diff)
tdf#123587 Beanshell editor: Show current file name as window title
Change-Id: I7a817d19cfadc46b1f35a4e42e5a6177c1910a4b Reviewed-on: https://gerrit.libreoffice.org/75869 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java9
-rw-r--r--scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java2
2 files changed, 10 insertions, 1 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java
index 6341b51d4e4a..de51b1247af5 100644
--- a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java
+++ b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java
@@ -102,6 +102,15 @@ public class ScriptMetaData extends ScriptEntry {
private static final String UNO_SHARED_PACKAGES2 = SHARE + "/uno_packages";
+ public static String getFileName(URL url) {
+ String fileName = url.toExternalForm();
+ if (fileName.lastIndexOf(UCBStreamHandler.separator) != -1) {
+ fileName = fileName.substring(0, fileName.lastIndexOf(UCBStreamHandler.separator));
+ fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
+ }
+ return fileName;
+ }
+
public static String getLocationPlaceHolder(String url, String pkgname) {
String result = "Unknown";
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
index 279e75fb3584..9ba128b42669 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
@@ -228,7 +228,7 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
this.context = context;
this.scriptURL = url;
this.model = new ScriptSourceModel(url);
- this.filename = url.getFile();
+ this.filename = ScriptMetaData.getFileName(url);
this.cl = cl;
try {