From 4e2a69b7a93bea457b88b8c5d748d7856ef5ca9a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 12 Dec 2019 14:54:46 +0100 Subject: [PATCH] cleanup GitOrigin-RevId: 885625b9ea8799b652ff08eb3d4a07c245526d03 --- .../intellij/build/BuildTreeConsoleView.java | 1 + .../src/com/intellij/build/CompositeView.java | 1 + .../console/ConsoleViewWrapperBase.java | 3 +- .../execution/console/DuplexConsoleView.java | 15 ++++--- .../openapi/ui/ComponentContainer.java | 23 ++-------- .../intellij/ui/content/ContentManager.java | 2 + .../wm/impl/content/ToolWindowContentUi.java | 43 +++++++++++-------- .../terminal/TerminalExecutionConsole.java | 1 + .../intellij/ui/content/impl/ContentImpl.java | 1 + .../ui/content/impl/ContentManagerImpl.java | 2 +- .../ui/BaseTestsOutputConsoleView.java | 22 +++------- .../changes/ui/CommitChangeListDialog.java | 1 + .../config/execution/AntRunProfileState.java | 17 +------- 13 files changed, 55 insertions(+), 77 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/build/BuildTreeConsoleView.java b/platform/lang-impl/src/com/intellij/build/BuildTreeConsoleView.java index dc85d237a9ac..5f369493a3be 100644 --- a/platform/lang-impl/src/com/intellij/build/BuildTreeConsoleView.java +++ b/platform/lang-impl/src/com/intellij/build/BuildTreeConsoleView.java @@ -582,6 +582,7 @@ public class BuildTreeConsoleView implements ConsoleView, DataProvider, BuildCon public void allowHeavyFilters() { } + @NotNull @Override public JComponent getComponent() { return myPanel; diff --git a/platform/lang-impl/src/com/intellij/build/CompositeView.java b/platform/lang-impl/src/com/intellij/build/CompositeView.java index f4388b81668e..a868c26eefe9 100644 --- a/platform/lang-impl/src/com/intellij/build/CompositeView.java +++ b/platform/lang-impl/src/com/intellij/build/CompositeView.java @@ -109,6 +109,7 @@ public class CompositeView extends JPanel implemen return new AnAction[]{actionGroup}; } + @NotNull @Override public JComponent getComponent() { return this; diff --git a/platform/lang-impl/src/com/intellij/execution/console/ConsoleViewWrapperBase.java b/platform/lang-impl/src/com/intellij/execution/console/ConsoleViewWrapperBase.java index 970478a3b80b..6a3672399648 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/ConsoleViewWrapperBase.java +++ b/platform/lang-impl/src/com/intellij/execution/console/ConsoleViewWrapperBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// 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.execution.console; import com.intellij.execution.filters.Filter; @@ -123,6 +123,7 @@ public class ConsoleViewWrapperBase implements ConsoleView, ExecutionConsoleEx { : null; } + @NotNull @Override public JComponent getComponent() { return myDelegate.getComponent(); diff --git a/platform/lang-impl/src/com/intellij/execution/console/DuplexConsoleView.java b/platform/lang-impl/src/com/intellij/execution/console/DuplexConsoleView.java index 1322b3edf834..19175bf8e2af 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/DuplexConsoleView.java +++ b/platform/lang-impl/src/com/intellij/execution/console/DuplexConsoleView.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 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. +// 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.execution.console; import com.google.common.collect.Lists; @@ -32,7 +32,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -public class DuplexConsoleView extends JPanel implements ConsoleView, +public class DuplexConsoleView extends JPanel implements ConsoleView, ObservableConsoleView, DataProvider { private final static String PRIMARY_CONSOLE_PANEL = "PRIMARY_CONSOLE_PANEL"; @@ -204,7 +204,7 @@ public class DuplexConsoleView ext @Override public AnAction[] createConsoleActions() { List actions = Lists.newArrayList(); - actions.addAll(mergeConsoleActions(Arrays.asList(myPrimaryConsoleView.createConsoleActions()), + actions.addAll(mergeConsoleActions(Arrays.asList(myPrimaryConsoleView.createConsoleActions()), Arrays.asList(mySecondaryConsoleView.createConsoleActions()))); actions.add(mySwitchConsoleAction); @@ -220,6 +220,7 @@ public class DuplexConsoleView ext myPrimaryConsoleView.allowHeavyFilters(); } + @NotNull @Override public JComponent getComponent() { return this; @@ -265,7 +266,7 @@ public class DuplexConsoleView ext public void setDisableSwitchConsoleActionOnProcessEnd(boolean disableSwitchConsoleActionOnProcessEnd) { myDisableSwitchConsoleActionOnProcessEnd = disableSwitchConsoleActionOnProcessEnd; } - + @NotNull private List mergeConsoleActions(@NotNull List actions1, @NotNull Collection actions2) { return ContainerUtil.map(actions1, action1 -> { @@ -299,7 +300,7 @@ public class DuplexConsoleView ext DuplexConsoleView.this.getComponent().revalidate(); } } - + private class SwitchDuplexConsoleViewAction extends ToggleAction implements DumbAware { SwitchDuplexConsoleViewAction() { @@ -336,7 +337,7 @@ public class DuplexConsoleView ext } } } - + private static class MergedToggleAction extends ToggleAction implements DumbAware { @NotNull private final ToggleAction myAction1; @@ -379,5 +380,5 @@ public class DuplexConsoleView ext myAction2.actionPerformed(e); } } - + } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComponentContainer.java b/platform/platform-api/src/com/intellij/openapi/ui/ComponentContainer.java index 959181bbb943..c8fc61df1a21 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComponentContainer.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComponentContainer.java @@ -1,29 +1,14 @@ -/* - * Copyright 2000-2009 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.ui; import com.intellij.openapi.Disposable; +import org.jetbrains.annotations.NotNull; import javax.swing.*; public interface ComponentContainer extends Disposable { - + @NotNull JComponent getComponent(); - JComponent getPreferredFocusableComponent(); - + JComponent getPreferredFocusableComponent(); } diff --git a/platform/platform-api/src/com/intellij/ui/content/ContentManager.java b/platform/platform-api/src/com/intellij/ui/content/ContentManager.java index 7bf303848f5e..44a86a4b42e1 100644 --- a/platform/platform-api/src/com/intellij/ui/content/ContentManager.java +++ b/platform/platform-api/src/com/intellij/ui/content/ContentManager.java @@ -7,6 +7,7 @@ import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.util.ActionCallback; import com.intellij.openapi.util.BusyObject; import com.intellij.util.ContentsUtil; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,6 +40,7 @@ public interface ContentManager extends Disposable, BusyObject { void setSelectedContent(@NotNull Content content); @NotNull + @ApiStatus.Internal ActionCallback setSelectedContentCB(@NotNull Content content); void setSelectedContent(@NotNull Content content, boolean requestFocus); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java index cf911cea066f..b7698bbe2ff3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java @@ -172,14 +172,14 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop myManager.addContentManagerListener(new ContentManagerListener() { @Override - public void contentAdded(@NotNull final ContentManagerEvent event) { + public void contentAdded(@NotNull ContentManagerEvent event) { getCurrentLayout().contentAdded(event); event.getContent().addPropertyChangeListener(ToolWindowContentUi.this); rebuild(); } @Override - public void contentRemoved(@NotNull final ContentManagerEvent event) { + public void contentRemoved(@NotNull ContentManagerEvent event) { event.getContent().removePropertyChangeListener(ToolWindowContentUi.this); getCurrentLayout().contentRemoved(event); ensureSelectedContentVisible(); @@ -187,11 +187,11 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop } @Override - public void contentRemoveQuery(@NotNull final ContentManagerEvent event) { + public void contentRemoveQuery(@NotNull ContentManagerEvent event) { } @Override - public void selectionChanged(@NotNull final ContentManagerEvent event) { + public void selectionChanged(@NotNull ContentManagerEvent event) { ensureSelectedContentVisible(); update(); @@ -212,15 +212,17 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop } private void ensureSelectedContentVisible() { - final Content selected = myManager.getSelectedContent(); + Content selected = myManager.getSelectedContent(); if (selected == null) { myContent.removeAll(); return; } if (myContent.getComponentCount() == 1) { - final Component visible = myContent.getComponent(0); - if (visible == selected.getComponent()) return; + Component visible = myContent.getComponent(0); + if (visible == selected.getComponent()) { + return; + } } myContent.removeAll(); @@ -476,10 +478,11 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop c.putClientProperty(TOOLWINDOW_UI_INSTALLED, Boolean.TRUE); } - private void initActionGroup(DefaultActionGroup group, final Content content) { + private void initActionGroup(DefaultActionGroup group, @Nullable Content content) { if (content == null) { return; } + group.addSeparator(); group.add(new TabbedContentAction.CloseAction(content)); group.add(myCloseAllAction); @@ -512,6 +515,7 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop if (selectedContent == null && toolWindowGroup == null) { return; } + DefaultActionGroup configuredGroup = (DefaultActionGroup)ActionManager.getInstance().getAction("ToolWindowContextMenu"); DefaultActionGroup group = new DefaultActionGroup(); group.copyFromGroup(configuredGroup); @@ -527,7 +531,8 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop popupMenu.getComponent().show(comp, x, y); } - private static AnAction createSplitTabsAction(final TabbedContent content) { + @NotNull + private static AnAction createSplitTabsAction(@NotNull TabbedContent content) { return new DumbAwareAction("Split '" + content.getTitlePrefix() + "' group") { @Override public void actionPerformed(@NotNull AnActionEvent e) { @@ -536,7 +541,8 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop }; } - private static AnAction createMergeTabsAction(final ContentManager manager, final String tabPrefix) { + @NotNull + private static AnAction createMergeTabsAction(@NotNull ContentManager manager, String tabPrefix) { return new DumbAwareAction("Merge tabs to '" + tabPrefix + "' group") { @Override public void actionPerformed(@NotNull AnActionEvent e) { @@ -568,7 +574,7 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop }; } - private void processHide(final MouseEvent e) { + private void processHide(@NotNull MouseEvent e) { IdeEventQueue.getInstance().blockNextEvents(e); final Component c = e.getComponent(); if (c instanceof BaseLabel) { @@ -576,12 +582,14 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop if (tab.getContent() != null) { if (myManager.canCloseContents() && tab.getContent().isCloseable()) { myManager.removeContent(tab.getContent(), true, true, true); - } else { + } + else { if (myManager.getContentCount() == 1) { hideWindow(e); } } - } else { + } + else { hideWindow(e); } } @@ -590,7 +598,7 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop } } - private void hideWindow(final MouseEvent e) { + private void hideWindow(@NotNull MouseEvent e) { if (e.isControlDown()) { myWindow.fireHiddenSide(); } @@ -613,7 +621,7 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop return null; } - + @NotNull private CloseAction.CloseTarget computeCloseTarget() { if (myManager.canCloseContents()) { Content selected = myManager.getSelectedContent(); @@ -625,15 +633,14 @@ public final class ToolWindowContentUi extends JPanel implements ContentUI, Prop return new HideToolwindowTarget(); } - private class HideToolwindowTarget implements CloseAction.CloseTarget { + private final class HideToolwindowTarget implements CloseAction.CloseTarget { @Override public void close() { myWindow.fireHidden(); } } - private class CloseContentTarget implements CloseAction.CloseTarget { - + private final class CloseContentTarget implements CloseAction.CloseTarget { private final Content myContent; private CloseContentTarget(Content content) { diff --git a/platform/platform-impl/src/com/intellij/terminal/TerminalExecutionConsole.java b/platform/platform-impl/src/com/intellij/terminal/TerminalExecutionConsole.java index 085ffa8a2066..bc1c9a5f1254 100644 --- a/platform/platform-impl/src/com/intellij/terminal/TerminalExecutionConsole.java +++ b/platform/platform-impl/src/com/intellij/terminal/TerminalExecutionConsole.java @@ -292,6 +292,7 @@ public class TerminalExecutionConsole implements ConsoleView, ObservableConsoleV public void allowHeavyFilters() { } + @NotNull @Override public JComponent getComponent() { return myTerminalWidget.getComponent(); diff --git a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentImpl.java b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentImpl.java index c6a2719e57c8..7fbf8524cfa3 100644 --- a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentImpl.java @@ -59,6 +59,7 @@ public class ContentImpl extends UserDataHolderBase implements Content { myPinnable = isPinnable; } + @NotNull @Override public JComponent getComponent() { return myComponent; diff --git a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java index 3dfccdb26d7e..3e2458122d91 100644 --- a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java @@ -508,7 +508,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene } @Override - public void setSelectedContent(@NotNull final Content content) { + public void setSelectedContent(@NotNull Content content) { setSelectedContentCB(content); } diff --git a/platform/testRunner/src/com/intellij/execution/testframework/ui/BaseTestsOutputConsoleView.java b/platform/testRunner/src/com/intellij/execution/testframework/ui/BaseTestsOutputConsoleView.java index 527f641e0569..87b82f58088c 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/ui/BaseTestsOutputConsoleView.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/ui/BaseTestsOutputConsoleView.java @@ -1,24 +1,13 @@ -/* - * Copyright 2000-2012 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.execution.testframework.ui; import com.intellij.execution.filters.Filter; import com.intellij.execution.filters.HyperlinkInfo; import com.intellij.execution.process.ProcessHandler; -import com.intellij.execution.testframework.*; +import com.intellij.execution.testframework.AbstractTestProxy; +import com.intellij.execution.testframework.HyperLink; +import com.intellij.execution.testframework.Printable; +import com.intellij.execution.testframework.TestConsoleProperties; import com.intellij.execution.ui.ConsoleView; import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.execution.ui.ObservableConsoleView; @@ -128,6 +117,7 @@ public abstract class BaseTestsOutputConsoleView implements ConsoleView, Observa return myPrinter != null && myPrinter.canPause() && myConsole.canPause(); } + @NotNull @Override public JComponent getComponent() { return myTestResultsPanel; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index 5dc4a4494696..2ab72120c34f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -590,6 +590,7 @@ public abstract class CommitChangeListDialog extends DialogWrapper implements Si return myCommitMessageArea.getEditorField(); } + @NotNull @Override public JComponent getComponent() { return mySplitter; diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java index a2b5b6a465a9..60b0c0e1a237 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.lang.ant.config.execution; import com.intellij.execution.DefaultExecutionResult; @@ -54,6 +40,7 @@ public class AntRunProfileState implements RunProfileState { } return new DefaultExecutionResult(new ExecutionConsole() { + @NotNull @Override public JComponent getComponent() { return processHandler.getUserData(MESSAGE_VIEW);