products/sources/formale sprachen/Isabelle/Tools/jEdit/dist/macros/Files image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: Insert_Selection.bsh   Sprache: Unknown

Spracherkennung für: .bsh vermutete Sprache: Latech {Latech[91] CS[96] C[122]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

/*
 * 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>

*/

[ Dauer der Verarbeitung: 0.104 Sekunden  ]