use of org.jabref.gui.ClipBoardManager in project jabref by JabRef.
the class CopyVersionToClipboardAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
String info = String.format("JabRef %s%n%s %s %s %nJava %s", Globals.BUILD_INFO.getVersion(), BuildInfo.OS, BuildInfo.OS_VERSION, BuildInfo.OS_ARCH, BuildInfo.JAVA_VERSION);
new ClipBoardManager().setClipboardContents(info);
JabRefGUI.getMainFrame().output(Localization.lang("Copied version to clipboard"));
}
use of org.jabref.gui.ClipBoardManager in project jabref by JabRef.
the class FileAnnotationTab method copyToClipboard.
/**
* Copies the meta and content information of the pdf annotation to the clipboard
*/
private void copyToClipboard() {
StringJoiner sj = new StringJoiner(System.getProperty("line.separator"));
sj.add(Localization.lang("Author") + ": " + authorArea.getText());
sj.add(Localization.lang("Date") + ": " + dateArea.getText());
sj.add(Localization.lang("Page") + ": " + pageArea.getText());
sj.add(Localization.lang("Content") + ": " + contentTxtArea.getText());
sj.add(Localization.lang("Marking") + ": " + markedTxtArea.getText());
new ClipBoardManager().setClipboardContents(sj.toString());
}
use of org.jabref.gui.ClipBoardManager in project jabref by JabRef.
the class CitationStyleToClipboardWorker method done.
@Override
public void done() {
try {
List<String> citations = get();
// if it's not a citation style take care of the preview
if (!CitationStyle.isCitationStyleFile(style)) {
new ClipBoardManager().setTransferableClipboardContents(processPreview(citations));
} else {
// if it's generated by a citation style take care of each output format
Transferable transferable;
switch(outputFormat) {
case HTML:
transferable = processHtml(citations);
break;
case RTF:
transferable = processRtf(citations);
break;
case XSL_FO:
transferable = processXslFo(citations);
break;
case ASCII_DOC:
case TEXT:
transferable = processText(citations);
break;
default:
LOGGER.warn("unknown output format: '" + outputFormat + "', processing it via the default.");
transferable = processText(citations);
break;
}
new ClipBoardManager().setTransferableClipboardContents(transferable);
}
basePanel.frame().setStatus(Localization.lang("Copied %0 citations.", String.valueOf(selectedEntries.size())));
} catch (InterruptedException | ExecutionException e) {
LOGGER.error("Error while copying citations to the clipboard", e);
}
}
use of org.jabref.gui.ClipBoardManager in project jabref by JabRef.
the class CopyBibTeXKeyAndLinkAction method action.
@Override
public void action() throws Exception {
List<BibEntry> entries = mainTable.getSelectedEntries();
if (!entries.isEmpty()) {
StringBuilder sb = new StringBuilder();
List<BibEntry> entriesWithKey = entries.stream().filter(BibEntry::hasCiteKey).collect(Collectors.toList());
if (entriesWithKey.isEmpty()) {
JabRefGUI.getMainFrame().output(Localization.lang("None of the selected entries have BibTeX keys."));
return;
}
for (BibEntry entry : entriesWithKey) {
String key = entry.getCiteKeyOptional().get();
String url = entry.getField(FieldName.URL).orElse("");
sb.append(url.isEmpty() ? key : String.format("<a href=\"%s\">%s</a>", url, key));
sb.append(OS.NEWLINE);
}
ClipBoardManager clipboard = new ClipBoardManager();
clipboard.setClipboardContents(sb.toString());
int copied = entriesWithKey.size();
int toCopy = entries.size();
if (copied == toCopy) {
// All entries had keys.
JabRefGUI.getMainFrame().output((entries.size() > 1 ? Localization.lang("Copied keys") : Localization.lang("Copied key")) + '.');
} else {
JabRefGUI.getMainFrame().output(Localization.lang("Warning: %0 out of %1 entries have undefined BibTeX key.", Long.toString(toCopy - copied), Integer.toString(toCopy)));
}
}
}
use of org.jabref.gui.ClipBoardManager in project jabref by JabRef.
the class CopyDoiUrlAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
identifier = component == null ? identifier : component.getText();
Optional<String> urlOptional = DOI.parse(identifier).map(DOI::getURIAsASCIIString);
if (urlOptional.isPresent()) {
ClipBoardManager clipBoard = new ClipBoardManager();
clipBoard.setClipboardContents(urlOptional.get());
JabRefGUI.getMainFrame().output(Localization.lang("The link has been copied to the clipboard."));
} else {
JabRefGUI.getMainFrame().output(Localization.lang("Invalid DOI: '%0'.", identifier));
}
}
Aggregations