@@ -767,7 +767,7 @@ private void moveAction(final ActionEvent ev) {
767
767
//get an array of collection paths
768
768
try {
769
769
final Collection root = client .getCollection (XmldbURI .ROOT_COLLECTION );
770
- final List <PrettyXmldbURI > alCollections = getCollections (root , new ArrayList <PrettyXmldbURI >());
770
+ final List <PrettyXmldbURI > alCollections = getCollections (root , new ArrayList <>());
771
771
collections = new PrettyXmldbURI [alCollections .size ()];
772
772
alCollections .toArray (collections );
773
773
} catch (final XMLDBException e ) {
@@ -786,12 +786,12 @@ private void moveAction(final ActionEvent ev) {
786
786
try {
787
787
final EXistCollectionManagementService service = (EXistCollectionManagementService )
788
788
client .current .getService ("CollectionManagementService" , "1.0" ); //$NON-NLS-1$ //$NON-NLS-2$
789
- for (int i = 0 ; i < res . length ; i ++ ) {
790
- setStatus (Messages .getString ("ClientFrame.115" ) + res [ i ] .getName () + Messages .getString ("ClientFrame.116" ) + destinationPath + Messages .getString ("ClientFrame.117" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
791
- if (res [ i ] .isCollection ()) {
792
- service .move (res [ i ] .getName (), destinationPath , null );
789
+ for (ResourceDescriptor re : res ) {
790
+ setStatus (Messages .getString ("ClientFrame.115" ) + re .getName () + Messages .getString ("ClientFrame.116" ) + destinationPath + Messages .getString ("ClientFrame.117" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
791
+ if (re .isCollection ()) {
792
+ service .move (re .getName (), destinationPath , null );
793
793
} else {
794
- service .moveResource (res [ i ] .getName (), destinationPath , null );
794
+ service .moveResource (re .getName (), destinationPath , null );
795
795
}
796
796
}
797
797
client .reloadCollection ();
@@ -828,12 +828,12 @@ private void renameAction(final ActionEvent ev) {
828
828
try {
829
829
final EXistCollectionManagementService service = (EXistCollectionManagementService )
830
830
client .current .getService ("CollectionManagementService" , "1.0" ); //$NON-NLS-1$ //$NON-NLS-2$
831
- for (int i = 0 ; i < res . length ; i ++ ) {
832
- setStatus (Messages .getString ("ClientFrame.124" ) + res [ i ] .getName () + Messages .getString ("ClientFrame.125" ) + destinationFilename + Messages .getString ("ClientFrame.126" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
833
- if (res [ i ] .isCollection ()) {
834
- service .move (res [ i ] .getName (), null , destinationFilename );
831
+ for (ResourceDescriptor re : res ) {
832
+ setStatus (Messages .getString ("ClientFrame.124" ) + re .getName () + Messages .getString ("ClientFrame.125" ) + destinationFilename + Messages .getString ("ClientFrame.126" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
833
+ if (re .isCollection ()) {
834
+ service .move (re .getName (), null , destinationFilename );
835
835
} else {
836
- service .moveResource (res [ i ] .getName (), null , destinationFilename );
836
+ service .moveResource (re .getName (), null , destinationFilename );
837
837
}
838
838
}
839
839
client .reloadCollection ();
@@ -853,7 +853,7 @@ private void copyAction(final ActionEvent ev) {
853
853
//get an array of collection paths
854
854
try {
855
855
final Collection root = client .getCollection (XmldbURI .ROOT_COLLECTION );
856
- final List <PrettyXmldbURI > alCollections = getCollections (root , new ArrayList <PrettyXmldbURI >());
856
+ final List <PrettyXmldbURI > alCollections = getCollections (root , new ArrayList <>());
857
857
collections = new PrettyXmldbURI [alCollections .size ()];
858
858
alCollections .toArray (collections );
859
859
} catch (final XMLDBException e ) {
@@ -873,7 +873,7 @@ private void copyAction(final ActionEvent ev) {
873
873
try {
874
874
final EXistCollectionManagementService service = (EXistCollectionManagementService )
875
875
client .current .getService ("CollectionManagementService" , "1.0" ); //$NON-NLS-1$ //$NON-NLS-2$
876
- for (int i = 0 ; i < res . length ; i ++ ) {
876
+ for (ResourceDescriptor re : res ) {
877
877
878
878
//TODO
879
879
//what happens if the source and destination paths are the same?
@@ -884,11 +884,11 @@ private void copyAction(final ActionEvent ev) {
884
884
//
885
885
//Its too late and brain hurts - deliriumsky
886
886
887
- setStatus (Messages .getString ("ClientFrame.132" ) + res [ i ] .getName () + Messages .getString ("ClientFrame.133" ) + destinationPath + Messages .getString ("ClientFrame.134" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
888
- if (res [ i ] .isCollection ()) {
889
- service .copy (res [ i ] .getName (), destinationPath , null );
887
+ setStatus (Messages .getString ("ClientFrame.132" ) + re .getName () + Messages .getString ("ClientFrame.133" ) + destinationPath + Messages .getString ("ClientFrame.134" )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
888
+ if (re .isCollection ()) {
889
+ service .copy (re .getName (), destinationPath , null );
890
890
} else {
891
- service .copyResource (res [ i ] .getName (), destinationPath , null );
891
+ service .copyResource (re .getName (), destinationPath , null );
892
892
}
893
893
}
894
894
client .reloadCollection ();
@@ -904,9 +904,9 @@ private ArrayList<PrettyXmldbURI> getCollections(final Collection root, final Ar
904
904
collectionsList .add (new PrettyXmldbURI (XmldbURI .create (root .getName ())));
905
905
final String [] childCollections = root .listChildCollections ();
906
906
Collection child = null ;
907
- for (int i = 0 ; i < childCollections . length ; i ++ ) {
907
+ for (String childCollection : childCollections ) {
908
908
try {
909
- child = root .getChildCollection (childCollections [ i ] );
909
+ child = root .getChildCollection (childCollection );
910
910
} catch (final XMLDBException xmldbe ) {
911
911
if (xmldbe .getCause () instanceof PermissionDeniedException ) {
912
912
continue ;
@@ -955,8 +955,7 @@ private void reindexAction(final ActionEvent ev) {
955
955
try {
956
956
service = (IndexQueryService )
957
957
client .current .getService ("IndexQueryService" , "1.0" ); //$NON-NLS-1$ //$NON-NLS-2$
958
- for (int i = 0 ; i < collections .length ; i ++) {
959
- final ResourceDescriptor next = collections [i ];
958
+ for (final ResourceDescriptor next : collections ) {
960
959
setStatus (Messages .getString ("ClientFrame.142" ) + next .getName () + Messages .getString ("ClientFrame.143" )); //$NON-NLS-1$ //$NON-NLS-2$
961
960
service .reindexCollection (next .getName ());
962
961
}
@@ -1305,10 +1304,10 @@ private void setPermAction(final ActionEvent ev) throws PermissionDeniedExceptio
1305
1304
permAider = PermissionAiderFactory .getPermission (account .getName (), account .getPrimaryGroup (), Permission .DEFAULT_RESOURCE_PERM ); //$NON-NLS-1$ //$NON-NLS-2$
1306
1305
}
1307
1306
1308
- final List <ResourceDescriptor > selected = new ArrayList <ResourceDescriptor >();
1307
+ final List <ResourceDescriptor > selected = new ArrayList <>();
1309
1308
final int rows [] = fileman .getSelectedRows ();
1310
- for (int i = 0 ; i < rows . length ; i ++ ) {
1311
- selected .add (resources .getRow (fileman .convertRowIndexToModel (rows [ i ] )));
1309
+ for (int row : rows ) {
1310
+ selected .add (resources .getRow (fileman .convertRowIndexToModel (row )));
1312
1311
}
1313
1312
1314
1313
final EditPropertiesDialog editPropertiesDialog = new EditPropertiesDialog (service , client .getProperties ().getProperty (InteractiveClient .USER ), collection , name , mimeType , created , modified , size , messageDigest , permAider , selected );
@@ -1491,7 +1490,7 @@ static class ResourceTableModel extends AbstractTableModel {
1491
1490
private DateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" );
1492
1491
1493
1492
public void setData (final List <ResourceDescriptor > rows ) {
1494
- Collections .sort (rows , new ResourceComparator ());
1493
+ rows .sort (new ResourceComparator ());
1495
1494
this .rows = rows ;
1496
1495
fireTableDataChanged ();
1497
1496
}
@@ -1688,7 +1687,7 @@ public static int showErrorMessageQuery(final String message, final Throwable t)
1688
1687
if (result == null ) {
1689
1688
return 2 ;
1690
1689
}
1691
- return (( Integer ) optionPane .getValue ()). intValue ();
1690
+ return (Integer ) optionPane .getValue ();
1692
1691
}
1693
1692
1694
1693
/*
0 commit comments