public void setValue (Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canWrite()) throw new IllegalAccessException(); if (!(val instanceof String)) throw new IllegalArgumentException(); try { DataObject orig = obj.getOriginal (); orig.rename ((String)val); writeOriginal (null, null, obj.getPrimaryFile (), orig); } catch (IOException ex) { throw new InvocationTargetException (ex); } }
public void doRefactoringBypass() throws IOException { DataObject dob = null; if (byPassFolder != null) { dob = DataFolder.findFolder(byPassFolder); } else { dob = DataObject.find(refactoring.getRefactoringSource().lookup(FileObject.class)); } dob.rename(getPanelName()); } }
@Override public void doRefactoringBypass() throws IOException { DataObject dob = null; if (byPassFolder != null) { dob = DataFolder.findFolder(byPassFolder); } else { dob = DataObject.find(refactoring.getRefactoringSource().lookup(FileObject.class)); } dob.rename(panel.getNameValue()); } }
public void doRefactoringBypass() throws IOException { DataObject dob = null; if (byPassFolder != null) { dob = DataFolder.findFolder(byPassFolder); } else { dob = DataObject.find(refactoring.getRefactoringSource().lookup(FileObject.class)); } dob.rename(panel.getNameValue()); }
/** Changes the name of the node and may also rename the data object. * If the object is renamed and file extensions are to be shown, * the display name is also updated accordingly. * * @param name new name for the object * @param rename rename the data object? * @exception IllegalArgumentException if the rename failed */ public void setName (String name, boolean rename) { try { if (rename) { obj.rename (name); } super.setName (name); if (rename) updateDisplayName (); } catch (IOException ex) { String msg = null; if ((ex.getLocalizedMessage() == null) || (ex.getLocalizedMessage().equals(ex.getMessage()))) { msg = NbBundle.getMessage (DataNode.class, "MSG_renameError", getName (), name); // NOI18N } else { msg = ex.getLocalizedMessage(); } RuntimeException e = new IllegalArgumentException(); ErrorManager.getDefault().copyAnnotation (e, ex); ErrorManager.getDefault().annotate (e, ErrorManager.USER, null, msg, null, null); throw e; } }
propertiesDO.rename(oldName); } catch (IOException ex) { Exceptions.printStackTrace(ex);
template.rename(licenseNewName); templateFile = template.getPrimaryFile();
@Override public void handleRename(Node node, String newName) { DataObject dob = node.getCookie(DataObject.class); CsmFile[] csmFiles = CsmUtilities.getCsmFiles(dob, false, false); if (csmFiles != null && csmFiles.length > 0) { InstanceContent ic = new InstanceContent(); // pass new name (without extension as needed by dob.rename) ExplorerContext explorerContext = new ExplorerContext(); explorerContext.setNewName(newName); ic.add(explorerContext); for (CsmFile file : csmFiles) { ic.add(file); } Lookup l = new AbstractLookup(ic); Action a = RefactoringActionsFactory.renameAction().createContextAwareInstance(l); if (Boolean.TRUE.equals(a.getValue("applicable"))) {//NOI18N a.actionPerformed(RefactoringActionsFactory.DEFAULT_EVENT); return; } } try { dob.rename(newName); } catch (IOException ioe) { ErrorManager.getDefault().notify(ioe); } } }