private void overwriteProcess(final ProcessEntry processEntry) { if (SwingTools.showConfirmDialog( "overwrite", ConfirmDialog.YES_NO_OPTION, processEntry.getLocation()) == ConfirmDialog.YES_OPTION) { ProgressThread storeProgressThread = new ProgressThread("store_process") { @Override public void run() { getProgressListener().setTotal(100); getProgressListener().setCompleted(10); try { Process process = RapidMinerGUI.getMainFrame().getProcess(); process.setProcessLocation( new RepositoryProcessLocation(processEntry.getLocation())); processEntry.storeXML(process.getRootOperator().getXML(false)); RapidMinerGUI.addToRecentFiles(process.getProcessLocation()); RapidMinerGUI.getMainFrame().processHasBeenSaved(); } catch (Exception e) { SwingTools.showSimpleErrorMessage( "cannot_store_process_in_repository", e, processEntry.getName()); } finally { getProgressListener().setCompleted(100); getProgressListener().complete(); } } }; storeProgressThread.start(); } }
@Override public void actionPerformed(ActionEvent e) { String loc = RepositoryLocationChooser.selectLocation( lastLocation, "", RapidMinerGUI.getMainFrame(), true, false, true, true, true); if (loc != null) { RepositoryLocation location; try { location = new RepositoryLocation(loc); } catch (Exception ex) { SwingTools.showSimpleErrorMessage("malformed_rep_location", ex, loc); return; } try { if (location.locateEntry() != null) { // overwrite? if (SwingTools.showConfirmDialog("overwrite", ConfirmDialog.YES_NO_OPTION, location) != ConfirmDialog.YES_OPTION) { return; } } RepositoryManager.getInstance(null).store(object, location, null); lastLocation = location; } catch (RepositoryException ex) { SwingTools.showSimpleErrorMessage("cannot_store_obj_at_location", ex, loc); } } }