Skip to content

Commit

Permalink
Fix the function "Edit - Copy BibTeX key and link" (#2952)
Browse files Browse the repository at this point in the history
* Fix the function "Edit - Copy BibTeX key and link" to pass a hyperlink rather than an HTML statement.

* Update CHANGELOG.md

* Remove comment about non-working code

* Reorder the import statement using IntelliJ Configuration.
  • Loading branch information
jhshinn authored and tobiasdiez committed Jul 3, 2017
1 parent 7e50e84 commit 37dc46e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Links in the Recommended Articles tab (Mr.DLib), when clicked, are now opened in the system's default browser. [2931](https://github.com/JabRef/jabref/issues/2931)

### Fixed
- We fixed the function "Edit - Copy BibTeX key and link" to pass a hyperlink rather than an HTML statement.
- We fixed the adding of a new entry from DOI which led to a connection error. The DOI resolution now uses HTTPS to protect the user's privacy.[#2879](https://github.com/JabRef/jabref/issues/2897)
- We fixed the IEEE Xplore web search functionality [#2789](https://github.com/JabRef/jabref/issues/2789)
- We fixed an error in the CrossRef fetcher that occurred if one of the fetched entries had no title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import java.util.List;
import java.util.stream.Collectors;

import javafx.application.Platform;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;

import org.jabref.JabRefGUI;
import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.maintable.MainTable;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.OS;
Expand Down Expand Up @@ -44,8 +47,16 @@ public void action() throws Exception {
sb.append(OS.NEWLINE);
}

ClipBoardManager clipboard = new ClipBoardManager();
clipboard.setClipboardContents(sb.toString());
// This works on Mac and Windows 10, but not on Ubuntu 16.04
Platform.runLater(new Runnable() {
@Override
public void run() {
final Clipboard clipboard = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
content.putHtml(sb.toString());
clipboard.setContent(content);
}
});

int copied = entriesWithKey.size();
int toCopy = entries.size();
Expand Down

0 comments on commit 37dc46e

Please sign in to comment.