diff --git a/src/com/webcodepro/applecommander/storage/DirectoryEntry.java b/src/com/webcodepro/applecommander/storage/DirectoryEntry.java index 77e3a7a..17a2c81 100644 --- a/src/com/webcodepro/applecommander/storage/DirectoryEntry.java +++ b/src/com/webcodepro/applecommander/storage/DirectoryEntry.java @@ -43,6 +43,11 @@ public interface DirectoryEntry { * Create a new FileEntry. */ public FileEntry createFile() throws DiskFullException; + + /** + * Create a new DirectoryEntry. + */ + public DirectoryEntry createDirectory() throws DiskFullException; /** * Identify if additional directories can be created. This diff --git a/src/com/webcodepro/applecommander/storage/StorageBundle.properties b/src/com/webcodepro/applecommander/storage/StorageBundle.properties index 5bbb138..4692c54 100644 --- a/src/com/webcodepro/applecommander/storage/StorageBundle.properties +++ b/src/com/webcodepro/applecommander/storage/StorageBundle.properties @@ -22,6 +22,7 @@ SizeInBytes=Size (bytes) DiskNameN={0} (Disk {1}) Dos33=DOS 3.3 LockedQ=Locked? +DirectoryCreationNotSupported=Unable to create directories. ##### FIX ##### ############### diff --git a/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java index 5ffcd73..a759af8 100644 --- a/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/cpm/CpmFormatDisk.java @@ -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$ + } } diff --git a/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java index 1fb40d1..15a600d 100644 --- a/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java @@ -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$ + } } diff --git a/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java index 35655c7..23ed8d7 100644 --- a/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/pascal/PascalFormatDisk.java @@ -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$ + } } diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java index 8bc5a93..3946e03 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosDirectoryEntry.java @@ -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$ + } } diff --git a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java index 353dd69..369409b 100644 --- a/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/prodos/ProdosFormatDisk.java @@ -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$ + } } diff --git a/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java index 280729f..73a6817 100644 --- a/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java @@ -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$ + } } diff --git a/src/com/webcodepro/applecommander/ui/UiBundle.properties b/src/com/webcodepro/applecommander/ui/UiBundle.properties index b88c019..4f1c839 100644 --- a/src/com/webcodepro/applecommander/ui/UiBundle.properties +++ b/src/com/webcodepro/applecommander/ui/UiBundle.properties @@ -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} diff --git a/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java b/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java index 8d0ceeb..09b6ca1 100644 --- a/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java +++ b/src/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java @@ -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));