@@ -43,29 +43,36 @@ class PlaceholderManager {
43
43
}
44
44
45
45
ComponentPlaceholder replacePlaceholder (ComponentProvider provider ,
46
- ComponentPlaceholder oldPlaceholder ) {
46
+ ComponentPlaceholder defaultPlaceholder ) {
47
47
48
- ComponentPlaceholder newPlaceholder = createOrRecyclePlaceholder (provider , oldPlaceholder );
48
+ // Note: the 'restoredPlaceholder' is from xml; the 'defaultPlaceholder' is that which was
49
+ // created by a plugin as it was constructed. If there is no placeholder in the xml,
50
+ // then the original 'defaultPlaceholder' will be returned from
51
+ // createOrRecyclePlaceholder().
52
+ ComponentPlaceholder restoredPlaceholder =
53
+ createOrRecyclePlaceholder (provider , defaultPlaceholder );
49
54
50
- moveActions (oldPlaceholder , newPlaceholder );
51
- if (!oldPlaceholder .isHeaderShowing ()) {
52
- newPlaceholder .showHeader (false );
55
+ moveActions (defaultPlaceholder , restoredPlaceholder );
56
+ if (!defaultPlaceholder .isHeaderShowing ()) {
57
+ restoredPlaceholder .showHeader (false );
53
58
}
54
59
55
- if (oldPlaceholder .isShowing () != newPlaceholder .isShowing ()) {
56
- if (newPlaceholder .isShowing ()) {
60
+ if (defaultPlaceholder .isShowing () != restoredPlaceholder .isShowing ()) {
61
+ if (restoredPlaceholder .isShowing ()) {
57
62
provider .componentShown ();
58
63
}
59
64
else {
60
65
provider .componentHidden ();
61
66
}
62
67
}
63
68
64
- if (newPlaceholder != oldPlaceholder ) {
65
- oldPlaceholder .dispose ();
66
- removePlaceholder (oldPlaceholder );
69
+ // if we have found a replacement placeholder, then remove the default placeholder
70
+ if (restoredPlaceholder != defaultPlaceholder ) {
71
+ defaultPlaceholder .dispose ();
72
+ removePlaceholder (defaultPlaceholder );
67
73
}
68
- return newPlaceholder ;
74
+
75
+ return restoredPlaceholder ;
69
76
}
70
77
71
78
/**
@@ -240,8 +247,8 @@ private ComponentPlaceholder findBestPlaceholderAnchor(
240
247
// 1) share the same owner (plugin), and
241
248
// 2) are in the same group, or related groups
242
249
//
243
- // If there are not other providers that share the same owner as the one we are given,
244
- // then we will search all providers. This allows different plugins to share
250
+ // If there are not other providers that share the same owner as the one we are given,
251
+ // then we will search all providers. This allows different plugins to share
245
252
// window arrangement.
246
253
//
247
254
Set <ComponentPlaceholder > buddies = activePlaceholders ;
@@ -275,7 +282,7 @@ private ComponentPlaceholder findBestPlaceholderAnchor(
275
282
* provider.
276
283
* @param activePlaceholders the set of currently showing placeholders.
277
284
* @param newInfo the placeholder for the new provider to be shown.
278
- * @return an existing matching placeholder or null.
285
+ * @return an existing matching placeholder or null.
279
286
*/
280
287
private ComponentPlaceholder findBestPlaceholderToStackUpon (
281
288
Set <ComponentPlaceholder > activePlaceholders , ComponentPlaceholder newInfo ) {
0 commit comments