mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
GP-0 Corrected bad behavior in repository selection dialog.
This commit is contained in:
@@ -570,7 +570,7 @@ class ProjectActionManager {
|
|||||||
ProjectManager projectManager = tool.getProjectManager();
|
ProjectManager projectManager = tool.getProjectManager();
|
||||||
projectManager.forgetViewedProject(view);
|
projectManager.forgetViewedProject(view);
|
||||||
Msg.showError(getClass(), tool.getToolFrame(), "Error Adding View",
|
Msg.showError(getClass(), tool.getToolFrame(), "Error Adding View",
|
||||||
"Failed to view project/repository: " + e.getMessage(), e);
|
"Failed to view project/repository: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.io.IOException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.MouseInputAdapter;
|
import javax.swing.event.*;
|
||||||
|
|
||||||
import docking.ReusableDialogComponentProvider;
|
import docking.ReusableDialogComponentProvider;
|
||||||
import docking.widgets.button.GButton;
|
import docking.widgets.button.GButton;
|
||||||
@@ -131,6 +131,23 @@ class RepositoryChooser extends ReusableDialogComponentProvider {
|
|||||||
|
|
||||||
urlTextField = new JTextField("ghidra:");
|
urlTextField = new JTextField("ghidra:");
|
||||||
urlTextField.getAccessibleContext().setAccessibleName("URL");
|
urlTextField.getAccessibleContext().setAccessibleName("URL");
|
||||||
|
urlTextField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeUpdate(DocumentEvent e) {
|
||||||
|
choiceChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertUpdate(DocumentEvent e) {
|
||||||
|
choiceChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changedUpdate(DocumentEvent e) {
|
||||||
|
choiceChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
JPanel panel = new JPanel(new PairLayout());
|
JPanel panel = new JPanel(new PairLayout());
|
||||||
panel.add(new GLabel("URL:"));
|
panel.add(new GLabel("URL:"));
|
||||||
@@ -255,13 +272,23 @@ class RepositoryChooser extends ReusableDialogComponentProvider {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
String urlText = urlTextField.getText();
|
String urlText = urlTextField.getText();
|
||||||
|
|
||||||
if (!GhidraURL.isGhidraURL(urlText)) {
|
if (!GhidraURL.isGhidraURL(urlText)) {
|
||||||
setStatusText("URL must specify 'ghidra:' protocol", MessageType.ERROR);
|
setStatusText("URL must specify 'ghidra:' protocol", MessageType.ERROR);
|
||||||
|
setOkEnabled(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
GhidraURL.toURL(urlText); // check ability to form URL instance
|
URL url = GhidraURL.toURL(urlText); // check ability to form URL instance
|
||||||
setOkEnabled(true);
|
|
||||||
|
if (!GhidraURL.isLocalURL(url) && !GhidraURL.isServerRepositoryURL(url)) {
|
||||||
|
setStatusText("URL must specify server repository or local project",
|
||||||
|
MessageType.ERROR);
|
||||||
|
setOkEnabled(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setOkEnabled(true);
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e) {
|
catch (IllegalArgumentException e) {
|
||||||
setStatusText(e.getMessage(), MessageType.ERROR);
|
setStatusText(e.getMessage(), MessageType.ERROR);
|
||||||
|
|||||||
Reference in New Issue
Block a user