|
|
@ -5,26 +5,48 @@ import java.awt.Toolkit;
|
|
|
|
import java.awt.datatransfer.Clipboard;
|
|
|
|
import java.awt.datatransfer.Clipboard;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
abstract class ClipboardListener {
|
|
|
|
abstract class ClipboardListener {
|
|
|
|
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
|
|
|
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
|
|
|
|
|
|
|
final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
private EventManager eventManager = new EventManager();
|
|
|
|
private EventManager eventManager = new EventManager();
|
|
|
|
private boolean imageMonitored = true;
|
|
|
|
private boolean imageMonitored = true;
|
|
|
|
private boolean textMonitored = true;
|
|
|
|
private boolean textMonitored = true;
|
|
|
|
private boolean fileMonitored = true;
|
|
|
|
private boolean fileMonitored = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Main entry point of execution for both {@link MacClipboardListener} and {@link WindowsOrUnixClipboardListener}
|
|
|
|
* Main entry point of execution for the correct {@link ClipboardListener}
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @see MacClipboardListener
|
|
|
|
* @see WindowsOrUnixClipboardListener#execute()
|
|
|
|
* @see WindowsOrUnixClipboardListener
|
|
|
|
* @see MacClipboardListener#execute()
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
abstract void execute();
|
|
|
|
abstract void execute();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Allows the correct {@link ClipboardListener} to start listening for clipboard changes
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @see WindowsOrUnixClipboardListener#startListening()
|
|
|
|
|
|
|
|
* @see MacClipboardListener#startListening()
|
|
|
|
|
|
|
|
*/
|
|
|
|
abstract void startListening();
|
|
|
|
abstract void startListening();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Stops the correct {@link ClipboardListener} to stop listening for clipboard changes
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @see WindowsOrUnixClipboardListener#stopListening()
|
|
|
|
|
|
|
|
* @see MacClipboardListener#stopListening()
|
|
|
|
|
|
|
|
*/
|
|
|
|
abstract void stopListening();
|
|
|
|
abstract void stopListening();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Insert the given {@link String} into the system clipboard
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param stringContent The given {@link String} to insert
|
|
|
|
|
|
|
|
* @see WindowsOrUnixClipboardListener#insert(String)
|
|
|
|
|
|
|
|
* @see MacClipboardListener#insert(String)
|
|
|
|
|
|
|
|
*/
|
|
|
|
abstract void insert(String stringContent);
|
|
|
|
abstract void insert(String stringContent);
|
|
|
|
|
|
|
|
|
|
|
|
abstract void insert(Image imageContent);
|
|
|
|
abstract void insert(Image imageContent);
|
|
|
|