Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
73ee44c0
Kaydet (Commit)
73ee44c0
authored
May 26, 2003
tarafından
Tomas O'Connor
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes from code review, BeanShell document scripts can now be edited,
Rhino document scripts cannot.
üst
9b4ee751
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
65 deletions
+93
-65
DebugRunner.java
scripting/examples/java/debugger/DebugRunner.java
+71
-59
OOBeanShellDebugger.java
scripting/examples/java/debugger/OOBeanShellDebugger.java
+0
-0
OORhinoDebugger.java
scripting/examples/java/debugger/OORhinoDebugger.java
+16
-3
OOScriptDebugger.java
scripting/examples/java/debugger/OOScriptDebugger.java
+2
-0
parcel-descriptor.xml
scripting/examples/java/debugger/parcel-descriptor.xml
+4
-3
No files found.
scripting/examples/java/debugger/DebugRunner.java
Dosyayı görüntüle @
73ee44c0
import
java.io.*
;
import
java.net.URL
;
import
java.net.URLDecoder
;
import
drafts.com.sun.star.script.framework.runtime.XScriptContext
;
public
class
DebugRunner
{
private
static
final
String
FILE_URL_PREFIX
=
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
)
==
true
?
"file:///"
:
"file://"
;
public
void
go
(
final
XScriptContext
xsctxt
,
String
language
,
String
uri
,
String
filename
)
{
OOScriptDebugger
debugger
;
InputStream
is
=
null
;
String
path
=
""
;
System
.
out
.
println
(
"uri: "
+
uri
+
", language: "
+
language
);
if
(
language
.
equals
(
"Rhino"
))
debugger
=
new
OORhinoDebugger
();
else
if
(
language
.
equals
(
"BeanShell"
))
debugger
=
new
OOBeanShellDebugger
();
else
return
;
if
(
uri
.
startsWith
(
FILE_URL_PREFIX
))
{
uri
=
URLDecoder
.
decode
(
uri
);
String
s
=
uri
.
substring
(
FILE_URL_PREFIX
.
length
());
File
f
=
new
File
(
s
);
if
(
f
.
exists
())
{
if
(
f
.
isDirectory
())
{
if
(!
filename
.
equals
(
""
))
{
path
=
new
File
(
f
,
filename
).
getAbsolutePath
();
}
}
else
{
path
=
f
.
getAbsolutePath
();
}
}
}
else
if
(
uri
.
startsWith
(
"http://"
))
{
try
{
if
(!
filename
.
equals
(
""
))
uri
=
uri
+
"/"
+
filename
;
URL
url
=
new
URL
(
uri
);
is
=
url
.
openStream
();
}
catch
(
IOException
ioe
)
{
ioe
.
printStackTrace
();
}
}
System
.
out
.
println
(
"path: "
+
path
);
debugger
.
go
(
xsctxt
,
path
);
}
}
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.net.URLDecoder
;
import
com.sun.star.uno.XComponentContext
;
import
com.sun.star.scripting.runtime.java.PathUtils
;
import
drafts.com.sun.star.script.framework.runtime.XScriptContext
;
public
class
DebugRunner
{
private
static
final
String
FILE_URL_PREFIX
=
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
)
==
true
?
"file:///"
:
"file://"
;
public
void
go
(
final
XScriptContext
xsctxt
,
String
language
,
String
uri
,
String
filename
)
{
OOScriptDebugger
debugger
;
String
path
=
""
;
if
(
language
.
equals
(
"Rhino"
))
{
debugger
=
new
OORhinoDebugger
();
}
else
if
(
language
.
equals
(
"BeanShell"
))
{
debugger
=
new
OOBeanShellDebugger
();
}
else
{
return
;
}
if
(
uri
.
startsWith
(
FILE_URL_PREFIX
))
{
uri
=
URLDecoder
.
decode
(
uri
);
String
s
=
uri
.
substring
(
FILE_URL_PREFIX
.
length
());
File
f
=
new
File
(
s
);
if
(
f
.
exists
())
{
if
(
f
.
isDirectory
())
{
if
(!
filename
.
equals
(
""
))
{
path
=
new
File
(
f
,
filename
).
getAbsolutePath
();
}
}
else
{
path
=
f
.
getAbsolutePath
();
}
}
debugger
.
go
(
xsctxt
,
path
);
}
else
{
if
(!
uri
.
endsWith
(
"/"
))
{
uri
+=
"/"
;
}
String
script
=
uri
+
filename
;
InputStream
is
;
try
{
is
=
PathUtils
.
getScriptFileStream
(
script
,
xsctxt
.
getComponentContext
());
if
(
is
!=
null
)
{
debugger
.
go
(
xsctxt
,
is
);
}
}
catch
(
IOException
ioe
)
{
System
.
out
.
println
(
"Error loading script: "
+
script
);
}
}
}
}
scripting/examples/java/debugger/OOBeanShellDebugger.java
Dosyayı görüntüle @
73ee44c0
This diff is collapsed.
Click to expand it.
scripting/examples/java/debugger/OORhinoDebugger.java
Dosyayı görüntüle @
73ee44c0
import
drafts.com.sun.star.script.framework.runtime.XScriptContext
;
import
javax.swing.SwingUtilities
;
import
org.mozilla.javascript.*
;
import
org.mozilla.javascript.tools.debugger.*
;
import
java.io.InputStream
;
import
org.mozilla.javascript.Context
;
import
org.mozilla.javascript.Scriptable
;
import
org.mozilla.javascript.ImporterTopLevel
;
import
org.mozilla.javascript.tools.debugger.Main
;
import
org.mozilla.javascript.tools.debugger.ScopeProvider
;
import
drafts.com.sun.star.script.framework.runtime.XScriptContext
;
public
class
OORhinoDebugger
implements
OOScriptDebugger
{
// This code is based on the main method of the Rhino Debugger Main class
// We pass in the XScriptContext in the global scope for script execution
public
void
go
(
final
XScriptContext
xsctxt
,
String
filename
)
{
try
{
final
Main
sdb
=
new
Main
(
"Rhino JavaScript Debugger"
);
...
...
@@ -31,12 +39,17 @@ public class OORhinoDebugger implements OOScriptDebugger {
return
scope
;
}
});
// This is the method we've added to open a file when starting
// the Rhino debugger
sdb
.
openFile
(
filename
);
}
catch
(
Exception
exc
)
{
exc
.
printStackTrace
();
}
}
public
void
go
(
final
XScriptContext
xsctxt
,
InputStream
in
)
{
}
static
void
swingInvoke
(
Runnable
f
)
{
if
(
SwingUtilities
.
isEventDispatchThread
())
{
f
.
run
();
...
...
scripting/examples/java/debugger/OOScriptDebugger.java
Dosyayı görüntüle @
73ee44c0
import
java.io.InputStream
;
import
drafts.com.sun.star.script.framework.runtime.XScriptContext
;
public
interface
OOScriptDebugger
{
public
void
go
(
XScriptContext
ctxt
,
String
filename
);
public
void
go
(
XScriptContext
ctxt
,
InputStream
in
);
}
scripting/examples/java/debugger/parcel-descriptor.xml
Dosyayı görüntüle @
73ee44c0
...
...
@@ -4,10 +4,11 @@
<script
language=
"Java"
>
<locale
lang=
"en"
>
<displayname
value=
"asdf.doMethod"
/>
<description>
asdf.doMethod
</description>
<displayname
value=
"Scripting Framework Debugger"
/>
<description>
Script that starts debuggers for Rhino and BeanShell
</description>
</locale>
<logicalname
value=
"DebugRunner.Debug"
/>
<logicalname
value=
"
_$
DebugRunner.Debug"
/>
<functionname
value=
"DebugRunner.go"
/>
<languagedepprops>
<prop
name=
"classpath"
value=
"debugger.jar"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment