public void destroy () throws IOException { if (obj.isDeleteAllowed ()) { obj.delete (); } super.destroy (); }
private void deleteSnapshots(FileObject[] selectedSnapshots) { boolean success = true; for (int i = 0; i < selectedSnapshots.length; i++) { FileObject selectedSnapshotFile = selectedSnapshots[i]; try { DataObject.find(selectedSnapshotFile).delete(); } catch (Throwable t) { success = false; t.printStackTrace(); } } if (!success) { ProfilerDialogs.displayError(Bundle.ProfilerControlPanel2_SnapshotsNotDeletedMsg()); } }
private boolean removeRecent (DataObject template) { DataFolder folder = getRecentFolder (); // no recent folder, no recent templates if (folder == null) return false; try { template.delete (); return true; } catch (IOException ioe) { ErrorManager em = ErrorManager.getDefault(); em.notify (ErrorManager.INFORMATIONAL, ioe); // it couldn't be deleted return false; } }
protected void handleDelete () throws IOException { Enumeration en = children (); try { while (en.hasMoreElements ()) { DataObject obj = (DataObject)en.nextElement (); if (obj.isValid ()) { obj.delete (); } } } catch (IOException iex) { /** Annotates exception and throws again*/ FileObject fo = getPrimaryFile(); String message = NbBundle.getMessage(DataFolder.class, "EXC_CannotDelete2", FileUtil.getFileDisplayName(fo)); ErrorManager.getDefault().annotate(iex, message); throw iex; } super.handleDelete (); }
dobj.delete(); } catch (IOException ex) { Logger.getLogger(Services.class.getName()).log(Level.WARNING, null, ex);
private void removePlatform(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removePlatform Node[] nodes = getExplorerManager().getSelectedNodes(); if (nodes.length!=1) { return; } DataObject dobj = nodes[0].getLookup().lookup(DataObject.class); if (dobj == null) { assert false : "Can not find platform definition for node: "+ nodes[0].getDisplayName(); //NOI18N return; } try { dobj.delete(); this.getChildren().refreshPlatforms(); this.expandPlatforms(null); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } }//GEN-LAST:event_removePlatform
@Override public void destroy() throws IOException { if (parent != null) { for (DataObject d = getLookup().lookup(DataObject.class); d != null && FileUtil.isParentOf(parent.getPrimaryFile(), d.getPrimaryFile()); d = d.getFolder()) { d.delete(); } } else { super.destroy(); } }
newPropertiesDO.delete(); newPropertiesDO = null; if (srcFileAfter != null) {
private void removePlatform(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removePlatform Node[] nodes = getExplorerManager().getSelectedNodes(); if (nodes.length!=1) { assert false : "Illegal number of selected nodes"; //NOI18N return; } DataObject dobj = nodes[0].getLookup().lookup(DataObject.class); if (dobj == null) { assert false : "Can not find platform definition for node: "+ nodes[0].getDisplayName(); //NOI18N return; } try { dobj.delete(); this.getChildren().refreshPlatforms(); this.expandPlatforms(null); } catch (IOException ioe) { ErrorManager.getDefault().notify (ioe); } }//GEN-LAST:event_removePlatform
@Override public void destroy() throws IOException { FileObject parent = dataFolder.getPrimaryFile().getParent(); // First; delete all files except packages DataObject ch[] = dataFolder.getChildren(); boolean empty = true; for( int i = 0; ch != null && i < ch.length; i++ ) { if ( !ch[i].getPrimaryFile().isFolder() ) { ch[i].delete(); } else { empty = false; } } // If empty delete itself if ( empty ) { super.destroy(); } // Second; delete empty super packages while( !parent.equals( root ) && parent.getChildren().length == 0 ) { FileObject newParent = parent.getParent(); parent.delete(); parent = newParent; } }
if (removeFile && object != null && object.isValid()) { try { object.delete(); } catch (IOException ex) { ErrorManager.getDefault().notify(ex);