Columbo aufrufen.bsh zum Wurzelverzeichnis wechselnLatech {Latech[91] CS[96] C[122]}Datei anzeigen
/*
* Insert_Selection.bsh - Inserts the contents of the
* current selection (assuming it's the path to a file)
* into the current buffer -- replacing the selected
* text. Text must be selected and it must not span
* multiple lines.
*
* Copyright (C) 2004 Ollie Rutherfurd <[email protected]>
*
* $Id: Insert_Selection.bsh 23971 2015-08-08 19:37:35Z daleanson $
*/
insertSelected(View view, String path){
// read into temporary buffer
Buffer b = jEdit.openTemporary(view,null,path,false);
try{
if(b == null)
return;
while(!b.isLoaded())
VFSManager.waitForRequests();
String text = b.getText(0,b.getLength());
view.getTextArea().setSelectedText(text);
}finally{
if(b != null)
jEdit._closeBuffer(null, b);
}
}
String selected = view.getTextArea().getSelectedText();
if(selected == null || selected.indexOf('\n') != -1)
Toolkit.getDefaultToolkit().beep();
else
insertSelected(view,selected);
/*
<listitem>
<para><filename>Insert_Selection.bsh</filename></para>
<abstract><para>Assumes the current selection is
file path and tries replaces the selection with the
contents of the file. Does nothing if no text is
selected or the selection spans multiple lines.
</para></abstract>
</listitem>
*/
[ Original von:0.168Diese Quellcodebibliothek enthält Beispiele in vielen Programmiersprachen.
Man kann per Verzeichnistruktur darin navigieren.
Der Code wird farblich markiert angezeigt.
]