GT-3218 updates per review comments

This commit is contained in:
ghidra1
2019-10-07 17:46:41 -04:00
parent 6ece3f4f4f
commit c6158c7160
3 changed files with 14 additions and 17 deletions
@@ -225,10 +225,11 @@ public class RepositoryManager {
} }
/** /**
* Get list of all users to be returned to specified currentUser. * Get all defined users. If currentUser is an
* Anonymous user will be returned an empty list. * Anonymous user an empty array will be returned.
* @param currentUser current user * @param currentUser current user
* @return array of users known to this manager. * @return array of users known to this manager or empty array if
* we should not reveal to currentUser.
*/ */
public synchronized String[] getAllUsers(String currentUser) throws IOException { public synchronized String[] getAllUsers(String currentUser) throws IOException {
if (isAnonymousUser(currentUser)) { if (isAnonymousUser(currentUser)) {
@@ -243,9 +244,6 @@ public class RepositoryManager {
} }
} }
/**
* @return UserManager object
*/
public UserManager getUserManager() { public UserManager getUserManager() {
return userMgr; return userMgr;
} }
@@ -21,8 +21,7 @@ import ghidra.framework.store.local.LocalFileSystem;
import util.CollectionUtils; import util.CollectionUtils;
/** /**
* Utility class with static methods for validating project file names and converting * Utility class with static methods for validating project file names.
* strings to numbers, etc.
*/ */
public final class NamingUtilities { public final class NamingUtilities {
@@ -27,6 +27,7 @@ import javax.swing.text.Document;
import docking.options.editor.ButtonPanelFactory; import docking.options.editor.ButtonPanelFactory;
import docking.widgets.filechooser.GhidraFileChooser; import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.filechooser.GhidraFileChooserMode;
import docking.widgets.label.GDLabel; import docking.widgets.label.GDLabel;
import docking.wizard.AbstractWizardJPanel; import docking.wizard.AbstractWizardJPanel;
import docking.wizard.WizardManager; import docking.wizard.WizardManager;
@@ -256,7 +257,7 @@ class SelectProjectPanel extends AbstractWizardJPanel {
wm.setStatusMessage(""); wm.setStatusMessage("");
} }
projectLocator = null; projectLocator = null;
ProjectLocator projectLocator = null; ProjectLocator locator = null;
String msg = null; String msg = null;
String dir = directoryField.getText().trim(); String dir = directoryField.getText().trim();
if (dir.length() == 0) { if (dir.length() == 0) {
@@ -271,30 +272,29 @@ class SelectProjectPanel extends AbstractWizardJPanel {
projectName = projectName =
projectName.substring(0, projectName.length() - PROJECT_EXTENSION.length()); projectName.substring(0, projectName.length() - PROJECT_EXTENSION.length());
} }
if (projectName.length() == 0 || !NamingUtilities.isValidProjectName(projectName)) { if (!NamingUtilities.isValidProjectName(projectName)) {
msg = "Please specify valid project name"; msg = "Please specify valid project name";
} }
else { else {
try { try {
projectLocator = new ProjectLocator(dir, projectName); locator = new ProjectLocator(dir, projectName);
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
msg = e.getMessage(); msg = e.getMessage();
} }
} }
} }
if (projectLocator != null) { if (locator != null) {
File parentDir = new File(dir); File parentDir = new File(dir);
if (!parentDir.isDirectory()) { if (!parentDir.isDirectory()) {
msg = "Please specify a Project Directory"; msg = "Please specify a Project Directory";
} }
else if (projectLocator.getMarkerFile().exists() || else if (locator.getMarkerFile().exists() || locator.getProjectDir().exists()) {
projectLocator.getProjectDir().exists()) { msg = getProjectName("A project named " + locator.getName() +
msg = getProjectName("A project named " + projectLocator.getName() +
" already exists in " + parentDir.getAbsolutePath()); " already exists in " + parentDir.getAbsolutePath());
} }
else { else {
this.projectLocator = projectLocator; this.projectLocator = locator;
} }
} }
wm.validityChanged(); wm.validityChanged();
@@ -342,7 +342,7 @@ class SelectProjectPanel extends AbstractWizardJPanel {
if (lastDirSelected != null) { if (lastDirSelected != null) {
projectDirectory = new File(lastDirSelected); projectDirectory = new File(lastDirSelected);
} }
fileChooser.setFileSelectionMode(GhidraFileChooser.DIRECTORIES_ONLY); fileChooser.setFileSelectionMode(GhidraFileChooserMode.DIRECTORIES_ONLY);
fileChooser.setFileFilter(new GhidraFileFilter() { fileChooser.setFileFilter(new GhidraFileFilter() {
@Override @Override
public String getDescription() { public String getDescription() {