GitOrigin-RevId: 7a6101d2850d7f0163866dc6cb9ef8a687c73a03
This commit is contained in:
Vladimir Krivosheev
2019-12-14 07:11:32 +00:00
committed by intellij-monorepo-bot
parent a87ed3eeeb
commit 81a2f41d2d
23 changed files with 48 additions and 84 deletions
@@ -1,22 +1,9 @@
/*
* Copyright 2000-2016 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.ide.ui;
import com.intellij.util.messages.Topic;
import org.jetbrains.annotations.NotNull;
import java.util.EventListener;
@@ -31,8 +18,7 @@ import java.util.EventListener;
*/
@FunctionalInterface
public interface UISettingsListener extends EventListener {
Topic<UISettingsListener> TOPIC = Topic.create("UI settings", UISettingsListener.class);
void uiSettingsChanged(UISettings uiSettings);
void uiSettingsChanged(@NotNull UISettings uiSettings);
}
@@ -371,7 +371,7 @@ public class KeymapUtil {
public static boolean isTooltipRequest(@NotNull KeyEvent keyEvent) {
if (ourTooltipKeysProperty == null) {
ourTooltipKeysProperty = Registry.get("ide.forcedShowTooltip");
ourTooltipKeysProperty.addListener(new RegistryValueListener.Adapter() {
ourTooltipKeysProperty.addListener(new RegistryValueListener() {
@Override
public void afterValueChanged(@NotNull RegistryValue value) {
updateTooltipRequestKey(value);
@@ -138,7 +138,7 @@ abstract class ToolWindowManager {
* tool window with specified `id` then the method returns `null`.
* @see ToolWindowId
*/
abstract fun getToolWindow(id: String): ToolWindow?
abstract fun getToolWindow(id: String?): ToolWindow?
/**
* Puts specified runnable to the tail of current command queue.
@@ -355,7 +355,7 @@ public class JBTabsImpl extends JComponent
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
for (Map.Entry<TabInfo, TabLabel> entry : myInfo2Label.entrySet()) {
entry.getKey().revalidate();
entry.getValue().updateActionLabelPosition();
@@ -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.ide.actions;
import com.intellij.openapi.actionSystem.AnAction;
@@ -14,7 +14,7 @@ import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class HideToolWindowAction extends AnAction implements DumbAware {
public final class HideToolWindowAction extends AnAction implements DumbAware {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
@@ -31,7 +31,9 @@ public class HideToolWindowAction extends AnAction implements DumbAware {
}
static boolean shouldBeHiddenByShortCut(@NotNull ToolWindowManagerEx manager, @Nullable String id) {
if (id == null) return false;
if (id == null) {
return false;
}
ToolWindow window = manager.getToolWindow(id);
return window.isVisible() && window.getType() != ToolWindowType.WINDOWED && window.getType() != ToolWindowType.FLOATING;
}
@@ -40,7 +40,7 @@ public class IdeNotificationArea extends JLabel implements UISettingsListener, C
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
updateStatus(myStatusBar != null ? myStatusBar.getProject() : null);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.editor.impl;
import com.intellij.ide.ui.UISettings;
@@ -40,7 +26,7 @@ public class EditorHeaderComponent extends JPanel implements UISettingsListener
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
boolean topBorderRequired = uiSettings.getShowNavigationBar() || uiSettings.getShowMainToolbar();
topBorderRequired = uiSettings.getEditorTabPlacement() == 0 && topBorderRequired;
setBorder(new CustomLineBorder(JBColor.border(), topBorderRequired ? 1 : 0, 0, 1, 0));
@@ -571,7 +571,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
if (!uiSettings.getShowEditorToolTip()) {
hideMyEditorPreviewHint();
}
@@ -538,7 +538,7 @@ public class EditorsSplitters extends IdePanePanel implements UISettingsListener
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
if (!myManager.getProject().isOpen()) return;
for (VirtualFile file : getOpenFiles()) {
updateFileBackgroundColor(file);
@@ -1899,7 +1899,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
*/
private final class MyUISettingsListener implements UISettingsListener {
@Override
public void uiSettingsChanged(final UISettings uiSettings) {
public void uiSettingsChanged(@NotNull final UISettings uiSettings) {
assertDispatchThread();
mySplitters.revalidate();
for (EditorsSplitters each : getAllSplitters()) {
@@ -382,7 +382,7 @@ public final class FloatingDecorator extends JDialog {
private final class MyUISettingsListener implements UISettingsListener {
@Override
public void uiSettingsChanged(final UISettings uiSettings) {
public void uiSettingsChanged(@NotNull final UISettings uiSettings) {
LOG.assertTrue(isDisplayable());
LOG.assertTrue(isShowing());
final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
@@ -288,7 +288,7 @@ public class IdeMenuBar extends JMenuBar implements IdeEventQueue.EventDispatche
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
updateMnemonicsVisibility();
myPresentationFactory.reset();
}
@@ -147,7 +147,7 @@ public abstract class ToolWindowHeader extends JPanel implements UISettingsListe
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
clearCaches();
}
@@ -713,8 +713,8 @@ open class ToolWindowManagerImpl(val project: Project) : ToolWindowManagerEx(),
}
// cannot be ToolWindowEx because of backward compatibility
override fun getToolWindow(id: String): ToolWindow? {
return idToEntry.get(id)?.toolWindow
override fun getToolWindow(id: String?): ToolWindow? {
return idToEntry.get(id ?: return null)?.toolWindow
}
fun showToolWindow(id: String) {
@@ -671,7 +671,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
ToolWindowAnchor anchor = myInfo.getAnchor();
final class MySplitter extends OnePixelSplitter implements UISettingsListener {
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
if (anchor == ToolWindowAnchor.LEFT) {
setOrientation(!uiSettings.getLeftHorizontalSplit());
}
@@ -6,7 +6,6 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ApplicationNamesInfo
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
import com.intellij.openapi.fileEditor.FileEditorManagerListener
@@ -34,17 +33,7 @@ import javax.swing.JLabel
import javax.swing.JPanel
import kotlin.math.min
open class SelectedEditorFilePath(private val onBoundsChanged: (() -> Unit)? = null ) {
companion object{
private val PROJECT_PATH_REGISTRY = Registry.get("ide.borderless.title.project.path")
private val CLASSPATH_REGISTRY = Registry.get("ide.borderless.title.classpath")
private val PRODUCT_REGISTRY = Registry.get("ide.borderless.title.product")
private val VERSION_REGISTRY = Registry.get("ide.borderless.title.version")
}
private val LOGGER = logger<SelectedEditorFilePath>()
private val projectTitle = ProjectTitlePane()
private val classTitle = ClippingTitle()
private val productTitle = DefaultPartTitle(" - ")
@@ -56,7 +45,7 @@ open class SelectedEditorFilePath(private val onBoundsChanged: (() -> Unit)? = n
private val updater = Alarm(Alarm.ThreadToUse.SWING_THREAD, ApplicationManager.getApplication())
private val UPDATER_TIMEOUT = 70
private val registryListener = object : RegistryValueListener.Adapter() {
private val registryListener = object : RegistryValueListener {
override fun afterValueChanged(value: RegistryValue) {
updateTitlePaths()
update()
@@ -110,10 +99,10 @@ open class SelectedEditorFilePath(private val onBoundsChanged: (() -> Unit)? = n
}
private fun updateTitlePaths() {
projectTitle.active = PROJECT_PATH_REGISTRY.asBoolean() || multipleSameNamed
classTitle.active = CLASSPATH_REGISTRY.asBoolean() || classPathNeeded
productTitle.active = PRODUCT_REGISTRY.asBoolean()
productVersion.active = VERSION_REGISTRY.asBoolean()
projectTitle.active = Registry.get("ide.borderless.title.project.path").asBoolean() || multipleSameNamed
classTitle.active = Registry.get("ide.borderless.title.classpath").asBoolean() || classPathNeeded
productTitle.active = Registry.get("ide.borderless.title.product").asBoolean()
productVersion.active = Registry.get("ide.borderless.title.version").asBoolean()
}
open fun getView(): JComponent {
@@ -161,10 +150,10 @@ open class SelectedEditorFilePath(private val onBoundsChanged: (() -> Unit)? = n
Disposer.register(it, disp)
disposable = disp
PROJECT_PATH_REGISTRY.addListener(registryListener, disp)
CLASSPATH_REGISTRY.addListener(registryListener, disp)
PRODUCT_REGISTRY.addListener(registryListener, disp)
VERSION_REGISTRY.addListener(registryListener, disp)
Registry.get("ide.borderless.title.project.path").addListener(registryListener, disp)
Registry.get("ide.borderless.title.classpath").addListener(registryListener, disp)
Registry.get("ide.borderless.title.product").addListener(registryListener, disp)
Registry.get("ide.borderless.title.version").addListener(registryListener, disp)
updateTitlePaths()
@@ -345,7 +334,7 @@ open class SelectedEditorFilePath(private val onBoundsChanged: (() -> Unit)? = n
}
}
label.text = titleString ?: ""
label.text = titleString
label.toolTipText = if(!isClipped) null else components.joinToString(separator = "", transform = {it.toolTipPart})
label.revalidate()
@@ -185,7 +185,7 @@ class ToolWindowsWidget extends JLabel implements CustomStatusBarWidget, StatusB
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
updateIcon();
}
@@ -185,7 +185,7 @@ public final class MacMainFrameDecorator extends IdeFrameDecorator {
//noinspection Convert2Lambda
ApplicationManager.getApplication().getMessageBus().connect(parentDisposable).subscribe(UISettingsListener.TOPIC, new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
if (CURRENT_GETTER != null) {
//noinspection AssignmentToStaticFieldFromInstanceMethod
SHOWN = CURRENT_GETTER.get();
@@ -328,7 +328,7 @@ public class ChangesViewManager implements ChangesViewEx,
myChangesPanel.setToolbarHorizontal(commitWorkflowManager.isNonModal() && isToolbarHorizontalSetting.asBoolean());
registerShortcuts(this);
isToolbarHorizontalSetting.addListener(new RegistryValueListener.Adapter() {
isToolbarHorizontalSetting.addListener(new RegistryValueListener() {
@Override
public void afterValueChanged(@NotNull RegistryValue value) {
boolean isToolbarHorizontal = value.asBoolean() && commitWorkflowManager.isNonModal();
@@ -412,14 +412,14 @@ public class ChangesViewManager implements ChangesViewEx,
setContent(simplePanel(mainPanel).addToBottom(myProgressLabel));
setCommitSplitOrientation();
isCommitSplitHorizontal.addListener(new RegistryValueListener.Adapter() {
isCommitSplitHorizontal.addListener(new RegistryValueListener() {
@Override
public void afterValueChanged(@NotNull RegistryValue value) {
setCommitSplitOrientation();
}
}, this);
isToggleCommitUi().addListener(new RegistryValueListener.Adapter() {
isToggleCommitUi().addListener(new RegistryValueListener() {
@Override
public void afterValueChanged(@NotNull RegistryValue value) {
if (myCommitWorkflowHandler == null) return;
@@ -60,9 +60,9 @@ import kotlin.properties.Delegates.observable
private val DEFAULT_COMMIT_ACTION_SHORTCUT = CustomShortcutSet(getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK))
private val isCompactCommitLegend = Registry.get("vcs.non.modal.commit.legend.compact")
private fun createHorizontalPanel(): JBPanel<*> = JBPanel<JBPanel<*>>(HorizontalLayout(scale(16), SwingConstants.CENTER))
private fun createHorizontalPanel(): JBPanel<*> {
return JBPanel<JBPanel<*>>(HorizontalLayout(scale(16), SwingConstants.CENTER))
}
private fun JBOptionButton.getBottomInset(): Int =
border?.getBorderInsets(this)?.bottom
@@ -149,8 +149,9 @@ open class ChangesViewCommitPanel(private val changesView: ChangesListView, priv
init {
Disposer.register(this, commitMessage)
val isCompactCommitLegend = Registry.get("vcs.non.modal.commit.legend.compact")
commitLegend.isCompact = isCompactCommitLegend.asBoolean()
isCompactCommitLegend.addListener(object : RegistryValueListener.Adapter() {
isCompactCommitLegend.addListener(object : RegistryValueListener {
override fun afterValueChanged(value: RegistryValue) {
commitLegend.isCompact = value.asBoolean()
}
@@ -50,7 +50,7 @@ class CommitWorkflowManager(private val project: Project) : ProjectComponent {
private fun subscribeToChanges() {
if (project.isDisposed) return
isForceNonModalCommit.addListener(object : RegistryValueListener.Adapter() {
isForceNonModalCommit.addListener(object : RegistryValueListener {
override fun afterValueChanged(value: RegistryValue) = updateWorkflow()
}, project)
@@ -36,7 +36,7 @@ public final class SvnExecutableChecker extends ExecutableValidator {
super(vcs.getProject(), getNotificationTitle(), getWrongPathMessage());
myVcs = vcs;
Registry.get(SVN_EXECUTABLE_LOCALE_REGISTRY_KEY).addListener(new RegistryValueListener.Adapter() {
Registry.get(SVN_EXECUTABLE_LOCALE_REGISTRY_KEY).addListener(new RegistryValueListener() {
@Override
public void afterValueChanged(@NotNull RegistryValue value) {
myVcs.checkCommandLineVersion();
@@ -299,7 +299,7 @@ public class TerminalView {
panel.setContent(terminalWidget.getComponent());
panel.addFocusListener(createFocusListener());
panel.uiSettingsChanged(null);
panel.updateDFState();
content.setPreferredFocusableComponent(terminalWidget.getPreferredFocusableComponent());
@@ -512,11 +512,11 @@ class TerminalToolWindowPanel extends SimpleToolWindowPanel implements UISetting
}
@Override
public void uiSettingsChanged(UISettings uiSettings) {
public void uiSettingsChanged(@NotNull UISettings uiSettings) {
updateDFState();
}
private void updateDFState() {
void updateDFState() {
if (isDfmSupportEnabled()) {
setDistractionFree(shouldMakeDistractionFree());
}