IDEA-164734 Update screen is too big

This commit is contained in:
Vassiliy.Kudryashov
2016-12-02 13:43:08 +03:00
parent 6d8ea9b422
commit af49a13f04
5 changed files with 168 additions and 21 deletions
@@ -75,6 +75,7 @@ public abstract class AbstractUpdateDialog extends DialogWrapper {
area.setBackground(UIUtil.getPanelBackground());
area.setBorder(IdeBorderFactory.createEmptyBorder());
area.setText(text);
area.setCaretPosition(0);
area.setEditable(false);
if (listener == null && myEnableLink) {
@@ -0,0 +1,129 @@
/*
* 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.openapi.updateSettings.impl;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.util.JDOMUtil;
import java.util.Collections;
public class ShowUpdateInfoDialogAction extends AnAction {
private boolean myShowBigData = false;
public ShowUpdateInfoDialogAction() {
}
@Override
public void actionPerformed(AnActionEvent e) {
try {
myShowBigData = ! myShowBigData;
UpdateChannel channel = new UpdateChannel(JDOMUtil.loadDocument(getXML(myShowBigData)).getRootElement());
BuildInfo newBuild = channel.getBuilds().get(0);
PatchInfo patchInfo = new PatchInfo(
JDOMUtil.loadDocument("<patch from=\"" + ApplicationInfo.getInstance().getBuild().asString() + "\" size=\"from 733 to 800\"/>")
.getRootElement());
new UpdateInfoDialog(channel, newBuild, patchInfo, true, UpdateSettings.getInstance().canUseSecureConnection(),
Collections.emptyList(), Collections.emptyList()).show();
}
catch (Exception ignored) {
ignored.printStackTrace();
}
}
private static final String PARAGRAPH = " <li><strong>Refactoring to Java 8</strong>: more powerful inspections.</li>\n" +
" <li><strong>JVM Debugger</strong>: Class-level Watches; the JVM Memory View plugin.</li>\n" +
" <li><strong>User Interface</strong>: Parameter Hints; Semantic Highlighting; flat file icons.</li>\n" +
" <li><strong>Build Tools</strong>: Delegate IDE build/run actions to Gradle; Composite <br>\n" +
" Builds support; Polyglot Maven.</li>\n" +
" <li><strong>Scala</strong>: scala.meta and Scala.js</li>\n" +
" <li><strong>JavaScript</strong>: refactoring to ECMAScript 6; Flow-based inspections; <br>\n" +
" React Native debugger, Protractor, Stylelint, PostCSS, and more.</li>\n" +
" <li><strong>VCS</strong>: Faster and more ergonomic Log for Git/Mercurial; automatic <br>\n" +
" resolving conflicts; managing Git remotes.</li>\n" +
" <li><strong>Android</strong>: Blueprint; Constraint Layout, APK Analyzer, and better Instant Run.</li>\n" +
" <li><strong>Database</strong>: editing multiple cells at once; submit changes in bulk; <br>\n" +
" find usages of objects within the source code of other objects.</li>\n";
private static final String CHANNEL_XML_START = "<!DOCTYPE products SYSTEM \"updates.dtd\">\n" +
"<channel id=\"IDEA_EAP\" name=\"IntelliJ IDEA EAP\" status=\"eap\"\n" +
" url=\"https://confluence.jetbrains.com/display/IDEADEV/IDEA+2016.3+EAP\"\n" +
" feedback=\"http://youtrack.jetbrains.net\"\n" +
" majorVersion=\"2016\" licensing=\"eap\">\n" +
" <build number=\"163.7743.44\" version=\"2016.3\" releaseDate=\"20161122\">\n" +
" <message><![CDATA[\n" +
" <p>Please meet IntelliJ IDEA 2016.3, the third update planned for 2016!</p>\n" +
"\n" +
"<p>Visit <a href=\"https://www.jetbrains.com/idea/whatsnew/?landing\">What's New</a> page for a full list of new features and an overview video.</p>\n" +
"\n" +
"<p>And here're the highlights:</p>\n" +
"\n" +
"<ul>\n";
private static final String CHANNEL_XML_END = "</ul>\n" +
"]]></message>\n" +
" <button name=\"Download\" url=\"https://www.jetbrains.com/idea/download/\" download=\"true\"/>\n" +
" <button name=\"What's New\" url=\"https://www.jetbrains.com/idea/whatsnew/?landing\"/>\n" +
" <patch from=\"163.7743.17\" size=\"from 2 to 18\"/>\n" +
" <patch from=\"163.7743.37\" size=\"from 2 to 18\"/>\n" +
" </build>\n" +
" <build number=\"162.2228.15\" version=\"2016.2.5\" releaseDate=\"20160712\">\n" +
" <message><![CDATA[\n" +
" <p>The <strong>IntelliJ IDEA 2016.2.5</strong> update is available. <br>\n" +
" Apart from bugfixes, the update brings support for <strong>macOS Sierra</strong>.</p>\n" +
"]]></message>\n" +
" <button name=\"Download\" url=\"https://www.jetbrains.com/idea/download/\" download=\"true\"/>\n" +
" <button name=\"Release Notes\" url=\"https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+2016.2.5+Release+Notes\"/>\n" +
" <patch from=\"162.2032.8\" size=\"from 1 to 13\"/>\n" +
" <patch from=\"162.2228.14\" size=\"from 21 to 53\"/>\n" +
" <patch from=\"162.1812.17\" size=\"from 21 to 55\"/>\n" +
" <patch from=\"162.1628.40\" size=\"from 21 to 59\"/>\n" +
" <patch from=\"162.1447.26\" size=\"from 21 to 67\"/>\n" +
" <patch from=\"162.1121.32\" size=\"from 33 to 80\"/>\n" +
" </build>\n" +
" <build number=\"162.1121.32\" version=\"2016.2\" releaseDate=\"20160712\">\n" +
" <message><![CDATA[\n" +
" <p>Welcome <strong>IntelliJ IDEA 2016.2</strong>, a second update planned for this year.<br>\n" +
" The update brings lots of new features and improvements across the <br>\n" +
" built-in tools, UI, and support for languages and frameworks.\n" +
"</p>\n" +
"\n" +
"<p>Learn more about the update by reading the <a href=\"http://blog.jetbrains.com/idea/2016/07/intellij-idea-2016-2-is-here/\">blog post</a>.</p>\n" +
"]]></message>\n" +
" <button name=\"What's New\" url=\"https://www.jetbrains.com/idea/whatsnew/\"/>\n" +
" <button name=\"Download\" url=\"https://www.jetbrains.com/idea/download/\" download=\"true\"/>\n" +
" <patch from=\"162.1121.10\" size=\"from 1 to 12\"/>\n" +
" </build>\n" +
" <build number=\"145.2070\" version=\"2016.1.4\" releaseDate=\"20160316\">\n" +
" <message><![CDATA[\n" +
" <p>IntelliJ IDEA 2016.1.4 build 145.2070 is available with important bugfixes.</p>\n" +
"]]></message>\n" +
" <button name=\"Release Notes\" url=\"https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+2016.1.4+Release+Notes\"/>\n" +
" <button name=\"Download\" url=\"https://confluence.jetbrains.com/display/IntelliJIDEA/Previous+IntelliJ+IDEA+Releases\"\n" +
" download=\"true\"/>\n" +
" <patch from=\"145.1617\" size=\"from 42 to 58\"/>\n" +
" </build>\n" +
" </channel>\n";
private static String getXML(boolean bigData) {
StringBuilder sb = new StringBuilder(CHANNEL_XML_START);
int count = bigData ? 4 : 1;
for (int i = 0; i < count; i++) { sb.append(PARAGRAPH); }
sb.append(CHANNEL_XML_END);
return sb.toString();
}
}
@@ -41,9 +41,11 @@ import com.intellij.ui.BrowserHyperlinkListener;
import com.intellij.ui.JBColor;
import com.intellij.ui.LicensingFacade;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.JBUI;
import org.apache.http.client.utils.URIBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -278,6 +280,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
private JBLabel myPatchInfo;
private JEditorPane myMessageArea;
private JEditorPane myLicenseArea;
private JBScrollPane myScrollPane;
public UpdateInfoPanel() {
ApplicationInfo appInfo = ApplicationInfo.getInstance();
@@ -326,6 +329,21 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
configureMessageArea(myLicenseArea, myLicenseInfo.first, myLicenseInfo.second, null);
}
}
private void createUIComponents() {
myUpdateMessage = new JEditorPane("text/html", "") {
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension size = super.getPreferredScrollableViewportSize();
size.height = Math.min(size.height, JBUI.scale(400));
return size;
}
};
myScrollPane = new JBScrollPane(myUpdateMessage,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
myScrollPane.setBorder(JBUI.Borders.empty());
}
}
protected static String formatVersion(String versionString, String build) {
@@ -2,26 +2,14 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.updateSettings.impl.UpdateInfoDialog.UpdateInfoPanel">
<grid id="27dc6" binding="myPanel" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="500" height="172"/>
<xy x="20" y="20" width="500" height="470"/>
</constraints>
<properties/>
<border type="empty">
<size top="0" left="5" bottom="0" right="5"/>
</border>
<children>
<component id="f7184" class="javax.swing.JEditorPane" binding="myUpdateMessage">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="2" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
<gridbag weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<contentType value="text/html"/>
<margin top="0" left="0" bottom="0" right="0"/>
</properties>
</component>
<grid id="d6625" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="d6625" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="0" bottom="10" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -32,7 +20,7 @@
<children>
<component id="6ab75" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="updates.current.version"/>
@@ -40,7 +28,7 @@
</component>
<component id="d276e" class="com.intellij.ui.components.JBLabel" binding="myCurrentVersion">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="X.Y (build XXX.YYY)"/>
@@ -48,7 +36,7 @@
</component>
<component id="5a935" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="updates.available.version"/>
@@ -56,7 +44,7 @@
</component>
<component id="ef80e" class="com.intellij.ui.components.JBLabel" binding="myNewVersion">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="X.Y (build XXX.YYY)"/>
@@ -64,7 +52,7 @@
</component>
<component id="f145c" class="com.intellij.ui.components.JBLabel" binding="myPatchLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="updates.patch.label"/>
@@ -72,7 +60,7 @@
</component>
<component id="b16ba" class="com.intellij.ui.components.JBLabel" binding="myPatchInfo">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="XX MB"/>
@@ -80,9 +68,19 @@
</component>
<hspacer id="2c1a8">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<scrollpane id="b5edb" class="com.intellij.ui.components.JBScrollPane" binding="myScrollPane" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="2" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<horizontalScrollBarPolicy value="31"/>
</properties>
<border type="none"/>
<children/>
</scrollpane>
</children>
</grid>
<component id="63ccb" class="javax.swing.JEditorPane" binding="myMessageArea">
@@ -758,6 +758,7 @@
<group id="TopAnomalies" internal="true" class="com.intellij.internal.anomalies.TopAnomaliesAction" text="Top Anomalies" popup="true"/>
<action id="ImageDuplicates" internal="true" class="com.intellij.internal.ShowImageDuplicatesAction" text="Find Image Duplicates"/>
<action id="ShowNonRetinaImages" internal="true" class="com.intellij.internal.ShowNonRetinaImagesActions" text="Show Non Retina Images"/>
<action id="ShowUpdateDialogAction" internal="true" class="com.intellij.openapi.updateSettings.impl.ShowUpdateInfoDialogAction" text="Show Update Dialog"/>
<separator/>
<reference ref="MaintenanceGroup"/>