Adjusting the coding format as suggested in:

https://github.com/AppleCommander/AppleCommander/pull/19#pullrequestreview-82711570
This commit is contained in:
Lisias 2018-01-07 19:12:46 -02:00
parent 5c77c57aa2
commit ae66b88e0a
3 changed files with 86 additions and 71 deletions

View File

@ -288,13 +288,15 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
if (files != null) {
for (int i=0; i<files.size(); i++) {
FileEntry entry = (FileEntry) files.get(i);
if (entry.isDirectory()) try {
theFileEntry = getFile(
((DirectoryEntry)entry).getFiles(), filename);
if (theFileEntry != null) break;
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
if (entry.isDirectory()) {
try {
theFileEntry = getFile(
((DirectoryEntry)entry).getFiles(), filename);
if (theFileEntry != null) break;
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
}
String otherFilename = entry.getFilename();
if (otherFilename != null) otherFilename = otherFilename.trim();
if (filename.equalsIgnoreCase(otherFilename)) {

View File

@ -330,11 +330,13 @@ public class ac {
directory = "."+File.separator;
}
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
for (int i = 0; i < formattedDisks.length; i++) try {
FormattedDisk formattedDisk = formattedDisks[i];
writeFiles(formattedDisk.getFiles(), directory);
} catch (DiskException e) {
// FIXME How to warn user about the problem?
for (int i = 0; i < formattedDisks.length; i++) {
try {
FormattedDisk formattedDisk = formattedDisks[i];
writeFiles(formattedDisk.getFiles(), directory);
} catch (DiskException e) {
// FIXME How to warn user about the problem?
}
}
}
@ -357,10 +359,12 @@ public class ac {
OutputStream output = new FileOutputStream(file);
output.write(buf, 0, buf.length);
output.close();
} else if (entry.isDirectory()) try {
writeFiles(((DirectoryEntry) entry).getFiles(),directory+entry.getFilename()+File.separator);
} catch (DiskException e) {
// FIXME How to warn user about the problem?
} else if (entry.isDirectory()) {
try {
writeFiles(((DirectoryEntry) entry).getFiles(),directory+entry.getFilename()+File.separator);
} catch (DiskException e) {
// FIXME How to warn user about the problem?
}
}
}
}
@ -441,11 +445,13 @@ public class ac {
}
System.out.println();
}
if (entry.isDirectory()) try {
showFiles(((DirectoryEntry) entry).getFiles(),
indent + " ", display); //$NON-NLS-1$
} catch (DiskException e) {
// FIXME How to warn user about the problem?
if (entry.isDirectory()) {
try {
showFiles(((DirectoryEntry) entry).getFiles(),
indent + " ", display); //$NON-NLS-1$
} catch (DiskException e) {
// FIXME How to warn user about the problem?
}
}
}
}

View File

@ -258,20 +258,22 @@ public class DiskExplorerTab {
diskItem.setData(disks[i]);
directoryTree.setSelection(new TreeItem[] { diskItem });
if (disks[i].canHaveDirectories()) try {
Iterator files = disks[i].getFiles().iterator();
while (files.hasNext()) {
FileEntry entry = (FileEntry) files.next();
if (entry.isDirectory()) {
TreeItem item = new TreeItem(diskItem, SWT.BORDER);
item.setText(entry.getFilename());
item.setData(entry);
addDirectoriesToTree(item, (DirectoryEntry)entry);
if (disks[i].canHaveDirectories()) {
try {
Iterator files = disks[i].getFiles().iterator();
while (files.hasNext()) {
FileEntry entry = (FileEntry) files.next();
if (entry.isDirectory()) {
TreeItem item = new TreeItem(diskItem, SWT.BORDER);
item.setText(entry.getFilename());
item.setData(entry);
addDirectoriesToTree(item, (DirectoryEntry)entry);
}
}
}
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
}
}
computeColumnWidths(FormattedDisk.FILE_DISPLAY_STANDARD);
@ -1368,11 +1370,13 @@ public class DiskExplorerTab {
viewFileItem.setEnabled(false);
viewFileItem.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent event) {
if (event.detail != SWT.ARROW) try {
viewFile(null);
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
if (event.detail != SWT.ARROW) {
try {
viewFile(null);
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
}
}
});
printToolItem = new ToolItem(toolBar, SWT.PUSH);
@ -1682,40 +1686,43 @@ public class DiskExplorerTab {
saveAs();
break;
}
} else try {
switch (event.character) {
case CTRL_I: // Import Wizard
importFiles();
break;
case CTRL_P: // Print...
print();
break;
case CTRL_S: // Save
if (getSaveToolItem().isEnabled()) {
save();
}
break;
}
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
} else {
try {
switch (event.character) {
case CTRL_I: // Import Wizard
importFiles();
break;
case CTRL_P: // Print...
print();
break;
case CTRL_S: // Save
if (getSaveToolItem().isEnabled()) {
save();
}
break;
}
} catch (DiskException e) {
// FIXME how to warn the User about this?
}
}
} else { // No CTRL key
if ((event.stateMask & SWT.ALT) != SWT.ALT) // Ignore ALT key combinations like alt-F4!
try { switch (event.keyCode) {
case SWT.F2: // Standard file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_STANDARD);
break;
case SWT.F3: // Native file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_NATIVE);
break;
case SWT.F4: // Detail file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_DETAIL);
break;
case SWT.F5: // Show deleted files
setShowDeletedFiles(!getShowDeletedFilesToolItem().getSelection());
getShowDeletedFilesToolItem().setSelection(isShowDeletedFiles());
fillFileTable(getCurrentFileList());
break;
try {
switch (event.keyCode) {
case SWT.F2: // Standard file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_STANDARD);
break;
case SWT.F3: // Native file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_NATIVE);
break;
case SWT.F4: // Detail file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_DETAIL);
break;
case SWT.F5: // Show deleted files
setShowDeletedFiles(!getShowDeletedFilesToolItem().getSelection());
getShowDeletedFilesToolItem().setSelection(isShowDeletedFiles());
fillFileTable(getCurrentFileList());
break;
}
} catch (DiskException e) {
// FIXME how to warn the User about this?