Skip to content

Commit

Permalink
Fix project list update to maintain selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan McCauley authored and Ryan McCauley committed Jul 26, 2016
1 parent d65fb27 commit 5c3835e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ public void run(){
}
};
updateThread.start();
} else if (pane != tabs.getSelectedComponent()){
NameValuePair project = getProject();
if (project != null)
callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, project.getValue());
}
}

Expand Down Expand Up @@ -198,6 +202,9 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
Thread updateThread = new Thread() {
public void run(){
NameValuePair selected = getProject();
if(selected != null)
callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, selected.getValue());
updateProjects();
}
};
Expand Down Expand Up @@ -324,7 +331,9 @@ public String[] getTargetUrls(){
}

public NameValuePair getProject(){
return (NameValuePair)projectBox.getSelectedItem();
if(projectBox != null && projectBox.getSelectedItem() instanceof NameValuePair)
return (NameValuePair)projectBox.getSelectedItem();
return null;
}

public NameValuePair[] getProjects(){
Expand Down Expand Up @@ -449,13 +458,12 @@ private ModifiedNameValuePair[] parseProjectJson(String json, boolean ignoreMess

public void updateProjectComboBox(){
if(projectBox != null){
Object selected = projectBox.getSelectedItem();
projectBox.removeAllItems();
for(NameValuePair p: projectArr){
for(NameValuePair p: projectArr)
projectBox.addItem(p);
if (selected != null && selected.equals(p))
projectBox.setSelectedItem(p);
}
int activeProject = getSavedProjectIndex();
if(activeProject != -1)
projectBox.setSelectedIndex(activeProject);
}
}

Expand Down

0 comments on commit 5c3835e

Please sign in to comment.