This commit is contained in:
Vladimir Krivosheev
2016-08-24 13:24:51 +02:00
parent 7adfcc8df7
commit fc9f8c5c8e
3 changed files with 36 additions and 36 deletions
@@ -16,7 +16,11 @@
package com.intellij.layout
import com.intellij.BundleBase
import com.intellij.openapi.vcs.changes.issueLinks.LinkMouseListenerBase
import com.intellij.ui.IdeBorderFactory
import com.intellij.ui.JBColor
import com.intellij.ui.SimpleColoredComponent
import com.intellij.ui.SimpleTextAttributes
import com.intellij.ui.components.JBLabel
import com.intellij.util.ui.UIUtil
import net.miginfocom.layout.*
@@ -26,6 +30,7 @@ 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
@@ -213,4 +218,33 @@ 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
}
@@ -15,7 +15,7 @@
*/
package com.intellij.xdebugger.impl.settings;
import com.intellij.layout.MigLayoutKt;
import com.intellij.layout.LayoutKt;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.components.JBLabel;
@@ -84,6 +84,6 @@ public class DataViewsConfigurableUi {
}
private void createUIComponents() {
myEditorSettingsPanel = MigLayoutKt.titledPanel("Editor");
myEditorSettingsPanel = LayoutKt.titledPanel("Editor");
}
}
@@ -22,24 +22,15 @@ import com.intellij.layout.LCFlags.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.ui.dialog
import com.intellij.openapi.util.Computable
import com.intellij.openapi.vcs.changes.issueLinks.LinkMouseListenerBase
import com.intellij.ui.DocumentAdapter
import com.intellij.ui.JBColor
import com.intellij.ui.SimpleColoredComponent
import com.intellij.ui.SimpleTextAttributes
import com.intellij.util.PathUtilRt
import com.intellij.util.nullize
import com.intellij.util.trimMiddle
import com.intellij.util.ui.UIUtil
import java.util.regex.Pattern
import javax.swing.JPasswordField
import javax.swing.JTextField
import javax.swing.event.DocumentEvent
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 showAuthenticationForm(credentials: Credentials?, uri: String, host: String?, path: String?, sshKeyFile: String?): Credentials? {
if (ApplicationManager.getApplication()?.isUnitTestMode === true) {
throw AssertionError("showAuthenticationForm called from tests")
@@ -96,29 +87,4 @@ fun showAuthenticationForm(credentials: Credentials?, uri: String, host: String?
null
}
})
}
private 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
}