@Override public void run(ITextSelection selection) { fClipboard= new Clipboard(getShell().getDisplay()); try { copyToClipboard(selection, 0); } finally { fClipboard.dispose(); } }
public void run(ITextSelection selection) { fClipboard= new Clipboard(getShell().getDisplay()); try { copyToClipboard(selection, 0); } finally { fClipboard.dispose(); } }
@Override public void run(ITextSelection selection) { fClipboard= new Clipboard(getShell().getDisplay()); try { copyToClipboard(selection, 0); } finally { fClipboard.dispose(); } }
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } } }
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } } }
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } } }