From: <oms...@us...> - 2007-01-13 03:53:27
|
Revision: 985 http://svn.sourceforge.net/azcvsupdater/?rev=985&view=rev Author: omschaub Date: 2007-01-12 19:53:27 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Fixing issue with new Azureus3 name so that it shows in the list Modified Paths: -------------- trunk/omschaub/omschaub/azcvsupdater/main/Tab1Utils.java Modified: trunk/omschaub/omschaub/azcvsupdater/main/Tab1Utils.java =================================================================== --- trunk/omschaub/omschaub/azcvsupdater/main/Tab1Utils.java 2006-12-13 19:04:45 UTC (rev 984) +++ trunk/omschaub/omschaub/azcvsupdater/main/Tab1Utils.java 2007-01-13 03:53:27 UTC (rev 985) @@ -1,7 +1,7 @@ /* * Created on Feb 6, 2005 * Created by omschaub - * + * */ package omschaub.azcvsupdater.main; @@ -30,10 +30,10 @@ */ public class Tab1Utils { - - + + /** Delete the Selected File - * + * * @param filetodie * @param name */ @@ -45,30 +45,30 @@ ButtonStatus.set(true, true, false, true,true); return; } - Thread deleteFileThread = new Thread() + Thread deleteFileThread = new Thread() { - public void run() - { - + public void run() + { + final File timetodie = new File(filetodie); if (timetodie.isDirectory() == true) { StatusBoxUtils.mainStatusAdd(" You seem to have chosen a directory.. Action Cancelled",2); return; } - + if (timetodie.isFile() == false) { StatusBoxUtils.mainStatusAdd("Please select a file first",2); return; } - + if(View.getDisplay()==null && View.getDisplay().isDisposed()) return; - + View.DML_BOOLEAN = false; View.getDisplay().asyncExec(new Runnable (){ - public void run () + public void run () { Shell shell = new Shell(View.getDisplay()); MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); @@ -84,7 +84,7 @@ { timetodie.delete(); //System.out.println("AZCVSUPDATER: dml_boolean is false.. straight delete"); - + } StatusBoxUtils.mainStatusAdd(" Deleted file " + timetodie,0); File checkdir = new File(DirectoryUtils.getBackupDirectory() + System.getProperty("file.separator") + "comments"); @@ -94,13 +94,13 @@ { comment_delete(inFile); } - + } catch (Exception e) { e.printStackTrace() ; } - + loadDirectory(View.getPluginInterface().getPluginconfig().getPluginIntParameter("Azureus_TableSort",2)); Tab6Utils.refreshLists(); //StatusBoxUtils.mainStatusAdd(" File Deleted"); @@ -127,7 +127,7 @@ deleteFileThread.setDaemon(true); deleteFileThread.start(); } - + public static void delete_multiple_files(TableItem[] list_item){ String label_files=""; String fileName; @@ -136,9 +136,9 @@ TableItem item = list_item[i]; fileName = item.getText(0); label_files=label_files + fileName + "\n"; - + } - + Shell shell = new Shell(); MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); messageBox.setText("Delete Confirmation"); @@ -150,9 +150,9 @@ for (int i = 0; i< list_item.length; i++){ TableItem item = list_item[i]; fileName = item.getText(0); - + File timetodie = new File(backup_dir + System.getProperty("file.separator") + fileName); - + if (timetodie == null){ if (Tab1.listTable != null && !Tab1.listTable.isDisposed()){ Tab1.listTable.deselectAll(); @@ -160,18 +160,18 @@ ButtonStatus.set(true, true, false, true, true); return; } - - - + + + if (timetodie.isDirectory() == true){ - + StatusBoxUtils.mainStatusAdd(" You seem to have chosen a directory.. Action Cancelled",2); - + return; } - + if (timetodie.isFile() == false){ - + StatusBoxUtils.mainStatusAdd(" Error.. File to delete does not seem to be an actual file",2); return; @@ -179,65 +179,65 @@ MainCVSGet.removeDownload(fileName,View.getPluginInterface()); if(!View.DML_BOOLEAN); { - timetodie.delete(); + timetodie.delete(); } - + StatusBoxUtils.mainStatusAdd(" Deleted file " + timetodie,0); - + //check for comment file File checkdir = new File(backup_dir + System.getProperty("file.separator") + "comments"); File inFile = new File(checkdir + System.getProperty("file.separator") + fileName+".txt"); //String commentFile = new String(checkdir + System.getProperty("file.separator") + fileName+".txt"); if (inFile.isFile()){ comment_delete(inFile); - + } } - + } catch (Exception e){ e.printStackTrace() ; } - + StatusBoxUtils.mainStatusAdd(" Multiple Files Deleted",0); - + shell.dispose(); loadDirectory(View.getPluginInterface().getPluginconfig().getPluginIntParameter("Azureus_TableSort",2)); Tab6Utils.refreshLists(); break; case SWT.NO: - + StatusBoxUtils.mainStatusAdd(" Multiple File Deletion Cancelled",0); - + shell.dispose(); break; } } - - - + + + public static void loadDirectory(final int type) { if(View.LOAD_DIR){ View.LOAD_DIR = false; return; } - + View.LOAD_DIR = true; //String installdirectory = DirectoryUtils.getInstallDirectory(); final Thread load_directory_thread = new Thread() { public void run() { try { - + if(View.getDisplay()== null && View.getDisplay().isDisposed()) return; - + View.getDisplay().syncExec(new Runnable (){ public void run () { if (Tab1.listTable !=null && !Tab1.listTable.isDisposed()){ /*Control[] controls = Tab1.listTable.getChildren(); for(int i = 0; i < controls.length ; i++){ - + controls[i].dispose(); controls[i] = null; }*/ @@ -258,14 +258,14 @@ Tab1.downloadVisible(false,false); } } - + } }); File [] files = fileDateSort(type); for(int i = 0 ; i < files.length ; i++) { String fileName = files[i].getName(); - if(!fileName.startsWith("Azureus2")) + if(!fileName.startsWith("Azureus")) continue; int fileSizeInKB = 0; try { @@ -281,10 +281,10 @@ //urlMap.put(fileName,fileURL); addTableElement(fileName,fileSizeInKB,lastModified,Tab1.listTable); } - + //We also need to re-enable the browse button ButtonStatus.set(true, true, false, true, true); - + View.LOAD_DIR = false; } catch(Exception e) { @@ -293,14 +293,14 @@ } } }; - + //Before starting our Thread, we remove all elements in the table if(View.getDisplay()==null && View.getDisplay().isDisposed()) return; View.getDisplay().asyncExec(new Runnable (){ public void run () { if (Tab1.listTable !=null && !Tab1.listTable.isDisposed()){ - + Tab1.listTable.removeAll(); Tab1.listTable.redraw(); Tab1.listTable.setEnabled(true); @@ -309,11 +309,11 @@ load_directory_thread.start(); } }); - - + + } - - + + public static void comment_delete(File commentFiletoDie){ Shell shell = new Shell(); MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.NO | SWT.YES); @@ -329,23 +329,23 @@ shell.dispose(); break; case SWT.NO: - + //this.mainStatus.setText(" Idle..."); shell.dispose(); break; } - + } public static void addTableElement(final String fileName,final int fileSizeInKb,final long lastModified, final Table table_to_add /*,final String fileURL*/) { if(View.getDisplay() == null || View.getDisplay().isDisposed()) return; - + View.getDisplay().asyncExec( new Runnable() { public void run() { if(table_to_add == null || table_to_add.isDisposed()) - return; + return; TableItem item = new TableItem(table_to_add,SWT.NULL); if (table_to_add.getItemCount()%2==0) { item.setBackground(ColorUtilities.getBackgroundColor()); @@ -364,23 +364,23 @@ } else { - sdf = new SimpleDateFormat("MM/dd/yyy hh:mm:ss aa" ); + sdf = new SimpleDateFormat("MM/dd/yyy hh:mm:ss aa" ); } - + sdf.setTimeZone(TimeZone.getDefault()); String date = sdf.format(when); - + item.setText(2,date); - + String textTemp; textTemp = CommentMaker.commentFirstLine(fileName); item.setText(3,textTemp); - - - } + + + } }); - - + + } public static File[] fileDateSort(int type){ @@ -392,28 +392,28 @@ *type = 4 is Size ascending *type = 5 is Size descending **/ - + File f = new File(DirectoryUtils.getBackupDirectory()); File[] files = f.listFiles(); int filesLength = files.length; long[] fileModified = new long[ filesLength ]; long[] fileSize = new long[ filesLength]; - + // Parsing for ( int i = 0; i < filesLength; i++ ){ - fileModified[i] = files[i].lastModified(); + fileModified[i] = files[i].lastModified(); fileSize[i] = files[i].length(); } - + // Bubblesort - + //type 0 = Date of CVS Build ascending if (type==0){ for ( int i = 0; i < filesLength; i++ ){ for ( int j = 0; j < filesLength - 1; j++ ){ // This does the actual comparison - if ( fileModified[j] < fileModified[j+1] || + if ( fileModified[j] < fileModified[j+1] || ( fileModified[j] == fileModified[j+1] && files[j].compareTo( files[j+1] ) > 0 ) ){ // Swapping fileModified[j] ^= fileModified[j+1]; @@ -424,14 +424,14 @@ files[j+1] = temp; } } - } + } } //type 1 = Date of CVS Build descending if (type==1){ for ( int i = 0; i < filesLength; i++ ){ for ( int j = 0; j < filesLength - 1; j++ ){ // This does the actual comparison - if ( fileModified[j] > fileModified[j+1] || + if ( fileModified[j] > fileModified[j+1] || ( fileModified[j] == fileModified[j+1] && files[j].compareTo( files[j+1] ) > 0 ) ){ // Swapping fileModified[j] ^= fileModified[j+1]; @@ -445,14 +445,14 @@ } } - + //type = 2 is File ascending if (type==2){ for ( int i = 0; i < filesLength; i++ ){ for ( int j = 0; j < filesLength - 1; j++ ){ // This does the actual comparison - if ( files[j].compareTo( files [j+1]) > 0 || + if ( files[j].compareTo( files [j+1]) > 0 || ( files[j].compareTo( files[j+1]) == 0 && fileModified[j] > fileModified[j+1]) ){ // Swapping fileModified[j] ^= fileModified[j+1]; @@ -463,16 +463,16 @@ files[j+1] = temp; } } - } + } } - + // type = 3 is File descending if (type==3){ for ( int i = 0; i < filesLength; i++ ){ for ( int j = 0; j < filesLength - 1; j++ ){ // This does the actual comparison - if ( files[j+1].compareTo( files [j]) > 0 || + if ( files[j+1].compareTo( files [j]) > 0 || ( files[j+1].compareTo( files[j]) == 0 && fileModified[j] > fileModified[j+1]) ){ // Swapping fileModified[j] ^= fileModified[j+1]; @@ -483,15 +483,15 @@ files[j+1] = temp; } } - } + } } - + //type = 4 is Size ascending if (type==4){ for ( int i = 0; i < filesLength; i++ ){ for ( int j = 0; j < filesLength - 1; j++ ){ // This does the actual comparison - if ( fileSize[j] < fileSize[j+1] || + if ( fileSize[j] < fileSize[j+1] || ( fileSize[j] == fileSize[j+1] && files[j].compareTo( files[j+1] ) > 0 ) ){ // Swapping fileSize[j] ^= fileSize[j+1]; @@ -502,7 +502,7 @@ files[j+1] = temp; } } - } + } } //type = 5 is Size descending @@ -510,7 +510,7 @@ for ( int i = 0; i < filesLength; i++ ){ for ( int j = 0; j < filesLength - 1; j++ ){ // This does the actual comparison - if ( fileSize[j] > fileSize[j+1] || + if ( fileSize[j] > fileSize[j+1] || ( fileSize[j] == fileSize[j+1] && files[j].compareTo( files[j+1] ) > 0 ) ){ // Swapping fileSize[j] ^= fileSize[j+1]; @@ -523,11 +523,11 @@ } } } - + return files; } - -/* + +/* public static String CVSurlGetter(String cvs_name) { String sourceFile = "mail_list.cache"; String sourceDir = View.getPluginInterface().getPluginDirectoryName() + System.getProperty("file.separator"); @@ -562,11 +562,11 @@ } in.close(); return "http://sourceforge.net/mailarchive/" + inputLine.substring(beginningIndex,endIndex); - + } - - - + + + } in.close(); return url; @@ -575,10 +575,10 @@ } return "empty"; }*/ - - + + public static boolean string_Contains(String inputLine, String searchLine){ - boolean answer = false; + boolean answer = false; //String tempHolder=""; int nPos = 0; while(true){ @@ -595,7 +595,7 @@ return answer; } - - - //EOF + + + //EOF } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |