-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement native messaging #3246
Merged
Merged
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ce94601
First working prototype
tobiasdiez 2b8c252
Don't remember completed requests
tobiasdiez 4b4ae53
Improve native messaging interface and add import functionality
tobiasdiez 0d120f5
Add native messaging manifest
tobiasdiez 30e174c
Add default handler
tobiasdiez 7064df8
Add todo: timeout
tobiasdiez 9bc7e24
Don't wait for response from debug messages
tobiasdiez 04fe0bd
handle IOException
tobiasdiez 90b80ca
Update JabRefMain.java
tobiasdiez dc4317c
Update log4j2.xml
tobiasdiez fbd5260
Fix NPE
tobiasdiez 35be5de
Merge branch 'master' of /~https://github.com/JabRef/jabref into native…
tobiasdiez 9ac9d20
Merge branch 'nativeMessaging' of /~https://github.com/JabRef/jabref in…
tobiasdiez 6b50302
Fix build
tobiasdiez b24b599
Make it work in principle
tobiasdiez 6c2c8f8
Give up on native messaging with Java
tobiasdiez 5dc0fc1
Give up on native messaging with Java
tobiasdiez c3a18ca
Native messaging via powershell script
tobiasdiez b55a0e4
Small code cleanup
tobiasdiez 3bd7436
Remove silent ApplicationInsights hack since it is no longer needed
tobiasdiez ef25f09
Specify correct add-on identifier
tobiasdiez 8d5a872
Fix remote passing of arguments with line breaks
tobiasdiez 091ca23
Include into Install4J (and update that from 7.0.3 to 7.0.4)
koppor c51b9a4
Add exception in architecture tests for javafx.util.Pair
tobiasdiez 2c47830
Fix powershell script
tobiasdiez 242309d
Fix regkey for install4j
koppor 223bd46
Merge branch 'master' of /~https://github.com/JabRef/jabref into native…
tobiasdiez 159874f
Disable remote tests on travis
tobiasdiez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
pushd %~dp0 | ||
@powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File ".\JabRef.ps1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
function Respond($response) { | ||
$jsonResponse = $response | ConvertTo-Json | ||
|
||
try { | ||
$writer = New-Object System.IO.BinaryWriter([System.Console]::OpenStandardOutput()) | ||
$writer.Write([int]$jsonResponse.Length) | ||
$writer.Write([System.Text.Encoding]::UTF8.GetBytes($jsonResponse)) | ||
$writer.Close() | ||
} finally { | ||
$writer.Dispose() | ||
} | ||
} | ||
|
||
$jabRefJarFileName = "@jabRefJarFileName@" | ||
$jabRefJar = [System.IO.Path]::Combine($PSScriptRoot, $jabRefJarFileName) | ||
|
||
try { | ||
$reader = New-Object System.IO.BinaryReader([System.Console]::OpenStandardInput()) | ||
$length = $reader.ReadInt32() | ||
$messageRaw = [System.Text.Encoding]::UTF8.GetString($reader.ReadBytes($length)) | ||
$message = $messageRaw | ConvertFrom-Json | ||
|
||
if ($message.Status -eq "validate") { | ||
if (-not (Test-Path $jabRefJar)) { | ||
return Respond @{message="jarNotFound";path=$jabRefJar} | ||
} else { | ||
return Respond @{message="jarFound"} | ||
} | ||
} | ||
|
||
if (-not (Test-Path $jabRefJar)) { | ||
$wshell = New-Object -ComObject Wscript.Shell | ||
$popup = "Unable to locate '$jabRefJarFileName' in '$([System.IO.Path]::GetDirectoryName($jabRefJar))'." | ||
$wshell.Popup($popup,0,"JabRef", 0x0 + 0x30) | ||
return | ||
} | ||
|
||
#$wshell = New-Object -ComObject Wscript.Shell | ||
#$wshell.Popup($message.Text,0,"JabRef", 0x0 + 0x30) | ||
|
||
$messageText = $message.Text | ||
$output = & java -jar $jabRefJar -importBibtex "$messageText" 2>&1 | ||
#$output = & echoargs -importBibtex $messageText 2>&1 | ||
#$wshell.Popup($output,0,"JabRef", 0x0 + 0x30) | ||
return Respond @{message="ok";output="$output"} | ||
} finally { | ||
$reader.Dispose() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "org.jabref.jabref", | ||
"description": "JabRef", | ||
"path": "JabRef.bat", | ||
"type": "stdio", | ||
"allowed_extensions": [ | ||
"@jabfox" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@koppor This generates a key with a value
/ve /d "C:\Program Files\JabRef\jabref.json" /f
. However, there actually should be a folderorg.jabref.jabref
with keyDefault
and only the path as value.It would be nice if you could fix this since this is the last issue that currently prevents merging this PR. Thanks!
See JabRef/JabRef-Browser-Extension#50.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. I was in a hurry when copy'n'pasting your requirements.