added internal action to show 'About' popup in debug mode

In this mode it'll show rectangles around hyperlink areas so we can check that coordinates of the logo are specified in *ApplicationInfo.xml file properly.
This commit is contained in:
nik
2016-12-20 16:50:39 +03:00
parent 8901f0fa6e
commit 296b2dabff
4 changed files with 45 additions and 4 deletions
@@ -39,6 +39,6 @@ public class AboutAction extends AnAction implements DumbAware {
}
public static void perform(@Nullable Project project) {
AboutPopup.show(WindowManager.getInstance().suggestParentWindow(project));
AboutPopup.show(WindowManager.getInstance().suggestParentWindow(project), false);
}
}
@@ -67,13 +67,13 @@ public class AboutPopup {
private static final String COPY_URL = "copy://";
private static JBPopup ourPopup;
public static void show(@Nullable Window window) {
public static void show(@Nullable Window window, boolean showDebugInfo) {
ApplicationInfoEx appInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
final PopupPanel panel = new PopupPanel(new BorderLayout());
Icon image = IconLoader.getIcon(appInfo.getAboutImageUrl());
if (appInfo.showLicenseeInfo()) {
final InfoSurface infoSurface = new InfoSurface(image);
final InfoSurface infoSurface = new InfoSurface(image, showDebugInfo);
infoSurface.setPreferredSize(new Dimension(image.getIconWidth(), image.getIconHeight()));
panel.setInfoSurface(infoSurface);
}
@@ -125,6 +125,7 @@ public class AboutPopup {
private final Color myColor;
private final Color myLinkColor;
private final Icon myImage;
private final boolean myShowDebugInfo;
private Font myFont;
private Font myBoldFont;
private final List<AboutBoxLine> myLines = new ArrayList<>();
@@ -135,13 +136,14 @@ public class AboutPopup {
private float myShowCopyAlpha;
private Alarm myAlarm = new Alarm();
public InfoSurface(Icon image) {
public InfoSurface(Icon image, final boolean showDebugInfo) {
ApplicationInfoImpl appInfo = (ApplicationInfoImpl)ApplicationInfoEx.getInstanceEx();
myImage = image;
//noinspection UseJBColor
myColor = Color.white;
myLinkColor = appInfo.getAboutLinkColor() != null ? appInfo.getAboutLinkColor() : UI.getColor("link.foreground");
myShowDebugInfo = showDebugInfo;
setOpaque(false);
setBackground(myColor);
@@ -330,6 +332,12 @@ public class AboutPopup {
final int copyrightX = Registry.is("ide.new.about") ? JBUI.scale(140) : JBUI.scale(30);
final int copyrightY = Registry.is("ide.new.about") ? JBUI.scale(390) : JBUI.scale(284);
g2.drawString(getCopyrightText(), copyrightX, copyrightY);
if (myShowDebugInfo) {
g2.setColor(((ApplicationInfoEx)appInfo).getAboutForeground());
for (Link link : myLinks) {
g2.drawRect(link.myRectangle.x, link.myRectangle.y, link.myRectangle.width, link.myRectangle.height);
}
}
}
@NotNull
@@ -0,0 +1,31 @@
/*
* 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.
*/
package com.intellij.internal.ui;
import com.intellij.ide.actions.AboutPopup;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.wm.WindowManager;
/**
* @author nik
*/
public class ShowAboutPopupInDebugModeAction extends DumbAwareAction {
@Override
public void actionPerformed(AnActionEvent e) {
AboutPopup.show(WindowManager.getInstance().suggestParentWindow(getEventProject(e)), true);
}
}
@@ -736,6 +736,8 @@
</action>
<action id="UiDropper" internal="true" class="com.intellij.internal.inspector.UiDropperAction" text="UI &amp;Dropper"/>
<action id="ShowSplash" internal="true" class="com.intellij.ui.ShowSplashAction" text="Show Splash" />
<action id="ShowAboutPopupInDebugModeAction" class="com.intellij.internal.ui.ShowAboutPopupInDebugModeAction"
text="Show About Popup in Debug Mode"/>
<action id="ValidationTest" internal="true" class="com.intellij.internal.validation.TestDialogWithValidationAction" text="Validation Dialog Test" />
<action id="MacMessagesTest" internal="true" class="com.intellij.internal.validation.TestMacMessagesAction" text="Test Mac Messages" />
<action id="ColorBlindnessTest" internal="true" class="com.intellij.ide.ui.ColorBlindnessInternalAction" text="Test ColorBlindness" />