remove deprecated StatusBarCustomComponentFactory (10 years ago), do not create memory indicator widget if not initial setting is false (part 2 - cleanup)

GitOrigin-RevId: 373458e5dc5660833eec8b7ed4df9aa962c308b9
This commit is contained in:
Vladimir Krivosheev
2019-06-08 20:10:06 +03:00
committed by intellij-monorepo-bot
parent 40b78decfb
commit 649c46f93d
5 changed files with 24 additions and 22 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2019 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.wm;
import com.intellij.openapi.Disposable;
@@ -110,8 +96,12 @@ public interface StatusBar extends StatusBarInfo, Disposable {
StatusBar findChild(Component c);
@Nullable
IdeFrame getFrame();
@Nullable
Project getProject();
void install(IdeFrame frame);
class Anchors {
@@ -91,10 +91,6 @@ public final class IdeRootPane extends JRootPane implements UISettingsListener,
createStatusBar(frame);
updateStatusBarVisibility();
myContentPane.add(myStatusBar, BorderLayout.SOUTH);
IdeMenuBar menu = new IdeMenuBar(ActionManagerEx.getInstanceEx(), DataManager.getInstance());
myDecoratedMenu = IdeFrameDecorator.isCustomDecoration() && frame instanceof IdeFrameEx;
@@ -266,11 +262,15 @@ public final class IdeRootPane extends JRootPane implements UISettingsListener,
setMemoryIndicatorVisible(UISettings.getInstance().getShowMemoryIndicator());
myStatusBar.addWidget(new IdeMessagePanel(frame, MessagePool.getInstance()), StatusBar.Anchors.before(MemoryUsagePanel.WIDGET_ID));
myContentPane.add(myStatusBar, BorderLayout.SOUTH);
updateStatusBarVisibility();
}
private void setMemoryIndicatorVisible(boolean visible) {
if (myMemoryWidget == null) {
if (!visible) {
myStatusBar.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 6));
return;
}
@@ -199,6 +199,12 @@ public final class TestWindowManager extends WindowManagerEx {
private static final class DummyStatusBar implements StatusBarEx {
private final Map<String, StatusBarWidget> myWidgetMap = new HashMap<>();
@Nullable
@Override
public Project getProject() {
return null;
}
@Override
public Dimension getSize() {
return new Dimension(0, 0);
@@ -6,6 +6,7 @@ import com.intellij.notification.impl.IdeNotificationArea;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.TaskInfo;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.popup.BalloonHandler;
import com.intellij.openapi.ui.popup.ListPopup;
@@ -736,6 +737,12 @@ public class IdeStatusBarImpl extends JComponent implements Accessible, StatusBa
return myFrame;
}
@Nullable
@Override
public Project getProject() {
return myFrame == null ? null : myFrame.getProject();
}
@Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
@@ -113,7 +113,7 @@ class ToolWindowsWidget extends JLabel implements CustomStatusBarWidget, StatusB
}
if (myAlarm.getActiveRequestCount() == 0) {
myAlarm.addRequest(() -> {
final IdeFrameImpl frame = ComponentUtil.getParentOfType((Class<? extends IdeFrameImpl>)IdeFrameImpl.class, (Component)this);
final IdeFrameImpl frame = ComponentUtil.getParentOfType(IdeFrameImpl.class, this);
if (frame == null) return;
List<ToolWindow> toolWindows = new ArrayList<>();
@@ -229,8 +229,7 @@ class ToolWindowsWidget extends JLabel implements CustomStatusBarWidget, StatusB
}
private boolean isActive() {
return myStatusBar != null && myStatusBar.getFrame() != null && myStatusBar.getFrame().getProject() != null && Registry
.is("ide.windowSystem.showTooWindowButtonsSwitcher");
return myStatusBar != null && myStatusBar.getProject() != null && Registry.is("ide.windowSystem.showTooWindowButtonsSwitcher");
}
@Override