Exemplo n.º 1
0
 public void loadFile(String filename) {
   filename = FileManager.slashify(filename, false);
   setSrcBundle(filename + "/");
   File script = new File(filename);
   _editingFile = FileManager.getScriptFile(script, null, null);
   if (_editingFile != null) {
     editingType =
         _editingFile
             .getAbsolutePath()
             .substring(_editingFile.getAbsolutePath().lastIndexOf(".") + 1);
     initBeforeLoad(editingType);
     try {
       this.read(
           new BufferedReader(new InputStreamReader(new FileInputStream(_editingFile), "UTF8")),
           null);
     } catch (Exception ex) {
       _editingFile = null;
     }
   }
   if (_editingFile != null) {
     updateDocumentListeners();
     setDirty(false);
     _srcBundleTemp = false;
   } else {
     _srcBundlePath = null;
   }
 }
Exemplo n.º 2
0
 public String getSrcBundle() {
   if (_srcBundlePath == null) {
     File tmp = FileManager.createTempDir();
     setSrcBundle(FileManager.slashify(tmp.getAbsolutePath(), true));
     _srcBundleTemp = true;
   }
   return _srcBundlePath;
 }
Exemplo n.º 3
0
 private void saveAsBundle(String bundlePath, String current) throws IOException {
   // TODO allow other file types
   bundlePath = FileManager.slashify(bundlePath, true);
   if (_srcBundlePath != null) {
     FileManager.xcopy(_srcBundlePath, bundlePath, current);
   }
   if (_srcBundleTemp) {
     FileManager.deleteTempDir(_srcBundlePath);
     _srcBundleTemp = false;
   }
   ImagePath.remove(_srcBundlePath);
   setSrcBundle(bundlePath);
   _editingFile = createSourceFile(bundlePath, "." + Settings.TypeEndings.get(sikuliContentType));
   Debug.log(3, "IDE: saveAsBundle: " + getSrcBundle());
   writeSrcFile();
   reparse();
 }