MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / paste

Method paste

ij/src/main/java/ij/plugin/frame/Editor.java:868–884  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

866 }
867
868 void paste() {
869 String s;
870 s = ta.getSelectedText();
871 Clipboard clipboard = getToolkit( ). getSystemClipboard();
872 Transferable clipData = clipboard.getContents(s);
873 try {
874 s = (String)(clipData.getTransferData(DataFlavor.stringFlavor));
875 } catch (Exception e) {
876 s = e.toString( );
877 }
878 int start = ta.getSelectionStart( );
879 int end = ta.getSelectionEnd( );
880 ta.replaceRange(s, start-offset(start), end-offset(end-2>=start?end-2:start));
881 if (IJ.isMacOSX())
882 ta.setCaretPosition(start+s.length());
883 checkForCurlyQuotes = true;
884 }
885
886 // workaround for TextArea.getCaretPosition() bug on Windows
887 private int offset(int pos) {

Callers 1

actionPerformedMethod · 0.95

Calls 7

offsetMethod · 0.95
isMacOSXMethod · 0.95
lengthMethod · 0.65
getTransferDataMethod · 0.45
toStringMethod · 0.45
getSelectionStartMethod · 0.45
getSelectionEndMethod · 0.45

Tested by

no test coverage detected