Early hooks for creating directories.

This commit is contained in:
Robert Greene 2004-07-17 00:22:17 +00:00
parent 38754a05a5
commit d64a4ad95b
10 changed files with 78 additions and 5 deletions

View File

@ -44,6 +44,11 @@ public interface DirectoryEntry {
*/
public FileEntry createFile() throws DiskFullException;
/**
* Create a new DirectoryEntry.
*/
public DirectoryEntry createDirectory() throws DiskFullException;
/**
* Identify if additional directories can be created. This
* may indicate that directories are not available to this

View File

@ -22,6 +22,7 @@ SizeInBytes=Size (bytes)
DiskNameN={0} (Disk {1})
Dos33=DOS 3.3
LockedQ=Locked?
DirectoryCreationNotSupported=Unable to create directories.
##### FIX #####
###############

View File

@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import com.webcodepro.applecommander.storage.DirectoryEntry;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
@ -528,4 +529,12 @@ public class CpmFormatDisk extends FormattedDisk {
public void setFileData(FileEntry fileEntry, byte[] fileData) throws DiskFullException {
// TODO implement setFileData
}
/**
* Create a new DirectoryEntry.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#createDirectory()
*/
public DirectoryEntry createDirectory() throws DiskFullException {
throw new UnsupportedOperationException(textBundle.get("DirectoryCreationNotSupported")); //$NON-NLS-1$
}
}

View File

@ -22,6 +22,7 @@ package com.webcodepro.applecommander.storage.os.dos33;
import java.util.ArrayList;
import java.util.List;
import com.webcodepro.applecommander.storage.DirectoryEntry;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
@ -250,7 +251,7 @@ public class DosFormatDisk extends FormattedDisk {
*/
public String getDiskName() {
int volumeNumber = AppleUtil.getUnsignedByte(readVtoc()[0x06]);
return textBundle.get("DosFormatDisk.DiskVolume") + volumeNumber; //$NON-NLS-1$
return textBundle.format("DosFormatDisk.DiskVolume", volumeNumber); //$NON-NLS-1$
}
/**
@ -736,4 +737,12 @@ public class DosFormatDisk extends FormattedDisk {
AppleUtil.changeImageOrderByTrackAndSector(getImageOrder(), imageOrder);
setImageOrder(imageOrder);
}
/**
* Create a new DirectoryEntry.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#createDirectory()
*/
public DirectoryEntry createDirectory() throws DiskFullException {
throw new UnsupportedOperationException(textBundle.get("DirectoryCreationNotSupported")); //$NON-NLS-1$
}
}

View File

@ -25,6 +25,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import com.webcodepro.applecommander.storage.DirectoryEntry;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
@ -571,4 +572,12 @@ public class PascalFormatDisk extends FormattedDisk {
public void setFileData(FileEntry fileEntry, byte[] fileData) throws DiskFullException {
// TODO implement setFileData
}
/**
* Create a new DirectoryEntry.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#createDirectory()
*/
public DirectoryEntry createDirectory() throws DiskFullException {
throw new UnsupportedOperationException(textBundle.get("DirectoryCreationNotSupported")); //$NON-NLS-1$
}
}

View File

@ -24,6 +24,8 @@ import java.util.List;
import com.webcodepro.applecommander.storage.DirectoryEntry;
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.
@ -31,8 +33,8 @@ import com.webcodepro.applecommander.storage.FileEntry;
* Date Created: Mar 2, 2003
* @author Rob Greene
*/
public class ProdosDirectoryEntry extends ProdosFileEntry
implements DirectoryEntry {
public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEntry {
private TextBundle textBundle = StorageBundle.getInstance();
private ProdosSubdirectoryHeader subdirectoryHeader;
/**
@ -77,7 +79,7 @@ implements DirectoryEntry {
* to writing.
*/
public boolean canCreateDirectories() {
return false;
return true;
}
/**
@ -88,4 +90,12 @@ implements DirectoryEntry {
public boolean canCreateFile() {
return true;
}
/**
* Create a new DirectoryEntry.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#createDirectory()
*/
public DirectoryEntry createDirectory() throws DiskFullException {
throw new UnsupportedOperationException(textBundle.get("DirectoryCreationNotSupported")); //$NON-NLS-1$
}
}

View File

@ -26,6 +26,7 @@ import java.util.Date;
import java.util.List;
import java.util.Properties;
import com.webcodepro.applecommander.storage.DirectoryEntry;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
@ -340,7 +341,7 @@ public class ProdosFormatDisk extends FormattedDisk {
* to writing.
*/
public boolean canCreateDirectories() {
return false;
return true;
}
/**
@ -979,4 +980,12 @@ public class ProdosFormatDisk extends FormattedDisk {
protected ProdosVolumeDirectoryHeader getVolumeHeader() {
return volumeHeader;
}
/**
* Create a new DirectoryEntry.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#createDirectory()
*/
public DirectoryEntry createDirectory() throws DiskFullException {
throw new UnsupportedOperationException(textBundle.get("DirectoryCreationNotSupported")); //$NON-NLS-1$
}
}

View File

@ -24,6 +24,7 @@ import java.util.BitSet;
import java.util.Iterator;
import java.util.List;
import com.webcodepro.applecommander.storage.DirectoryEntry;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
@ -500,4 +501,12 @@ public class RdosFormatDisk extends FormattedDisk {
public void setFileData(FileEntry fileEntry, byte[] fileData) throws DiskFullException {
// TODO implement setFileData
}
/**
* Create a new DirectoryEntry.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#createDirectory()
*/
public DirectoryEntry createDirectory() throws DiskFullException {
throw new UnsupportedOperationException(textBundle.get("DirectoryCreationNotSupported")); //$NON-NLS-1$
}
}

View File

@ -94,6 +94,7 @@ ChangeToNibbleOrderMenuItem=Nibble Order (*.nib)
ChangeToDosOrderMenuItem=DOS Order (*.dsk)
ChangeToProdosOrderMenuItem=ProDOS Order (*.po)
FileNofM=File {0} of {1}
CreateDirectoryMenuItem=Create Directory...
# ac
CommandLineErrorMessage = Error: {0}

View File

@ -318,6 +318,17 @@ public class DiskExplorerTab {
item = new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.CASCADE);
item.setText(textBundle.get("CreateDirectoryMenuItem")); //$NON-NLS-1$
item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
// FIXME need to create directory
}
});
item.setEnabled(disks[0].canCreateDirectories());
item = new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.CASCADE);
item.setText(textBundle.get("ImportMenuItem")); //$NON-NLS-1$
item.setImage(imageManager.get(ImageManager.ICON_IMPORT_FILE));