FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
vscode-java/src/javaClassEditor.ts at main · redhat-developer/vscode-java · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
redhat-developer
/
vscode-java
Public
Notifications
You must be signed in to change notification settings
Fork
544
Star
2.3k
Code
Issues
930
Pull requests
21
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
vscode-java
/
src
/
javaClassEditor.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (53 loc) · 2.01 KB
Breadcrumbs
vscode-java
/
src
/
javaClassEditor.ts
Copy path
File metadata and controls
60 lines (53 loc) · 2.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import
path
=
require
(
'path'
)
;
import
*
as
vscode
from
'vscode'
;
import
{
Uri
,
window
,
ExtensionContext
}
from
"vscode"
;
import
{
getNonce
}
from
"./webviewUtils"
;
class
JavaClassDocument
implements
vscode
.
CustomDocument
{
constructor
(
uri
:
Uri
)
{
this
.
uri
=
uri
;
}
uri
:
Uri
;
dispose
(
)
:
void
{
}
}
export
class
JavaClassEditorProvider
implements
vscode
.
CustomReadonlyEditorProvider
{
private
context
:
ExtensionContext
;
openCustomDocument
(
uri
:
Uri
,
openContext
:
vscode
.
CustomDocumentOpenContext
,
token
:
vscode
.
CancellationToken
)
:
JavaClassDocument
{
return
new
JavaClassDocument
(
uri
)
;
}
constructor
(
context
:
ExtensionContext
)
{
this
.
context
=
context
;
}
public
static
readonly
viewType
=
'decompiled.javaClass'
;
async
resolveCustomEditor
(
document
:
vscode
.
CustomDocument
,
webviewPanel
:
vscode
.
WebviewPanel
,
token
:
vscode
.
CancellationToken
)
:
Promise
<
void
>
{
const
nonce
:
string
=
getNonce
(
)
;
webviewPanel
.
webview
.
options
=
{
enableScripts
:
true
,
localResourceRoots
:
[
Uri
.
joinPath
(
Uri
.
parse
(
this
.
context
.
extensionPath
)
,
'webview-resources'
)
]
}
;
const
classUri
=
Uri
.
parse
(
(
document
.
uri
.
toString
(
)
)
.
replace
(
/
^
f
i
l
e
/
,
"class"
)
)
;
const
styleUri
=
Uri
.
file
(
path
.
join
(
this
.
context
.
extensionPath
,
'webview-resources'
,
'button.css'
)
)
;
const
style
:
string
=
`<link rel="stylesheet" type="text/css" href="
${
webviewPanel
.
webview
.
asWebviewUri
(
styleUri
)
.
toString
(
)
}
">`
;
webviewPanel
.
webview
.
html
=
`
<html lang="en">
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-
${
nonce
}
'; style-src
${
webviewPanel
.
webview
.
cspSource
}
;">
${
style
}
</head>
<body>
<script nonce="
${
nonce
}
">
const vscode = acquireVsCodeApi();
vscode.postMessage({ command: 'decompiled' });
</script>
</body>
</html>
`
;
webviewPanel
.
webview
.
onDidReceiveMessage
(
message
=>
{
switch
(
message
.
command
)
{
case
'decompiled'
:
webviewPanel
.
dispose
(
)
;
window
.
showTextDocument
(
classUri
,
{
preview
:
false
}
)
;
return
;
}
}
,
undefined
,
this
.
context
.
subscriptions
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL