Both TextBundle changes and DirectoryEntry change. #36
This is a change to the API, so bumping minor version as well. 1.6.0!
This commit is contained in:
parent
c82571df3c
commit
d54b14f797
|
@ -1,7 +1,7 @@
|
||||||
# Universal AppleCommander version number. Used for:
|
# Universal AppleCommander version number. Used for:
|
||||||
# - Naming JAR file.
|
# - Naming JAR file.
|
||||||
# - The build will insert this into a file that is read at run time as well.
|
# - The build will insert this into a file that is read at run time as well.
|
||||||
version=1.5.1
|
version=1.6.0-PRE
|
||||||
|
|
||||||
# Dependency versions
|
# Dependency versions
|
||||||
shkVersion=1.2.2
|
shkVersion=1.2.2
|
||||||
|
|
|
@ -40,7 +40,7 @@ public interface DirectoryEntry {
|
||||||
* return value should always be a list - a directory
|
* return value should always be a list - a directory
|
||||||
* with 0 entries returns an empty list.
|
* with 0 entries returns an empty list.
|
||||||
*/
|
*/
|
||||||
public List<FileEntry> getFiles() throws DiskException;
|
public List<? extends FileEntry> getFiles() throws DiskException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new FileEntry.
|
* Create a new FileEntry.
|
||||||
|
|
|
@ -268,7 +268,7 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
|
||||||
* Returns a null if specific filename is not located.
|
* Returns a null if specific filename is not located.
|
||||||
*/
|
*/
|
||||||
public FileEntry getFile(String filename) throws DiskException {
|
public FileEntry getFile(String filename) throws DiskException {
|
||||||
List files = getFiles();
|
List<? extends FileEntry> files = getFiles();
|
||||||
return getFile(files, filename.trim());
|
return getFile(files, filename.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,11 +277,10 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
|
||||||
* Note that in the instance of a system with directories (ie, ProDOS),
|
* Note that in the instance of a system with directories (ie, ProDOS),
|
||||||
* this really returns the first file with the given filename.
|
* this really returns the first file with the given filename.
|
||||||
*/
|
*/
|
||||||
protected FileEntry getFile(List files, String filename) throws DiskException {
|
protected FileEntry getFile(List<? extends FileEntry> files, String filename) throws DiskException {
|
||||||
FileEntry theFileEntry = null;
|
FileEntry theFileEntry = null;
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (FileEntry entry : files) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
theFileEntry = getFile(
|
theFileEntry = getFile(
|
||||||
((DirectoryEntry)entry).getFiles(), filename);
|
((DirectoryEntry)entry).getFiles(), filename);
|
||||||
|
@ -384,7 +383,7 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
|
||||||
/**
|
/**
|
||||||
* Change the physical ordering of the disk. This must be implemented by all
|
* Change the physical ordering of the disk. This must be implemented by all
|
||||||
* subclasses. See AppleUtil for common utility methods. (It is assumed that a
|
* subclasses. See AppleUtil for common utility methods. (It is assumed that a
|
||||||
* disk needs to be copied in the appropriate order - ie, by track and sector for
|
* disk needs to be copied in the appropriate order - i.e., by track and sector for
|
||||||
* a DOS type disk or by blocks in a ProDOS type disk.)
|
* a DOS type disk or by blocks in a ProDOS type disk.)
|
||||||
*/
|
*/
|
||||||
public abstract void changeImageOrder(ImageOrder imageOrder);
|
public abstract void changeImageOrder(ImageOrder imageOrder);
|
||||||
|
|
|
@ -24,7 +24,6 @@ package com.webcodepro.applecommander.storage.os.pascal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
|
@ -90,9 +89,7 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
bitmap.set(block);
|
bitmap.set(block);
|
||||||
}
|
}
|
||||||
// process through all files and mark those blocks as used
|
// process through all files and mark those blocks as used
|
||||||
Iterator files = getFiles().iterator();
|
for (PascalFileEntry entry : getFiles()) {
|
||||||
while (files.hasNext()) {
|
|
||||||
PascalFileEntry entry = (PascalFileEntry) files.next();
|
|
||||||
for (int block=entry.getFirstBlock(); block<entry.getLastBlock(); block++) {
|
for (int block=entry.getFirstBlock(); block<entry.getLastBlock(); block++) {
|
||||||
bitmap.clear(block);
|
bitmap.clear(block);
|
||||||
}
|
}
|
||||||
|
@ -139,8 +136,8 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
* Retrieve a list of files.
|
* Retrieve a list of files.
|
||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
|
||||||
*/
|
*/
|
||||||
public List<FileEntry> getFiles() {
|
public List<PascalFileEntry> getFiles() {
|
||||||
List<FileEntry> list = new ArrayList<>();
|
List<PascalFileEntry> list = new ArrayList<>();
|
||||||
byte[] directory = readDirectory();
|
byte[] directory = readDirectory();
|
||||||
// process directory blocks:
|
// process directory blocks:
|
||||||
int entrySize = ENTRY_SIZE;
|
int entrySize = ENTRY_SIZE;
|
||||||
|
@ -175,12 +172,11 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
/**
|
/**
|
||||||
* Write the revised directory.
|
* Write the revised directory.
|
||||||
*/
|
*/
|
||||||
public void putDirectory(List list) {
|
public void putDirectory(List<PascalFileEntry> files) {
|
||||||
byte[] directory = new byte[2048];
|
byte[] directory = new byte[2048];
|
||||||
int count = list.size();
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int i = 0; i < count; i++) {
|
for (PascalFileEntry fileEntry : files) {
|
||||||
byte[] entry = ((PascalFileEntry) list.get(i)).toBytes();
|
byte[] entry = fileEntry.toBytes();
|
||||||
System.arraycopy(entry, 0, directory, offset, entry.length);
|
System.arraycopy(entry, 0, directory, offset, entry.length);
|
||||||
offset += ENTRY_SIZE;
|
offset += ENTRY_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -304,11 +300,10 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
* Return the number of free blocks.
|
* Return the number of free blocks.
|
||||||
*/
|
*/
|
||||||
public int getFreeBlocks() {
|
public int getFreeBlocks() {
|
||||||
List files = getFiles();
|
List<PascalFileEntry> files = getFiles();
|
||||||
int blocksFree = getBlocksOnDisk() - 6;
|
int blocksFree = getBlocksOnDisk() - 6;
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (PascalFileEntry entry : files) {
|
||||||
PascalFileEntry entry = (PascalFileEntry) files.get(i);
|
|
||||||
blocksFree-= entry.getBlocksUsed();
|
blocksFree-= entry.getBlocksUsed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,11 +367,10 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
* Return the number of used blocks.
|
* Return the number of used blocks.
|
||||||
*/
|
*/
|
||||||
public int getUsedBlocks() {
|
public int getUsedBlocks() {
|
||||||
List files = getFiles();
|
List<PascalFileEntry> files = getFiles();
|
||||||
int blocksUsed = 6;
|
int blocksUsed = 6;
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (PascalFileEntry entry : files) {
|
||||||
PascalFileEntry entry = (PascalFileEntry) files.get(i);
|
|
||||||
blocksUsed+= entry.getBlocksUsed();
|
blocksUsed+= entry.getBlocksUsed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -642,7 +636,7 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change to a different ImageOrder. Remains in Pascal format but
|
* Change to a different ImageOrder. Remains in Pascal format but
|
||||||
* the underlying order can chage.
|
* the underlying order can change.
|
||||||
* @see ImageOrder
|
* @see ImageOrder
|
||||||
*/
|
*/
|
||||||
public void changeImageOrder(ImageOrder imageOrder) {
|
public void changeImageOrder(ImageOrder imageOrder) {
|
||||||
|
|
|
@ -24,9 +24,6 @@ import java.util.List;
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
import com.webcodepro.applecommander.storage.DiskException;
|
import com.webcodepro.applecommander.storage.DiskException;
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
import com.webcodepro.applecommander.storage.DiskFullException;
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement directory functionality.
|
* Implement directory functionality.
|
||||||
|
@ -38,7 +35,6 @@ import com.webcodepro.applecommander.util.TextBundle;
|
||||||
* @author Lisias Toledo
|
* @author Lisias Toledo
|
||||||
*/
|
*/
|
||||||
public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEntry {
|
public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEntry {
|
||||||
private TextBundle textBundle = StorageBundle.getInstance();
|
|
||||||
private ProdosSubdirectoryHeader subdirectoryHeader;
|
private ProdosSubdirectoryHeader subdirectoryHeader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,14 +62,14 @@ public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEn
|
||||||
* with 0 entries returns an empty list.
|
* with 0 entries returns an empty list.
|
||||||
* @throws DiskException
|
* @throws DiskException
|
||||||
*/
|
*/
|
||||||
public List<FileEntry> getFiles() throws DiskException {
|
public List<ProdosFileEntry> getFiles() throws DiskException {
|
||||||
return getDisk().getFiles(getSubdirectoryHeader().getFileEntryBlock());
|
return getDisk().getFiles(getSubdirectoryHeader().getFileEntryBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new FileEntry.
|
* Create a new FileEntry.
|
||||||
*/
|
*/
|
||||||
public FileEntry createFile() throws DiskFullException {
|
public ProdosFileEntry createFile() throws DiskFullException {
|
||||||
return getDisk().createFile(getSubdirectoryHeader());
|
return getDisk().createFile(getSubdirectoryHeader());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
|
||||||
*/
|
*/
|
||||||
public String getFiletype() {
|
public String getFiletype() {
|
||||||
int filetype = getFiletypeByte();
|
int filetype = getFiletypeByte();
|
||||||
return getDisk().getFiletype(filetype);
|
return ProdosFormatDisk.getFiletype(filetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFiletypeByte() {
|
public int getFiletypeByte() {
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class ProdosFormatDisk extends FormattedDisk {
|
||||||
/**
|
/**
|
||||||
* Create a FileEntry in the given directory.
|
* Create a FileEntry in the given directory.
|
||||||
*/
|
*/
|
||||||
public FileEntry createFile(ProdosCommonDirectoryHeader directory)
|
public ProdosFileEntry createFile(ProdosCommonDirectoryHeader directory)
|
||||||
throws DiskFullException {
|
throws DiskFullException {
|
||||||
|
|
||||||
int blockNumber = directory.getFileEntryBlock();
|
int blockNumber = directory.getFileEntryBlock();
|
||||||
|
@ -261,7 +261,7 @@ public class ProdosFormatDisk extends FormattedDisk {
|
||||||
* @throws DiskException
|
* @throws DiskException
|
||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
|
||||||
*/
|
*/
|
||||||
public List<FileEntry> getFiles() throws DiskException {
|
public List<ProdosFileEntry> getFiles() throws DiskException {
|
||||||
return getFiles(VOLUME_DIRECTORY_BLOCK);
|
return getFiles(VOLUME_DIRECTORY_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,8 +269,8 @@ public class ProdosFormatDisk extends FormattedDisk {
|
||||||
* Build a list of files, starting in the given block number.
|
* Build a list of files, starting in the given block number.
|
||||||
* This works for the master as well as the subdirectories.
|
* This works for the master as well as the subdirectories.
|
||||||
*/
|
*/
|
||||||
protected List<FileEntry> getFiles(int blockNumber) throws DiskException {
|
protected List<ProdosFileEntry> getFiles(int blockNumber) throws DiskException {
|
||||||
List<FileEntry> files = new ArrayList<>();
|
List<ProdosFileEntry> files = new ArrayList<>();
|
||||||
final Set<Integer> visits = new HashSet<>();
|
final Set<Integer> visits = new HashSet<>();
|
||||||
while (blockNumber != 0) {
|
while (blockNumber != 0) {
|
||||||
// Prevents a recursive catalog crawling.
|
// Prevents a recursive catalog crawling.
|
||||||
|
|
|
@ -21,7 +21,6 @@ package com.webcodepro.applecommander.storage.os.rdos;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
|
@ -103,9 +102,7 @@ public class RdosFormatDisk extends FormattedDisk {
|
||||||
bitmap.set(b);
|
bitmap.set(b);
|
||||||
}
|
}
|
||||||
// for each file, mark the blocks used
|
// for each file, mark the blocks used
|
||||||
Iterator files = getFiles().iterator();
|
for (RdosFileEntry fileEntry : getFiles()) {
|
||||||
while (files.hasNext()) {
|
|
||||||
RdosFileEntry fileEntry = (RdosFileEntry) files.next();
|
|
||||||
if (!fileEntry.isDeleted()) {
|
if (!fileEntry.isDeleted()) {
|
||||||
for (int b=0; b<fileEntry.getSizeInBlocks(); b++) {
|
for (int b=0; b<fileEntry.getSizeInBlocks(); b++) {
|
||||||
bitmap.clear(fileEntry.getStartingBlock()+b);
|
bitmap.clear(fileEntry.getStartingBlock()+b);
|
||||||
|
@ -182,8 +179,8 @@ public class RdosFormatDisk extends FormattedDisk {
|
||||||
/**
|
/**
|
||||||
* Retrieve a list of files.
|
* Retrieve a list of files.
|
||||||
*/
|
*/
|
||||||
public List<FileEntry> getFiles() {
|
public List<RdosFileEntry> getFiles() {
|
||||||
List<FileEntry> files = new ArrayList<>();
|
List<RdosFileEntry> files = new ArrayList<>();
|
||||||
for (int b=13; b<23; b++) {
|
for (int b=13; b<23; b++) {
|
||||||
byte[] data = readRdosBlock(b);
|
byte[] data = readRdosBlock(b);
|
||||||
for (int i=0; i<data.length; i+= ENTRY_LENGTH) {
|
for (int i=0; i<data.length; i+= ENTRY_LENGTH) {
|
||||||
|
@ -243,9 +240,7 @@ public class RdosFormatDisk extends FormattedDisk {
|
||||||
*/
|
*/
|
||||||
public int getUsedBlocks() {
|
public int getUsedBlocks() {
|
||||||
int used = 0;
|
int used = 0;
|
||||||
Iterator files = getFiles().iterator();
|
for (RdosFileEntry fileEntry : getFiles()) {
|
||||||
while (files.hasNext()) {
|
|
||||||
RdosFileEntry fileEntry = (RdosFileEntry) files.next();
|
|
||||||
if (!fileEntry.isDeleted()) used+= fileEntry.getSizeInBlocks();
|
if (!fileEntry.isDeleted()) used+= fileEntry.getSizeInBlocks();
|
||||||
}
|
}
|
||||||
return used;
|
return used;
|
||||||
|
|
|
@ -467,7 +467,7 @@ public class ac {
|
||||||
/**
|
/**
|
||||||
* Recursive routine to write directory and file entries.
|
* Recursive routine to write directory and file entries.
|
||||||
*/
|
*/
|
||||||
static void writeFiles(List<FileEntry> files, String directory) throws IOException, DiskException {
|
static void writeFiles(List<? extends FileEntry> files, String directory) throws IOException, DiskException {
|
||||||
for (FileEntry entry : files) {
|
for (FileEntry entry : files) {
|
||||||
if ((entry != null) && (!entry.isDeleted()) && (!entry.isDirectory())) {
|
if ((entry != null) && (!entry.isDeleted()) && (!entry.isDirectory())) {
|
||||||
FileFilter ff = entry.getSuggestedFilter();
|
FileFilter ff = entry.getSuggestedFilter();
|
||||||
|
@ -493,7 +493,7 @@ public class ac {
|
||||||
* file with the given filename.
|
* file with the given filename.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
static FileEntry getEntry(List<FileEntry> files, String fileName) throws DiskException {
|
static FileEntry getEntry(List<? extends FileEntry> files, String fileName) throws DiskException {
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (FileEntry entry : files) {
|
for (FileEntry entry : files) {
|
||||||
String entryName = entry.getFilename();
|
String entryName = entry.getFilename();
|
||||||
|
@ -523,7 +523,7 @@ public class ac {
|
||||||
FormattedDisk formattedDisk = formattedDisks[i];
|
FormattedDisk formattedDisk = formattedDisks[i];
|
||||||
System.out.print(args[d] + " ");
|
System.out.print(args[d] + " ");
|
||||||
System.out.println(formattedDisk.getDiskName());
|
System.out.println(formattedDisk.getDiskName());
|
||||||
List<FileEntry> files = formattedDisk.getFiles();
|
List<? extends FileEntry> files = formattedDisk.getFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
showFiles(files, "", display); //$NON-NLS-1$
|
showFiles(files, "", display); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ public class ac {
|
||||||
* system with directories (e.g. ProDOS), this really returns the first file
|
* system with directories (e.g. ProDOS), this really returns the first file
|
||||||
* with the given filename.
|
* with the given filename.
|
||||||
*/
|
*/
|
||||||
static void showFiles(List<FileEntry> files, String indent, int display) throws DiskException {
|
static void showFiles(List<? extends FileEntry> files, String indent, int display) throws DiskException {
|
||||||
for (FileEntry entry : files) {
|
for (FileEntry entry : files) {
|
||||||
if (!entry.isDeleted()) {
|
if (!entry.isDeleted()) {
|
||||||
List<String> data = entry.getFileColumnData(display);
|
List<String> data = entry.getFileColumnData(display);
|
||||||
|
@ -728,7 +728,7 @@ public class ac {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileEntry getEntry(FormattedDisk formattedDisk) throws DiskException {
|
public FileEntry getEntry(FormattedDisk formattedDisk) throws DiskException {
|
||||||
List<FileEntry> files = formattedDisk.getFiles();
|
List<? extends FileEntry> files = formattedDisk.getFiles();
|
||||||
FileEntry entry = null;
|
FileEntry entry = null;
|
||||||
for (int i = 0; i < path.length - 1; i++) {
|
for (int i = 0; i < path.length - 1; i++) {
|
||||||
String dirName = path[i];
|
String dirName = path[i];
|
||||||
|
@ -754,7 +754,7 @@ public class ac {
|
||||||
if (path.length == 1) {
|
if (path.length == 1) {
|
||||||
return formattedDisk.createFile();
|
return formattedDisk.createFile();
|
||||||
}
|
}
|
||||||
List<FileEntry> files = formattedDisk.getFiles();
|
List<? extends FileEntry> files = formattedDisk.getFiles();
|
||||||
DirectoryEntry dir = null, parentDir = null;
|
DirectoryEntry dir = null, parentDir = null;
|
||||||
for (int i = 0; i < path.length - 1; i++) {
|
for (int i = 0; i < path.length - 1; i++) {
|
||||||
String dirName = path[i];
|
String dirName = path[i];
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.webcodepro.applecommander.ui.swing;
|
package com.webcodepro.applecommander.ui.swing;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class DiskExplorerTab {
|
||||||
|
|
||||||
private int currentFormat = FormattedDisk.FILE_DISPLAY_STANDARD;
|
private int currentFormat = FormattedDisk.FILE_DISPLAY_STANDARD;
|
||||||
private boolean formatChanged;
|
private boolean formatChanged;
|
||||||
private List<FileEntry> currentFileList;
|
private List<? extends FileEntry> currentFileList;
|
||||||
private Map<Integer,int[]> columnWidths = new HashMap<>();
|
private Map<Integer,int[]> columnWidths = new HashMap<>();
|
||||||
private boolean showDeletedFiles;
|
private boolean showDeletedFiles;
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ public class DiskExplorerTab {
|
||||||
|
|
||||||
if (disks[i].canHaveDirectories()) {
|
if (disks[i].canHaveDirectories()) {
|
||||||
try {
|
try {
|
||||||
Iterator<FileEntry> files = disks[i].getFiles().iterator();
|
Iterator<? extends FileEntry> files = disks[i].getFiles().iterator();
|
||||||
while (files.hasNext()) {
|
while (files.hasNext()) {
|
||||||
FileEntry entry = (FileEntry) files.next();
|
FileEntry entry = (FileEntry) files.next();
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
|
@ -864,7 +864,7 @@ public class DiskExplorerTab {
|
||||||
}
|
}
|
||||||
gc.dispose();
|
gc.dispose();
|
||||||
gc = null;
|
gc = null;
|
||||||
columnWidths.put(new Integer(format), headerWidths);
|
columnWidths.put(Integer.valueOf(format), headerWidths);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Preserve the column widths.
|
* Preserve the column widths.
|
||||||
|
@ -875,12 +875,12 @@ public class DiskExplorerTab {
|
||||||
for (int i=0; i<columns.length; i++) {
|
for (int i=0; i<columns.length; i++) {
|
||||||
widths[i] = columns[i].getWidth();
|
widths[i] = columns[i].getWidth();
|
||||||
}
|
}
|
||||||
columnWidths.put(new Integer(currentFormat), widths);
|
columnWidths.put(Integer.valueOf(currentFormat), widths);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Display files in the fileTable.
|
* Display files in the fileTable.
|
||||||
*/
|
*/
|
||||||
protected void fillFileTable(List<FileEntry> fileList) {
|
protected void fillFileTable(List<? extends FileEntry> fileList) {
|
||||||
int[] weights = sashForm.getWeights();
|
int[] weights = sashForm.getWeights();
|
||||||
|
|
||||||
if (formatChanged) {
|
if (formatChanged) {
|
||||||
|
@ -922,7 +922,7 @@ public class DiskExplorerTab {
|
||||||
});
|
});
|
||||||
TableColumn column = null;
|
TableColumn column = null;
|
||||||
List<FileColumnHeader> headers = disks[0].getFileColumnHeaders(currentFormat);
|
List<FileColumnHeader> headers = disks[0].getFileColumnHeaders(currentFormat);
|
||||||
int[] widths = (int[])columnWidths.get(new Integer(currentFormat));
|
int[] widths = (int[])columnWidths.get(Integer.valueOf(currentFormat));
|
||||||
for (int i=0; i<headers.size(); i++) {
|
for (int i=0; i<headers.size(); i++) {
|
||||||
FileColumnHeader header = (FileColumnHeader) headers.get(i);
|
FileColumnHeader header = (FileColumnHeader) headers.get(i);
|
||||||
int align = header.isCenterAlign() ? SWT.CENTER :
|
int align = header.isCenterAlign() ? SWT.CENTER :
|
||||||
|
@ -941,9 +941,7 @@ public class DiskExplorerTab {
|
||||||
fileTable.removeAll();
|
fileTable.removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<FileEntry> files = fileList.iterator();
|
for (FileEntry entry : fileList) {
|
||||||
while (files.hasNext()) {
|
|
||||||
FileEntry entry = (FileEntry) files.next();
|
|
||||||
if (showDeletedFiles || !entry.isDeleted()) {
|
if (showDeletedFiles || !entry.isDeleted()) {
|
||||||
TableItem item = new TableItem(fileTable, 0);
|
TableItem item = new TableItem(fileTable, 0);
|
||||||
List<String> data = entry.getFileColumnData(currentFormat);
|
List<String> data = entry.getFileColumnData(currentFormat);
|
||||||
|
@ -1042,7 +1040,7 @@ public class DiskExplorerTab {
|
||||||
int answer = SwtUtil.showOkCancelErrorDialog(shell,
|
int answer = SwtUtil.showOkCancelErrorDialog(shell,
|
||||||
textBundle.get("ExportErrorTitle"), //$NON-NLS-1$
|
textBundle.get("ExportErrorTitle"), //$NON-NLS-1$
|
||||||
textBundle.format("ExportErrorMessage", //$NON-NLS-1$
|
textBundle.format("ExportErrorMessage", //$NON-NLS-1$
|
||||||
new Object[] { filename, errorMessage }));
|
filename, errorMessage));
|
||||||
if (answer == SWT.CANCEL) break; // break out of loop
|
if (answer == SWT.CANCEL) break; // break out of loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1106,7 @@ public class DiskExplorerTab {
|
||||||
int answer = SwtUtil.showOkCancelErrorDialog(shell,
|
int answer = SwtUtil.showOkCancelErrorDialog(shell,
|
||||||
textBundle.get("UnableToCompileTitle"), //$NON-NLS-1$
|
textBundle.get("UnableToCompileTitle"), //$NON-NLS-1$
|
||||||
textBundle.format("UnableToCompileMessage", //$NON-NLS-1$
|
textBundle.format("UnableToCompileMessage", //$NON-NLS-1$
|
||||||
new Object[] { filename, errorMessage }));
|
filename, errorMessage));
|
||||||
if (answer == SWT.CANCEL) break; // break out of loop
|
if (answer == SWT.CANCEL) break; // break out of loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1190,7 +1188,7 @@ public class DiskExplorerTab {
|
||||||
ImportSpecification spec =
|
ImportSpecification spec =
|
||||||
(ImportSpecification) specs.get(i);
|
(ImportSpecification) specs.get(i);
|
||||||
countLabel.setText(textBundle.format("FileNofM", //$NON-NLS-1$
|
countLabel.setText(textBundle.format("FileNofM", //$NON-NLS-1$
|
||||||
new Object[] { new Integer(i+1), new Integer(specs.size()) }));
|
i+1, specs.size()));
|
||||||
nameLabel.setText(spec.getSourceFilename());
|
nameLabel.setText(spec.getSourceFilename());
|
||||||
progressBar.setSelection(i);
|
progressBar.setSelection(i);
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
@ -1248,9 +1246,7 @@ public class DiskExplorerTab {
|
||||||
* @throws DiskException
|
* @throws DiskException
|
||||||
*/
|
*/
|
||||||
protected void addDirectoriesToTree(TreeItem directoryItem, DirectoryEntry directoryEntry) throws DiskException {
|
protected void addDirectoriesToTree(TreeItem directoryItem, DirectoryEntry directoryEntry) throws DiskException {
|
||||||
Iterator<FileEntry> files = directoryEntry.getFiles().iterator();
|
for (final FileEntry entry : directoryEntry.getFiles()) {
|
||||||
while (files.hasNext()) {
|
|
||||||
final FileEntry entry = (FileEntry) files.next();
|
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
TreeItem item = new TreeItem(directoryItem, SWT.BORDER);
|
TreeItem item = new TreeItem(directoryItem, SWT.BORDER);
|
||||||
item.setText(entry.getFilename());
|
item.setText(entry.getFilename());
|
||||||
|
@ -1473,7 +1469,7 @@ public class DiskExplorerTab {
|
||||||
TreeItem selection = directoryTree.getSelection()[0];
|
TreeItem selection = directoryTree.getSelection()[0];
|
||||||
Object data = selection.getData();
|
Object data = selection.getData();
|
||||||
DirectoryEntry directory = (DirectoryEntry) data;
|
DirectoryEntry directory = (DirectoryEntry) data;
|
||||||
List<FileEntry> fileList = directory.getFiles();
|
List<? extends FileEntry> fileList = directory.getFiles();
|
||||||
|
|
||||||
formatChanged = (currentFormat != newFormat);
|
formatChanged = (currentFormat != newFormat);
|
||||||
if (formatChanged || !fileList.equals(currentFileList)) {
|
if (formatChanged || !fileList.equals(currentFileList)) {
|
||||||
|
@ -1482,7 +1478,7 @@ public class DiskExplorerTab {
|
||||||
fillFileTable(fileList);
|
fillFileTable(fileList);
|
||||||
|
|
||||||
// Ensure that the control buttons are set appropriately.
|
// Ensure that the control buttons are set appropriately.
|
||||||
// Primarly required for keyboard interface.
|
// Primarily required for keyboard interface.
|
||||||
standardFormatToolItem.setSelection(
|
standardFormatToolItem.setSelection(
|
||||||
currentFormat == FormattedDisk.FILE_DISPLAY_STANDARD);
|
currentFormat == FormattedDisk.FILE_DISPLAY_STANDARD);
|
||||||
nativeFormatToolItem.setSelection(
|
nativeFormatToolItem.setSelection(
|
||||||
|
@ -1544,7 +1540,7 @@ public class DiskExplorerTab {
|
||||||
SWT.ICON_ERROR | SWT.CLOSE);
|
SWT.ICON_ERROR | SWT.CLOSE);
|
||||||
box.setText(textBundle.get("SaveDiskImageErrorTitle")); //$NON-NLS-1$
|
box.setText(textBundle.get("SaveDiskImageErrorTitle")); //$NON-NLS-1$
|
||||||
box.setMessage(textBundle.format("SaveDiskImageErrorMessage", //$NON-NLS-1$
|
box.setMessage(textBundle.format("SaveDiskImageErrorMessage", //$NON-NLS-1$
|
||||||
new Object[] { getDisk(0).getFilename(), errorMessage }));
|
getDisk(0).getFilename(), errorMessage));
|
||||||
box.open();
|
box.open();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1894,9 +1890,7 @@ public class DiskExplorerTab {
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
protected void printFiles(DirectoryEntry directory, int level) throws DiskException {
|
protected void printFiles(DirectoryEntry directory, int level) throws DiskException {
|
||||||
Iterator<FileEntry> iterator = directory.getFiles().iterator();
|
for (FileEntry fileEntry : directory.getFiles()) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
FileEntry fileEntry = (FileEntry) iterator.next();
|
|
||||||
if (!fileEntry.isDeleted() || isShowDeletedFiles()) {
|
if (!fileEntry.isDeleted() || isShowDeletedFiles()) {
|
||||||
List<String> columns = fileEntry.getFileColumnData(getCurrentFormat());
|
List<String> columns = fileEntry.getFileColumnData(getCurrentFormat());
|
||||||
for (int i=0; i<columns.size(); i++) {
|
for (int i=0; i<columns.size(); i++) {
|
||||||
|
@ -2099,7 +2093,7 @@ public class DiskExplorerTab {
|
||||||
return viewFileItem;
|
return viewFileItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<FileEntry> getCurrentFileList() {
|
protected List<? extends FileEntry> getCurrentFileList() {
|
||||||
return currentFileList;
|
return currentFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.ui.swt;
|
package com.webcodepro.applecommander.ui.swt;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.CTabFolder;
|
import org.eclipse.swt.custom.CTabFolder;
|
||||||
import org.eclipse.swt.custom.CTabItem;
|
import org.eclipse.swt.custom.CTabItem;
|
||||||
|
@ -112,10 +110,8 @@ public class DiskInfoTab {
|
||||||
* Build the table describing the given disk.
|
* Build the table describing the given disk.
|
||||||
*/
|
*/
|
||||||
public void buildDiskInfoTable(FormattedDisk disk) {
|
public void buildDiskInfoTable(FormattedDisk disk) {
|
||||||
Iterator iterator = disk.getDiskInformation().iterator();
|
|
||||||
TableItem item = null;
|
TableItem item = null;
|
||||||
while (iterator.hasNext()) {
|
for (DiskInformation diskinfo : disk.getDiskInformation()) {
|
||||||
DiskInformation diskinfo = (DiskInformation) iterator.next();
|
|
||||||
item = new TableItem(infoTable, SWT.NULL);
|
item = new TableItem(infoTable, SWT.NULL);
|
||||||
item.setText(new String[] { diskinfo.getLabel(), diskinfo.getValue() });
|
item.setText(new String[] { diskinfo.getLabel(), diskinfo.getValue() });
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class CompareDisksResultsPane extends WizardPane {
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
errorMessages.append(textBundle.
|
errorMessages.append(textBundle.
|
||||||
format("CompareDisksResultsPane.UnableToLoadDiskN", //$NON-NLS-1$
|
format("CompareDisksResultsPane.UnableToLoadDiskN", //$NON-NLS-1$
|
||||||
new Object[] { new Integer(1), t.getLocalizedMessage() }));
|
1, t.getLocalizedMessage()));
|
||||||
}
|
}
|
||||||
FormattedDisk[] disk2 = null;
|
FormattedDisk[] disk2 = null;
|
||||||
try {
|
try {
|
||||||
|
@ -108,7 +108,7 @@ public class CompareDisksResultsPane extends WizardPane {
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
errorMessages.append(textBundle.
|
errorMessages.append(textBundle.
|
||||||
format("CompareDisksResultsPane.UnableToLoadDiskN", //$NON-NLS-1$
|
format("CompareDisksResultsPane.UnableToLoadDiskN", //$NON-NLS-1$
|
||||||
new Object[] { new Integer(2), t.getLocalizedMessage() }));
|
2, t.getLocalizedMessage()));
|
||||||
}
|
}
|
||||||
if (disk1 != null && disk2 != null) {
|
if (disk1 != null && disk2 != null) {
|
||||||
if (disk1.length != disk2.length) {
|
if (disk1.length != disk2.length) {
|
||||||
|
|
|
@ -164,6 +164,6 @@ public class CompareDisksStartPane extends WizardPane {
|
||||||
}
|
}
|
||||||
protected String getDiskLabel(int diskNumber) {
|
protected String getDiskLabel(int diskNumber) {
|
||||||
return textBundle.format("CompareDisksStartPane.DiskNLabel", //$NON-NLS-1$
|
return textBundle.format("CompareDisksStartPane.DiskNLabel", //$NON-NLS-1$
|
||||||
new Object[] { new Integer(diskNumber) });
|
diskNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,13 +98,11 @@ public class DiskImageNamePane extends WizardPane {
|
||||||
if (wizard.isFormatProdos() || wizard.isFormatPascal()) {
|
if (wizard.isFormatProdos() || wizard.isFormatPascal()) {
|
||||||
int maxLength = wizard.isFormatProdos() ? 15 : 7;
|
int maxLength = wizard.isFormatProdos() ? 15 : 7;
|
||||||
label = new Label(control, SWT.WRAP);
|
label = new Label(control, SWT.WRAP);
|
||||||
Object[] objects = new Object[2];
|
String name = wizard.isFormatProdos()
|
||||||
objects[0] = wizard.isFormatProdos()
|
|
||||||
? textBundle.get("Prodos") //$NON-NLS-1$
|
? textBundle.get("Prodos") //$NON-NLS-1$
|
||||||
: textBundle.get("Pascal"); //$NON-NLS-1$
|
: textBundle.get("Pascal"); //$NON-NLS-1$
|
||||||
objects[1] = new Integer(maxLength);
|
|
||||||
label.setText(textBundle.format(
|
label.setText(textBundle.format(
|
||||||
"DiskImageNameLengthText", objects)); //$NON-NLS-1$
|
"DiskImageNameLengthText", name, maxLength)); //$NON-NLS-1$
|
||||||
final Text volumeName = new Text(control, SWT.BORDER);
|
final Text volumeName = new Text(control, SWT.BORDER);
|
||||||
volumeName.setText(wizard.getVolumeName());
|
volumeName.setText(wizard.getVolumeName());
|
||||||
volumeName.setTextLimit(maxLength);
|
volumeName.setTextLimit(maxLength);
|
||||||
|
|
|
@ -69,52 +69,12 @@ public class TextBundle {
|
||||||
return resourceBundle.getString(name);
|
return resourceBundle.getString(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Format the given resource name with a single String value.
|
|
||||||
*/
|
|
||||||
public String format(String name, String value) {
|
|
||||||
return format(name, new Object[] { value });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the given resource name with multiple values.
|
* Format the given resource name with multiple values.
|
||||||
*/
|
*/
|
||||||
public String format(String name, Object[] values) {
|
public String format(String name, Object... values) {
|
||||||
String resourceValue = get(name);
|
String resourceValue = get(name);
|
||||||
MessageFormat messageFormat = new MessageFormat(resourceValue);
|
MessageFormat messageFormat = new MessageFormat(resourceValue);
|
||||||
return messageFormat.format(values);
|
return messageFormat.format(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Format the given resource name with one integer.
|
|
||||||
*/
|
|
||||||
public String format(String name, int value1) {
|
|
||||||
return format(name, new Object[] {
|
|
||||||
new Integer(value1) });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format the given resource name with two integers.
|
|
||||||
*/
|
|
||||||
public String format(String name, int value1, int value2) {
|
|
||||||
return format(name, new Object[] {
|
|
||||||
new Integer(value1), new Integer(value2) });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format the given resource name with three integers.
|
|
||||||
*/
|
|
||||||
public String format(String name, int value1, int value2, int value3) {
|
|
||||||
return format(name, new Object[] {
|
|
||||||
new Integer(value1), new Integer(value2),
|
|
||||||
new Integer(value3) });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format the given resource name with two integers.
|
|
||||||
*/
|
|
||||||
public String format(String name, String value1, int value2) {
|
|
||||||
return format(name, new Object[] {
|
|
||||||
value1, new Integer(value2) });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class DiskHelperTest {
|
||||||
FormattedDisk formattedDisk = formattedDisks[i];
|
FormattedDisk formattedDisk = formattedDisks[i];
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println(formattedDisk.getDiskName());
|
System.out.println(formattedDisk.getDiskName());
|
||||||
List<FileEntry> files = formattedDisk.getFiles();
|
List<? extends FileEntry> files = formattedDisk.getFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
showFiles(files, ""); //$NON-NLS-1$
|
showFiles(files, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class DiskHelperTest {
|
||||||
return formattedDisks;
|
return formattedDisks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showFiles(List<FileEntry> files, String indent) throws DiskException {
|
protected void showFiles(List<? extends FileEntry> files, String indent) throws DiskException {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = files.get(i);
|
FileEntry entry = files.get(i);
|
||||||
if (!entry.isDeleted()) {
|
if (!entry.isDeleted()) {
|
||||||
|
|
|
@ -384,7 +384,7 @@ public class DiskWriterTest {
|
||||||
FormattedDisk formattedDisk = formattedDisks[i];
|
FormattedDisk formattedDisk = formattedDisks[i];
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println(formattedDisk.getDiskName());
|
System.out.println(formattedDisk.getDiskName());
|
||||||
List<FileEntry> files = formattedDisk.getFiles();
|
List<? extends FileEntry> files = formattedDisk.getFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
showFiles(files, "", false); //$NON-NLS-1$
|
showFiles(files, "", false); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ public class DiskWriterTest {
|
||||||
/**
|
/**
|
||||||
* Display a list of files.
|
* Display a list of files.
|
||||||
*/
|
*/
|
||||||
protected void showFiles(List<FileEntry> files, String indent, boolean showDeleted) throws DiskException {
|
protected void showFiles(List<? extends FileEntry> files, String indent, boolean showDeleted) throws DiskException {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = (FileEntry) files.get(i);
|
||||||
if (showDeleted || !entry.isDeleted()) {
|
if (showDeleted || !entry.isDeleted()) {
|
||||||
|
@ -482,7 +482,7 @@ public class DiskWriterTest {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
// Remove the files:
|
// Remove the files:
|
||||||
List<FileEntry> files = disk.getFiles();
|
List<? extends FileEntry> files = disk.getFiles();
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = (FileEntry) files.get(i);
|
||||||
entry.delete();
|
entry.delete();
|
||||||
|
@ -506,7 +506,7 @@ public class DiskWriterTest {
|
||||||
System.out.println("Exercising create, delete, create sequence " //$NON-NLS-1$
|
System.out.println("Exercising create, delete, create sequence " //$NON-NLS-1$
|
||||||
+ "on disk " + disk.getDiskName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ "on disk " + disk.getDiskName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
writeFile(disk, 5432, filetype, false);
|
writeFile(disk, 5432, filetype, false);
|
||||||
List<FileEntry> files = disk.getFiles();
|
List<? extends FileEntry> files = disk.getFiles();
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = (FileEntry) files.get(i);
|
||||||
entry.delete();
|
entry.delete();
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class AppleSingleTest {
|
||||||
|
|
||||||
Disk disk = new Disk(tmpImageName);
|
Disk disk = new Disk(tmpImageName);
|
||||||
FormattedDisk formattedDisk = disk.getFormattedDisks()[0];
|
FormattedDisk formattedDisk = disk.getFormattedDisks()[0];
|
||||||
List<FileEntry> files = formattedDisk.getFiles();
|
List<? extends FileEntry> files = formattedDisk.getFiles();
|
||||||
assertNotNull(files);
|
assertNotNull(files);
|
||||||
assertEquals(1, files.size());
|
assertEquals(1, files.size());
|
||||||
ProdosFileEntry file = (ProdosFileEntry)files.get(0);
|
ProdosFileEntry file = (ProdosFileEntry)files.get(0);
|
||||||
|
|
Loading…
Reference in New Issue