Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java')
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java46
1 files changed, 20 insertions, 26 deletions
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java
index 41da2e83e2..c92bf6e1e5 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java
@@ -88,23 +88,20 @@ public class CopyToClipboardOperation implements IRunnableWithProgress {
copy(sb, monitor);
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- if (sb.length() == 0) {
- return;
- }
- Clipboard clipboard = new Clipboard(Display.getDefault());
- try {
- clipboard.setContents(new Object[] { sb.toString() },
- new Transfer[] { TextTransfer.getInstance() });
- } catch (OutOfMemoryError e) {
- sb.setLength(0);
- sb.trimToSize();
- showErrorDialog();
- } finally {
- clipboard.dispose();
- }
+ Display.getDefault().syncExec(() -> {
+ if (sb.length() == 0) {
+ return;
+ }
+ Clipboard clipboard = new Clipboard(Display.getDefault());
+ try {
+ clipboard.setContents(new Object[] { sb.toString() },
+ new Transfer[] { TextTransfer.getInstance() });
+ } catch (OutOfMemoryError e) {
+ sb.setLength(0);
+ sb.trimToSize();
+ showErrorDialog();
+ } finally {
+ clipboard.dispose();
}
});
@@ -151,15 +148,12 @@ public class CopyToClipboardOperation implements IRunnableWithProgress {
}
private static void showErrorDialog() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- MessageBox confirmOperation = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
- confirmOperation.setText(Messages.CopyToClipboardOperation_OutOfMemoryErrorTitle);
- confirmOperation.setMessage(Messages.CopyToClipboardOperation_OutOfMemoryErrorMessage);
- confirmOperation.open();
- }
+ Display.getDefault().syncExec(() -> {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ MessageBox confirmOperation = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
+ confirmOperation.setText(Messages.CopyToClipboardOperation_OutOfMemoryErrorTitle);
+ confirmOperation.setMessage(Messages.CopyToClipboardOperation_OutOfMemoryErrorMessage);
+ confirmOperation.open();
});
}
}

Back to the top