diff --git a/build/build.xml b/build/build.xml index 7f00836..d444a18 100644 --- a/build/build.xml +++ b/build/build.xml @@ -87,6 +87,7 @@ + @@ -107,6 +108,7 @@ + diff --git a/src/com/webcodepro/applecommander/compiler/ApplesoftCompiler.java b/src/com/webcodepro/applecommander/compiler/ApplesoftCompiler.java index 6028518..2f019c7 100644 --- a/src/com/webcodepro/applecommander/compiler/ApplesoftCompiler.java +++ b/src/com/webcodepro/applecommander/compiler/ApplesoftCompiler.java @@ -72,25 +72,25 @@ public class ApplesoftCompiler implements ApplesoftTokens { * by the compiled program. This map is keyed by the name of the * address and the value is the address. */ - private Map knownAddresses = new HashMap(); + private Map knownAddresses = new HashMap<>(); /** * Lists the names of all addresses used by the compiled program. * To identify the value, use the knownAddresses map. */ - private List usedAddresses = new ArrayList(); + private List usedAddresses = new ArrayList<>(); /** * Contains a list of all variables declared or used by the * program. */ - private List variables = new ArrayList(); + private List variables = new ArrayList<>(); /** * Dynamically created map of commands to Methods. */ - private Map commandMethods = new HashMap(); + private Map commandMethods = new HashMap<>(); /** * Track FOR loop variables. */ - private Stack loopVariables = new Stack(); + private Stack loopVariables = new Stack<>(); /** * Indicates integer math operations only. */ diff --git a/src/com/webcodepro/applecommander/storage/DirectoryEntry.java b/src/com/webcodepro/applecommander/storage/DirectoryEntry.java index 72ff7e3..3934e8b 100644 --- a/src/com/webcodepro/applecommander/storage/DirectoryEntry.java +++ b/src/com/webcodepro/applecommander/storage/DirectoryEntry.java @@ -37,7 +37,7 @@ public interface DirectoryEntry { * return value should always be a list - a directory * with 0 entries returns an empty list. */ - public List getFiles(); + public List getFiles(); /** * Create a new FileEntry. diff --git a/src/com/webcodepro/applecommander/storage/FileEntry.java b/src/com/webcodepro/applecommander/storage/FileEntry.java index ab7fe2d..c82d30d 100644 --- a/src/com/webcodepro/applecommander/storage/FileEntry.java +++ b/src/com/webcodepro/applecommander/storage/FileEntry.java @@ -84,7 +84,7 @@ public interface FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode); + public List getFileColumnData(int displayMode); /** * Get file data. This handles any operating-system specific issues. diff --git a/src/com/webcodepro/applecommander/storage/FileEntryComparator.java b/src/com/webcodepro/applecommander/storage/FileEntryComparator.java index 66beddc..ff18aff 100644 --- a/src/com/webcodepro/applecommander/storage/FileEntryComparator.java +++ b/src/com/webcodepro/applecommander/storage/FileEntryComparator.java @@ -29,7 +29,7 @@ import java.util.Comparator; * Date created: Oct 27, 2002 8:24:39 PM * @author Rob Greene */ -public class FileEntryComparator implements Comparator { +public class FileEntryComparator implements Comparator { private int columnIndex; private int displayMode; @@ -45,11 +45,12 @@ public class FileEntryComparator implements Comparator { * Compare two FileEntry objects. * @see java.util.Comparator#compare(Object, Object) */ - public int compare(Object o1, Object o2) { + public int compare(FileEntry o1, FileEntry o2) { + // FIXME?: This safety check is safe to remove now? if (!(o1 instanceof FileEntry) || !(o2 instanceof FileEntry)) { return 0; } - + if (o1 == null || o2 == null) { return ((o1 == null) ? -1 : 0) + ((o2 == null) ? 1 : 0); } diff --git a/src/com/webcodepro/applecommander/storage/FormattedDisk.java b/src/com/webcodepro/applecommander/storage/FormattedDisk.java index 6d19a7a..d407638 100644 --- a/src/com/webcodepro/applecommander/storage/FormattedDisk.java +++ b/src/com/webcodepro/applecommander/storage/FormattedDisk.java @@ -185,8 +185,8 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry { * each disk format can build this as appropriate. Each subclass should * override this method and add its own detail. */ - public List getDiskInformation() { - List list = new ArrayList(); + public List getDiskInformation() { + List list = new ArrayList<>(); list.add(new DiskInformation(textBundle.get("FormattedDisk.FileName"), getFilename())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FormattedDisk.DiskName"), getDiskName())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FormattedDisk.PhysicalSizeInBytes"), getPhysicalSize())); //$NON-NLS-1$ @@ -204,8 +204,8 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); list.add(new FileColumnHeader(textBundle .get("Name"), 30, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$ list.add(new FileColumnHeader(textBundle diff --git a/src/com/webcodepro/applecommander/storage/filters/GraphicsFileFilter.java b/src/com/webcodepro/applecommander/storage/filters/GraphicsFileFilter.java index 70a5bfd..5ea84dc 100644 --- a/src/com/webcodepro/applecommander/storage/filters/GraphicsFileFilter.java +++ b/src/com/webcodepro/applecommander/storage/filters/GraphicsFileFilter.java @@ -413,7 +413,7 @@ public class GraphicsFileFilter implements FileFilter { * @see File Types */ public AppleImage[] buildQuickDraw2Icons(FileEntry fileEntry) { - List icons = new ArrayList(); + List icons = new ArrayList<>(); int offset = 26; // skip file header byte[] filedata = fileEntry.getFileData(); while (offset < filedata.length) { diff --git a/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java b/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java index 5376ef1..540c15b 100644 --- a/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java +++ b/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java @@ -49,17 +49,17 @@ public abstract class AppleImage { public static AppleImage create(int width, int height) { String[] classes = { "ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Class[] constructorArgClasses = new Class[] { - int.class, int.class }; + Class constructorArgType = AppleImage.class; + Class[] constructorArgClasses = new Class[] { AppleImage.class }; Object[] constructorArgs = new Object[] { new Integer(width), new Integer(height) }; for (int i=0; i appleImageClass = Class.forName( "com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$ + classes[i]); - Constructor constructor = - appleImageClass.getConstructor(constructorArgClasses); + Constructor constructor = + constructorArgType.getConstructor(constructorArgClasses); AppleImage appleImage = (AppleImage) constructor.newInstance(constructorArgs); return appleImage; diff --git a/src/com/webcodepro/applecommander/storage/os/cpm/CpmFileEntry.java b/src/com/webcodepro/applecommander/storage/os/cpm/CpmFileEntry.java index 960c46e..e8a02d3 100644 --- a/src/com/webcodepro/applecommander/storage/os/cpm/CpmFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/cpm/CpmFileEntry.java @@ -98,7 +98,7 @@ public class CpmFileEntry implements FileEntry { /** * The offset(s) into the block that the FileEntry is at. */ - private List offsets = new ArrayList(); + private List offsets = new ArrayList<>(); /** * Construct a CP/M file entry. @@ -374,10 +374,10 @@ public class CpmFileEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(getFilename()); diff --git a/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java index 396adc1..6c3ff83 100644 --- a/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java @@ -152,7 +152,7 @@ public class CpmFormatDisk extends FormattedDisk { * Compute the number of CP/M blocks that are currently used. */ public int getBlocksUsed() { - List files = getFiles(); + List files = getFiles(); int blocksUsed = 0; for (int i=0; i files = getFiles(); for (int i=0; i getFiles() { + List files = new ArrayList<>(); + Map index = new HashMap<>(); for (int i=0; i<64; i++) { int offset = i*CpmFileEntry.ENTRY_LENGTH; CpmFileEntry fileEntry = new CpmFileEntry(this, offset); @@ -473,8 +473,8 @@ public class CpmFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(textBundle.get("Name"), 8, //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/storage/os/dos33/DosFileEntry.java b/src/com/webcodepro/applecommander/storage/os/dos33/DosFileEntry.java index b977008..ed2013a 100644 --- a/src/com/webcodepro/applecommander/storage/os/dos33/DosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/dos33/DosFileEntry.java @@ -263,10 +263,10 @@ public class DosFileEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java index e11a9f1..f7d6009 100644 --- a/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java @@ -134,8 +134,8 @@ public class DosFormatDisk extends FormattedDisk { * Retrieve a list of files. * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() */ - public List getFiles() { - List list = new ArrayList(); + public List getFiles() { + List list = new ArrayList<>(); byte[] vtoc = readVtoc(); int track = AppleUtil.getUnsignedByte(vtoc[1]); int sector = AppleUtil.getUnsignedByte(vtoc[2]); @@ -319,8 +319,8 @@ public class DosFormatDisk extends FormattedDisk { /** * Get DOS-specific disk information. */ - public List getDiskInformation() { - List list = super.getDiskInformation(); + public List getDiskInformation() { + List list = super.getDiskInformation(); list.add(new DiskInformation(textBundle.get("DosFormatDisk.TotalSectors"), getTotalSectors())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("DosFormatDisk.FreeSectors"), getFreeSectors())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("DosFormatDisk.UsedSectors"), getUsedSectors())); //$NON-NLS-1$ @@ -333,8 +333,8 @@ public class DosFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFileEntry.java b/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFileEntry.java index 89ba1fa..d23df5e 100644 --- a/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFileEntry.java @@ -209,9 +209,9 @@ public class GutenbergFileEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFormatDisk.java index d8f6496..aa1459c 100644 --- a/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/gutenberg/GutenbergFormatDisk.java @@ -133,8 +133,8 @@ public class GutenbergFormatDisk extends FormattedDisk { * Retrieve a list of files. * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() */ - public List getFiles() { - List list = new ArrayList(); + public List getFiles() { + List list = new ArrayList<>(); int track = CATALOG_TRACK; int sector = VTOC_SECTOR; while (track < 40) { // iterate through all catalog sectors @@ -309,8 +309,8 @@ public class GutenbergFormatDisk extends FormattedDisk { /** * Get WP-specific disk information. */ - public List getDiskInformation() { - List list = super.getDiskInformation(); + public List getDiskInformation() { + List list = super.getDiskInformation(); return list; } @@ -318,8 +318,8 @@ public class GutenbergFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFileEntry.java b/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFileEntry.java index a03b817..b02b732 100644 --- a/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFileEntry.java @@ -154,9 +154,9 @@ public class NakedosFileEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFormatDisk.java index 0bd774d..e15169e 100644 --- a/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/nakedos/NakedosFormatDisk.java @@ -138,8 +138,8 @@ public class NakedosFormatDisk extends FormattedDisk { * Retrieve a list of files. * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() */ - public List getFiles() { - ArrayList list = new ArrayList(); + public List getFiles() { + ArrayList list = new ArrayList<>(); int totalUsed = 0; int i; int[] fileSizes = new int[256]; @@ -310,9 +310,9 @@ public class NakedosFormatDisk extends FormattedDisk { /** * Get WP-specific disk information. */ - public List getDiskInformation() { + public List getDiskInformation() { getFiles(); - List list = super.getDiskInformation(); + List list = super.getDiskInformation(); return list; } @@ -320,8 +320,8 @@ public class NakedosFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/storage/os/pascal/PascalFileEntry.java b/src/com/webcodepro/applecommander/storage/os/pascal/PascalFileEntry.java index 531837a..2de1ea2 100644 --- a/src/com/webcodepro/applecommander/storage/os/pascal/PascalFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/pascal/PascalFileEntry.java @@ -203,7 +203,7 @@ public class PascalFileEntry implements FileEntry { * Retrieve the list of files in this directory. * Always returns null, as Pascal does not support directories. */ - public List getFiles() { + public List getFiles() { return null; } @@ -223,7 +223,7 @@ public class PascalFileEntry implements FileEntry { public void delete() { int index = 0; String dname = this.getFilename(); - List dir = disk.getDirectory(); + List dir = disk.getDirectory(); int count = dir.size(); // find the index of the matching entry for (int i = 1; i < count; i++) { @@ -261,12 +261,12 @@ public class PascalFileEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat( textBundle.get("PascalFileEntry.PascalDateFormat")); //$NON-NLS-1$ - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(dateFormat.format(getModificationDate())); @@ -344,7 +344,7 @@ public class PascalFileEntry implements FileEntry { */ private void storageError(String s) throws DiskFullException { if (this.index > 0) { - List dir = disk.getDirectory(); + List dir = disk.getDirectory(); int count = dir.size(); dir.remove(this.index); PascalFileEntry volEntry = (PascalFileEntry) dir.get(0); @@ -452,7 +452,7 @@ public class PascalFileEntry implements FileEntry { } // update this directory entry if (this.index > 0) { - List dir = disk.getDirectory(); + List dir = disk.getDirectory(); dir.set(this.index, this); disk.putDirectory(dir); } diff --git a/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java index 7e2226d..3a6d135 100644 --- a/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java @@ -139,8 +139,8 @@ public class PascalFormatDisk extends FormattedDisk { * Retrieve a list of files. * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() */ - public List getFiles() { - List list = new ArrayList(); + public List getFiles() { + List list = new ArrayList<>(); byte[] directory = readDirectory(); // process directory blocks: int entrySize = ENTRY_SIZE; @@ -158,8 +158,8 @@ public class PascalFormatDisk extends FormattedDisk { /** * Retrieve the entire directory. */ - public List getDirectory() { - List list = new ArrayList(); + public List getDirectory() { + List list = new ArrayList<>(); byte[] directory = readDirectory(); int count = AppleUtil.getWordValue(directory, 16); int offset = 0; @@ -194,7 +194,7 @@ public class PascalFormatDisk extends FormattedDisk { // find index of largest free space int count = 0; int index = 0; int max = 0; int last = 0; int first = 0; int free = 0; - List dir = getDirectory(); + List dir = getDirectory(); count = dir.size(); for (int i = 1; i < count; i++) { last = ((PascalFileEntry) dir.get(i - 1)).getLastBlock(); @@ -432,8 +432,8 @@ public class PascalFormatDisk extends FormattedDisk { /** * Get Pascal-specific disk information. */ - public List getDiskInformation() { - List list = super.getDiskInformation(); + public List getDiskInformation() { + List list = super.getDiskInformation(); list.add(new DiskInformation(textBundle.get("TotalBlocks"), getBlocksOnDisk())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$ @@ -452,8 +452,8 @@ public class PascalFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(textBundle.get("Modified"), 8, //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java index 4db1885..3ebc356 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java @@ -61,7 +61,7 @@ public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEn * return value should always be a list - a directory * with 0 entries returns an empty list. */ - public List getFiles() { + public List getFiles() { return getDisk().getFiles(getSubdirectoryHeader().getFileEntryBlock()); } diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java index 4c9c238..7ee9d8c 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFileEntry.java @@ -397,12 +397,12 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat( textBundle.get("DateFormat")); //$NON-NLS-1$ - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java index acbab8b..d210e3f 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java @@ -257,7 +257,7 @@ public class ProdosFormatDisk extends FormattedDisk { * Retrieve a list of files. * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() */ - public List getFiles() { + public List getFiles() { return getFiles(VOLUME_DIRECTORY_BLOCK); } @@ -265,8 +265,8 @@ public class ProdosFormatDisk extends FormattedDisk { * Build a list of files, starting in the given block number. * This works for the master as well as the subdirectories. */ - protected List getFiles(int blockNumber) { - List files = new ArrayList(); + protected List getFiles(int blockNumber) { + List files = new ArrayList<>(); while (blockNumber != 0) { byte[] block = readBlock(blockNumber); int offset = 4; @@ -400,8 +400,8 @@ public class ProdosFormatDisk extends FormattedDisk { /** * Get Pascal-specific disk information. */ - public List getDiskInformation() { - List list = super.getDiskInformation(); + public List getDiskInformation() { + List list = super.getDiskInformation(); list.add(new DiskInformation(textBundle.get("TotalBlocks"), //$NON-NLS-1$ volumeHeader.getTotalBlocks())); list.add(new DiskInformation(textBundle.get("FreeBlocks"), //$NON-NLS-1$ @@ -429,8 +429,8 @@ public class ProdosFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/storage/os/rdos/RdosFileEntry.java b/src/com/webcodepro/applecommander/storage/os/rdos/RdosFileEntry.java index bbab2b6..f3f3152 100644 --- a/src/com/webcodepro/applecommander/storage/os/rdos/RdosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/rdos/RdosFileEntry.java @@ -157,7 +157,7 @@ public class RdosFileEntry implements FileEntry { * Retrieve the list of files in this directory. * Since RDOS does not support directories, this will always return null. */ - public List getFiles() { + public List getFiles() { return null; } @@ -180,10 +180,10 @@ public class RdosFileEntry implements FileEntry { * This default implementation is intended only for standard mode. * displayMode is specified in FormattedDisk. */ - public List getFileColumnData(int displayMode) { + public List getFileColumnData(int displayMode) { NumberFormat numberFormat = NumberFormat.getNumberInstance(); - List list = new ArrayList(); + List list = new ArrayList<>(); switch (displayMode) { case FormattedDisk.FILE_DISPLAY_NATIVE: list.add(getFiletype()); diff --git a/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java index 3b45b0d..408eaef 100644 --- a/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java @@ -182,8 +182,8 @@ public class RdosFormatDisk extends FormattedDisk { /** * Retrieve a list of files. */ - public List getFiles() { - List files = new ArrayList(); + public List getFiles() { + List files = new ArrayList<>(); for (int b=13; b<23; b++) { byte[] data = readRdosBlock(b); for (int i=0; i getDiskInformation() { + List list = super.getDiskInformation(); list.add(new DiskInformation(textBundle.get("TotalBlocks"), BLOCKS_ON_DISK)); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$ @@ -309,8 +309,8 @@ public class RdosFormatDisk extends FormattedDisk { * Get the standard file column header information. * This default implementation is intended only for standard mode. */ - public List getFileColumnHeaders(int displayMode) { - List list = new ArrayList(); + public List getFileColumnHeaders(int displayMode) { + List list = new ArrayList<>(); switch (displayMode) { case FILE_DISPLAY_NATIVE: list.add(new FileColumnHeader(textBundle.get("Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/ui/AppleCommander.java b/src/com/webcodepro/applecommander/ui/AppleCommander.java index c709921..bbb0bb7 100644 --- a/src/com/webcodepro/applecommander/ui/AppleCommander.java +++ b/src/com/webcodepro/applecommander/ui/AppleCommander.java @@ -79,14 +79,14 @@ public class AppleCommander { * command-line version. */ protected static void launchSwtAppleCommander(String[] args) { - Class swtAppleCommander; + Class swtAppleCommander; try { swtAppleCommander = Class.forName( "com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$ Object object = swtAppleCommander.newInstance(); Method launchMethod = swtAppleCommander. - getMethod("launch", (Class[])null); //$NON-NLS-1$ - launchMethod.invoke(object, (Object[])null); + getMethod("launch", (Class[]) null); //$NON-NLS-1$ + launchMethod.invoke(object, (Object[]) null); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SecurityException e) { @@ -133,14 +133,14 @@ public class AppleCommander { * command-line version. */ protected static void launchSwingAppleCommander(String[] args) { - Class swtAppleCommander; + Class swtAppleCommander; try { swtAppleCommander = Class.forName( "com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$ Object object = swtAppleCommander.newInstance(); Method launchMethod = swtAppleCommander. - getMethod("launch", (Class[])null); //$NON-NLS-1$ - launchMethod.invoke(object, (Object[])null); + getMethod("launch", (Class[]) null); //$NON-NLS-1$ + launchMethod.invoke(object, (Object[]) null); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SecurityException e) { diff --git a/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java b/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java index ac85ae9..f5794e3 100644 --- a/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java +++ b/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java @@ -158,8 +158,8 @@ public class DiskExplorerTab { private int currentFormat = FormattedDisk.FILE_DISPLAY_STANDARD; private boolean formatChanged; - private List currentFileList; - private Map columnWidths = new HashMap(); + private List currentFileList; + private Map columnWidths = new HashMap<>(); private boolean showDeletedFiles; /** @@ -846,7 +846,7 @@ public class DiskExplorerTab { /** * Display files in the fileTable. */ - protected void fillFileTable(List fileList) { + protected void fillFileTable(List fileList) { int[] weights = sashForm.getWeights(); if (formatChanged) { @@ -1407,7 +1407,7 @@ public class DiskExplorerTab { TreeItem selection = directoryTree.getSelection()[0]; Object data = selection.getData(); DirectoryEntry directory = (DirectoryEntry) data; - List fileList = directory.getFiles(); + List fileList = directory.getFiles(); formatChanged = (currentFormat != newFormat); if (formatChanged || !fileList.equals(currentFileList)) { @@ -2017,7 +2017,7 @@ public class DiskExplorerTab { return viewFileItem; } - protected List getCurrentFileList() { + protected List getCurrentFileList() { return currentFileList; } diff --git a/src/com/webcodepro/applecommander/ui/swt/FileViewerWindow.java b/src/com/webcodepro/applecommander/ui/swt/FileViewerWindow.java index 0081420..ef24896 100644 --- a/src/com/webcodepro/applecommander/ui/swt/FileViewerWindow.java +++ b/src/com/webcodepro/applecommander/ui/swt/FileViewerWindow.java @@ -99,7 +99,7 @@ public class FileViewerWindow { private Color green; private ContentTypeAdapter contentTypeAdapter; - private Map nativeFilterAdapterMap; + private Map,FilterAdapter> nativeFilterAdapterMap; private FilterAdapter nativeFilterAdapter; private FilterAdapter hexFilterAdapter; private FilterAdapter rawDumpFilterAdapter; @@ -165,7 +165,7 @@ public class FileViewerWindow { * Setup all possible specialized FilterAdapters. */ protected void createFilterAdapterMap() { - nativeFilterAdapterMap = new HashMap(); + nativeFilterAdapterMap = new HashMap<>(); nativeFilterAdapterMap.put(ApplesoftFileFilter.class, new ApplesoftFilterAdapter(this, textBundle.get("FileViewerWindow.ApplesoftButton"), //$NON-NLS-1$ diff --git a/src/com/webcodepro/applecommander/ui/swt/util/ImageManager.java b/src/com/webcodepro/applecommander/ui/swt/util/ImageManager.java index 8e08737..3a51af2 100644 --- a/src/com/webcodepro/applecommander/ui/swt/util/ImageManager.java +++ b/src/com/webcodepro/applecommander/ui/swt/util/ImageManager.java @@ -75,7 +75,7 @@ public class ImageManager { public static final String LOGO_COMPILE_WIZARD = "CompileWizardLogo.gif"; //$NON-NLS-1$ public static final String LOGO_COMPARE_IMAGE_WIZARD = "CompareImageWizardLogo.gif"; //$NON-NLS-1$ - private Map images = new HashMap(); + private Map images = new HashMap<>(); private String[] imageNames = { // Icons: ICON_DISK, ICON_STANDARD_FILE_VIEW, diff --git a/src/com/webcodepro/applecommander/ui/swt/wizard/Wizard.java b/src/com/webcodepro/applecommander/ui/swt/wizard/Wizard.java index 3f81a6e..61fe4bf 100644 --- a/src/com/webcodepro/applecommander/ui/swt/wizard/Wizard.java +++ b/src/com/webcodepro/applecommander/ui/swt/wizard/Wizard.java @@ -48,7 +48,7 @@ public abstract class Wizard { private Shell dialog; private Image logo; private String title; - private Stack wizardPanes = new Stack(); + private Stack wizardPanes = new Stack<>(); private boolean wizardCompleted; private Button backButton; private Button nextButton; @@ -109,8 +109,8 @@ public abstract class Wizard { backButton.setText(textBundle.get("BackButton")); //$NON-NLS-1$ backButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - WizardPane current = (WizardPane) getWizardPanes().pop(); - WizardPane previous = (WizardPane) getWizardPanes().peek(); + WizardPane current = getWizardPanes().pop(); + WizardPane previous = getWizardPanes().peek(); getBackButton().setEnabled(getWizardPanes().size() > 1); current.dispose(); previous.open(); @@ -220,7 +220,7 @@ public abstract class Wizard { /** * @return Returns the wizardPanes. */ - protected Stack getWizardPanes() { + protected Stack getWizardPanes() { return wizardPanes; } /** diff --git a/src/com/webcodepro/applecommander/ui/swt/wizard/importfile/ImportWizard.java b/src/com/webcodepro/applecommander/ui/swt/wizard/importfile/ImportWizard.java index 884c11a..d032e47 100644 --- a/src/com/webcodepro/applecommander/ui/swt/wizard/importfile/ImportWizard.java +++ b/src/com/webcodepro/applecommander/ui/swt/wizard/importfile/ImportWizard.java @@ -39,7 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane; */ public class ImportWizard extends Wizard { private FormattedDisk disk; - private List importSpecifications; + private List importSpecifications; /** * Constructor for ImportWizard. */ @@ -70,9 +70,9 @@ public class ImportWizard extends Wizard { /** * Get the list of ImportSpecifications. */ - public List getImportSpecifications() { + public List getImportSpecifications() { if (importSpecifications == null) { - importSpecifications = new ArrayList(); + importSpecifications = new ArrayList<>(); } return importSpecifications; }