Author: rfelden
Date: Thu Jul 19 13:03:47 2007
New Revision: 9

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D9&repname=3Df=
ix_apply
Log:
update from jahia specific branch
(coherence between branches)

Modified:
    trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/MyContro=
ller.java
    trunk/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.java
    trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/ViewAdapter.j=
ava
    trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/MainWindo=
w.java

Modified: trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/My=
Controller.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/fixapplier/src/=
main/java/org/jahia/fixapplier/controller/MyController.java&rev=3D9&repname=
=3Dfix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/MyContro=
ller.java (original)
+++ trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/MyContro=
ller.java Thu Jul 19 13:03:47 2007
@@ -472,7 +472,7 @@
 =

         // do the job...
         replaceCoreFiles();
-        deleteRemovedPaths() ;
+        deleteRemovedFiles() ;
 =

         // log the patching
         addToHistory() ;
@@ -483,9 +483,11 @@
     public void threadedPatch() {
         new Thread() {
             public void run() {
+                view.enableHourglass() ;
                 // first check if a zip file is currently selected
                 if (dataModel.getZippedFix() =3D=3D null) {
                     printUI("no zipped fix selected");
+                    view.disableHourglass() ;
                     return ;
                 }
 =

@@ -498,21 +500,24 @@
                 // then check if the patch has already been applied
                 if (dataModel.checkForExisting()) {
                     printUI("fix already applied") ;
+                    view.disableHourglass() ;
                     return ;
                 }
 =

                 // finally check if the project to patch is selected
                 if (dataModel.getProject() =3D=3D null || !dataModel.getPr=
oject().exists()) {
                     printUI("no project selected");
+                    view.disableHourglass() ;
                     return ;
                 }
 =

                 // do the job...
                 replaceCoreFiles();
-                deleteRemovedPaths() ;
+                deleteRemovedFiles() ;
 =

                 // log the patching
                 addToHistory() ;
+                view.disableHourglass() ;
              }
         }.start() ;
     }
@@ -555,9 +560,26 @@
             =

             File parentPath =3D destination.getParentFile() ;
             parentPath.mkdirs() ;
-            Tools.copy(neu, destination) ;
-            out(neu.getName() + " replaced");
-            printUI("   " + neu.getName() + " replaced");
+            =

+            // this concerns a maven dependency update
+            if (dataModel.getFix().getMavenDependencies().contains(neu.get=
Name())) {
+                File[] list =3D parentPath.listFiles() ;
+                for (int i =3D 0; i < list.length; i++) {
+                    if (StringUtils.cleanAfterLastToken(list[i].getName(),=
 "-", false)
+                            .equals(StringUtils.cleanAfterLastToken(neu.ge=
tName(), "-", false))) {
+                        // delete old versions
+                        Tools.recDel(list[i]) ;
+                        Tools.copy(neu, destination) ;
+                        printUI(list[i].getName() + " replaced with " + ne=
u.getName());
+                        out(list[i].getName() + " replaced with " + neu.ge=
tName()) ;
+                        break ;
+                    }
+                }
+            } else {
+                Tools.copy(neu, destination) ;
+                out(neu.getName() + " copied");
+                printUI("   " + neu.getName() + " copied");
+            }
         }
     }
 =

@@ -614,9 +636,9 @@
     }
 =

     /**
-     * Remove the paths that are marked for deletion.
+     * Remove the files that are marked for deletion.
      */
-    private void deleteRemovedPaths() {
+    private void deleteRemovedFiles() {
         ArrayList paths =3D dataModel.getFix().getRemovedFiles() ;
         for (java.util.Iterator it =3D paths.iterator(); it.hasNext();) {
             String path =3D (String) it.next();

Modified: trunk/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/fixapplier/src/=
main/java/org/jahia/fixapplier/model/Fix.java&rev=3D9&repname=3Dfix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.java (ori=
ginal)
+++ trunk/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.java Thu =
Jul 19 13:03:47 2007
@@ -35,6 +35,7 @@
     private Timestamp date ;
     private ArrayList coreFiles;
     private ArrayList removedFiles ;
+    private ArrayList mavenDependencies ;
     private ArrayList otherFiles ;
     private String description ;
 =

@@ -182,6 +183,14 @@
         return otherFiles ;
     }
 =

+    public void addMavenDependency(String file) {
+        mavenDependencies.add(file);
+    }
+
+    public ArrayList getMavenDependencies() {
+        return mavenDependencies;
+    }
+
     public String toString() {
         StringBuffer core =3D new StringBuffer() ;
         core.append("core files:") ;
@@ -195,6 +204,12 @@
             String c =3D (String) it2.next();
             remove.append("\n   ").append(c);
         }
+        StringBuffer maven =3D new StringBuffer() ;
+        maven.append("maven dependencies:") ;
+        for (java.util.Iterator it1 =3D mavenDependencies.iterator(); it1.=
hasNext();) {
+            String c =3D (String) it1.next();
+            maven.append("\n   ").append(c);
+        }
         StringBuffer other =3D new StringBuffer() ;
         other.append("other files:") ;
         for (java.util.Iterator it1 =3D otherFiles.iterator(); it1.hasNext=
();) {
@@ -210,6 +225,7 @@
                "description: "+  description + "\n" +
                 (coreFiles.isEmpty() ? "" : core.toString()) +
                 (removedFiles.isEmpty() ? "" : "\n" + remove.toString()) +
+                (mavenDependencies.isEmpty() ? "" : maven.toString() + "\n=
") +
                 (otherFiles.isEmpty() ? "" : "\n" + other.toString()) ;
     }
 =

@@ -235,6 +251,11 @@
             fix.addRemovedFile(((Element) removedFile).getText());
         }
 =

+        for (java.util.Iterator it3 =3D root.getChild("mavenDependencies")=
.getChildren("mavenDependency").iterator(); it3.hasNext();) {
+            Object removedFile =3D it3.next();
+            fix.addMavenDependency(((Element) removedFile).getText());
+        }
+
         for (java.util.Iterator it1 =3D root.getChild("otherFiles").getChi=
ldren("file").iterator(); it1.hasNext();) {
             Object otherFile =3D it1.next();
             fix.addOtherFile(((Element) otherFile).getText());

Modified: trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/ViewAda=
pter.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/fixapplier/src/=
main/java/org/jahia/fixapplier/views/ViewAdapter.java&rev=3D9&repname=3Dfix=
_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/ViewAdapter.j=
ava (original)
+++ trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/ViewAdapter.j=
ava Thu Jul 19 13:03:47 2007
@@ -19,10 +19,10 @@
 =

     public void rebuild(boolean appcast) {}
 =

-    public void onAppcastRetrieved(Appcast appcast) {
-
-    }
+    public void onAppcastRetrieved(Appcast appcast) {}
 =

+    public void enableHourglass() {}
 =

+    public void disableHourglass() {}
 =

 }

Modified: trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/Mai=
nWindow.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/fixapplier/src/=
main/java/org/jahia/fixapplier/views/gui/MainWindow.java&rev=3D9&repname=3D=
fix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/MainWindo=
w.java (original)
+++ trunk/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/MainWindo=
w.java Thu Jul 19 13:03:47 2007
@@ -8,6 +8,7 @@
 import javax.swing.*;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.awt.*;
 import java.util.ResourceBundle;
 =

 /**
@@ -86,4 +87,13 @@
             appcastPane.onAppcastRetrieved(appcast);
         }
     }
+
+    public void enableHourglass() {
+        frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)) ;
+    }
+
+    public void disableHourglass() {
+        frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)) ;
+    }
+
 }

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to