LinkLabel — simplify link

This commit is contained in:
Vladimir Krivosheev
2016-09-07 07:57:06 +02:00
parent 8d1211a2f8
commit aebe2fdfc5
19 changed files with 167 additions and 146 deletions
@@ -20,6 +20,7 @@ import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.ComponentsKt;
import com.intellij.ui.layout.LayoutKt;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -96,6 +97,6 @@ class EnterPasswordComponent {
note = "The passwords will be stored in IDE configuration files with weak protection<br>(" + subNote + ").";
}
myPromptLabel = LayoutKt.htmlComponent("Master password is required to convert saved passwords.<br>" + note, UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
myPromptLabel = ComponentsKt.htmlComponent("Master password is required to convert saved passwords.<br>" + note, UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -48,6 +48,7 @@ public abstract class ErrorReportSubmitter implements PluginAware {
/**
* @return an action text to be used in Error Reporter user interface, e.g. "Report to JetBrains".
*/
@NotNull
public abstract String getReportActionText();
/**
@@ -15,10 +15,18 @@
*/
package com.intellij.openapi.ui
import com.intellij.openapi.project.Project
import java.awt.Component
import javax.swing.JComponent
fun dialog(title: String, centerPanel: JComponent, resizable: Boolean = true, preferedFocusComponent: JComponent? = null, okActionEnabled: Boolean = true): DialogBuilder {
val builder = DialogBuilder()
fun dialog(title: String,
centerPanel: JComponent,
resizable: Boolean = true,
preferedFocusComponent: JComponent? = null,
okActionEnabled: Boolean = true,
project: Project? = null,
parent: Component? = null): DialogBuilder {
val builder = if (parent == null) DialogBuilder(project) else DialogBuilder(parent)
builder
.title(title)
.centerPanel(centerPanel)
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* 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.
@@ -25,6 +25,7 @@ import com.intellij.ui.UI;
import com.intellij.util.ui.JBRectangle;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.accessibility.ScreenReader;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -34,7 +35,6 @@ import javax.accessibility.AccessibleRole;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.HashSet;
import java.util.Set;
/**
@@ -46,7 +46,7 @@ public class LinkLabel<T> extends JLabel {
private LinkListener<T> myLinkListener;
private T myLinkData;
private static final Set<String> ourVisitedLinks = new HashSet<>();
private static final Set<String> ourVisitedLinks = new THashSet<>();
private boolean myIsLinkActive;
@@ -69,6 +69,16 @@ public class LinkLabel<T> extends JLabel {
this(text, icon, aListener, null, null);
}
@NotNull
public static LinkLabel<?> create(@Nullable String text, @Nullable Runnable action) {
return new LinkLabel<>(text, null, action == null ? null : new LinkListener<Object>() {
@Override
public void linkSelected(LinkLabel source, Object linkData) {
action.run();
}
}, null, null);
}
public LinkLabel(String text, @Nullable Icon icon, @Nullable LinkListener<T> aListener, @Nullable T aLinkData) {
this(text, icon, aListener, aLinkData, null);
}
@@ -142,8 +152,12 @@ public class LinkLabel<T> extends JLabel {
try {
myClickIsBeingProcessed = true;
if (myLinkListener != null) myLinkListener.linkSelected(this, myLinkData);
ourVisitedLinks.add(myVisitedLinksKey);
if (myLinkListener != null) {
myLinkListener.linkSelected(this, myLinkData);
}
if (myVisitedLinksKey != null) {
ourVisitedLinks.add(myVisitedLinksKey);
}
repaint();
}
finally {
@@ -222,7 +236,6 @@ public class LinkLabel<T> extends JLabel {
}
protected void onSetActive(boolean active) {
}
private final JBRectangle iconR = new JBRectangle();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -17,13 +17,11 @@ package com.intellij.ui.components.labels;
import org.jetbrains.annotations.NotNull;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.beans.EventHandler;
import java.beans.PropertyChangeListener;
import static java.beans.EventHandler.create;
/**
* @author Sergey.Malenkov
*/
@@ -35,7 +33,7 @@ public class SwingActionLink extends LinkLabel<Action> implements LinkListener<A
setToolTipText((String)action.getValue(Action.SHORT_DESCRIPTION));
setVisible(action.isEnabled());
setListener(this, action);
action.addPropertyChangeListener(create(PropertyChangeListener.class, this, "visible", "source.enabled"));
action.addPropertyChangeListener(EventHandler.create(PropertyChangeListener.class, this, "visible", "source.enabled"));
}
@Override
@@ -16,7 +16,10 @@
package com.intellij.util
import com.intellij.openapi.util.text.StringUtil
import java.util.Base64
fun String?.nullize(nullizeSpaces: Boolean = false): String? = StringUtil.nullize(this, nullizeSpaces)
fun String.trimMiddle(maxLength: Int): String? = StringUtil.trimMiddle(this, maxLength)
fun String.trimMiddle(maxLength: Int): String? = StringUtil.trimMiddle(this, maxLength)
fun String.decodeBase64(): ByteArray = Base64.getDecoder().decode(this)
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -39,8 +39,7 @@ internal class ErrorReportConfigurable : PersistentStateComponent<OldState> {
get() = ServiceManager.getService(ErrorReportConfigurable::class.java)
@JvmStatic
val credentials: Credentials?
get() = PasswordSafe.getInstance().get(CredentialAttributes(SERVICE_NAME))
fun getCredentials() = PasswordSafe.getInstance().get(CredentialAttributes(SERVICE_NAME))
}
}
@@ -98,7 +98,7 @@ private fun submit(event: IdeaLoggingEvent, parentComponent: Component, callback
var credentials = ErrorReportConfigurable.getCredentials()
// ask password only if user name was specified
if (credentials?.userName != null && credentials?.password.isNullOrEmpty()) {
if (!JetBrainsAccountDialog(parentComponent).showAndGet()) {
if (!showJetBrainsAccountDialog(parentComponent).showAndGet()) {
return false
}
@@ -145,16 +145,12 @@ private fun submit(event: IdeaLoggingEvent, parentComponent: Component, callback
}) { e ->
Logger.getInstance(ITNReporter::class.java).info("reporting failed: " + e)
ApplicationManager.getApplication().invokeLater {
val msg: String
if (e is NoSuchEAPUserException) {
msg = DiagnosticBundle.message("error.report.authentication.failed")
}
else if (e is InternalEAPException) {
msg = DiagnosticBundle.message("error.report.posting.failed", e.message)
}
else {
msg = DiagnosticBundle.message("error.report.sending.failure")
val msg = when (e) {
is NoSuchEAPUserException -> DiagnosticBundle.message("error.report.authentication.failed")
is InternalEAPException -> DiagnosticBundle.message("error.report.posting.failed", e.message)
else -> DiagnosticBundle.message("error.report.sending.failure")
}
if (e is UpdateAvailableException) {
val message = DiagnosticBundle.message("error.report.new.eap.build.message", e.message)
showMessageDialog(parentComponent, project, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon())
@@ -164,14 +160,7 @@ private fun submit(event: IdeaLoggingEvent, parentComponent: Component, callback
callback.consume(SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.FAILED))
}
else if (e is NoSuchEAPUserException) {
val dialog: JetBrainsAccountDialog
if (parentComponent.isShowing) {
dialog = JetBrainsAccountDialog(parentComponent)
}
else {
dialog = JetBrainsAccountDialog(project!!)
}
dialog.show()
showJetBrainsAccountDialog(parentComponent, project).show()
}
ApplicationManager.getApplication().invokeLater { submit(event, parentComponent, callback, errorBean, description) }
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* 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.
@@ -347,7 +347,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
new JetBrainsAccountDialog(getRootPane()).show();
JetBrainsAccountDialogKt.showJetBrainsAccountDialog(getRootPane(), null).show();
updateCredentialsPane(getSelectedMessage());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -19,31 +19,40 @@ import com.intellij.credentialStore.CredentialAttributes
import com.intellij.credentialStore.Credentials
import com.intellij.ide.BrowserUtil
import com.intellij.ide.passwordSafe.PasswordSafe
import com.intellij.layout.*
import com.intellij.layout.LCFlags.*
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogBuilder
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.openapi.ui.dialog
import com.intellij.openapi.util.text.StringUtil
import com.intellij.ui.ClickListener
import com.intellij.util.net.HttpConfigurable
import javax.swing.*
import java.awt.*
import java.awt.Component
import java.awt.Cursor
import java.awt.event.MouseEvent
import javax.swing.*
class JetBrainsAccountDialog : DialogWrapper {
fun showJetBrainsAccountDialog(parent: Component, project: Project? = null): DialogBuilder {
val panel = panel(fillX) {
label(DiagnosticBundle.message("diagnostic.error.report.description"))
link(DiagnosticBundle.message("diagnostic.error.report.proxy.setup")) {
HttpConfigurable.editConfigurable(this)
}
}
return dialog(
title = DiagnosticBundle.message("error.report.title"),
centerPanel = panel,
project = project,
parent = if (parent.isShowing) parent else null)
}
class JetBrainsAccountDialog : DialogWrapper(null) {
private val myItnLoginTextField: JTextField? = null
private val myPasswordText: JPasswordField? = null
private val myRememberCheckBox: JCheckBox? = null
@Throws(HeadlessException::class)
constructor(parent: Component) : super(parent, false) {
init()
}
@Throws(HeadlessException::class)
constructor(project: Project) : super(project, false) {
init()
}
var myMainPanel: JPanel? = null
var mySendingSettingsLabel: JLabel? = null
private val myCreateAccountLabel: JLabel? = null
@@ -57,7 +66,6 @@ class JetBrainsAccountDialog : DialogWrapper {
}
override fun init() {
title = ReportMessages.ERROR_REPORT
contentPane.add(myMainPanel)
object : ClickListener() {
@@ -79,7 +79,7 @@
<text resource-bundle="messages/DiagnosticBundle" key="diagnostic.error.report.proxy.setup"/>
</properties>
</component>
<component id="cd549" class="javax.swing.JLabel">
<component id="cd549" class="javax.swing.JLabel" binding="eee">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* 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.
@@ -291,13 +291,8 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
content.add(BorderLayout.CENTER, panel);
panel.add(Box.createVerticalStrut(10));
for (final Configurable current : composite.getConfigurables()) {
LinkLabel label = new LinkLabel(current.getDisplayName(), null) {
@Override
public void doClick() {
openLink(current);
}
};
for (Configurable current : composite.getConfigurables()) {
LinkLabel label = LinkLabel.create(current.getDisplayName(), () -> openLink(current));
label.setBorder(BorderFactory.createEmptyBorder(1, 17, 3, 1));
panel.add(label);
}
@@ -0,0 +1,65 @@
/*
* 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.ui
import com.intellij.openapi.vcs.changes.issueLinks.LinkMouseListenerBase
import com.intellij.util.ui.SwingHelper
import com.intellij.util.ui.UIUtil
import java.awt.Color
import java.awt.Font
import java.util.regex.Pattern
import javax.swing.JEditorPane
private val HREF_PATTERN = Pattern.compile("<a(?:\\s+href\\s*=\\s*[\"']([^\"']*)[\"'])?\\s*>([^<]*)</a>")
private val LINK_TEXT_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, JBColor.blue)
private val SMALL_TEXT_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, null)
fun noteComponent(note: String): SimpleColoredComponent {
val noteComponent = SimpleColoredComponent()
val matcher = HREF_PATTERN.matcher(note)
var prev = 0
if (matcher.find()) {
do {
if (matcher.start() != prev) {
noteComponent.append(note.substring(prev, matcher.start()), SMALL_TEXT_ATTRIBUTES)
}
noteComponent.append(matcher.group(2), LINK_TEXT_ATTRIBUTES, SimpleColoredComponent.BrowserLauncherTag(matcher.group(1)))
prev = matcher.end()
}
while (matcher.find())
LinkMouseListenerBase.installSingleTagOn(noteComponent)
}
if (prev < note.length) {
noteComponent.append(note.substring(prev), SMALL_TEXT_ATTRIBUTES)
}
return noteComponent
}
@JvmOverloads
fun htmlComponent(text: String = "", font: Font = UIUtil.getLabelFont(), background: Color? = null, foreground: Color? = null, lineWrap: Boolean = false): JEditorPane {
val pane = SwingHelper.createHtmlViewer(lineWrap, font, background, foreground)
if (!text.isNullOrEmpty()) {
pane.text = "<html><head>${UIUtil.getCssFontDeclaration(font, UIUtil.getLabelForeground(), null, null)}</head><body>$text</body></html>"
}
pane.border = null
pane.disabledTextColor = UIUtil.getLabelDisabledForeground()
pane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE)
return pane
}
@@ -16,18 +16,17 @@
package com.intellij.ui.layout
import com.intellij.BundleBase
import com.intellij.openapi.vcs.changes.issueLinks.LinkMouseListenerBase
import com.intellij.ui.*
import com.intellij.ui.IdeBorderFactory
import com.intellij.ui.components.JBLabel
import com.intellij.util.ui.SwingHelper
import com.intellij.ui.components.labels.LinkLabel
import com.intellij.util.ui.UIUtil
import com.intellij.util.ui.UIUtil.getCssFontDeclaration
import com.intellij.util.ui.UIUtil.getLabelForeground
import net.miginfocom.layout.*
import net.miginfocom.swing.MigLayout
import java.awt.*
import java.awt.BorderLayout
import java.awt.Component
import java.awt.Font
import java.awt.LayoutManager
import java.awt.event.ActionEvent
import java.util.regex.Pattern
import javax.swing.*
// http://www.migcalendar.com/miglayout/mavensite/docs/cheatsheet.pdf
@@ -121,6 +120,10 @@ fun JPanel.label(text: String, vararg constraints: CCFlags, componentStyle: UIUt
add(label, _cc)
}
fun JPanel.link(text: String, action: () -> Unit) {
add(LinkLabel.create(text, action))
}
private fun gapToBoundSize(value: Int, isHorizontal: Boolean): BoundSize {
val unitValue = UnitValue(value.toFloat(), "", isHorizontal, UnitValue.STATIC, null)
return BoundSize(unitValue, unitValue, null, false, null)
@@ -215,45 +218,4 @@ fun CC.apply(flags: Array<out CCFlags>): CC {
}
}
return this
}
private val HREF_PATTERN = Pattern.compile("<a(?:\\s+href\\s*=\\s*[\"']([^\"']*)[\"'])?\\s*>([^<]*)</a>")
private val LINK_TEXT_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, JBColor.blue)
private val SMALL_TEXT_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, null)
fun noteComponent(note: String): SimpleColoredComponent {
val noteComponent = SimpleColoredComponent()
val matcher = HREF_PATTERN.matcher(note)
var prev = 0
if (matcher.find()) {
do {
if (matcher.start() != prev) {
noteComponent.append(note.substring(prev, matcher.start()), SMALL_TEXT_ATTRIBUTES)
}
noteComponent.append(matcher.group(2), LINK_TEXT_ATTRIBUTES, SimpleColoredComponent.BrowserLauncherTag(matcher.group(1)))
prev = matcher.end()
}
while (matcher.find())
LinkMouseListenerBase.installSingleTagOn(noteComponent)
}
if (prev < note.length) {
noteComponent.append(note.substring(prev), SMALL_TEXT_ATTRIBUTES)
}
return noteComponent
}
@JvmOverloads
fun htmlComponent(text: String = "", font: Font = UIUtil.getLabelFont(), background: Color? = null, foreground: Color? = null, lineWrap: Boolean = false): JEditorPane {
val pane = SwingHelper.createHtmlViewer(lineWrap, font, background, foreground)
if (!text.isNullOrEmpty()) {
pane.text = "<html><head>${getCssFontDeclaration(font, getLabelForeground(), null, null)}</head><body>$text</body></html>"
}
pane.border = null
pane.disabledTextColor = UIUtil.getLabelDisabledForeground()
pane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE)
return pane
}
@@ -11,7 +11,6 @@ diagnostic.out.of.memory.dump=Memory Dump
diagnostic.error.report.send=&Send
diagnostic.error.report.description=<html>If you would like to get notified when the exceptions you submit are fixed,<br>please fill in your JetBrains Account login and password.</html>
diagnostic.error.report.proxy.setup=<html><a href="#">Set up HTTP proxy settings</a></html>
diagnostic.error.report.login.group=JetBrains Account
diagnostic.error.report.login.remember.password.checkbox=&Remember password
diagnostic.error.report.login.name=&Username:
diagnostic.error.report.login.password=&Password:
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -28,7 +28,6 @@ import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.psi.search.scope.packageSet.NamedScope;
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -91,13 +90,10 @@ class VcsUpdateInfoScopeFilterConfigurable implements Configurable, NamedScopesH
panel.add(myCheckbox);
panel.add(myComboBox);
panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP));
panel.add(new LinkLabel("Manage Scopes", null, new LinkListener() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
Settings settings = Settings.KEY.getData(DataManager.getInstance().getDataContext(panel));
if (settings != null) {
settings.select(settings.find(ScopeChooserConfigurable.PROJECT_SCOPES));
}
panel.add(LinkLabel.create("Manage Scopes", () -> {
Settings settings = Settings.KEY.getData(DataManager.getInstance().getDataContext(panel));
if (settings != null) {
settings.select(settings.find(ScopeChooserConfigurable.PROJECT_SCOPES));
}
}));
return panel;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* 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.
@@ -24,7 +24,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
import com.intellij.util.ui.UIUtil;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
@@ -33,13 +32,6 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created with IntelliJ IDEA.
* User: zajac
* Date: 4/4/12
* Time: 5:51 PM
* To change this template use File | Settings | File Templates.
*/
public class BreakpointEditor {
public JPanel getMainPanel() {
return myMainPanel;
@@ -49,12 +41,9 @@ public class BreakpointEditor {
AnAction action = ActionManager.getInstance().getAction(XDebuggerActions.VIEW_BREAKPOINTS);
String shortcutText = action != null ? KeymapUtil.getFirstKeyboardShortcutText(action) : null;
String text = shortcutText != null ? "More (" + shortcutText + ")" : "More";
myShowMoreOptionsLink = new LinkLabel(text, null, new LinkListener() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
if (myDelegate != null) {
myDelegate.more();
}
myShowMoreOptionsLink = LinkLabel.create(text, () -> {
if (myDelegate != null) {
myDelegate.more();
}
});
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* 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.
@@ -21,7 +21,6 @@ import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
import com.intellij.util.ui.GridBag;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -76,12 +75,7 @@ public class GitCrlfDialog extends DialogWrapper {
"<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" +
"Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL);
JLabel readMore = new LinkLabel("Read more", null, new LinkListener() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
BrowserUtil.browse("https://help.github.com/articles/dealing-with-line-endings");
}
});
JLabel readMore = LinkLabel.create("Read more", () -> BrowserUtil.browse("https://help.github.com/articles/dealing-with-line-endings"));
JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
myDontWarn = new JBCheckBox("Don't warn again");
@@ -24,6 +24,7 @@ import com.intellij.ui.DocumentAdapter
import com.intellij.ui.layout.*
import com.intellij.ui.layout.CCFlags.*
import com.intellij.ui.layout.LCFlags.*
import com.intellij.ui.noteComponent
import com.intellij.util.PathUtilRt
import com.intellij.util.nullize
import com.intellij.util.trimMiddle