public boolean close() throws IOException { if (isDirty()) { Object[] options = { SikuliIDEI18N._I("yes"), SikuliIDEI18N._I("no"), SikuliIDEI18N._I("cancel") }; int ans = JOptionPane.showOptionDialog( this, SikuliIDEI18N._I("msgAskSaveChanges", getCurrentShortFilename()), SikuliIDEI18N._I("dlgAskCloseTab"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); if (ans == JOptionPane.CANCEL_OPTION || ans == JOptionPane.CLOSED_OPTION) { return false; } else if (ans == JOptionPane.YES_OPTION) { if (saveFile() == null) { return false; } } else { SikuliIDE.getInstance().getTabPane().resetLastClosed(); } if (_srcBundleTemp) { FileManager.deleteTempDir(_srcBundlePath); } setDirty(false); } if (_srcBundlePath != null) { ImagePath.remove(_srcBundlePath); } return true; }
public String saveFile() throws IOException { if (_editingFile == null) { return saveAsFile(Settings.isMac()); } else { ImagePath.remove(_srcBundlePath); writeSrcFile(); return getCurrentShortFilename(); } }
public static void main(String[] args) { TestEnvironment.createTestResultFolder(); Result standalone_result = JUnitCore.runClasses(StandaloneTestSuite.class); Settings.TypeDelay = 2; Settings.ClickDelay = 3; String OS = System.getProperty("os.name").toLowerCase(); System.out.println(System.getProperty("os.name").toLowerCase()); if (OS.equals("windows 7")) { ImagePath.setBundlePath("images/Windows7"); } else if (OS.equals("windows 8.1")) { ImagePath.setBundlePath("images/Windows8"); } for (Failure fail : standalone_result.getFailures()) { System.out.println(fail.toString()); } System.out.println(standalone_result.wasSuccessful()); }
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(); }
private void setSrcBundle(String newBundlePath) { _srcBundlePath = newBundlePath; ImagePath.setBundlePath(_srcBundlePath); }