Perfect.  

Sample outputs are:
mkdir -p com/rhino/model; mv Address.java com/rhino/model
mkdir -p com/rhino/model; mv AuditHistory.java com/rhino/model
...

It will save tons of jobs and my little poor fingers, too.  Grrrrrrrrreat 
thanks, mike.

Cheers

Cheong Hee

  ----- Original Message ----- 
  From: Mike Schrag 
  To: Cheong Hee Ng 
  Cc: WODev (Apple) 
  Sent: Wednesday, December 30, 2009 3:38 AM
  Subject: Re: Refactor java files (Prev: OT: Refactor files into packages 
(Eclipse))


  take off the "| sh" at the end and run it and you can see the script it 
outputs


  ms


  On Dec 29, 2009, at 1:17 PM, Cheong Hee Ng wrote:


    This looks da Vinci Code to me.. need to digest and digest.  May be best to 
try out tomorrow after a good rest.

    Thanks alot.

    Cheong Hee


    On Tue, Dec 29, 2009 at 11:09 PM, Mike Schrag <[email protected]> 
wrote:

      grep "^package " *.java | sed "s#\(.*\):package \(.*\);#mkdir -p \2; mv 
\1 \2#" | sed s#\\.#/#g | sed "s#/java #.java #" | sh


      prrrooobbabbbllyyy do a backup before you run that :)


      On Dec 29, 2009, at 9:54 AM, Mike Schrag wrote:


        I don't believe there is an Eclipse way to do what you're asking ... If 
I understand you correctly, you have a bunch of Java files that explicitly 
declare a package, but they're not in package folders. From Eclipse's 
perspective, you're not trying to do a bulk refactor, you're trying to do a 
bulk quick-fix. Currently only a very few quick fixes can be performed in bulk, 
and "move to package" isn't one of them. I don't remember -- does the 
Xcode=>Eclipse conversion app put java files in package folders? That might be 
one way if it does ... I suspect you can write a shell script with one line to 
do the move, too.


        ms




          Hi Dave

          It is easier to do - drag the java files into package and Eclipse 
will do the rest.  If I want to moved existing java files (from old project 
builder directory), all I can see is the little red icon error at each file - 
that I need to go to each individual java file and resolved the package error.  
One at a time.
          The problem I am having now is thinking of moving around hundred of 
files in this manner, really get into my nerve.  Wont' there be a nicer, 
friendly / lazy way to do refactor all the java files into their respective 
packages?  Since Eclipse could do it one a time?  No?

          I had done some docs finding, and can't get any clue.  Thanks for 
responding, Dave.

          Cheers

          Cheong Hee
            ----- Original Message -----
            From: David Avendasora
            To: Cheong Hee Ng
            Cc: WODev (Apple)
            Sent: Tuesday, December 29, 2009 7:08 AM
            Subject: Re: Refactor java files (Prev: OT: Refactor files into 
packages (Eclipse))


            Hi Cheong Hee,


            Sorry, I misunderstood.



            I always created the packages first, then moved the source files in 
and let Eclipse refactor the package names for me. I've never tried to do the 
reverse.


            Dave


            On Dec 28, 2009, at 1:22 PM, Cheong Hee Ng wrote:


              Hi David

              I think this is one of ways I am doing so far as in (1) and (2).  
I thought there may be a lazy way to do it => when all java files moved/copied 
into "Sources", these java files (since package has been defined in each java 
file) could be moved into package all at one go.

              Currently, moving one java file at a time is tedious and may be 
prone to manual error (considering  quite big number of files to move into 
packages).  If Eclipse can't do that, I may need to find a tool to move the 
java files into their package before moving them into Eclipse/Resources.  Is 
this what you guys are doing during migration?

              Cheers

              Cheong Hee
                


              On Mon, Dec 28, 2009 at 7:14 PM, David Avendasora 
<[email protected]> wrote:

                Hi Cheong Hee,


                I just tested this on a new project. Here is what I had to do 
to get Eclipse to automatically refactor the package declaration:


                1) Move .java file into the root of "Sources"
                2) Move the .java file into a package.


                If you move the .java file from the project root directly into 
a package Eclipse will _not_ automatically add the package declaration. It only 
does it if the .java file is already in a directory that is designated as a 
source folder.


                Dave


                On Dec 27, 2009, at 11:27 PM, Cheong Hee (Gmail) wrote:


                  Hi

                  Following previous tips on this item, I have tried both way 
as suggested:
                  1.  moved java files to Sources using WOExplorer
                  2.  Refactor -> rename

                  I had no luck to turn them directly into packages.  To recap, 
I am trying to move in some existing java files with package defined into new 
WO Framework project in Eclipse.  It turned out the files only moved in as 
"default package" and manually works need to be done to do it one at a time. 

                  anything missing here or am I the only one have this problem? 
 Really appreciate pointers.  I have quite some files to move into framework.

                  Cheers

                  Cheong Hee
                  _______________________________________________
                  Do not post admin requests to the list. They will be ignored.
                  Webobjects-dev mailing list      
([email protected])
                  Help/Unsubscribe/Update your Subscription:
                  
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

                  This email sent to [email protected]


                David Avendasora
                Senior Software Engineer
                K12, Inc.


                *****
                WebObjects Documentation Wiki : 
http://wiki.objectstyle.org/confluence/display/WO/
                *****
                WebObjects API: 
http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
                *****






            David Avendasora
            Senior Software Engineer
            K12, Inc.


            *****
            WebObjects Documentation Wiki : 
http://wiki.objectstyle.org/confluence/display/WO/
            *****
            WebObjects API: 
http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
            *****


          _______________________________________________
          Do not post admin requests to the list. They will be ignored.
          Webobjects-dev mailing list      ([email protected])
          Help/Unsubscribe/Update your Subscription:
          
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

          This email sent to [email protected]


        _______________________________________________
        Do not post admin requests to the list. They will be ignored.
        Webobjects-dev mailing list      ([email protected])
        Help/Unsubscribe/Update your Subscription:
        
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

        This email sent to [email protected]





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to