Skip to content
Permalink
Browse files

[FIXED JENKINS-25276] NestedView extends View implements ViewGroup, s…

…o need to search recursively. (#1798)
  • Loading branch information
jglick authored and oleg-nenashev committed Oct 28, 2017
1 parent f546ffc commit 65d14179bf3e134a4903652d9d8198d160cf6b85
Showing with 26 additions and 24 deletions.
  1. +26 −24 core/src/main/java/hudson/model/ListView.java
@@ -519,24 +519,25 @@ public FormValidation doCheckIncludeRegex( @QueryParameter String value ) throws
@Override
public void onLocationChanged(final Item item, final String oldFullName, final String newFullName) {
try (ACLContext _ = ACL.as(ACL.SYSTEM)) {
locationChanged(item, oldFullName, newFullName);
locationChanged(oldFullName, newFullName);
}
}
private void locationChanged(Item item, String oldFullName, String newFullName) {
private void locationChanged(String oldFullName, String newFullName) {
final Jenkins jenkins = Jenkins.getInstance();
for (View view: jenkins.getViews()) {
if (view instanceof ListView) {
renameViewItem(oldFullName, newFullName, jenkins, (ListView) view);
}
}
locationChanged(jenkins, oldFullName, newFullName);
for (Item g : jenkins.allItems()) {
if (g instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) g;
for (View v : vg.getViews()) {
if (v instanceof ListView) {
renameViewItem(oldFullName, newFullName, vg, (ListView) v);
}
}
locationChanged((ViewGroup) g, oldFullName, newFullName);
}
}
}
private void locationChanged(ViewGroup vg, String oldFullName, String newFullName) {
for (View v : vg.getViews()) {
if (v instanceof ListView) {
renameViewItem(oldFullName, newFullName, vg, (ListView) v);
}
if (v instanceof ViewGroup) {
locationChanged((ViewGroup) v, oldFullName, newFullName);
}
}
}
@@ -568,19 +569,20 @@ public void onDeleted(final Item item) {
}
private void deleted(Item item) {
final Jenkins jenkins = Jenkins.getInstance();
for (View view: jenkins.getViews()) {
if (view instanceof ListView) {
deleteViewItem(item, jenkins, (ListView) view);
}
}
deleted(jenkins, item);
for (Item g : jenkins.allItems()) {
if (g instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) g;
for (View v : vg.getViews()) {
if (v instanceof ListView) {
deleteViewItem(item, vg, (ListView) v);
}
}
deleted((ViewGroup) g, item);
}
}
}
private void deleted(ViewGroup vg, Item item) {
for (View v : vg.getViews()) {
if (v instanceof ListView) {
deleteViewItem(item, vg, (ListView) v);
}
if (v instanceof ViewGroup) {
deleted((ViewGroup) v, item);
}
}
}

0 comments on commit 65d1417

Please sign in to comment.
You can’t perform that action at this time.