mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't show any messages in case of clipboard operation failure
This commit is contained in:
@@ -72,7 +72,7 @@ public class AnalyzeStacktraceUtil {
|
||||
|
||||
@Nullable
|
||||
public static String getTextInClipboard() {
|
||||
final Transferable contents = CopyPasteManagerEx.getInstance().getContents();
|
||||
final Transferable contents = CopyPasteManagerEx.getInstanceEx().getSystemClipboardContents(false);
|
||||
if (contents != null) {
|
||||
try {
|
||||
return (String)contents.getTransferData(DataFlavor.stringFlavor);
|
||||
|
||||
@@ -51,11 +51,19 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn
|
||||
private static final int DELAY_UNTIL_ABORT_CLIPBOARD_ACCESS = 2000;
|
||||
private boolean myIsWarningShown = false;
|
||||
|
||||
public static CopyPasteManagerEx getInstanceEx() {
|
||||
return (CopyPasteManagerEx)getInstance();
|
||||
}
|
||||
|
||||
public CopyPasteManagerEx() {
|
||||
myDatas = new ArrayList<Transferable>();
|
||||
}
|
||||
|
||||
public Transferable getSystemClipboardContents() {
|
||||
return getSystemClipboardContents(true);
|
||||
}
|
||||
|
||||
public Transferable getSystemClipboardContents(boolean showMessage) {
|
||||
final Transferable[] contents = new Transferable[] {null};
|
||||
final boolean[] success = new boolean[] {false};
|
||||
Runnable accessor = new Runnable() {
|
||||
@@ -105,7 +113,9 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn
|
||||
|
||||
if (success[0]) return contents[0];
|
||||
accessorFuture.cancel(true);
|
||||
showWorkaroundMessage();
|
||||
if (showMessage) {
|
||||
showWorkaroundMessage();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user