diff --git a/AceJump.iml b/AceJump.iml index b55a4d89..b48b96ee 100644 --- a/AceJump.iml +++ b/AceJump.iml @@ -6,9 +6,9 @@ - + - + diff --git a/AceJump.zip b/AceJump.zip new file mode 100644 index 00000000..bae4516a Binary files /dev/null and b/AceJump.zip differ diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index fb3673f0..ba37570d 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -13,6 +13,8 @@
+
2.0.6
+
Fixing "lost focus" bugs mentioned here: https://github.com/johnlindquist/AceJump/issues/41
2.0.5
Fixing "backspace" bugs mentioned here: https://github.com/johnlindquist/AceJump/issues/20
2.0.4
@@ -44,14 +46,14 @@ com.intellij.modules.platform - 2.0.5 + 2.0.6 Navigation johnlindquist - + diff --git a/README b/README index bd6bbbba..29e63a21 100644 --- a/README +++ b/README @@ -1,2 +1,4 @@ -Updated for Intellij v12 (build 120.000 and later) -This file was modified by IntelliJ IDEA (Leda) IU-120.305 for binding GitHub repository \ No newline at end of file +Fix bug #41 and #39 for Intellij v13.1.1 (build 135.480) + +Put **the content** of AceJump.zip to .IdeaIC13/config/plugins/ or .IntellijIdea13/config/plugins/. + diff --git a/src/com/johnlindquist/acejump/AceJumpAction.kt b/src/com/johnlindquist/acejump/AceJumpAction.kt index 8a2d5abb..2755f156 100644 --- a/src/com/johnlindquist/acejump/AceJumpAction.kt +++ b/src/com/johnlindquist/acejump/AceJumpAction.kt @@ -28,19 +28,19 @@ import javax.swing.* import javax.swing.event.ChangeEvent import javax.swing.event.ChangeListener import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.wm.impl.IdeFocusManagerImpl import com.intellij.openapi.wm.IdeFocusManager +import com.intellij.openapi.actionSystem.CommonDataKeys -public open class AceJumpAction(): DumbAwareAction() { +public open class AceJumpAction() : DumbAwareAction() { override public fun update(e: AnActionEvent?) { - e?.getPresentation()?.setEnabled((e?.getData(PlatformDataKeys.EDITOR)) != null) + e?.getPresentation()?.setEnabled((e?.getData(CommonDataKeys.EDITOR)) != null) } override public fun actionPerformed(p0: AnActionEvent?) { val actionEvent = p0 - val project = actionEvent?.getData(PlatformDataKeys.PROJECT) as Project - val editor = actionEvent?.getData(PlatformDataKeys.EDITOR) as EditorImpl - val virtualFile = actionEvent?.getData(PlatformDataKeys.VIRTUAL_FILE) as VirtualFile + val project = actionEvent?.getData(CommonDataKeys.PROJECT) as Project + val editor = actionEvent?.getData(CommonDataKeys.EDITOR) as EditorImpl + val virtualFile = actionEvent?.getData(CommonDataKeys.VIRTUAL_FILE) as VirtualFile val document = editor.getDocument() as DocumentImpl val scheme = EditorColorsManager.getInstance()?.getGlobalScheme() val font = Font(scheme?.getEditorFontName(), Font.BOLD, scheme?.getEditorFontSize()!!) @@ -69,7 +69,7 @@ public open class AceJumpAction(): DumbAwareAction() { */ fun setupJumpLocations(results: MutableList) { - if(results.size == 0) return //todo: hack, in case random keystrokes make it through + if (results.size == 0) return //todo: hack, in case random keystrokes make it through textAndOffsetHash.clear() val textPointPairs: MutableList> = ArrayList>() val total = results.size - 1 @@ -77,9 +77,9 @@ public open class AceJumpAction(): DumbAwareAction() { val letters = aceFinder.getAllowedCharacters()!! var len = letters.length var groups = Math.floor(total.toDouble() / len) -// print("groups: " + groups.toString()) + // print("groups: " + groups.toString()) val lenMinusGroups = len - groups.toInt() -// print("last letter: " + letters.charAt(lenMinusGroups).toString() + "\n") + // print("last letter: " + letters.charAt(lenMinusGroups).toString() + "\n") for (i in 0..total) { @@ -87,15 +87,15 @@ public open class AceJumpAction(): DumbAwareAction() { val iGroup = i - lenMinusGroups val iModGroup = iGroup % len -// if(iModGroup == 0) print("================\n") + // if(iModGroup == 0) print("================\n") val i1 = Math.floor(lenMinusGroups.toDouble() + ((i + groups.toInt()) / len)).toInt() - 1 - if(i >= lenMinusGroups){ + if (i >= lenMinusGroups) { str += letters.charAt(i1) str += letters.charAt(iModGroup).toString() - }else { + } else { str += letters.charAt(i).toString() } -// print(i.toString() + ": " + str + " iModGroup:" + iModGroup.toString() + "\n") + // print(i.toString() + ": " + str + " iModGroup:" + iModGroup.toString() + "\n") val textOffset: Int = results.get(i) @@ -103,7 +103,7 @@ public open class AceJumpAction(): DumbAwareAction() { textPointPairs.add(Pair(str, point?.getOriginalPoint() as Point)) textAndOffsetHash.put(str, textOffset) - if(str == "zz"){ + if (str == "zz") { break } } @@ -114,8 +114,8 @@ public open class AceJumpAction(): DumbAwareAction() { fun addAceCanvas() { val contentComponent: JComponent? = editor.getContentComponent() contentComponent?.add(aceCanvas) - val viewport = editor.getScrollPane().getViewport() - aceCanvas.setBounds(0, 0, (viewport?.getWidth())!! + 1000, (viewport?.getHeight())!! + 1000) + val viewport = editor.getScrollPane().getViewport()!! + aceCanvas.setBounds(0, 0, viewport.getWidth() + 1000, viewport.getHeight() + 1000) val rootPane: JRootPane? = editor.getComponent().getRootPane()!! val locationOnScreen: Point? = SwingUtilities.convertPoint(aceCanvas, (aceCanvas.getLocation()), rootPane) aceCanvas.setLocation(-locationOnScreen!!.x, -locationOnScreen.y) @@ -165,9 +165,11 @@ public open class AceJumpAction(): DumbAwareAction() { popupBuilder?.setCancelKeyEnabled(true) val popup = (popupBuilder?.createPopup() as AbstractPopup?) popup?.show(guessBestLocation(editor)) - val width = searchBox.getFontMetrics(font)?.stringWidth("w") + popup?.setRequestFocus(true); + + val width = searchBox.getFontMetrics(font).stringWidth("w") var dimension: Dimension? = null - if(width != null){ + if (width != null) { dimension = Dimension(width * 2, (editor.getLineHeight())) if (SystemInfo.isMac) { dimension?.setSize(dimension!!.width * 2, dimension!!.height * 2) @@ -203,12 +205,13 @@ public open class AceJumpAction(): DumbAwareAction() { configureAceCanvas() - ApplicationManager.getApplication()?.invokeLater(object:Runnable{ + ApplicationManager.getApplication()?.invokeLater(object:Runnable { public override fun run() { - IdeFocusManager.getInstance(project)?.requestFocus(searchBox, true) - } + val manager = IdeFocusManager.getInstance(project) + manager?.requestFocus(searchBox, false) + } }); } +} -} \ No newline at end of file diff --git a/src/com/johnlindquist/acejump/keycommands/ChangeToTargetMode.kt b/src/com/johnlindquist/acejump/keycommands/ChangeToTargetMode.kt index 1508b9f6..fa01a6b3 100644 --- a/src/com/johnlindquist/acejump/keycommands/ChangeToTargetMode.kt +++ b/src/com/johnlindquist/acejump/keycommands/ChangeToTargetMode.kt @@ -13,7 +13,8 @@ public class ChangeToTargetMode(val searchBox: SearchBox, val aceFinder: AceFind override fun execute(keyEvent: KeyEvent) { aceFinder.addResultsReadyListener(object :ChangeListener{ public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) + eventDispatcher?.getMulticaster()?.stateChanged(p0) +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) } }) diff --git a/src/com/johnlindquist/acejump/keycommands/DefaultKeyCommand.kt b/src/com/johnlindquist/acejump/keycommands/DefaultKeyCommand.kt index d26d1be9..f0d25eb2 100644 --- a/src/com/johnlindquist/acejump/keycommands/DefaultKeyCommand.kt +++ b/src/com/johnlindquist/acejump/keycommands/DefaultKeyCommand.kt @@ -22,7 +22,8 @@ public class DefaultKeyCommand(val searchBox: SearchBox, val aceFinder: AceFinde //Find aceFinder.addResultsReadyListener(object: ChangeListener{ public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) + eventDispatcher?.getMulticaster()?.stateChanged(p0) +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) } }) diff --git a/src/com/johnlindquist/acejump/keycommands/ExpandResults.kt b/src/com/johnlindquist/acejump/keycommands/ExpandResults.kt index 87f60c6a..a630fa83 100644 --- a/src/com/johnlindquist/acejump/keycommands/ExpandResults.kt +++ b/src/com/johnlindquist/acejump/keycommands/ExpandResults.kt @@ -12,7 +12,8 @@ public class ExpandResults(val searchBox: SearchBox, val aceFinder: AceFinder, a if(searchBox.getText()?.length() == 0){ aceFinder.addResultsReadyListener(object:ChangeListener{ public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())); + eventDispatcher?.getMulticaster()?.stateChanged(p0); +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())); } }); diff --git a/src/com/johnlindquist/acejump/keycommands/ShowBeginningOfLines.kt b/src/com/johnlindquist/acejump/keycommands/ShowBeginningOfLines.kt index 17a63405..796248f8 100644 --- a/src/com/johnlindquist/acejump/keycommands/ShowBeginningOfLines.kt +++ b/src/com/johnlindquist/acejump/keycommands/ShowBeginningOfLines.kt @@ -10,7 +10,8 @@ public class ShowBeginningOfLines(val searchBox: SearchBox, val aceFinder: AceFi override fun execute(keyEvent: KeyEvent) { aceFinder.addResultsReadyListener(object :ChangeListener{ public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) + eventDispatcher?.getMulticaster()?.stateChanged(p0) +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) } }) diff --git a/src/com/johnlindquist/acejump/keycommands/ShowEndOfLines.kt b/src/com/johnlindquist/acejump/keycommands/ShowEndOfLines.kt index 19c1d0f1..bb9a629d 100644 --- a/src/com/johnlindquist/acejump/keycommands/ShowEndOfLines.kt +++ b/src/com/johnlindquist/acejump/keycommands/ShowEndOfLines.kt @@ -11,7 +11,8 @@ public class ShowEndOfLines(val searchBox: SearchBox, val aceFinder: AceFinder): override fun execute(keyEvent: KeyEvent) { aceFinder.addResultsReadyListener(object : ChangeListener { public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) + eventDispatcher?.getMulticaster()?.stateChanged(p0) +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) } }) diff --git a/src/com/johnlindquist/acejump/keycommands/ShowFirstCharOfLines.kt b/src/com/johnlindquist/acejump/keycommands/ShowFirstCharOfLines.kt index 7d1e771b..14c96968 100644 --- a/src/com/johnlindquist/acejump/keycommands/ShowFirstCharOfLines.kt +++ b/src/com/johnlindquist/acejump/keycommands/ShowFirstCharOfLines.kt @@ -10,7 +10,8 @@ public class ShowFirstCharOfLines(val searchBox: SearchBox, val aceFinder: AceFi override fun execute(keyEvent: KeyEvent) { aceFinder.addResultsReadyListener(object :ChangeListener{ public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) + eventDispatcher?.getMulticaster()?.stateChanged(p0) +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) } }) diff --git a/src/com/johnlindquist/acejump/keycommands/ShowWhiteSpace.kt b/src/com/johnlindquist/acejump/keycommands/ShowWhiteSpace.kt index 24f9ea73..04b015e5 100644 --- a/src/com/johnlindquist/acejump/keycommands/ShowWhiteSpace.kt +++ b/src/com/johnlindquist/acejump/keycommands/ShowWhiteSpace.kt @@ -10,7 +10,8 @@ public class ShowWhiteSpace(val searchBox: SearchBox, val aceFinder: AceFinder): override fun execute(keyEvent: KeyEvent) { aceFinder.addResultsReadyListener(object :ChangeListener{ public override fun stateChanged(p0: ChangeEvent) { - eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) + eventDispatcher?.getMulticaster()?.stateChanged(p0) +// eventDispatcher?.getMulticaster()?.stateChanged(ChangeEvent(toString())) } }) diff --git a/src/com/johnlindquist/acejump/ui/AceCanvas.kt b/src/com/johnlindquist/acejump/ui/AceCanvas.kt index 750932d0..84a87c6d 100644 --- a/src/com/johnlindquist/acejump/ui/AceCanvas.kt +++ b/src/com/johnlindquist/acejump/ui/AceCanvas.kt @@ -22,9 +22,9 @@ public class AceCanvas: JComponent() { inner class FontBasedMeasurements() { - var font = getFont() - val fontWidth = getFontMetrics(font)?.stringWidth("w")!! - val fontHeight = font?.getSize()!! + var font = getFont()!! + val fontWidth = getFontMetrics(font).stringWidth("w") + val fontHeight = font.getSize() val rectMarginWidth = fontWidth / 2 val doubleRectMarginWidth = rectMarginWidth * 2