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