mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-22 21:43:06 +02:00
@@ -1,8 +1,8 @@
|
|||||||
package com.rarchives.ripme.ui;
|
package com.rarchives.ripme.ui;
|
||||||
|
|
||||||
import java.awt.HeadlessException;
|
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.datatransfer.DataFlavor;
|
import java.awt.datatransfer.DataFlavor;
|
||||||
|
import java.awt.datatransfer.Transferable;
|
||||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -30,16 +30,13 @@ class ClipboardUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getClipboardString() {
|
public static String getClipboardString() {
|
||||||
try {
|
Transferable contents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
|
||||||
return (String) Toolkit
|
if (contents.isDataFlavorSupported(DataFlavor.stringFlavor)) {
|
||||||
.getDefaultToolkit()
|
try {
|
||||||
.getSystemClipboard()
|
return (String) contents.getTransferData(DataFlavor.stringFlavor);
|
||||||
.getData(DataFlavor.getTextPlainUnicodeFlavor());
|
} catch (UnsupportedFlavorException | IOException e) {
|
||||||
} catch (IllegalStateException e) {
|
logger.debug("ignore this one" + e.getMessage());
|
||||||
e.printStackTrace();
|
}
|
||||||
logger.error("Caught and recovered from IllegalStateException: " + e.getMessage());
|
|
||||||
} catch (HeadlessException | IOException | UnsupportedFlavorException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -47,7 +44,7 @@ class ClipboardUtils {
|
|||||||
|
|
||||||
class AutoripThread extends Thread {
|
class AutoripThread extends Thread {
|
||||||
volatile boolean isRunning = false;
|
volatile boolean isRunning = false;
|
||||||
private Set<String> rippedURLs = new HashSet<>();
|
private final Set<String> rippedURLs = new HashSet<>();
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
Reference in New Issue
Block a user