Skip to content

Commit

Permalink
Comment and bugfix:
Browse files Browse the repository at this point in the history
-Commented PagesConcurrentHashMap
-Fixed openShow() in DS2MenuBar to correctly handle cancellation and errors
  • Loading branch information
EvanBelcher committed Jan 8, 2017
1 parent 24ae416 commit 0783445
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
@SuppressWarnings("SynchronizeOnNonFinalField") public class Main {

private static final String stateFileName = "STATE";
//private static ConcurrentHashMap<Integer, Page> pageMap;
private static PagesConcurrentHashMap pageMap;
private static State state;
private static GraphicsRunner graphicsRunner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import java.awt.*;
import java.util.concurrent.ConcurrentHashMap;

/**
* Holds the pages as well as the field in order to scale properly among different screen sizes
*
* @author Evan Belcher
*/
public class PagesConcurrentHashMap {

private ConcurrentHashMap<Integer, Page> pages;
Expand Down Expand Up @@ -49,6 +54,9 @@ public void fixPoints(Rectangle newField) {
}
}

/**
* Returns the pages map
*/
public ConcurrentHashMap<Integer, Page> getPages() {
return pages;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,11 @@ private void openShow() throws InterruptedException {
do {
returnVal = fc.showOpenDialog(this);
file = fc.getSelectedFile();
} while (!file.exists());

String name, path;

}
while (returnVal != JFileChooser.CANCEL_OPTION && returnVal != JFileChooser.ERROR_OPTION && !file.exists());
if (returnVal == JFileChooser.APPROVE_OPTION) {
try {
String name, path;
path = file.getCanonicalPath();
path = path.substring(0, path.lastIndexOf('\\') + 1);
name = file.getName().toLowerCase().endsWith(".ds2") ? file.getName() : file.getName() + ".ds2";
Expand Down

0 comments on commit 0783445

Please sign in to comment.