RefactoringSession session = RefactoringSession.create(getGetterSetterDisplayName(type)); EncapsulateFieldsRefactoring refactoring = new EncapsulateFieldsRefactoring(null, path);
RefactoringSession session = RefactoringSession.create(Bundle.LBL_BulkFormatting()); FormatRefactoring refactoring = new FormatRefactoring(new Transaction() { private boolean first = true;
private static void doRenameRefactoring(FormDataObject dao, String newName, TreePathHandle handle) throws IOException { if(handle==null){ //this would only happen if setName were called without the correct component being //selected some how... return; } FormEditorSupport fes = (FormEditorSupport)dao.getFormEditorSupport(); if (fes.isModified()) { fes.saveDocument(); } //ok, so we are now ready to actually setup our RenameRefactoring...we need the element TreePathHandle Lookup rnl = Lookups.singleton(handle); RefactoringSession renameSession = RefactoringSession.create("Change variable name");//NOI18N RenameRefactoring refactoring = new RenameRefactoring(rnl); Problem pre = refactoring.preCheck(); if(pre!=null&&pre.isFatal()){ Logger.getLogger("global").log(Level.WARNING, "There were problems trying to perform the refactoring."); } Problem p = null; if( (!(pre!=null&&pre.isFatal())) && !emptyOrWhite(newName) ){ refactoring.setNewName(newName); p = refactoring.prepare(renameSession); } if( (!(p!=null&&p.isFatal())) && !emptyOrWhite(newName) ){ renameSession.doRefactoring(true); } }