Use eventManager

MYC-Refactor
Hammy 3 years ago
parent af790bae99
commit 1b4e0af716

@ -28,7 +28,7 @@ class MacClipboardListener extends ClipboardListener {
if (STRING.isAvailable(clipboard)) { if (STRING.isAvailable(clipboard)) {
String newStringContent = getStringContent(newClipboardContents); String newStringContent = getStringContent(newClipboardContents);
if (!newStringContent.equals(myClipboardContents[0].getOldContent())) { if (!newStringContent.equals(myClipboardContents[0].getOldContent())) {
notifyStringEvent(newStringContent); getEventManager().notifyStringEvent(newStringContent);
myClipboardContents[0].setOldContent(newStringContent); myClipboardContents[0].setOldContent(newStringContent);
} }
} }
@ -39,7 +39,7 @@ class MacClipboardListener extends ClipboardListener {
BufferedImage bufferedImageContent = getImageContent(newClipboardContents); BufferedImage bufferedImageContent = getImageContent(newClipboardContents);
Dimension newDimensionContent = new Dimension(bufferedImageContent.getWidth(), bufferedImageContent.getHeight()); Dimension newDimensionContent = new Dimension(bufferedImageContent.getWidth(), bufferedImageContent.getHeight());
if (!newDimensionContent.equals(myClipboardContents[0].getOldContent())) { if (!newDimensionContent.equals(myClipboardContents[0].getOldContent())) {
notifyImageEvent(bufferedImageContent); getEventManager().notifyImageEvent(bufferedImageContent);
myClipboardContents[0].setOldContent(newDimensionContent); myClipboardContents[0].setOldContent(newDimensionContent);
} }
} }

@ -32,14 +32,14 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
if (isTextMonitored()) { if (isTextMonitored()) {
if (STRING.isAvailable(oldClipboard)) { if (STRING.isAvailable(oldClipboard)) {
String stringContent = getStringContent(newClipboardContents); String stringContent = getStringContent(newClipboardContents);
notifyStringEvent(stringContent); getEventManager().notifyStringEvent(stringContent);
} }
} }
if (isImagesMonitored()) { if (isImagesMonitored()) {
if (IMAGE.isAvailable(oldClipboard)) { if (IMAGE.isAvailable(oldClipboard)) {
BufferedImage bufferedImage = getImageContent(newClipboardContents); BufferedImage bufferedImage = getImageContent(newClipboardContents);
notifyImageEvent(bufferedImage); getEventManager().notifyImageEvent(bufferedImage);
} }
} }
} }
@ -64,6 +64,9 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
regainOwnership(clipboard, currentClipboardContents); regainOwnership(clipboard, currentClipboardContents);
} }
/**
*
*/
@Override @Override
public void execute() { public void execute() {
ExecutorService executorService = Executors.newCachedThreadPool(); ExecutorService executorService = Executors.newCachedThreadPool();

Loading…
Cancel
Save