I would add the line 

  File documentRoot = this.documentRoot;

immediately before the "File parentFolder = folder;" line, extract the
rest to a new method "removeEmptyFolders(File folder, File
documentRoot)", make it public and move it to FileUtils.

Tom


On Mon, 26 Aug 2002 13:58:46 +0200, Hans Speijer
<[EMAIL PROTECTED]> wrote:

> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
> 
> ------_=_NextPart_001_01C24CF7.EE7A22D0
> Content-Type: text/plain;
>       charset="iso-8859-1"
> 
> Hi, 
>  
> I have the following method in a class:
>  
> protected void removeEmptyFolders(File folder) {
>  
>   File parentFolder = folder;
>  
>   while(parentFolder.listFiles() != null && parentFolder.listFiles().length
> == 0 && !parentFolder.equals(documentRoot)) {
>    parentFolder.delete();
>    parentFolder = parentFolder.getParentFile();
>   }
>  }
>  
> I need to move the method to a a class called FileUtils. Because I don't
> have the documentRoot as a variable I need to pass it as a parameter to the
> new static method. 
>  
> How do I do this refactoring with IDEA. If this is not a standard
> refactoring, should I submit into Tracker?
>  
> Cheers,
>  
> Hans Speijer
> 
> ------_=_NextPart_001_01C24CF7.EE7A22D0
> Content-Type: text/html;
>       charset="iso-8859-1"
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
> 
> 
> <META content="MSHTML 6.00.2716.2200" name=GENERATOR></HEAD>
> <BODY>
> <DIV><FONT face=Arial size=2><SPAN class=739305411-26082002>Hi, 
> </SPAN></FONT></DIV>
> <DIV><FONT face=Arial size=2><SPAN 
> class=739305411-26082002></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2><SPAN class=739305411-26082002>I have the following 
> method in a class:</SPAN></FONT></DIV>
> <DIV><FONT face=Arial size=2><SPAN 
> class=739305411-26082002></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT face="Courier New" size=2><SPAN class=739305411-26082002>protected 
> void removeEmptyFolders(File folder) {</SPAN></FONT></DIV>
> <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face="Courier New" size=2><SPAN 
> class=739305411-26082002>&nbsp;&nbsp;File parentFolder = 
> folder;</SPAN></FONT></DIV>
> <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face="Courier New" size=2><SPAN 
> class=739305411-26082002>&nbsp;&nbsp;while(parentFolder.listFiles() != null 
> &amp;&amp; parentFolder.listFiles().length == 0 &amp;&amp; 
> !parentFolder.equals(documentRoot)) 
> {<BR>&nbsp;&nbsp;&nbsp;parentFolder.delete();<BR>&nbsp;&nbsp;&nbsp;parentFolder 
> = parentFolder.getParentFile();<BR>&nbsp;&nbsp;}<BR>&nbsp;}</SPAN></FONT></DIV>
> <DIV><FONT size=2><SPAN class=739305411-26082002></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2><SPAN class=739305411-26082002>I need to move the 
> method to a a class called FileUtils. Because I don't have the documentRoot as a 
> variable I need to pass it as a parameter to the new static method. 
> </SPAN></FONT></DIV>
> <DIV><FONT face=Arial size=2><SPAN 
> class=739305411-26082002></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2><SPAN class=739305411-26082002>How do I do this 
> refactoring with IDEA. If this is not a standard refactoring, should I submit 
> into Tracker?</SPAN></FONT></DIV>
> <DIV><FONT face=Arial size=2><SPAN 
> class=739305411-26082002></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2><SPAN 
> class=739305411-26082002>Cheers,</SPAN></FONT></DIV>
> <DIV><FONT face=Arial size=2><SPAN 
> class=739305411-26082002></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2><SPAN class=739305411-26082002>Hans 
> Speijer</SPAN></FONT></DIV></BODY></HTML>
> 
> ------_=_NextPart_001_01C24CF7.EE7A22D0--

_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features

Reply via email to