├── config ├── checkstyle │ ├── javaHeader.txt │ └── rstauiSuppressions.xml └── spotbugs-exclude.xml ├── .gitignore ├── RSTAUI ├── README.md ├── src │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── fife │ │ │ │ └── rsta │ │ │ │ └── ui │ │ │ │ ├── package-info.java │ │ │ │ ├── search │ │ │ │ ├── package-info.java │ │ │ │ ├── SearchListener.java │ │ │ │ ├── FindReplaceButtonsEnableResult.java │ │ │ │ ├── SearchUtil.java │ │ │ │ ├── SearchEvent.java │ │ │ │ ├── SearchComboBox.java │ │ │ │ ├── FindDialog.java │ │ │ │ └── ReplaceToolBar.java │ │ │ │ ├── ContentAssistable.java │ │ │ │ ├── ResizableFrameContentPane.java │ │ │ │ ├── SizeGripIcon.java │ │ │ │ ├── MaxWidthComboBox.java │ │ │ │ ├── RComboBoxModel.java │ │ │ │ ├── EscapableDialog.java │ │ │ │ ├── DecorativeIconPanel.java │ │ │ │ └── AssistanceIconPanel.java │ │ ├── resources │ │ │ └── org │ │ │ │ └── fife │ │ │ │ └── rsta │ │ │ │ └── ui │ │ │ │ ├── search │ │ │ │ ├── lightbulb.png │ │ │ │ ├── SearchToolBar_nl.properties │ │ │ │ ├── SearchToolBar.properties │ │ │ │ ├── SearchToolBar_in.properties │ │ │ │ ├── SearchToolBar_tr.properties │ │ │ │ ├── SearchToolBar_es.properties │ │ │ │ ├── SearchToolBar_hu.properties │ │ │ │ ├── SearchToolBar_ja.properties │ │ │ │ ├── SearchToolBar_pt_BR.properties │ │ │ │ ├── SearchToolBar_it.properties │ │ │ │ ├── SearchToolBar_ko.properties │ │ │ │ ├── SearchToolBar_pl.properties │ │ │ │ ├── SearchToolBar_zh_TW.properties │ │ │ │ ├── SearchToolBar_de.properties │ │ │ │ ├── SearchToolBar_ar.properties │ │ │ │ ├── SearchToolBar_pt.properties │ │ │ │ ├── SearchToolBar_zh_CN.properties │ │ │ │ ├── SearchToolBar_fr.properties │ │ │ │ ├── SearchToolBar_fi.properties │ │ │ │ ├── SearchToolBar_ru.properties │ │ │ │ ├── Search_in.properties │ │ │ │ ├── Search.properties │ │ │ │ ├── SearchToolBar_uk.properties │ │ │ │ ├── Search_it.properties │ │ │ │ ├── Search_tr.properties │ │ │ │ ├── Search_es.properties │ │ │ │ ├── Search_nl.properties │ │ │ │ ├── Search_fr.properties │ │ │ │ ├── Search_pt_BR.properties │ │ │ │ ├── Search_de.properties │ │ │ │ ├── Search_fi.properties │ │ │ │ ├── Search_pl.properties │ │ │ │ ├── Search_pt.properties │ │ │ │ ├── Search_zh_TW.properties │ │ │ │ ├── Search_hu.properties │ │ │ │ ├── Search_ko.properties │ │ │ │ ├── Search_zh_CN.properties │ │ │ │ ├── Search_ja.properties │ │ │ │ ├── Search_ar.properties │ │ │ │ ├── Search_ru.properties │ │ │ │ └── Search_uk.properties │ │ │ │ ├── GoToDialog_in.properties │ │ │ │ ├── GoToDialog.properties │ │ │ │ ├── GoToDialog_fi.properties │ │ │ │ ├── GoToDialog_it.properties │ │ │ │ ├── GoToDialog_nl.properties │ │ │ │ ├── GoToDialog_tr.properties │ │ │ │ ├── GoToDialog_de.properties │ │ │ │ ├── GoToDialog_fr.properties │ │ │ │ ├── GoToDialog_es.properties │ │ │ │ ├── GoToDialog_pt.properties │ │ │ │ ├── GoToDialog_pt_BR.properties │ │ │ │ ├── GoToDialog_pl.properties │ │ │ │ ├── GoToDialog_zh_CN.properties │ │ │ │ ├── GoToDialog_zh_TW.properties │ │ │ │ ├── GoToDialog_hu.properties │ │ │ │ ├── GoToDialog_ko.properties │ │ │ │ ├── GoToDialog_ja.properties │ │ │ │ ├── TextFilePropertiesDialog.properties │ │ │ │ ├── TextFilePropertiesDialog_in.properties │ │ │ │ ├── TextFilePropertiesDialog_nl.properties │ │ │ │ ├── TextFilePropertiesDialog_it.properties │ │ │ │ ├── TextFilePropertiesDialog_de.properties │ │ │ │ ├── GoToDialog_ar.properties │ │ │ │ ├── TextFilePropertiesDialog_tr.properties │ │ │ │ ├── TextFilePropertiesDialog_fr.properties │ │ │ │ ├── GoToDialog_ru.properties │ │ │ │ ├── TextFilePropertiesDialog_es.properties │ │ │ │ ├── TextFilePropertiesDialog_pl.properties │ │ │ │ ├── TextFilePropertiesDialog_fi.properties │ │ │ │ ├── TextFilePropertiesDialog_pt_BR.properties │ │ │ │ ├── TextFilePropertiesDialog_pt.properties │ │ │ │ ├── GoToDialog_uk.properties │ │ │ │ ├── TextFilePropertiesDialog_hu.properties │ │ │ │ ├── TextFilePropertiesDialog_zh_TW.properties │ │ │ │ ├── TextFilePropertiesDialog_ko.properties │ │ │ │ ├── TextFilePropertiesDialog_zh_CN.properties │ │ │ │ ├── TextFilePropertiesDialog_ja.properties │ │ │ │ ├── TextFilePropertiesDialog_ru.properties │ │ │ │ ├── TextFilePropertiesDialog_ar.properties │ │ │ │ └── TextFilePropertiesDialog_uk.properties │ │ └── dist │ │ │ └── RSTAUI.License.txt │ └── test │ │ └── java │ │ └── org │ │ └── fife │ │ └── rsta │ │ └── ui │ │ ├── TestUtil.java │ │ ├── search │ │ ├── SearchUtilTest.java │ │ ├── SearchEventTest.java │ │ ├── SearchComboBoxTest.java │ │ ├── FindToolBarTest.java │ │ ├── ReplaceToolBarTest.java │ │ └── FindDialogTest.java │ │ ├── ResizableFrameContentPaneTest.java │ │ ├── SizeGripIconTest.java │ │ ├── SwingRunnerExtension.java │ │ ├── MaxWidthComboBoxTest.java │ │ ├── AssistanceIconPanelTest.java │ │ ├── DecorativeIconPanelTest.java │ │ ├── GoToDialogTest.java │ │ ├── CollapsibleSectionPanelTest.java │ │ ├── EscapableDialogTest.java │ │ ├── RComboBoxModelTest.java │ │ └── TextFilePropertiesDialogTest.java └── build.gradle ├── settings.gradle ├── img ├── find-dialog.png ├── replace-dialog.png └── go-to-line-dialog.png ├── RSTAUIDemo ├── README.md ├── src │ └── main │ │ └── java │ │ └── org │ │ └── fife │ │ └── rsta │ │ └── ui │ │ └── demo │ │ ├── package-info.java │ │ └── RSTAUIDemoApp.java └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .editorconfig ├── gradle.properties ├── .github └── workflows │ ├── gradle.yml │ └── codeql-analysis.yml ├── gradlew.bat ├── README.md └── gradlew /config/checkstyle/javaHeader.txt: -------------------------------------------------------------------------------- 1 | /* 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | rstaui_*.zip 3 | .gradle 4 | build 5 | out/ 6 | -------------------------------------------------------------------------------- /RSTAUI/README.md: -------------------------------------------------------------------------------- 1 | # RSTAUI 2 | This is the source code for the library. 3 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RSTAUI' 2 | 3 | include 'RSTAUI', 'RSTAUIDemo' 4 | -------------------------------------------------------------------------------- /img/find-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/RSTAUI/HEAD/img/find-dialog.png -------------------------------------------------------------------------------- /img/replace-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/RSTAUI/HEAD/img/replace-dialog.png -------------------------------------------------------------------------------- /img/go-to-line-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/RSTAUI/HEAD/img/go-to-line-dialog.png -------------------------------------------------------------------------------- /RSTAUIDemo/README.md: -------------------------------------------------------------------------------- 1 | # RSTAUIDemo 2 | A demo application showing off some features of the RSTAUI library. 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/RSTAUI/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Main package for the library. 3 | */ 4 | package org.fife.rsta.ui; 5 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/search/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Search-related UI components. 3 | */ 4 | package org.fife.rsta.ui.search; 5 | -------------------------------------------------------------------------------- /RSTAUIDemo/src/main/java/org/fife/rsta/ui/demo/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Demo application for the library. 3 | */ 4 | package org.fife.rsta.ui.demo; 5 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/lightbulb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/RSTAUI/HEAD/RSTAUI/src/main/resources/org/fife/rsta/ui/search/lightbulb.png -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_nl.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Zoeken: 2 | Find.ToolTip=Shift+Enter zoekt achterwaarts 3 | FindPrev=Vorige zoeken. 4 | Replace.ToolTip=Shift+Enter vervangt achterwaarts 5 | ReplaceWith=Vervangen: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Find: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=Replace: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_in.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Cari: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=Ganti: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_tr.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Bul: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=Yer Degistir: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_es.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Buscar: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=Reemplazar: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_hu.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Keres\u00e9s: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=Csere: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_ja.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\u691c\u7d22: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=\u7f6e\u63db: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_pt_BR.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Procurar: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=Substituir: 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.java] 2 | indent_style = tab 3 | indent_size = 4 4 | trim_trailing_whitespace = true 5 | max_line_length = 120 6 | 7 | [*.xml] 8 | indent_style = tab 9 | indent_size = 4 10 | trim_trailing_whitespace = true 11 | end_of_line = lf 12 | max_line_length = 120 13 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_it.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Trova: 2 | Find.ToolTip=Shift+Enter esegue una ricerca all''indietro 3 | FindPrev=Trova Prec 4 | Replace.ToolTip=Shift+Enter esegue una sostituzione all''indietro 5 | ReplaceWith=Sostituisci: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_ko.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\ucc3e\uae30: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=\ubc14\uafb8\uae30: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_pl.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Znajd\u017a: 2 | Find.ToolTip=Shift+Enter wykonuje wyszukiwanie wstecz 3 | FindPrev=Znajd\u017a poprzednie 4 | Replace.ToolTip=Shift+Enter wykonuje zamian\u0119 wstecz 5 | ReplaceWith=Zamie\u0144: 6 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Note that Maven- and signing-related properties are in /gradle.properties 2 | javaLanguageVersion=8 3 | version=3.3.2-SNAPSHOT 4 | 5 | # Ugh, see https://github.com/gradle/gradle/issues/11308 6 | systemProp.org.gradle.internal.publish.checksums.insecure=true 7 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_zh_TW.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\u67e5\u627e\u4ec0\u9ebc: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=\u66ff\u63db: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_de.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Suchen: 2 | Find.ToolTip=Umschalt+Enter f\u00fchrt eine umgekehrte Suche durch 3 | FindPrev=Vorherige suchen 4 | Replace.ToolTip=Umschalt+Enter f\u00fchrt eine umgekehrte Ersetzung durch 5 | ReplaceWith=Ersetzen: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_ar.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\u0628\u062d\u062b: 2 | Find.ToolTip=Shift+Enter performs a backwards search 3 | FindPrev=Find Prev. 4 | Replace.ToolTip=Shift+Enter performs a backwards replace 5 | ReplaceWith=\u0627\u0633\u062a\u0628\u062f\u0627\u0644: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_in.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Menuju Baris 2 | LineNumber=Nomor Baris: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Masukkan integer antara dan 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Batal 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Error 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Goto Line 2 | LineNumber=Line Number: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Please enter an integer between 1 and 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Cancel 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Error 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_pt.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Localizar: 2 | Find.ToolTip=Shift+Enter efectua uma pesquisa de tr\u00e1s para a frente 3 | FindPrev=Localizar anterior. 4 | Replace.ToolTip=Shift+Enter executa uma substitui\u00e7\u00e3o para tr\u00e1s 5 | ReplaceWith=Substituir: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_fi.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Mene riville 2 | LineNumber=Rivin numero: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Kirjoita luku v\u00e4lilt\u00e4 1 ja 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Peruuta 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Virhe 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_it.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Vai a riga 2 | LineNumber=Numero di riga: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Inserire un numero intero tra 1 e 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Annulla 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Errore 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_nl.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Ga naar regel 2 | LineNumber=Regelnummer: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Voer een geheel getal in tussen 1 en 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Annuleren 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Fout 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_tr.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Satira Git 2 | LineNumber=Satir Numarasi: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Gireceginiz Tamsayi Araligi 1 ve 5 | OK=TAMAM 6 | OK.Mnemonic=O 7 | Cancel=Iptal 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Hata 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_zh_CN.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\u67e5\u627e\uff1a 2 | Find.ToolTip=Shift+Enter \u6267\u884c\u5411\u540e\u641c\u7d22 3 | FindPrev=\u67e5\u627e\u4e0a\u4e00\u4e2a 4 | Replace.ToolTip=Shift+Enter \u6267\u884c\u5411\u540e\u66ff\u6362 5 | ReplaceWith=\u66ff\u6362\uff1a 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_fr.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Rechercher\u00a0: 2 | Find.ToolTip=Shift+Enter effectue une recherche en arri\u00e8re 3 | FindPrev=Rechercher le pr\u00e9c\u00e9dent 4 | Replace.ToolTip=Shift+Entr\u00e9e effectue un remplacement en arri\u00e8re. 5 | ReplaceWith=Remplacer\u00a0: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_de.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Gehe zu Zeile 2 | LineNumber=Zeilennummer: 3 | LineNumber.Mnemonic=Z 4 | LineNumberRange=Bitte geben Sie eine Zahl ein, zwischen 1 und 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Abbrechen 8 | Cancel.Mnemonic=B 9 | ErrorDialog.Title=Fehler 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_fr.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Aller \u00e0 la ligne 2 | LineNumber=Ligne num\u00e9ro: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Veuillez saisir un entier entre 1 et 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Annuler 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Erreur 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_es.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Ir a la l\u00ednea 2 | LineNumber=N\u00famero de l\u00ednea: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Introduzca un n\u00famero entre 1 y 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Cancelar 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Error 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_pt.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Ir para linha 2 | LineNumber=N\u00famero de linha: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Por favor, insira um n\u00famero inteiro entre 1 e 5 | OK=Aceitar 6 | OK.Mnemonic=A 7 | Cancel=Cancelar 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Erro 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_pt_BR.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Ir para linha 2 | LineNumber=N\u00famero da linha: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Por favor, digite um n\u00famero inteiro entre 1 e 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Cancelar 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Erro 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_fi.properties: -------------------------------------------------------------------------------- 1 | FindWhat=Etsi: 2 | Find.ToolTip=N\u00e4pp\u00e4inyhdistelm\u00e4 vaihto+Enter hakee taaksep\u00e4in 3 | FindPrev=Etsi edellinen 4 | Replace.ToolTip=N\u00e4pp\u00e4inyhdistelm\u00e4 vaihto+Enter korvaa j\u00e4rjestyksess\u00e4 edellisen 5 | ReplaceWith=Korvaa t\u00e4ll\u00e4: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_pl.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Przejd\u017a do wiersza 2 | LineNumber=Numer wiersza: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Wprowad\u017a liczb\u0119 ca\u0142kowit\u0105 w przedziale od 1 do 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=Anuluj 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=\u2014 b\u0142\u0105d 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_zh_CN.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\u8f6c\u5230\u884c 2 | LineNumber=\u884c\u53f7\uff1a 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=\u8bf7\u8f93\u5165\u4e00\u4e2a\u6574\u6570\uff0c\u4ece 1 \u5230 5 | OK=\u786e\u5b9a 6 | OK.Mnemonic=O 7 | Cancel=\u53d6\u6d88 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=\u9519\u8bef 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_zh_TW.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\u8df3\u884c 2 | LineNumber=\u884c\u865f: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=\u8acb\u8f38\u5165\u4e00\u500b\u6574\u6578\uff0c\u7bc4\u570d\u57281\u548c 5 | OK=\u78ba\u5b9a 6 | OK.Mnemonic=O 7 | Cancel=\u53d6\u6d88 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=\u932f\u8aa4 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_hu.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=Sorhoz ugr\u00e1s 2 | LineNumber=Sor sz\u00e1ma: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=Adjon meg egy eg\u00e9sz sz\u00e1mot a k\u00f6vetkez\u0151 k\u00e9t sz\u00e1m k\u00f6z\u00f6tt 1 \u00e9s 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=M\u00e9gse 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=Hiba 10 | -------------------------------------------------------------------------------- /config/checkstyle/rstauiSuppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_ko.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\ud589 \uc774\ub3d9 2 | LineNumber=\uc904 \ubc88\ud638: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=1\ubcf4\ub2e4 \ud06c\uace0 \ub2e4\uc74c \uc22b\uc790\ubcf4\ub2e4 \uc791\uc740 \uc815\uc218 \uc785\ub825\ud558\uc138\uc694. 5 | OK=\ud655\uc778 6 | OK.Mnemonic=O 7 | Cancel=\ucde8\uc18c 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=\uc624\ub958 10 | -------------------------------------------------------------------------------- /config/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_ja.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\u6307\u5b9a\u884c\u3078\u306e\u30b8\u30e3\u30f3\u30d7 2 | LineNumber=\u884c\u756a\u53f7: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=\u6b21\u306e\u7bc4\u56f2\u306e\u6574\u6570\u306b\u3057\u3066\u4e0b\u3055\u3044:1\u304b\u3089 5 | OK=OK 6 | OK.Mnemonic=O 7 | Cancel=\u30ad\u30e3\u30f3\u30bb\u30eb 8 | Cancel.Mnemonic=C 9 | ErrorDialog.Title=\u30a8\u30e9\u30fc 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog.properties: -------------------------------------------------------------------------------- 1 | Title=Properties: {0} 2 | Path=Path: 3 | Path.Mnemonic=P 4 | Lines=Lines: 5 | Characters=Characters: 6 | Words=Words: 7 | LineTerminator=Line terminator: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Encoding: 10 | Encoding.Mnemonic=E 11 | FileSize=File Size: 12 | LastModified=Last modified: 13 | 14 | CR=Old Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=System Default 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Cancel 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_in.properties: -------------------------------------------------------------------------------- 1 | Title=Properti: {0} 2 | Path=Path: 3 | Path.Mnemonic=P 4 | Lines=Baris: 5 | Characters=Karakter: 6 | Words=Words: 7 | LineTerminator=Garis Batas: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Encoding: 10 | Encoding.Mnemonic=E 11 | FileSize=Ukuran File: 12 | LastModified=Modifikasi terakhir: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Sistem Default 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Batal 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_nl.properties: -------------------------------------------------------------------------------- 1 | Title=Eigenschappen: {0} 2 | Path=Pad: 3 | Path.Mnemonic=P 4 | Lines=Regels: 5 | Characters=Tekens: 6 | Words=Woorden: 7 | LineTerminator=Regeleinde: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Codering: 10 | Encoding.Mnemonic=E 11 | FileSize=Bestandsgrootte: 12 | LastModified=Laatst aangepast: 13 | 14 | CR=Oude Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Standaard systeem 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Annuleren 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_it.properties: -------------------------------------------------------------------------------- 1 | Title=Propriet\u00e0: {0} 2 | Path=Percorso: 3 | Path.Mnemonic=P 4 | Lines=Righe: 5 | Characters=Caratteri: 6 | Words=Parole: 7 | LineTerminator=Carattere di fine riga: 8 | LineTerminator.Mnemonic=R 9 | Encoding=Codifica: 10 | Encoding.Mnemonic=C 11 | FileSize=Dimensioni file: 12 | LastModified=Ultima modifica: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Predefinito di sistema 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Annulla 22 | Cancel.Mnemonic=N -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_de.properties: -------------------------------------------------------------------------------- 1 | Title=Eigenschaften: {0} 2 | Path=Pfad: 3 | Path.Mnemonic=D 4 | Lines=Zeilen: 5 | Characters=Zeichen: 6 | Words=W\u00f6rter: 7 | LineTerminator=Zeilentrennung: 8 | LineTerminator.Mnemonic=Z 9 | Encoding=Kodierung: 10 | Encoding.Mnemonic=E 11 | FileSize=Dateigr\u00f6\u00dfe: 12 | LastModified=Zuletzt ge\u00e4ndert: 13 | 14 | CR=Alter Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Systemstandard 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Abbrechen 22 | Cancel.Mnemonic=B -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_ar.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\u062a\u0648\u062c\u0647 \u0625\u0644\u0649 \u0627\u0644\u0633\u0637\u0631 2 | LineNumber=\u0631\u0642\u0645 \u0627\u0644\u0633\u0637\u0631: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=\u0627\u0644\u0631\u062c\u0627\u0621 \u0625\u062f\u062e\u0627\u0644 \u0631\u0642\u0645 \u0635\u062d\u064a\u062d \u0628\u064a\u0646 1 \u0648 5 | OK=\u0645\u0648\u0627\u0641\u0642 6 | OK.Mnemonic=\u0645 7 | Cancel=\u0625\u0644\u063a\u0627\u0621 8 | Cancel.Mnemonic=\u063a 9 | ErrorDialog.Title=\u062e\u0637\u0623 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_tr.properties: -------------------------------------------------------------------------------- 1 | Title=Ozellikler: {0} 2 | Path=Konum: 3 | Path.Mnemonic=P 4 | Lines=Satirlar: 5 | Characters=Karakterler: 6 | Words=Kelimeler: 7 | LineTerminator=Satir Sonlandirici: 8 | LineTerminator.Mnemonic=S 9 | Encoding=Kodlaniyor: 10 | Encoding.Mnemonic=K 11 | FileSize=Dosya Boyutu: 12 | LastModified=Son Degistirme: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Sistem Varsayilani 18 | 19 | OK=TAMAM 20 | OK.Mnemonic=T 21 | Cancel=Iptal 22 | Cancel.Mnemonic=I 23 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_fr.properties: -------------------------------------------------------------------------------- 1 | Title=Propri\u00e9t\u00e9s: {0} 2 | Path=Chemin: 3 | Path.Mnemonic=P 4 | Lines=Lignes: 5 | Characters=Caract\u00e8res: 6 | Words=Mots: 7 | LineTerminator=Caract\u00e8re de fin de ligne: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Encodage: 10 | Encoding.Mnemonic=E 11 | FileSize=Taille du fichier: 12 | LastModified=Derni\u00e8re modification: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Valeur de l'OS 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Annuler 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_ru.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u0442\u0440\u043e\u043a\u0435 2 | LineNumber=\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438: 3 | LineNumber.Mnemonic=L 4 | LineNumberRange=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u0436\u0434\u0443 1 \u0438 5 | OK=\u041e\u041a 6 | OK.Mnemonic=\u041e 7 | Cancel=\u041e\u0442\u043c\u0435\u043d\u0430 8 | Cancel.Mnemonic=\u0422 9 | ErrorDialog.Title=\u043e\u0448\u0438\u0431\u043a\u0430 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_es.properties: -------------------------------------------------------------------------------- 1 | Title=Propiedades: {0} 2 | Path=Ruta: 3 | Path.Mnemonic=P 4 | Lines=Lineas: 5 | Characters=Caracteres: 6 | Words=Palabras: 7 | LineTerminator=Delimitador de l\u00ednea: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Juego de caracteres: 10 | Encoding.Mnemonic=E 11 | FileSize=Tama\u00f1o de archivo: 12 | LastModified=\u00daltima modificaci\u00f3n: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Sistema por defecto 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Cancelar 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_pl.properties: -------------------------------------------------------------------------------- 1 | CR=Macintosh (\\r) 2 | CRLF=Windows (\\r\\n) 3 | Cancel=Anuluj 4 | Cancel.Mnemonic=C 5 | Characters=Znak\u00f3w: 6 | Encoding=Kodowanie: 7 | Encoding.Mnemonic=E 8 | FileSize=Rozmiar pliku: 9 | LF=UNIX (\\n) 10 | LastModified=Zmodyfikowany: 11 | LineTerminator=Znak ko\u0144ca wiersza: 12 | LineTerminator.Mnemonic=L 13 | Lines=Wierszy: 14 | OK=OK 15 | OK.Mnemonic=O 16 | Path=\u015acie\u017cka: 17 | Path.Mnemonic=P 18 | SysDef=domy\u015blny systemowy 19 | Title=W\u0142a\u015bciwo\u015bci pliku{0} 20 | Words=Wyraz\u00f3w: 21 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_ru.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\u041f\u043e\u0438\u0441\u043a: 2 | Find.ToolTip=Shift+Enter \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a 3 | FindPrev=\u041d\u0430\u0439\u0442\u0438 \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 4 | Replace.ToolTip=Shift+Enter \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0437\u0430\u043c\u0435\u043d\u0443 5 | ReplaceWith=\u0417\u0430\u043c\u0435\u043d\u0430: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_fi.properties: -------------------------------------------------------------------------------- 1 | Title=Ominaisuudet: {0} 2 | Path=Polku: 3 | Path.Mnemonic=P 4 | Lines=Rivit: 5 | Characters=Merkit: 6 | Words=Sanoja: 7 | LineTerminator=Rivin p\u00e4\u00e4tt\u00e4v\u00e4 merkki: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Merkist\u00f6koodaus: 10 | Encoding.Mnemonic=E 11 | FileSize=Tiedoston koko: 12 | LastModified=Viimeksi muokattu: 13 | 14 | CR=Vanha Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=J\u00e4rjestelm\u00e4n oletusarvo 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Peruuta 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_pt_BR.properties: -------------------------------------------------------------------------------- 1 | Title=Propriedades: {0} 2 | Path=Localiza\u00e7\u00e3o: 3 | Path.Mnemonic=P 4 | Lines=Linhas: 5 | Characters=Caracteres: 6 | Words=Palavras: 7 | LineTerminator=Terminador de Linha: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Codifica\u00e7\u00e3o: 10 | Encoding.Mnemonic=E 11 | FileSize=Tamanho do Arquivo: 12 | LastModified=Modificado pela \u00faltima vez em: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Padr\u00e3o do sistema 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=Cancelar 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_pt.properties: -------------------------------------------------------------------------------- 1 | Title=Propriedades: {0} 2 | Path=Caminho: 3 | Path.Mnemonic=S 4 | Lines=Linhas: 5 | Characters=Caracteres: 6 | Words=Palavras: 7 | LineTerminator=Final de linha: 8 | LineTerminator.Mnemonic=L 9 | Encoding=Codifica\u00e7\u00e3o: 10 | Encoding.Mnemonic=X 11 | FileSize=Tamanho de ficheiro: 12 | LastModified=\u00daltima modifica\u00e7\u00e3o: 13 | 14 | CR=Macintosh antigo (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Pr\u00e9-defini\u00e7\u00e3o do sistema 18 | 19 | OK=Aceitar 20 | OK.Mnemonic=A 21 | Cancel=Cancelar 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUIDemo/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'base' 3 | } 4 | 5 | base { 6 | archivesName = 'rstauidemo' 7 | } 8 | 9 | dependencies { 10 | implementation project(':RSTAUI') 11 | } 12 | 13 | jar { 14 | manifest { 15 | attributes('Class-Path': 'rsyntaxtextarea.jar autocomplete.jar', 16 | 'Specification-Title': 'RSTAUIDemo', 17 | 'Specification-Version': archiveVersion, 18 | 'Implementation-Title': 'org.fife.ui', 19 | 'Implementation-Version': archiveVersion, 20 | 'Main-Class': 'org.fife.rsta.ui.demo.RSTAUIDemoApp') 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/GoToDialog_uk.properties: -------------------------------------------------------------------------------- 1 | GotoDialogTitle=\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u0434\u043e \u0440\u044f\u0434\u043a\u0430 2 | LineNumber=\u041d\u043e\u043c\u0435\u0440 \u0440\u044f\u0434\u043a\u0430: 3 | LineNumber.Mnemonic=\u041d 4 | LineNumberRange=\u0423\u043a\u0430\u0436\u0456\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043c\u0456\u0436 1 \u0442\u0430 5 | OK=\u0413\u0430\u0440\u0430\u0437\u0434 6 | OK.Mnemonic=\u0413 7 | Cancel=\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438 8 | Cancel.Mnemonic=\u0421 9 | ErrorDialog.Title=\u041f\u043e\u043c\u0438\u043b\u043a\u0430 10 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_hu.properties: -------------------------------------------------------------------------------- 1 | Title=Tulajdons\u00e1gok:{0} 2 | Path=Hely: 3 | Path.Mnemonic=P 4 | Lines=Sorok: 5 | Characters=Karakterek: 6 | Words=Szavak: 7 | LineTerminator=Sorlez\u00e1r\u00f3: 8 | LineTerminator.Mnemonic=L 9 | Encoding=K\u00f3dol\u00e1s: 10 | Encoding.Mnemonic=E 11 | FileSize=F\u00e1jlm\u00e9ret: 12 | LastModified=Utols\u00f3 m\u00f3dos\u00edt\u00e1s: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=Rendszer alap\u00e9rtelmezett 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=M\u00e9gse 22 | Cancel.Mnemonic=C 23 | 24 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_zh_TW.properties: -------------------------------------------------------------------------------- 1 | Title=\u5c6c\u6027: {0} 2 | Path=\u8def\u5f91: 3 | Path.Mnemonic=P 4 | Lines=\u884c: 5 | Characters=\u5b57\u7b26: 6 | Words=\u8a5e: 7 | LineTerminator=\u884c\u7d42\u6b62\u7b26: 8 | LineTerminator.Mnemonic=L 9 | Encoding=\u7de8\u78bc: 10 | Encoding.Mnemonic=E 11 | FileSize=\u6a94\u6848\u5927\u5c0f: 12 | LastModified=\u6700\u5f8c\u4fee\u6539: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=\u7cfb\u7d71\u9ed8\u8a8d 18 | 19 | OK=\u78ba\u5b9a 20 | OK.Mnemonic=O 21 | Cancel=\u53d6\u6d88 22 | Cancel.Mnemonic=C 23 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_ko.properties: -------------------------------------------------------------------------------- 1 | Title=\uc18d\uc131: {0} 2 | Path=\uacbd\ub85c: 3 | Path.Mnemonic=P 4 | Lines=\uc904: 5 | Characters=\ubb38\uc790: 6 | Words=\ub2e8\uc5b4: 7 | LineTerminator=\ub77c\uc778 \uad6c\ubd84: 8 | LineTerminator.Mnemonic=L 9 | Encoding=\uc778\ucf54\ub529: 10 | Encoding.Mnemonic=E 11 | FileSize=\ud30c\uc77c \ud06c\uae30: 12 | LastModified=\ub9c8\uc9c0\ub9c9 \uc218\uc815 \uc2dc\uac04: 13 | 14 | CR=\ub9e4\ud0a8\ud1a0\uc2dc (\\r) 15 | LF=\uc720\ub2c9\uc2a4 (\\n) 16 | CRLF=\uc708\ub3c4\uc6b0 (\\r\\n) 17 | SysDef=\uc2dc\uc2a4\ud15c \uae30\ubcf8 18 | 19 | OK=\ud655\uc778 20 | OK.Mnemonic=O 21 | Cancel=\ucde8\uc18c 22 | Cancel.Mnemonic=C 23 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_zh_CN.properties: -------------------------------------------------------------------------------- 1 | Title=\u5c5e\u6027\uff1a{0} 2 | Path=\u8def\u5f84\uff1a 3 | Path.Mnemonic=P 4 | Lines=\u884c\u6570\uff1a 5 | Characters=\u5b57\u7b26\u6570\uff1a 6 | Words=\u5355\u8bcd\u6570\uff1a 7 | LineTerminator=\u884c\u7ec8\u6b62\u7b26\uff1a 8 | LineTerminator.Mnemonic=L 9 | Encoding=\u7f16\u7801\u65b9\u5f0f\uff1a 10 | Encoding.Mnemonic=E 11 | FileSize=\u6587\u4ef6\u5927\u5c0f\uff1a 12 | LastModified=\u4e0a\u6b21\u4fee\u6539\u65f6\u95f4\uff1a 13 | 14 | CR=\u8001 Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=\u7cfb\u7edf\u9ed8\u8ba4 18 | 19 | OK=\u786e\u5b9a 20 | OK.Mnemonic=O 21 | Cancel=\u53d6\u6d88 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/TestUtil.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui; 2 | 3 | import java.awt.*; 4 | import java.awt.image.BufferedImage; 5 | 6 | /** 7 | * Utility methods for testing. 8 | */ 9 | public final class TestUtil { 10 | 11 | /** 12 | * Private constructor to prevent instantiation. 13 | */ 14 | private TestUtil() { 15 | } 16 | 17 | public static Graphics2D createTestGraphics() { 18 | return createTestGraphics(80, 80); 19 | } 20 | 21 | 22 | public static Graphics2D createTestGraphics(int width, int height) { 23 | Graphics2D g = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB). 24 | createGraphics(); 25 | g.setClip(0, 0, width, height); 26 | return g; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_in.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Cari 2 | ReplaceDialogTitle=Ganti 3 | 4 | Direction=Arah: 5 | Up=Naik 6 | Down=Turun 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=Sama persis 11 | WholeWord=Semua kata 12 | RegEx=Regular Expresi 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | 17 | FindWhat=Cari Apa: 18 | ReplaceWith=Ganti dengan: 19 | FindWhat.Mnemonic=I 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=Cari 23 | Replace=Ganti 24 | ReplaceAll=Ganti Semua 25 | MarkAll=Tandai Semua 26 | Cancel=Batal 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=Content Assist Available 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Find 2 | ReplaceDialogTitle=Replace 3 | 4 | Direction=Direction: 5 | Up=Up 6 | Down=Down 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=Match case 11 | WholeWord=Whole word 12 | RegEx=Regex 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | Wrap=Wrap 17 | WrapMnemonic=Z 18 | 19 | FindWhat=Find what: 20 | ReplaceWith=Replace with: 21 | FindWhat.Mnemonic=I 22 | ReplaceWith.Mnemonic=P 23 | 24 | Find=Find 25 | Replace=Replace 26 | ReplaceAll=Replace All 27 | MarkAll=Mark all 28 | Cancel=Cancel 29 | Find.Mnemonic=F 30 | Replace.Mnemonic=R 31 | ReplaceAll.Mnemonic=A 32 | MarkAllMnemonic=K 33 | CancelMnemonic=C 34 | 35 | ContentAssistAvailable=Content Assist Available 36 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_ja.properties: -------------------------------------------------------------------------------- 1 | Title=\u30d7\u30ed\u30d1\u30c6\u30a3: {0} 2 | Path=\u30d1\u30b9: 3 | Path.Mnemonic=P 4 | Lines=\u884c\u6570: 5 | Characters=\u6587\u5b57\u6570: 6 | Words=Words: 7 | LineTerminator=\u884c\u30bf\u30fc\u30df\u30cd\u30fc\u30bf: 8 | LineTerminator.Mnemonic=L 9 | Encoding=\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0: 10 | Encoding.Mnemonic=E 11 | FileSize=\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba: 12 | LastModified=\u6700\u7d42\u66f4\u65b0\u65e5\u6642: 13 | 14 | CR=Macintosh (\\r) 15 | LF=UNIX (\\n) 16 | CRLF=Windows (\\r\\n) 17 | SysDef=\u30b7\u30b9\u30c6\u30e0\u306e\u30c7\u30d5\u30a9\u30eb\u30c8 18 | 19 | OK=OK 20 | OK.Mnemonic=O 21 | Cancel=\u30ad\u30e3\u30f3\u30bb\u30eb 22 | Cancel.Mnemonic=C -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/SearchToolBar_uk.properties: -------------------------------------------------------------------------------- 1 | FindWhat=\u0417\u043d\u0430\u0439\u0442\u0438: 2 | Find.ToolTip=\u041f\u043e\u0448\u0443\u043a \u0443 \u0437\u0432\u043e\u0440\u043e\u0442\u043d\u043e\u043c\u0443 \u043d\u0430\u043f\u0440\u044f\u043c\u043a\u0443 \u0437\u0430 \u043a\u043b\u0430\u0432\u0456\u0448\u0430\u043c\u0438 Shift+Enter 3 | FindPrev=\u0417\u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u0454 4 | Replace.ToolTip=\u0417\u0430\u043c\u0456\u043d\u0430 \u0443 \u0437\u0432\u043e\u0440\u043e\u0442\u043d\u043e\u043c\u0443 \u043d\u0430\u043f\u0440\u044f\u043c\u043a\u0443 \u0437\u0430 \u043a\u043b\u0430\u0432\u0456\u0448\u0430\u043c\u0438 Shift+Enter 5 | ReplaceWith=\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438 \u043d\u0430: 6 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_it.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Trova 2 | ReplaceDialogTitle=Sostituisci 3 | 4 | Direction=Direzione: 5 | Up=Su 6 | Down=Gi\u00f9 7 | UpMnemonic=U 8 | DownMnemonic=G 9 | 10 | MatchCase=Maiuscole/Minuscole 11 | WholeWord=Parola intera 12 | RegEx=Espressioni regolari 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=I 15 | RegExMnemonic=E 16 | 17 | FindWhat=Trova: 18 | ReplaceWith=Sostituisci con: 19 | FindWhat.Mnemonic=T 20 | ReplaceWith.Mnemonic=S 21 | 22 | Find=Trova 23 | Replace=Sostituisci 24 | ReplaceAll=Sostituisci tutto 25 | MarkAll=Segna tutto 26 | Cancel=Annulla 27 | Find.Mnemonic=T 28 | Replace.Mnemonic=S 29 | ReplaceAll.Mnemonic=U 30 | MarkAllMnemonic=G 31 | CancelMnemonic=N 32 | 33 | ContentAssistAvailable=Contenuto d'aiuto disponibile 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_tr.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Bul 2 | ReplaceDialogTitle=Yer degistir 3 | 4 | Direction=Yon: 5 | Up=Yukari 6 | Down=Asagi 7 | UpMnemonic=Y 8 | DownMnemonic=A 9 | 10 | MatchCase=Buyuk-Kucuk Harf 11 | WholeWord=Butun Kelime 12 | RegEx=Duzenli Ifade 13 | MatchCaseMnemonic=B 14 | WholeWordMnemonic=K 15 | RegExMnemonic=D 16 | 17 | FindWhat=Neyi Bul: 18 | ReplaceWith=Sununla Yer Degistir: 19 | FindWhat.Mnemonic=N 20 | ReplaceWith.Mnemonic=G 21 | 22 | Find=Bul 23 | Replace=Yer Degistir 24 | ReplaceAll=Tumunu Yer Degistir 25 | MarkAll=Tumunu Sec 26 | Cancel=Iptal 27 | Find.Mnemonic=L 28 | Replace.Mnemonic=T 29 | ReplaceAll.Mnemonic=U 30 | MarkAllMnemonic=C 31 | CancelMnemonic=I 32 | 33 | ContentAssistAvailable=Icerik danismani var 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_es.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Buscar 2 | ReplaceDialogTitle=Reemplazar 3 | 4 | Direction=Direcci\u00f3n: 5 | Up=Arriba 6 | Down=Abajo 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=Coincidir may\u00fasculas/min\u00fasculas 11 | WholeWord=Palabra completa 12 | RegEx=Expresi\u00f3n 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | 17 | FindWhat=Buscar: 18 | ReplaceWith=Reemplazar con: 19 | FindWhat.Mnemonic=I 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=Buscar 23 | Replace=Reemplazar 24 | ReplaceAll=Reemplazar Todo 25 | MarkAll=Marcar Todo 26 | Cancel=Cancelar 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=Contenido de ayuda disponible 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_nl.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Zoeken 2 | ReplaceDialogTitle=Vervangen 3 | 4 | Direction=Richting: 5 | Up=Op 6 | Down=Neer 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=(Hoofd)lettergevoelig 11 | WholeWord=Gehele woord 12 | RegEx=Regex 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | Wrap=Doorlopen 17 | WrapMnemonic=Z 18 | 19 | FindWhat=Zoeken naar: 20 | ReplaceWith=Vervangen door: 21 | FindWhat.Mnemonic=I 22 | ReplaceWith.Mnemonic=P 23 | 24 | Find=Zoeken 25 | Replace=Vervangen 26 | ReplaceAll=Alles vervangen 27 | MarkAll=Alles markeren 28 | Cancel=Annuleren 29 | Find.Mnemonic=F 30 | Replace.Mnemonic=R 31 | ReplaceAll.Mnemonic=A 32 | MarkAllMnemonic=K 33 | CancelMnemonic=C 34 | 35 | ContentAssistAvailable=Assistentie voor inhoud beschikbaar 36 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_fr.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Rechercher 2 | ReplaceDialogTitle=Remplacer 3 | 4 | Direction=Direction\u00a0: 5 | Up=Haut 6 | Down=Bas 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=Casse identique 11 | WholeWord=Mot entier 12 | RegEx=Regex 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | Wrap=Dans l'autre sens 17 | WrapMnemonic=Z 18 | 19 | FindWhat=Chercher\u00a0: 20 | ReplaceWith=Remplacer par\u00a0: 21 | FindWhat.Mnemonic=I 22 | ReplaceWith.Mnemonic=P 23 | 24 | Find=Rechercher 25 | Replace=Remplacer 26 | ReplaceAll=Remplacer tout 27 | MarkAll=Marquer tout 28 | Cancel=Annuler 29 | Find.Mnemonic=F 30 | Replace.Mnemonic=R 31 | ReplaceAll.Mnemonic=A 32 | MarkAllMnemonic=K 33 | CancelMnemonic=C 34 | 35 | ContentAssistAvailable=Aide au contenu disponible 36 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_pt_BR.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Procurar 2 | ReplaceDialogTitle=Substituir 3 | 4 | Direction=Dire\u00e7\u00e3o: 5 | Up=Voltar 6 | Down=Avan\u00e7ar 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=Diferenciar mai\u00fasculas/min\u00fasculas 11 | WholeWord=Palavra inteira 12 | RegEx=Express\u00e3o regular 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | 17 | FindWhat=Procurar: 18 | ReplaceWith=Substituir por: 19 | FindWhat.Mnemonic=I 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=Procurar 23 | Replace=Substituir 24 | ReplaceAll=Substituir Todas 25 | MarkAll=Marcar todas 26 | Cancel=Cancelar 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=Autocompletar Dispon\u00edvel 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_de.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Suchen 2 | ReplaceDialogTitle=Ersetzen 3 | 4 | Direction=Suchrichtung: 5 | Up=Nach oben 6 | Down=Nach unten 7 | UpMnemonic=O 8 | DownMnemonic=U 9 | 10 | MatchCase=Gro\u00df-/Kleinschreibung 11 | WholeWord=Ganzes Wort 12 | RegEx=Regex 13 | MatchCaseMnemonic=C 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | Wrap=Am Ende von vorne beginnen 17 | WrapMnemonic=M 18 | 19 | FindWhat=Suchen nach: 20 | ReplaceWith=Ersetzen durch: 21 | FindWhat.Mnemonic=S 22 | ReplaceWith.Mnemonic=D 23 | 24 | Find=Suchen 25 | Replace=Ersetzen 26 | ReplaceAll=Alle ersetzen 27 | MarkAll=Alle markieren 28 | Cancel=Abbrechen 29 | Find.Mnemonic=H 30 | Replace.Mnemonic=R 31 | ReplaceAll.Mnemonic=A 32 | MarkAllMnemonic=K 33 | CancelMnemonic=B 34 | 35 | ContentAssistAvailable=Inhaltsassistent verf\u00fcgbar 36 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_fi.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Etsi 2 | ReplaceDialogTitle=Korvaa 3 | 4 | Direction=Suunta: 5 | Up=Yl\u00f6sp\u00e4in 6 | Down=Alasp\u00e4in 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=T\u00e4sm\u00e4\u00e4 kirjainkoko 11 | WholeWord=Koko sana 12 | RegEx=Regex 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | Wrap=Kietaise haku 17 | WrapMnemonic=Z 18 | 19 | FindWhat=Etsi t\u00e4m\u00e4: 20 | ReplaceWith=Korvaa t\u00e4ll\u00e4: 21 | FindWhat.Mnemonic=I 22 | ReplaceWith.Mnemonic=P 23 | 24 | Find=Etsi 25 | Replace=Korvaa 26 | ReplaceAll=Korvaa kaikki 27 | MarkAll=Merkitse kaikki 28 | Cancel=Peruuta 29 | Find.Mnemonic=F 30 | Replace.Mnemonic=R 31 | ReplaceAll.Mnemonic=A 32 | MarkAllMnemonic=K 33 | CancelMnemonic=C 34 | 35 | ContentAssistAvailable=Sis\u00e4lt\u00f6apua saatavilla 36 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_pl.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Wyszukiwanie 2 | ReplaceDialogTitle=Zamienianie 3 | 4 | Direction=Kierunek: 5 | Down=W d\u00f3\u0142 6 | DownMnemonic=D 7 | Up=W g\u00f3r\u0119 8 | UpMnemonic=U 9 | 10 | MatchCase=Dopasuj wielko\u015b\u0107 liter 11 | MatchCaseMnemonic=M 12 | WholeWord=Tylko ca\u0142e wyrazy 13 | WholeWordMnemonic=W 14 | RegEx=Wyra\u017cenia regularne 15 | RegExMnemonic=E 16 | 17 | FindWhat=Szukany tekst: 18 | FindWhat.Mnemonic=I 19 | ReplaceWith=Zamie\u0144 na: 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=Znajd\u017a 23 | Replace=Zamie\u0144 24 | ReplaceAll=Zamie\u0144 wszystkie 25 | MarkAll=Oznacz wszystkie 26 | Cancel=Anuluj 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=Podpowiedzi s\u0105 aktywne 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_pt.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Localizar 2 | ReplaceDialogTitle=Substituir 3 | 4 | Direction=Direc\u00e7\u00e3o: 5 | Up=Acima 6 | Down=Abaixo 7 | UpMnemonic=C 8 | DownMnemonic=B 9 | 10 | MatchCase=Sens\u00edvel a mai\u00fasculas 11 | WholeWord=S\u00f3 palavras completas 12 | RegEx=Express\u00e3o regular 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=P 15 | RegExMnemonic=X 16 | Wrap=Quebra 17 | WrapMnemonic=Q 18 | 19 | FindWhat=Localizar o qu\u00ea: 20 | ReplaceWith=Substituir por: 21 | FindWhat.Mnemonic=L 22 | ReplaceWith.Mnemonic=S 23 | 24 | Find=Localizar 25 | Replace=Substituir 26 | ReplaceAll=Substituir tudo 27 | MarkAll=Marcar tudo 28 | Cancel=Cancelar 29 | Find.Mnemonic=Z 30 | Replace.Mnemonic=T 31 | ReplaceAll.Mnemonic=U 32 | MarkAllMnemonic=M 33 | CancelMnemonic=C 34 | 35 | ContentAssistAvailable=Assist\u00eancia de conte\u00fado dispon\u00edvel 36 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_zh_TW.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=\u67e5\u627e 2 | ReplaceDialogTitle=\u66ff\u63db 3 | 4 | Direction=\u65b9\u5411: 5 | Up=\u4e0a 6 | Down=\u4e0b 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=\u5927\u5c0f\u5beb\u5339\u914d 11 | WholeWord=\u5168\u5b57 12 | RegEx=\u6b63\u5247\u8868\u9054\u5f0f 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | 17 | FindWhat=\u67e5\u627e\u4ec0\u9ebc: 18 | ReplaceWith=\u66ff\u63db\u70ba: 19 | FindWhat.Mnemonic=I 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=\u67e5\u627e 23 | Replace=\u66ff\u63db 24 | ReplaceAll=\u5168\u90e8\u66ff\u63db 25 | MarkAll=\u5168\u90e8\u6a19\u8a18 26 | Cancel=\u53d6\u6d88 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=\u5167\u5bb9\u5e6b\u52a9\u5df2\u53ef\u7528 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_hu.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=Keres\u00e9s 2 | ReplaceDialogTitle=Csere 3 | 4 | Direction=Ir\u00e1ny: 5 | Up=Felfel\u00e9 6 | Down=Lefel\u00e9 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=Kis- \u00e9s nagybet\u0171 megk\u00fcl\u00f6nb\u00f6ztet\u00e9se 11 | WholeWord=Teljes sz\u00f3 12 | RegEx=Regul\u00e1ris kifejez\u00e9s 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | 17 | FindWhat=Keresend\u0151: 18 | ReplaceWith=Csere erre: 19 | FindWhat.Mnemonic=I 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=Keres\u00e9s 23 | Replace=Csere 24 | ReplaceAll=Mind cser\u00e9li 25 | MarkAll=Az \u00f6sszes megjel\u00f6l\u00e9se 26 | Cancel=M\u00e9gse 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=Tartalomseg\u00e9d el\u00e9rhet\u0151 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_ko.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=\ucc3e\uae30 2 | ReplaceDialogTitle=\ubc14\uafb8\uae30 3 | 4 | Direction=\ubc29\ud5a5: 5 | Up=\uc704\ub85c 6 | Down=\ubc11\uc73c\ub85c 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=\ub300/\uc18c\ubb38\uc790 \uad6c\ubcc4 11 | WholeWord=\ub2e8\uc5b4 \ub2e8\uc704\ub85c 12 | RegEx=\uc815\uaddc \ud45c\ud604 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | 17 | FindWhat=\uac80\uc0c9\uc5b4: 18 | ReplaceWith=\ub2e4\uc74c\uc73c\ub85c \ubc14\uafb8\uae30: 19 | FindWhat.Mnemonic=I 20 | ReplaceWith.Mnemonic=P 21 | 22 | Find=\ucc3e\uae30 23 | Replace=\ubc14\uafb8\uae30 24 | ReplaceAll=\ubaa8\ub450 \ubc14\uafb8\uae30 25 | MarkAll=\ubaa8\ub450 \ud45c\uc2dc 26 | Cancel=\ucde8\uc18c 27 | Find.Mnemonic=F 28 | Replace.Mnemonic=R 29 | ReplaceAll.Mnemonic=A 30 | MarkAllMnemonic=K 31 | CancelMnemonic=C 32 | 33 | ContentAssistAvailable=Content Assist \uac00\ub2a5 34 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/ContentAssistable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 01/12/2009 3 | * 4 | * ContentAssistable.java - A component, such as text field, that supports 5 | * content assist. 6 | * This library is distributed under a modified BSD license. See the included 7 | * RSTAUI.License.txt file for details. 8 | */ 9 | package org.fife.rsta.ui; 10 | 11 | 12 | /** 13 | * A component (such as a text field) that supports content assist. 14 | * Implementations will fire a property change event of type 15 | * {@link #ASSISTANCE_IMAGE} when content assist is enabled or disabled. 16 | * 17 | * @author Robert Futrell 18 | * @version 1.0 19 | */ 20 | public interface ContentAssistable { 21 | 22 | /** 23 | * Property event fired when the image to use when the component is focused 24 | * changes. This will either be null for "no image," or 25 | * a java.awt.Image. 26 | */ 27 | String ASSISTANCE_IMAGE = "AssistanceImage"; 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_zh_CN.properties: -------------------------------------------------------------------------------- 1 | FindDialogTitle=\u67e5\u627e 2 | ReplaceDialogTitle=\u66ff\u6362 3 | 4 | Direction=\u65b9\u5411\uff1a 5 | Up=\u5411\u4e0a 6 | Down=\u5411\u4e0b 7 | UpMnemonic=U 8 | DownMnemonic=D 9 | 10 | MatchCase=\u5339\u914d\u5927\u5c0f\u5199 11 | WholeWord=\u5339\u914d\u5355\u8bcd 12 | RegEx=\u6b63\u5219\u8868\u8fbe\u5f0f 13 | MatchCaseMnemonic=M 14 | WholeWordMnemonic=W 15 | RegExMnemonic=E 16 | Wrap=\u5faa\u73af\u67e5\u627e 17 | WrapMnemonic=Z 18 | 19 | FindWhat=\u67e5\u627e\u5185\u5bb9\uff1a 20 | ReplaceWith=\u66ff\u6362\u4e3a\uff1a 21 | FindWhat.Mnemonic=I 22 | ReplaceWith.Mnemonic=P 23 | 24 | Find=\u67e5\u627e 25 | Replace=\u66ff\u6362 26 | ReplaceAll=\u5168\u90e8\u66ff\u6362 27 | MarkAll=\u5168\u90e8\u6807\u8bb0 28 | Cancel=\u53d6\u6d88 29 | Find.Mnemonic=F 30 | Replace.Mnemonic=R 31 | ReplaceAll.Mnemonic=A 32 | MarkAllMnemonic=K 33 | CancelMnemonic=C 34 | 35 | ContentAssistAvailable=\u5185\u5bb9\u8f85\u52a9\u53ef\u7528 36 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchUtilTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui.search; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | /** 8 | * Unit tests for {@link SearchUtil}. 9 | */ 10 | public class SearchUtilTest { 11 | 12 | @Test 13 | void testGetToolTip_noError() { 14 | FindReplaceButtonsEnableResult result = new FindReplaceButtonsEnableResult(true, null); 15 | assertNull(SearchUtil.getToolTip(result)); 16 | } 17 | 18 | @Test 19 | void testGetToolTip_withError() { 20 | FindReplaceButtonsEnableResult result = new FindReplaceButtonsEnableResult(true, "Error"); 21 | assertEquals("Error", SearchUtil.getToolTip(result)); 22 | } 23 | 24 | @Test 25 | void testGetToolTip_withErrorContainingNewline() { 26 | FindReplaceButtonsEnableResult result = new FindReplaceButtonsEnableResult(true, "Foo\nbar"); 27 | assertEquals("Foo
bar", SearchUtil.getToolTip(result));
28 | 	}
29 | }
30 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_ja.properties:
--------------------------------------------------------------------------------
 1 | FindDialogTitle=\u691c\u7d22
 2 | ReplaceDialogTitle=\u7f6e\u63db
 3 | 
 4 | Direction=\u65b9\u5411:
 5 | Up=\u4e0a
 6 | Down=\u4e0b
 7 | UpMnemonic=U
 8 | DownMnemonic=D
 9 | 
10 | MatchCase=\u5927\u6587\u5b57\u3068\u5c0f\u6587\u5b57\u3092\u533a\u5225
11 | WholeWord=\u5358\u8a9e\u5358\u4f4d
12 | RegEx=\u6b63\u898f\u8868\u73fe
13 | MatchCaseMnemonic=M
14 | WholeWordMnemonic=W
15 | RegExMnemonic=E
16 | 
17 | FindWhat=\u691c\u7d22\u3059\u308b\u6587\u5b57\u5217:   
18 | ReplaceWith=\u7f6e\u63db\u5f8c\u306e\u6587\u5b57\u5217:
19 | FindWhat.Mnemonic=I
20 | ReplaceWith.Mnemonic=P
21 | 
22 | Find=\u691c\u7d22
23 | Replace=\u7f6e\u63db
24 | ReplaceAll=\u3059\u3079\u3066\u7f6e\u63db
25 | MarkAll=\u3059\u3079\u3066\u30de\u30fc\u30af
26 | Cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
27 | Find.Mnemonic=F
28 | Replace.Mnemonic=R
29 | ReplaceAll.Mnemonic=A
30 | MarkAllMnemonic=K
31 | CancelMnemonic=C
32 | 
33 | ContentAssistAvailable=\u5185\u5bb9\u30a2\u30b7\u30b9\u30c8\u306f\u53ef\u80fd
34 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_ru.properties:
--------------------------------------------------------------------------------
 1 | Title=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430: {0}
 2 | Path=\u041f\u0443\u0442\u044c:
 3 | Path.Mnemonic=P
 4 | Lines=\u0421\u0442\u0440\u043e\u043a\u0438:
 5 | Characters=\u0421\u0438\u043c\u0432\u043e\u043b\u044b:
 6 | Words=\u0421\u043b\u043e\u0432\u0430:
 7 | LineTerminator=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0441\u0442\u0440\u043e\u043a
 8 | LineTerminator.Mnemonic=\u0420
 9 | Encoding=\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430:
10 | Encoding.Mnemonic=\u041a
11 | FileSize=\u0420\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430:
12 | LastModified=\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435:
13 | 
14 | CR=Macintosh (\\r)
15 | LF=UNIX (\\n)
16 | CRLF=Windows (\\r\\n)
17 | SysDef=\u041f\u0440\u0438\u043d\u044f\u0442\u044b\u0439 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435
18 | 
19 | OK=\u041e\u041a
20 | OK.Mnemonic=\u041e
21 | Cancel=\u041e\u0442\u043c\u0435\u043d\u0430
22 | Cancel.Mnemonic=\u0422


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/ResizableFrameContentPaneTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui;
 2 | 
 3 | import org.junit.jupiter.api.Test;
 4 | import org.junit.jupiter.api.extension.ExtendWith;
 5 | 
 6 | import java.awt.*;
 7 | 
 8 | import static org.junit.jupiter.api.Assertions.*;
 9 | 
10 | /**
11 |  * Unit tests for {@link ResizableFrameContentPane}.
12 |  */
13 | @ExtendWith(SwingRunnerExtension.class)
14 | class ResizableFrameContentPaneTest {
15 | 
16 | 	@Test
17 | 	void testConstructor_noArgs() {
18 | 		assertDoesNotThrow(() -> new ResizableFrameContentPane());
19 | 	}
20 | 
21 | 	@Test
22 | 	void testConstructor_withLayout() {
23 | 		LayoutManager layout = new BorderLayout();
24 | 		ResizableFrameContentPane paneWithLayout = new ResizableFrameContentPane(layout);
25 | 		assertNotNull(paneWithLayout);
26 | 		assertEquals(layout, paneWithLayout.getLayout());
27 | 	}
28 | 
29 | 	@Test
30 | 	void testPaint() {
31 | 		ResizableFrameContentPane pane = new ResizableFrameContentPane();
32 | 		Graphics g = TestUtil.createTestGraphics();
33 | 		assertDoesNotThrow(() -> pane.paint(g));
34 | 	}
35 | }
36 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/search/SearchListener.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * 09/20/2013
 3 |  *
 4 |  * SearchListener - Listens for events in find/replace dialogs and toolbars.
 5 |  *
 6 |  * This library is distributed under a modified BSD license.  See the included
 7 |  * RSTAUI.license.txt file for details.
 8 |  */
 9 | package org.fife.rsta.ui.search;
10 | 
11 | import java.util.EventListener;
12 | 
13 | import org.fife.ui.rtextarea.SearchEngine;
14 | 
15 | 
16 | /**
17 |  * Listens for events fired from a Find or Replace dialog/toolbar.
18 |  * Applications can implement this class to listen for the user searching for
19 |  * text, and actually perform the operation via {@link SearchEngine} in
20 |  * response.
21 |  *
22 |  * @author Robert Futrell
23 |  * @version 1.0
24 |  */
25 | public interface SearchListener extends EventListener {
26 | 
27 | 
28 | 	/**
29 | 	 * Callback called whenever a search event occurs.
30 | 	 *
31 | 	 * @param e The event.
32 | 	 */
33 | 	void searchEvent(SearchEvent e);
34 | 
35 | 
36 | 	/**
37 | 	 * Returns the selected text.
38 | 	 *
39 | 	 * @return The selected text.
40 | 	 */
41 | 	String getSelectedText();
42 | 
43 | 
44 | }
45 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_ar.properties:
--------------------------------------------------------------------------------
 1 | Title=\u0627\u0644\u062e\u0635\u0627\u0626\u0635: {0}
 2 | Path=\u0627\u0644\u0645\u0633\u0627\u0631:
 3 | Path.Mnemonic=P
 4 | Lines=\u0627\u0644\u0623\u0633\u0637\u0631:
 5 | Characters=\u0627\u0644\u0645\u062d\u0631\u0641\u0627\u062a:
 6 | Words=\u0627\u0644\u0643\u0644\u0645\u0627\u062a:
 7 | LineTerminator=\u062e\u0627\u062a\u0645\u0629 \u0627\u0644\u0633\u0637\u0631:
 8 | LineTerminator.Mnemonic=\u062e
 9 | Encoding=\u0627\u0644\u062a\u0631\u0645\u064a\u0632:
10 | Encoding.Mnemonic=\u0631
11 | FileSize=\u062d\u062c\u0645 \u0627\u0644\u0645\u0644\u0641:
12 | LastModified=\u0622\u062e\u0631 \u062a\u0627\u0631\u064a\u062e \u0644\u0644\u062a\u0639\u062f\u064a\u0644:
13 | 
14 | CR=\u0645\u0627\u0643\u064a\u0646\u062a\u0648\u0634 (\\r)
15 | LF=\u064a\u0648\u0646\u064a\u0643\u0633 (\\n)
16 | CRLF=\u0648\u064a\u0646\u062f\u0648\u0632 (\\r\\n)
17 | SysDef=\u0627\u0641\u062a\u0631\u0627\u0636\u064a \u0627\u0644\u0646\u0638\u0627\u0645
18 | 
19 | OK=\u0645\u0648\u0627\u0641\u0642
20 | OK.Mnemonic=\u0645
21 | Cancel=\u0625\u0644\u063a\u0627\u0621
22 | Cancel.Mnemonic=\u063a
23 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/TextFilePropertiesDialog_uk.properties:
--------------------------------------------------------------------------------
 1 | Title=\u0412\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u0456: {0}
 2 | Path=\u0428\u043b\u044f\u0445:
 3 | Path.Mnemonic=\u0428
 4 | Lines=\u0420\u044f\u0434\u043a\u0456\u0432:
 5 | Characters=\u0421\u0438\u043c\u0432\u043e\u043b\u0456\u0432:
 6 | Words=\u0421\u043b\u0456\u0432:
 7 | LineTerminator=\u0420\u043e\u0437\u0440\u0438\u0432 \u0440\u044f\u0434\u043a\u0430:
 8 | LineTerminator.Mnemonic=\u0420
 9 | Encoding=\u041a\u043e\u0434\u0443\u0432\u0430\u043d\u043d\u044f:
10 | Encoding.Mnemonic=\u041a
11 | FileSize=\u0420\u043e\u0437\u043c\u0456\u0440 \u0444\u0430\u0439\u043b\u0443:
12 | LastModified=\u041e\u0441\u0442\u0430\u043d\u043d\u0456 \u0437\u043c\u0456\u043d\u0438:
13 | 
14 | CR=\\r (\u0441\u0442\u0430\u0440\u0430 MacOS)
15 | LF=\\n (UNIX)
16 | CRLF=\\r\\n (Windows)
17 | SysDef=\u0422\u0438\u043f\u043e\u0432\u043e \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0456\u0439\u043d\u043e\u0457 \u0441\u0438\u0441\u0442\u0435\u043c\u0438
18 | 
19 | OK=\u0413\u0430\u0440\u0430\u0437\u0434
20 | OK.Mnemonic=\u0413
21 | Cancel=\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438
22 | Cancel.Mnemonic=\u0421


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/search/FindReplaceButtonsEnableResult.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * 09/20/2013
 3 |  *
 4 |  * FindReplaceButtonsEnableResult - Whether "find" and "replace" buttons
 5 |  * should be enabled.
 6 |  *
 7 |  * This library is distributed under a modified BSD license.  See the included
 8 |  * RSTAUI.license.txt file for details.
 9 |  */
10 | package org.fife.rsta.ui.search;
11 | 
12 | /**
13 |  * Returns the result of whether the "action" buttons such as "Find"
14 |  * and "Replace" should be enabled.
15 |  *
16 |  * @author Robert Futrell
17 |  * @version 1.0
18 |  */
19 | // NOTE: This class is public to enable applications to create custom search
20 | // dialogs that extend AbstractSearchDialog, such as a FindInFilesDialog.
21 | public class FindReplaceButtonsEnableResult {
22 | 
23 | 	private boolean enable;
24 | 	private String error;
25 | 
26 | 	public FindReplaceButtonsEnableResult(boolean enable, String error) {
27 | 		this.enable = enable;
28 | 		this.error = error;
29 | 	}
30 | 
31 | 	public boolean getEnable() {
32 | 		return enable;
33 | 	}
34 | 
35 | 	public String getError() {
36 | 		return error;
37 | 	}
38 | 
39 | 	public void setEnable(boolean enable) {
40 | 		this.enable = enable;
41 | 	}
42 | 
43 | }
44 | 


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/SizeGripIconTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui;
 2 | 
 3 | import org.junit.jupiter.api.BeforeEach;
 4 | import org.junit.jupiter.api.Test;
 5 | 
 6 | import javax.swing.*;
 7 | import java.awt.*;
 8 | 
 9 | import static org.junit.jupiter.api.Assertions.*;
10 | 
11 | /**
12 |  * Unit tests for {@link SizeGripIcon}.
13 |  */
14 | class SizeGripIconTest {
15 | 
16 | 	private SizeGripIcon icon;
17 | 
18 | 	@BeforeEach
19 | 	void setUp() {
20 | 		icon = new SizeGripIcon();
21 | 	}
22 | 
23 | 	@Test
24 | 	void testGetIconHeight() {
25 | 		assertEquals(16, icon.getIconHeight());
26 | 	}
27 | 
28 | 	@Test
29 | 	void testGetIconWidth() {
30 | 		assertEquals(16, icon.getIconWidth());
31 | 	}
32 | 
33 | 	@Test
34 | 	void testPaintIcon_leftToRight() {
35 | 		JPanel panel = new JPanel();
36 | 		panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
37 | 		panel.setSize(20, 20);
38 | 		Graphics g = TestUtil.createTestGraphics();
39 | 		assertDoesNotThrow(() -> icon.paintIcon(panel, g, 0, 0));
40 | 	}
41 | 
42 | 	@Test
43 | 	void testPaintIcon_rightToLeft() {
44 | 		JPanel panel = new JPanel();
45 | 		panel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
46 | 		panel.setSize(20, 20);
47 | 		Graphics g = TestUtil.createTestGraphics();
48 | 		assertDoesNotThrow(() -> icon.paintIcon(panel, g, 0, 0));
49 | 	}
50 | }
51 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/search/SearchUtil.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * 09/20/2013
 3 |  *
 4 |  * SearchUtil - Utility methods for this package.
 5 |  *
 6 |  * This library is distributed under a modified BSD license.  See the included
 7 |  * RSTAUI.license.txt file for details.
 8 |  */
 9 | package org.fife.rsta.ui.search;
10 | 
11 | 
12 | /**
13 |  * Utility methods for this package.
14 |  *
15 |  * @author Robert Futrell
16 |  * @version 1.0
17 |  */
18 | final class SearchUtil {
19 | 
20 | 
21 |     /**
22 |      * Private constructor to prevent instantiation.
23 |      */
24 |     private SearchUtil() {
25 |     }
26 | 
27 | 	/**
28 | 	 * Formats an error message from a find/replace button enable result for
29 | 	 * use in a tool tip.  This assumes the error (if any) came from a
30 | 	 * PatternSyntaxException.
31 | 	 *
32 | 	 * @param res The result.
33 | 	 * @return The tool tip, or null if no error message was
34 | 	 *         specified in res.
35 | 	 */
36 | 	public static String getToolTip(FindReplaceButtonsEnableResult res) {
37 | 		String tooltip = res.getError();
38 | 		if (tooltip!=null && tooltip.indexOf('\n')>-1) {
39 | 			tooltip = tooltip.replaceFirst("\\\n", "
");
40 | 			tooltip = "" + tooltip;
41 | 		}
42 | 		return tooltip;
43 | 	}
44 | 
45 | 
46 | }
47 | 


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/SwingRunnerExtension.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * This library is distributed under a modified BSD license.  See the included
 3 |  * LICENSE file for details.
 4 |  */
 5 | package org.fife.rsta.ui;
 6 | 
 7 | import org.junit.jupiter.api.extension.ExtensionContext;
 8 | import org.junit.jupiter.api.extension.InvocationInterceptor;
 9 | import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
10 | 
11 | import javax.swing.*;
12 | import java.lang.reflect.Method;
13 | import java.util.concurrent.atomic.AtomicReference;
14 | 
15 | 
16 | /**
17 |  * Runs Swing unit tests on the EDT.
18 |  *
19 |  * @author Robert Futrell
20 |  * @version 1.0
21 |  */
22 | public class SwingRunnerExtension implements InvocationInterceptor {
23 | 
24 | 	@Override
25 | 	public void interceptTestMethod(Invocation invocation,
26 |                                     ReflectiveInvocationContext invocationContext,
27 |                                     ExtensionContext extensionContext) throws Throwable {
28 | 
29 | 		AtomicReference throwable = new AtomicReference<>();
30 | 
31 | 		SwingUtilities.invokeAndWait(() -> {
32 | 			try {
33 | 				invocation.proceed();
34 | 			} catch (Throwable t) {
35 | 				throwable.set(t);
36 | 			}
37 | 		});
38 | 		Throwable t = throwable.get();
39 | 		if (t != null) {
40 | 			throw t;
41 | 		}
42 | 	}
43 | }
44 | 


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchEventTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui.search;
 2 | 
 3 | import org.fife.ui.rtextarea.SearchContext;
 4 | import org.fife.rsta.ui.search.SearchEvent.Type;
 5 | import org.junit.jupiter.api.BeforeEach;
 6 | import org.junit.jupiter.api.Test;
 7 | 
 8 | import static org.junit.jupiter.api.Assertions.*;
 9 | 
10 | /**
11 |  * Unit tests for {@link SearchEvent}.
12 |  */
13 | public class SearchEventTest {
14 | 
15 | 	private SearchContext context;
16 | 	private SearchEvent event;
17 | 
18 | 	@BeforeEach
19 | 	void setUp() {
20 | 		context = new SearchContext();
21 | 	}
22 | 
23 | 	@Test
24 | 	void testConstructor() {
25 | 		event = new SearchEvent(this, Type.FIND, context);
26 | 		assertNotNull(event);
27 | 	}
28 | 
29 | 	@Test
30 | 	void testGetSearchContext() {
31 | 		event = new SearchEvent(this, Type.FIND, context);
32 | 		assertEquals(context, event.getSearchContext());
33 | 	}
34 | 
35 | 	@Test
36 | 	void testGetType() {
37 | 		event = new SearchEvent(this, Type.FIND, context);
38 | 		assertEquals(Type.FIND, event.getType());
39 | 	}
40 | 
41 | 	@Test
42 | 	void testTypeValues() {
43 | 		Type[] types = Type.values();
44 | 		assertEquals(4, types.length);
45 | 		assertEquals(Type.MARK_ALL, types[0]);
46 | 		assertEquals(Type.FIND, types[1]);
47 | 		assertEquals(Type.REPLACE, types[2]);
48 | 		assertEquals(Type.REPLACE_ALL, types[3]);
49 | 	}
50 | }
51 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_ar.properties:
--------------------------------------------------------------------------------
 1 | FindDialogTitle=\u0628\u062d\u062b
 2 | ReplaceDialogTitle=\u0627\u0633\u062a\u0628\u062f\u0627\u0644
 3 | 
 4 | Direction=\u0627\u0644\u0627\u062a\u062c\u0627\u0647:
 5 | Up=\u0641\u0648\u0642
 6 | Down=\u062a\u062d\u062a
 7 | UpMnemonic=\u0648
 8 | DownMnemonic=\u062a
 9 | 
10 | MatchCase=\u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u062d\u0627\u0644\u0629
11 | WholeWord=\u0643\u0644 \u0627\u0644\u0643\u0644\u0645\u0629
12 | RegEx=\u0627\u0644\u062a\u0639\u0627\u0628\u064a\u0631 \u0627\u0644\u0639\u0627\u062f\u064a\u0629
13 | MatchCaseMnemonic=\u0637
14 | WholeWordMnemonic=\u0643
15 | RegExMnemonic=\u0639
16 | 
17 | FindWhat=\u0627\u0644\u0628\u062d\u062b \u0639\u0646:   
18 | ReplaceWith=\u0627\u0644\u0627\u0633\u062a\u0628\u062f\u0627\u0644 \u0628\u0640:
19 | FindWhat.Mnemonic=\u062b
20 | ReplaceWith.Mnemonic=\u0633
21 | 
22 | Find=\u0628\u062d\u062b
23 | Replace=\u0627\u0633\u062a\u0628\u062f\u0627\u0644
24 | ReplaceAll=\u0627\u0633\u062a\u0628\u062f\u0627\u0644 \u0627\u0644\u0643\u0644
25 | MarkAll=\u062a\u062d\u062f\u064a\u062f \u0627\u0644\u0643\u0644
26 | Cancel=\u0625\u0644\u063a\u0627\u0621
27 | Find.Mnemonic=\u0628
28 | Replace.Mnemonic=\u062f
29 | ReplaceAll.Mnemonic=\u0644
30 | MarkAllMnemonic=\u062d
31 | CancelMnemonic=\u063a
32 | 
33 | ContentAssistAvailable=\u0645\u0633\u0627\u0639\u062f \u0627\u0644\u0645\u062d\u062a\u0648\u0649 \u0645\u062a\u0627\u062d
34 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_ru.properties:
--------------------------------------------------------------------------------
 1 | FindDialogTitle=\u041f\u043e\u0438\u0441\u043a
 2 | ReplaceDialogTitle=\u0417\u0430\u043c\u0435\u043d\u0430
 3 | 
 4 | Direction=\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435:
 5 | Up=\u0412\u0432\u0435\u0440\u0445
 6 | Down=\u0412\u043d\u0438\u0437
 7 | UpMnemonic=\u0412
 8 | DownMnemonic=\u043d
 9 | 
10 | MatchCase=\u0423\u0447\u0435\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430
11 | WholeWord=\u0421\u043b\u043e\u0432\u043e \u0446\u0435\u043b\u0438\u043a\u043e\u043c
12 | RegEx=\u0420\u0435\u0433. \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435
13 | MatchCaseMnemonic=\u0423
14 | WholeWordMnemonic=\u0446
15 | RegExMnemonic=\u0420
16 | 
17 | FindWhat=\u0418\u0441\u043a\u0430\u0442\u044c:   
18 | ReplaceWith=\u0417\u0430\u043c\u0435\u043d\u0442\u044c \u043d\u0430:
19 | FindWhat.Mnemonic=\u0418
20 | ReplaceWith.Mnemonic=\u0437
21 | 
22 | Find=\u041f\u043e\u0438\u0441\u043a
23 | Replace=\u0417\u0430\u043c\u0435\u043d\u0430
24 | ReplaceAll=\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435
25 | MarkAll=\u041e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0432\u0441\u0435
26 | Cancel=\u041e\u0442\u043c\u0435\u043d\u0430
27 | Find.Mnemonic=\u043e
28 | Replace.Mnemonic=\u043c
29 | ReplaceAll.Mnemonic=\u0435
30 | MarkAllMnemonic=\u044c
31 | CancelMnemonic=\u0442
32 | 
33 | ContentAssistAvailable=\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e\u043c\u043e\u0449\u0438
34 | 


--------------------------------------------------------------------------------
/.github/workflows/gradle.yml:
--------------------------------------------------------------------------------
 1 | # This workflow will build a Java project with Gradle
 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
 3 | 
 4 | name: Gradle Build
 5 | 
 6 | on:
 7 |   push:
 8 |     branches: [ master ]
 9 |   pull_request:
10 |     branches: [ master ]
11 | 
12 | jobs:
13 |   build:
14 | 
15 |     runs-on: ubuntu-latest
16 | 
17 |     strategy:
18 |       matrix:
19 |         java: [ '17', '21', '23' ]
20 | 
21 |     steps:
22 |       - uses: actions/checkout@v4
23 | 
24 |       - name: Verify gradle wrapper
25 |         uses: gradle/actions/wrapper-validation@v4
26 |         if: matrix.java == '17'
27 | 
28 |       - name: Set up JDK ${{ matrix.java }}
29 |         uses: actions/setup-java@v4
30 |         with:
31 |           java-version: ${{ matrix.java }}
32 |           distribution: 'temurin'
33 | 
34 |       - name: Grant execute permission for gradlew
35 |         run: chmod +x gradlew
36 | 
37 |       # Note: Assumes we're running on Ubuntu
38 |       # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
39 |       - name: Build with Gradle
40 |         run: xvfb-run ./gradlew build jacocoTestReport -xsign -xpublish --warning-mode all
41 | 
42 |       - name: Submit coverage data to codecov
43 |         uses: codecov/codecov-action@v5
44 |         if: matrix.java == '17'
45 |         with:
46 |           token: ${{ secrets.CODECOV_TOKEN }}
47 |           disable_search: true
48 |           files: ./RSTAUI/build/reports/jacoco/test/jacocoTestReport.xml
49 |           name: codecov
50 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/dist/RSTAUI.License.txt:
--------------------------------------------------------------------------------
 1 | Copyright (c) 2012, Robert Futrell
 2 | All rights reserved.
 3 | 
 4 | Redistribution and use in source and binary forms, with or without
 5 | modification, are permitted provided that the following conditions are met:
 6 |     * Redistributions of source code must retain the above copyright
 7 |       notice, this list of conditions and the following disclaimer.
 8 |     * Redistributions in binary form must reproduce the above copyright
 9 |       notice, this list of conditions and the following disclaimer in the
10 |       documentation and/or other materials provided with the distribution.
11 |     * Neither the name of the author nor the names of its contributors may
12 |       be used to endorse or promote products derived from this software
13 |       without specific prior written permission.
14 | 
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/MaxWidthComboBoxTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui;
 2 | 
 3 | import org.junit.jupiter.api.BeforeEach;
 4 | import org.junit.jupiter.api.Test;
 5 | import org.junit.jupiter.api.extension.ExtendWith;
 6 | 
 7 | import javax.swing.*;
 8 | import java.awt.*;
 9 | 
10 | import static org.junit.jupiter.api.Assertions.*;
11 | 
12 | /**
13 |  * Unit tests for {@link MaxWidthComboBox}.
14 |  */
15 | @ExtendWith(SwingRunnerExtension.class)
16 | class MaxWidthComboBoxTest {
17 | 
18 | 	private MaxWidthComboBox comboBox;
19 | 
20 | 	@Test
21 | 	void testConstructor_withMaxWidth() {
22 | 		comboBox = new MaxWidthComboBox<>(100);
23 | 		assertEquals(100, comboBox.getMaximumSize().width);
24 | 	}
25 | 
26 | 	@Test
27 | 	void testConstructor_withModelAndMaxWidth() {
28 | 		ComboBoxModel model = new DefaultComboBoxModel<>(new String[]{"item1", "item2"});
29 | 		MaxWidthComboBox comboBox = new MaxWidthComboBox<>(model, 100);
30 | 		assertNotNull(comboBox);
31 | 		assertEquals(100, comboBox.getMaximumSize().width);
32 | 		assertEquals(2, comboBox.getItemCount());
33 | 	}
34 | 
35 | 	@Test
36 | 	void testGetMaximumSize() {
37 | 		comboBox = new MaxWidthComboBox<>(100);
38 | 		Dimension maxSize = comboBox.getMaximumSize();
39 | 		assertEquals(100, maxSize.width);
40 | 	}
41 | 
42 | 	@Test
43 | 	void testGetMinimumSize() {
44 | 		comboBox = new MaxWidthComboBox<>(100);
45 | 		Dimension minSize = comboBox.getMinimumSize();
46 | 		assertNotEquals(0, minSize.width);
47 | 	}
48 | 
49 | 	@Test
50 | 	void testGetPreferredSize() {
51 | 		comboBox = new MaxWidthComboBox<>(100);
52 | 		Dimension prefSize = comboBox.getPreferredSize();
53 | 		assertNotEquals(00, prefSize.width);
54 | 	}
55 | }
56 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/resources/org/fife/rsta/ui/search/Search_uk.properties:
--------------------------------------------------------------------------------
 1 | FindDialogTitle=\u041f\u043e\u0448\u0443\u043a
 2 | ReplaceDialogTitle=\u0417\u0430\u043c\u0456\u043d\u0430
 3 | 
 4 | Direction=\u041d\u0430\u043f\u0440\u044f\u043c\u043e\u043a:
 5 | Up=\u0414\u043e\u0433\u043e\u0440\u0438
 6 | Down=\u0414\u043e\u043d\u0438\u0437\u0443
 7 | UpMnemonic=\u0413
 8 | DownMnemonic=\u0417
 9 | 
10 | MatchCase=\u0412\u0440\u0430\u0445\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0440\u0435\u0433\u0456\u0441\u0442\u0440
11 | WholeWord=\u0426\u0456\u043b\u0435 \u0441\u043b\u043e\u0432\u043e
12 | RegEx=\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0438\u0439 \u0432\u0438\u0440\u0430\u0437
13 | MatchCaseMnemonic=\u0425
14 | WholeWordMnemonic=\u0426
15 | RegExMnemonic=\u041b
16 | Wrap=\u0428\u0443\u043a\u0430\u0442\u0438 \u043f\u043e \u043a\u043e\u043b\u0443
17 | WrapMnemonic=\u0428
18 | 
19 | FindWhat=\u0428\u0443\u043a\u0430\u0442\u0438:   
20 | ReplaceWith=\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438 \u043d\u0430:
21 | FindWhat.Mnemonic=\u0410
22 | ReplaceWith.Mnemonic=\u0406
23 | 
24 | Find=\u0417\u043d\u0430\u0439\u0442\u0438
25 | Replace=\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438
26 | ReplaceAll=\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438 \u0432\u0441\u0435
27 | MarkAll=\u041f\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u0438 \u0432\u0441\u0435
28 | Cancel=\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438
29 | Find.Mnemonic=\u0419
30 | Replace.Mnemonic=\u041c
31 | ReplaceAll.Mnemonic=\u0415
32 | MarkAllMnemonic=\u0427
33 | CancelMnemonic=\u0421
34 | 
35 | ContentAssistAvailable=\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u0430 \u0449\u043e\u0434\u043e \u0432\u043c\u0456\u0441\u0442\u0443
36 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/search/SearchEvent.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * 09/20/2013
 3 |  *
 4 |  * SearchEvent - The event fired for find/replace/mark all operations.
 5 |  *
 6 |  * This library is distributed under a modified BSD license.  See the included
 7 |  * RSTAUI.license.txt file for details.
 8 |  */
 9 | package org.fife.rsta.ui.search;
10 | 
11 | import java.util.EventObject;
12 | 
13 | import org.fife.ui.rtextarea.SearchContext;
14 | 
15 | 
16 | /**
17 |  * The event fired whenever a user wants to search for or replace text in a
18 |  * Find or Replace dialog/toolbar.
19 |  *
20 |  * @author Robert Futrell
21 |  * @version 1.0
22 |  */
23 | public class SearchEvent extends EventObject {
24 | 
25 | 	private SearchContext context;
26 | 	private Type type;
27 | 
28 | 	public SearchEvent(Object source, Type type, SearchContext context) {
29 | 		super(source);
30 | 		this.type = type;
31 | 		this.context = context;
32 | 	}
33 | 
34 | 
35 | 	public Type getType() {
36 | 		return type;
37 | 	}
38 | 
39 | 
40 | 	public SearchContext getSearchContext() {
41 | 		return context;
42 | 	}
43 | 
44 | 
45 | 	/**
46 | 	 * Types of search events.
47 | 	 */
48 | 	public enum Type {
49 | 
50 | 		/**
51 | 		 * The event fired when the text to "mark all" has changed.
52 | 		 */
53 | 		MARK_ALL,
54 | 
55 | 		/**
56 | 		 * The event fired when the user wants to find text in the editor.
57 | 		 */
58 | 		FIND,
59 | 
60 | 		/**
61 | 		 * The event fired when the user wants to replace text in the editor.
62 | 		 */
63 | 		REPLACE,
64 | 
65 | 		/**
66 | 		 * The event fired when the user wants to replace all instances of
67 | 		 * specific text with new text in the editor.
68 | 		 */
69 | 		REPLACE_ALL
70 | 
71 | 	}
72 | 
73 | }
74 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/ResizableFrameContentPane.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * 09/07/2006
 3 |  *
 4 |  * ResizableFrameContentPane.java - A content pane with a size grip that
 5 |  * can be used to resize a sizable dialog or frame.
 6 |  * This library is distributed under a modified BSD license.  See the included
 7 |  * RSTAUI.License.txt file for details.
 8 |  */
 9 | package org.fife.rsta.ui;
10 | 
11 | import java.awt.*;
12 | import javax.swing.*;
13 | 
14 | 
15 | 
16 | /**
17 |  * A panel to be used as the content pane for JDialogs
18 |  * and JFrames that are resizable.  This panel has
19 |  * a size grip that can be dragged and cause a resize of the window,
20 |  * similar to that found on resizable Microsoft Windows dialogs.
21 |  *
22 |  * @author Robert Futrell
23 |  * @version 1.0
24 |  */
25 | public class ResizableFrameContentPane extends JPanel {
26 | 
27 | 	private static final long serialVersionUID = 1L;
28 | 
29 | 	private SizeGripIcon gripIcon;
30 | 
31 | 
32 | 	/**
33 | 	 * Constructor.
34 | 	 */
35 | 	public ResizableFrameContentPane() {
36 | 		gripIcon = new SizeGripIcon();
37 | 	}
38 | 
39 | 
40 | 	/**
41 | 	 * Constructor.
42 | 	 *
43 | 	 * @param layout The layout manager.
44 | 	 */
45 | 	public ResizableFrameContentPane(LayoutManager layout) {
46 | 		super(layout);
47 | 		gripIcon = new SizeGripIcon();
48 | 	}
49 | 
50 | 
51 | 	/**
52 | 	 * Paints this panel.
53 | 	 *
54 | 	 * @param g The graphics context.
55 | 	 */
56 | 	/*
57 | 	 * We override paint() instead of paintComponent() as if we do the latter,
58 | 	 * sometimes child panels will be painted over our size grip, rendering it
59 | 	 * invisible.
60 | 	 */
61 | 	@Override
62 | 	public void paint(Graphics g) {
63 | 		super.paint(g);
64 | 		gripIcon.paintIcon(this, g, this.getX(), this.getY());
65 | 	}
66 | 
67 | 
68 | }


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/AssistanceIconPanelTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui;
 2 | 
 3 | import org.fife.ui.autocomplete.EmptyIcon;
 4 | import org.junit.jupiter.api.BeforeEach;
 5 | import org.junit.jupiter.api.Test;
 6 | import org.junit.jupiter.api.extension.ExtendWith;
 7 | 
 8 | import javax.swing.*;
 9 | import java.awt.*;
10 | import java.beans.PropertyChangeEvent;
11 | 
12 | import static org.junit.jupiter.api.Assertions.*;
13 | 
14 | /**
15 |  * Unit tests for {@link AssistanceIconPanel}.
16 |  */
17 | @ExtendWith(SwingRunnerExtension.class)
18 | class AssistanceIconPanelTest {
19 | 
20 | 	private AssistanceIconPanel panel;
21 | 	private JComponent component;
22 | 
23 | 	@BeforeEach
24 | 	void setUp() {
25 | 		component = new JTextField();
26 | 		panel = new AssistanceIconPanel(component);
27 | 	}
28 | 
29 | 	@Test
30 | 	void testConstructor_noArgs() {
31 | 		assertDoesNotThrow(() -> new AssistanceIconPanel(null));
32 | 	}
33 | 
34 | 	@Test
35 | 	void testConstructor_withIconWidth() {
36 | 		assertDoesNotThrow(() -> new AssistanceIconPanel(component, 16));
37 | 	}
38 | 
39 | 	@Test
40 | 	void testGetSetAssistanceEnabled() {
41 | 		Image img = new ImageIcon(new byte[0]).getImage();
42 | 		panel.setAssistanceEnabled(img);
43 | 		assertNotNull(panel.getIcon());
44 | 		assertEquals(AssistanceIconPanel.getAssistanceAvailableText(), panel.getToolTipText());
45 | 
46 | 		panel.setAssistanceEnabled(null);
47 | 		assertInstanceOf(EmptyIcon.class, panel.getIcon());
48 | 		assertNull(panel.getToolTipText());
49 | 	}
50 | 
51 | 	@Test
52 | 	void testPropertyChange() {
53 | 		// Set the icon to a non-null value
54 | 		Image img = new ImageIcon(new byte[0]).getImage();
55 | 		PropertyChangeEvent event = new PropertyChangeEvent(component, ContentAssistable.ASSISTANCE_IMAGE, null, img);
56 | 		panel.propertyChange(event);
57 | 		assertNotNull(panel.getIcon());
58 | 
59 | 		// Back to bull results in an EmptyIcon
60 | 		event = new PropertyChangeEvent(component, ContentAssistable.ASSISTANCE_IMAGE, img, null);
61 | 		panel.propertyChange(event);
62 | 		assertInstanceOf(EmptyIcon.class, panel.getIcon());
63 | 	}
64 | 
65 | 	@Test
66 | 	void testUpdateUI_notComboBox() {
67 | 		assertDoesNotThrow(panel::updateUI);
68 | 	}
69 | 
70 | 	@Test
71 | 	void testUpdateUI_comboBox() {
72 | 		JComboBox comboBox = new JComboBox<>();
73 | 		AssistanceIconPanel panel = new AssistanceIconPanel(comboBox);
74 | 		assertDoesNotThrow(panel::updateUI);
75 | 	}
76 | }
77 | 


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/DecorativeIconPanelTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui;
 2 | 
 3 | import org.junit.jupiter.api.Test;
 4 | import org.junit.jupiter.api.extension.ExtendWith;
 5 | 
 6 | import javax.swing.*;
 7 | 
 8 | import static org.junit.jupiter.api.Assertions.*;
 9 | 
10 | /**
11 |  * Unit tests for {@link DecorativeIconPanel}.
12 |  */
13 | @ExtendWith(SwingRunnerExtension.class)
14 | class DecorativeIconPanelTest {
15 | 
16 | 	private DecorativeIconPanel panel;
17 | 
18 | 	@Test
19 | 	void testConstructor_noArgs() {
20 | 		assertDoesNotThrow(() -> new DecorativeIconPanel());
21 | 	}
22 | 
23 | 	@Test
24 | 	void testConstructor_withIconWidth() {
25 | 		assertDoesNotThrow(() -> new DecorativeIconPanel(16));
26 | 	}
27 | 
28 | 	@Test
29 | 	void testGetSetIcon() {
30 | 		panel = new DecorativeIconPanel(16);
31 | 		assertNotNull(panel.getIcon());
32 | 		Icon icon = new ImageIcon(new byte[0]);
33 | 		panel.setIcon(icon);
34 | 		assertEquals(icon, panel.getIcon());
35 | 	}
36 | 
37 | 	@Test
38 | 	void testGetSetShowIcon() {
39 | 		panel = new DecorativeIconPanel(16);
40 | 		assertFalse(panel.getShowIcon());
41 | 		panel.setShowIcon(true);
42 | 		assertTrue(panel.getShowIcon());
43 | 	}
44 | 
45 | 	@Test
46 | 	void testGetToolTipText() {
47 | 		panel = new DecorativeIconPanel(16);
48 | 		assertNull(panel.getToolTipText());
49 | 		String tip = "Test Tip";
50 | 		panel.setToolTipText(tip);
51 | 		assertEquals(tip, panel.getToolTipText());
52 | 	}
53 | 
54 | 	@Test
55 | 	void testPaintChildren_notShowingChildren() {
56 | 		panel = new DecorativeIconPanel(16);
57 | 		panel.setShowIcon(false);
58 | 		panel.paintChildren(TestUtil.createTestGraphics());
59 | 	}
60 | 
61 | 	@Test
62 | 	void testPaintChildren_showingChildren() {
63 | 		panel = new DecorativeIconPanel(16);
64 | 		panel.setShowIcon(true);
65 | 		panel.paintChildren(TestUtil.createTestGraphics());
66 | 	}
67 | 
68 | 	@Test
69 | 	void testSetIcon_null_usesDefaultIcon() {
70 | 		panel = new DecorativeIconPanel(16);
71 | 		panel.setIcon(null);
72 | 		assertNotNull(panel.getIcon());
73 | 	}
74 | 
75 | 	@Test
76 | 	void testSetIconWidth_sameWidth() {
77 | 		panel = new DecorativeIconPanel(16);
78 | 		panel.setIconWidth(16);
79 | 		assertEquals(16, panel.getIcon().getIconWidth());
80 | 	}
81 | 
82 | 	@Test
83 | 	void testSetIconWidth_differentWidth() {
84 | 		panel = new DecorativeIconPanel(16);
85 | 		panel.setIconWidth(18);
86 | 		assertEquals(18, panel.getIcon().getIconWidth());
87 | 	}
88 | }
89 | 


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchComboBoxTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui.search;
 2 | 
 3 | import org.fife.rsta.ui.SwingRunnerExtension;
 4 | import org.fife.rsta.ui.UIUtil;
 5 | import org.junit.jupiter.api.Assertions;
 6 | import org.junit.jupiter.api.Test;
 7 | import org.junit.jupiter.api.extension.ExtendWith;
 8 | 
 9 | import java.util.List;
10 | 
11 | /**
12 |  * Unit tests for the {@code SearchComboBox} class.
13 |  */
14 | @ExtendWith(SwingRunnerExtension.class)
15 | class SearchComboBoxTest {
16 | 
17 | 	@Test
18 | 	void testAddItem() {
19 | 		SearchComboBox comboBox = new SearchComboBox(null, false);
20 | 		Assertions.assertEquals(0, comboBox.getItemCount());
21 | 		comboBox.addItem("foo");
22 | 		Assertions.assertEquals(1, comboBox.getItemCount());
23 | 	}
24 | 
25 | 	@Test
26 | 	void testAddItem_existingItem_moveToTopOfList() {
27 | 		SearchComboBox comboBox = new SearchComboBox(null, false);
28 | 		comboBox.addItem("111");
29 | 		comboBox.addItem("222");
30 | 		comboBox.addItem("333");
31 | 		comboBox.addItem("222");
32 | 		List items = comboBox.getSearchStrings();
33 | 		Assertions.assertEquals(3, items.size());
34 | 		Assertions.assertEquals("222", comboBox.getSelectedItem());
35 | 		Assertions.assertEquals("222", items.get(0));
36 | 	}
37 | 
38 | 	@Test
39 | 	void testAddItem_existingItem_firstItem_orderNotChanged() {
40 | 		SearchComboBox comboBox = new SearchComboBox(null, false);
41 | 		comboBox.addItem("111");
42 | 		comboBox.addItem("222");
43 | 		comboBox.addItem("333");
44 | 		comboBox.addItem("111");
45 | 		List items = comboBox.getSearchStrings();
46 | 		Assertions.assertEquals(3, items.size());
47 | 		Assertions.assertEquals("111", comboBox.getSelectedItem());
48 | 		Assertions.assertEquals("111", items.get(0));
49 | 	}
50 | 
51 | 	@Test
52 | 	void testGetSearchStrings_noSelectedIndex_addsTextInTextComponent() {
53 | 		SearchComboBox comboBox = new SearchComboBox(null, false);
54 | 		UIUtil.getTextComponent(comboBox).setText("foo");
55 | 		List items = comboBox.getSearchStrings();
56 | 		Assertions.assertEquals(1, items.size());
57 | 		Assertions.assertEquals("foo", items.get(0));
58 | 	}
59 | 
60 | 	@Test
61 | 	void testGetSearchStrings_selectedIndexInMiddle_movedtoTop() {
62 | 		SearchComboBox comboBox = new SearchComboBox(null, false);
63 | 		comboBox.addItem("111");
64 | 		comboBox.addItem("222");
65 | 		comboBox.addItem("333");
66 | 		comboBox.setSelectedIndex(1);
67 | 		List items = comboBox.getSearchStrings();
68 | 		Assertions.assertEquals(3, items.size());
69 | 		Assertions.assertEquals("222", items.get(0));
70 | 		Assertions.assertEquals("333", items.get(1));
71 | 		Assertions.assertEquals("111", items.get(2));
72 | 	}
73 | }
74 | 


--------------------------------------------------------------------------------
/RSTAUI/src/test/java/org/fife/rsta/ui/GoToDialogTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.rsta.ui;
 2 | 
 3 | import org.junit.jupiter.api.Assertions;
 4 | import org.junit.jupiter.api.Test;
 5 | import org.junit.jupiter.api.extension.ExtendWith;
 6 | import org.mockito.MockedStatic;
 7 | import org.mockito.Mockito;
 8 | 
 9 | import javax.swing.*;
10 | import java.awt.*;
11 | 
12 | import static org.junit.jupiter.api.Assertions.*;
13 | 
14 | /**
15 |  * Unit tests for {@link GoToDialog}.
16 |  */
17 | @ExtendWith(SwingRunnerExtension.class)
18 | public class GoToDialogTest {
19 | 
20 | 	@Test
21 | 	void testConstructor_dialog_nonNull() {
22 | 		JDialog parent = new JDialog();
23 | 		Assertions.assertDoesNotThrow(() -> new GoToDialog(parent));
24 | 	}
25 | 
26 | 	@Test
27 | 	void testConstructor_dialog_null() {
28 | 		Assertions.assertDoesNotThrow(() -> new GoToDialog((Dialog) null));
29 | 	}
30 | 
31 | 	@Test
32 | 	void testConstructor_frame_nonNull() {
33 | 		JFrame parent = new JFrame();
34 | 		Assertions.assertDoesNotThrow(() -> new GoToDialog(parent));
35 | 	}
36 | 
37 | 	@Test
38 | 	void testConstructor_frame_null() {
39 | 		Assertions.assertDoesNotThrow(() -> new GoToDialog((Frame) null));
40 | 	}
41 | 
42 | 	@Test
43 | 	void testActionPerformed_cancelButton() {
44 | 		GoToDialog dialog = new GoToDialog((Frame) null);
45 | 		dialog.clickCancelButton();
46 | 		Assertions.assertFalse(dialog.isVisible());
47 | 	}
48 | 
49 | 	@Test
50 | 	void testActionPerformed_okButton() {
51 | 		GoToDialog dialog = new GoToDialog((Frame) null);
52 | 		dialog.setLineNumber(1);
53 | 		dialog.clickOkButton();
54 | 		Assertions.assertEquals(1, dialog.getLineNumber());
55 | 	}
56 | 
57 | 	@Test
58 | 	void testDisplayInvalidLineNumberMessage() {
59 | 		try (MockedStatic utils = Mockito.mockStatic(JOptionPane.class)) {
60 | 			GoToDialog dialog = new GoToDialog((Frame) null);
61 | 			dialog.displayInvalidLineNumberMessage();
62 | 			utils.verify(() -> JOptionPane.showMessageDialog(Mockito.any(), Mockito.anyString(),
63 | 				Mockito.anyString(), Mockito.anyInt()), Mockito.times(1));
64 | 		}
65 | 	}
66 | 
67 | 	@Test
68 | 	void testEscapePressed_hidesDialog() {
69 | 		GoToDialog dialog = new GoToDialog((Frame) null);
70 | 		dialog.escapePressed();
71 | 		Assertions.assertEquals(-1, dialog.getLineNumber());
72 | 	}
73 | 
74 | 	@Test
75 | 	void testGetSetMaxLineNumberAllowed() {
76 | 		GoToDialog dialog = new GoToDialog((Frame) null);
77 | 		dialog.setMaxLineNumberAllowed(100);
78 | 		Assertions.assertEquals(100, dialog.getMaxLineNumberAllowed());
79 | 	}
80 | 
81 | 	@Test
82 | 	void testGetSetErrorDialogTitle() {
83 | 		GoToDialog dialog = new GoToDialog((Frame) null);
84 | 		dialog.setErrorDialogTitle("title");
85 | 		Assertions.assertEquals("title", dialog.getErrorDialogTitle());
86 | 	}
87 | 
88 | 	@Test
89 | 	void testSetVisible_false() {
90 | 		GoToDialog dialog = new GoToDialog((Frame) null);
91 | 		dialog.setVisible(false);
92 | 		assertFalse(dialog.isVisible());
93 | 	}
94 | }
95 | 


--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
 1 | # For most projects, this workflow file will not need changing; you simply need
 2 | # to commit it to your repository.
 3 | #
 4 | # You may wish to alter this file to override the set of languages analyzed,
 5 | # or to provide custom queries or build logic.
 6 | #
 7 | # ******** NOTE ********
 8 | # We have attempted to detect the languages in your repository. Please check
 9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 | 
14 | on:
15 |   push:
16 |     branches: [ master ]
17 |   pull_request:
18 |     # The branches below must be a subset of the branches above
19 |     branches: [ master ]
20 |   schedule:
21 |     - cron: '28 6 * * 4'
22 | 
23 | jobs:
24 |   analyze:
25 |     name: Analyze
26 |     runs-on: ubuntu-latest
27 | 
28 |     strategy:
29 |       fail-fast: false
30 |       matrix:
31 |         language: [ 'java' ]
32 |         # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33 |         # Learn more:
34 |         # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35 | 
36 |     steps:
37 |     - name: Checkout repository
38 |       uses: actions/checkout@v4
39 | 
40 |     - name: Set up JDK 17
41 |       uses: actions/setup-java@v4
42 |       with:
43 |         java-version: '17'
44 |         distribution: 'temurin'
45 | 
46 |     # Initializes the CodeQL tools for scanning.
47 |     - name: Initialize CodeQL
48 |       uses: github/codeql-action/init@v3
49 |       with:
50 |         languages: ${{ matrix.language }}
51 |         # If you wish to specify custom queries, you can do so here or in a config file.
52 |         # By default, queries listed here will override any specified in a config file.
53 |         # Prefix the list here with "+" to use these queries and those in the config file.
54 |         # queries: ./path/to/local/query, your-org/your-repo/queries@main
55 | 
56 |     ## Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
57 |     ## If this step fails, then you should remove it and run the build manually (see below)
58 |     #- name: Autobuild
59 |     #  uses: github/codeql-action/autobuild@v1
60 | 
61 |     # ℹ️ Command-line programs to run using the OS shell.
62 |     # 📚 https://git.io/JvXDl
63 | 
64 |     # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
65 |     #    and modify them (or add more) to build your code if your project
66 |     #    uses a compiled language
67 | 
68 |     # Note: Assumes we're running on Ubuntu
69 |     # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
70 |     - name: Build
71 |       run: xvfb-run ./gradlew build -xsign -xpublish --warning-mode all
72 | 
73 |     - name: Perform CodeQL Analysis
74 |       uses: github/codeql-action/analyze@v3
75 | 


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/SizeGripIcon.java:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * 09/07/2006
  3 |  *
  4 |  * SizeGripIcon.java - An icon that paints a size grip.
  5 |  * This library is distributed under a modified BSD license.  See the included
  6 |  * RSTAUI.License.txt file for details.
  7 |  */
  8 | package org.fife.rsta.ui;
  9 | 
 10 | import java.awt.*;
 11 | import javax.swing.*;
 12 | 
 13 | 
 14 | /**
 15 |  * An icon that looks like a Windows 98 or XP-style size grip.
 16 |  *
 17 |  * @author Robert Futrell
 18 |  * @version 1.0
 19 |  */
 20 | public class SizeGripIcon implements Icon {
 21 | 
 22 | 	private static final int SIZE = 16;
 23 | 
 24 | 
 25 | 	/**
 26 | 	 * Returns the height of this icon.
 27 | 	 *
 28 | 	 * @return This icon's height.
 29 | 	 */
 30 | 	@Override
 31 | 	public int getIconHeight() {
 32 | 		return SIZE;
 33 | 	}
 34 | 
 35 | 
 36 | 	/**
 37 | 	 * Returns the width of this icon.
 38 | 	 *
 39 | 	 * @return This icon's width.
 40 | 	 */
 41 | 	@Override
 42 | 	public int getIconWidth() {
 43 | 		return SIZE;
 44 | 	}
 45 | 
 46 | 
 47 | 	/**
 48 | 	 * Paints this icon.
 49 | 	 *
 50 | 	 * @param c The component to paint on.
 51 | 	 * @param g The graphics context.
 52 | 	 * @param x The x-coordinate at which to paint.
 53 | 	 * @param y The y-coordinate at which to paint.
 54 | 	 */
 55 | 	@Override
 56 | 	public void paintIcon(Component c, Graphics g, int x, int y) {
 57 | 
 58 | 		Dimension dim = c.getSize();
 59 | 		Color c1 = UIManager.getColor("Label.disabledShadow");
 60 | 		Color c2 = UIManager.getColor("Label.disabledForeground");
 61 | 
 62 | 		ComponentOrientation orientation = c.getComponentOrientation();
 63 | 		int height = dim.height -= 3;
 64 | 
 65 | 		if (orientation.isLeftToRight()) {
 66 | 			int width = dim.width  -= 3;
 67 | 			g.setColor(c1);
 68 | 			g.fillRect(width-9,height-1, 3,3);
 69 | 			g.fillRect(width-5,height-1, 3,3);
 70 | 			g.fillRect(width-1,height-1, 3,3);
 71 | 			g.fillRect(width-5,height-5, 3,3);
 72 | 			g.fillRect(width-1,height-5, 3,3);
 73 | 			g.fillRect(width-1,height-9, 3,3);
 74 | 			g.setColor(c2);
 75 | 			g.fillRect(width-9,height-1, 2,2);
 76 | 			g.fillRect(width-5,height-1, 2,2);
 77 | 			g.fillRect(width-1,height-1, 2,2);
 78 | 			g.fillRect(width-5,height-5, 2,2);
 79 | 			g.fillRect(width-1,height-5, 2,2);
 80 | 			g.fillRect(width-1,height-9, 2,2);
 81 | 		}
 82 | 		else {
 83 | 			g.setColor(c1);
 84 | 			g.fillRect(10,height-1, 3,3);
 85 | 			g.fillRect(6,height-1, 3,3);
 86 | 			g.fillRect(2,height-1, 3,3);
 87 | 			g.fillRect(6,height-5, 3,3);
 88 | 			g.fillRect(2,height-5, 3,3);
 89 | 			g.fillRect(2,height-9, 3,3);
 90 | 			g.setColor(c2);
 91 | 			g.fillRect(10,height-1, 2,2);
 92 | 			g.fillRect(6,height-1, 2,2);
 93 | 			g.fillRect(2,height-1, 2,2);
 94 | 			g.fillRect(6,height-5, 2,2);
 95 | 			g.fillRect(2,height-5, 2,2);
 96 | 			g.fillRect(2,height-9, 2,2);
 97 | 		}
 98 | 
 99 | 	}
100 | 
101 | 
102 | }


--------------------------------------------------------------------------------
/RSTAUI/src/main/java/org/fife/rsta/ui/MaxWidthComboBox.java:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * 11/27/2004
  3 |  *
  4 |  * MaxWidthComboBox.java - A combo box with a maximum width, to avoid pesky
  5 |  * layout problems when the combo contains lengthy strings.
  6 |  * This library is distributed under a modified BSD license.  See the included
  7 |  * RSTAUI.License.txt file for details.
  8 |  */
  9 | package org.fife.rsta.ui;
 10 | 
 11 | import java.awt.Dimension;
 12 | import javax.swing.ComboBoxModel;
 13 | import javax.swing.JComboBox;
 14 | 
 15 | 
 16 | /**
 17 |  * A combo box whose width cannot go over a specified value.  This class is
 18 |  * useful when you have a layout manager that adheres to the combo box's
 19 |  * preferred/maximum sizes (such as SpringLayout), and your
 20 |  * combo box contains a value longer than you'd like - the combo box is drawn
 21 |  * too large and the GUI looks ugly.  With this class you can set a maximum
 22 |  * width for the combo box, and its height will never be affected.
 23 |  *
 24 |  * @author Robert Futrell
 25 |  * @version 0.5
 26 |  * @param  The type of item in the combo box.
 27 |  */
 28 | public class MaxWidthComboBox extends JComboBox {
 29 | 
 30 | 	private static final long serialVersionUID = 1L;
 31 | 
 32 | 	/**
 33 | 	 * The width of this combo box will never be greater than this value.
 34 | 	 */
 35 | 	private int maxWidth;
 36 | 
 37 | 
 38 | 	/**
 39 | 	 * Constructor.
 40 | 	 *
 41 | 	 * @param maxWidth The maximum width for this combo box.
 42 | 	 */
 43 | 	public MaxWidthComboBox(int maxWidth) {
 44 | 		this.maxWidth = maxWidth;
 45 | 	}
 46 | 
 47 | 
 48 | 	/**
 49 | 	 * Constructor.
 50 | 	 *
 51 | 	 * @param model The model for this combo box.
 52 | 	 * @param maxWidth The maximum width for this combo box.
 53 | 	 */
 54 | 	public MaxWidthComboBox(ComboBoxModel model, int maxWidth) {
 55 | 		super(model);
 56 | 		this.maxWidth = maxWidth;
 57 | 	}
 58 | 
 59 | 
 60 | 	/**
 61 | 	 * Overridden to ensure that the returned size has width no greater than
 62 | 	 * the specified maximum.
 63 | 	 *
 64 | 	 * @return The maximum size of this combo box.
 65 | 	 */
 66 | 	@Override
 67 | 	public Dimension getMaximumSize() {
 68 | 		Dimension size = super.getMaximumSize();
 69 | 		size.width = Math.min(size.width, maxWidth);
 70 | 		return size;
 71 | 	}
 72 | 
 73 | 
 74 | 	/**
 75 | 	 * Overridden to ensure that the returned size has width no greater than
 76 | 	 * the specified maximum.
 77 | 	 *
 78 | 	 * @return The minimum size of this combo box.
 79 | 	 */
 80 | 	@Override
 81 | 	public Dimension getMinimumSize() {
 82 | 		Dimension size = super.getMinimumSize();
 83 | 		size.width = Math.min(size.width, maxWidth);
 84 | 		return size;
 85 | 	}
 86 | 
 87 | 
 88 | 	/**
 89 | 	 * Overridden to ensure that the returned size has width no greater than
 90 | 	 * the specified maximum.
 91 | 	 *
 92 | 	 * @return The preferred size of this combo box.
 93 | 	 */
 94 | 	@Override
 95 | 	public Dimension getPreferredSize() {
 96 | 		Dimension size = super.getPreferredSize();
 97 | 		size.width = Math.min(size.width, maxWidth);
 98 | 		return size;
 99 | 	}
100 | 
101 | 
102 | }
103 | 


--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
 1 | @rem
 2 | @rem Copyright 2015 the original author or authors.
 3 | @rem
 4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
 5 | @rem you may not use this file except in compliance with the License.
 6 | @rem You may obtain a copy of the License at
 7 | @rem
 8 | @rem      https://www.apache.org/licenses/LICENSE-2.0
 9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 | 
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem  Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 | 
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 | 
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 | 
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 | 
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 | 
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 | 
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 | 
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 | 
54 | goto fail
55 | 
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 | 
60 | if exist "%JAVA_EXE%" goto execute
61 | 
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 | 
68 | goto fail
69 | 
70 | :execute
71 | @rem Setup the command line
72 | 
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 | 
75 | 
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 | 
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 | 
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 | 
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 | 
94 | :omega
95 | 


--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
 1 | # RSTAUI
 2 | ![Java Build](https://github.com/bobbylight/RSTAUI/actions/workflows/gradle.yml/badge.svg)
 3 | ![Java Build](https://github.com/bobbylight/RSTAUI/actions/workflows/codeql-analysis.yml/badge.svg)
 4 | ![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fifesoft/rstaui/badge.svg)
 5 | [![codecov](https://codecov.io/gh/bobbylight/RSTAUI/graph/badge.svg?token=fa8OfGn3RO)](https://codecov.io/gh/bobbylight/RSTAUI)
 6 | 
 7 | This is a library for adding the following dialogs to an application using `RSyntaxTextArea` as an
 8 | editor:
 9 | 
10 | * Find Dialog
11 | * Replace Dialog
12 | * Find and Replace toolbars (à la Sublime Text)
13 | * Go to Line Dialog
14 | * Text File Properties Dialog (requires use of `TextEditorPane`)
15 | 
16 | Searching support is fully featured - regex searches, match case, whole word, searching forward and
17 | backward, mark all occurrences.  Note that the actual searching functionality is handled in the
18 | `RSyntaxTextArea` project itself (see its `SearchEngine` class); this library just wraps that
19 | functionality in a UI.
20 | 
21 | Available in the [Maven Central repository](https://search.maven.org/search?q=rstaui%20jar) (`com.fifesoft:rstaui:XXX`).
22 | SNAPSHOT builds of the in-development, unreleased version are hosted on [Sonatype](https://oss.sonatype.org/content/repositories/snapshots/com/fifesoft/rstaui/).
23 | 
24 | RSTAUI is available under a [modified BSD license](https://github.com/bobbylight/RSTAUI/blob/master/RSTAUI/src/main/dist/RSTAUI.License.txt).
25 | For more information, visit [http://bobbylight.github.io/RSyntaxTextArea/](http://bobbylight.github.io/RSyntaxTextArea/).
26 | 
27 | ## Screenshots
28 | 

29 | 30 |
Find Dialog 31 |

32 | 33 |

34 | 35 |
Replace Dialog 36 |

37 | 38 |

39 | 40 |
Go to Line Dialog 41 |

42 | 43 | ## Compiling 44 | 45 | RSTAUI is built using Gradle. To compile the source, run all tests, and build the distribution jar, 46 | simply change into the project directory and run: 47 | 48 | gradlew build --warning-mode all 49 | 50 | ## Example Usage 51 | 52 | A very simple example can be found in the 53 | [RSTAUIDemoApp class](https://github.com/bobbylight/RSTAUI/blob/master/RSTAUIDemo/src/main/java/org/fife/rsta/ui/demo/RSTAUIDemoApp.java) 54 | included in this project. 55 | 56 | ## Sister Projects 57 | 58 | * [RSyntaxTextArea](https://github.com/bobbylight/RSyntaxTextArea) provides syntax highlighting, code folding, and many other features out-of-the-box. 59 | * [AutoComplete](https://github.com/bobbylight/AutoComplete) - Adds code completion to RSyntaxTextArea (or any other JTextComponent). 60 | * [RSTALanguageSupport](https://github.com/bobbylight/RSTALanguageSupport) - Code completion for RSTA for the following languages: Java, JavaScript, HTML, PHP, JSP, Perl, C, Unix Shell. 61 | Built on both RSTA and AutoComplete. 62 | * [SpellChecker](https://github.com/bobbylight/SpellChecker) - Adds squiggle-underline spell checking to RSyntaxTextArea. 63 | 64 | ## Getting Help 65 | 66 | * Add an issue on GitHub 67 | * Check the project's [home page](http://bobbylight.github.io/RSyntaxTextArea/) 68 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/CollapsibleSectionPanelTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui; 2 | 3 | import org.junit.jupiter.api.BeforeEach; 4 | import org.junit.jupiter.api.Test; 5 | import org.junit.jupiter.api.extension.ExtendWith; 6 | 7 | import javax.swing.*; 8 | import java.awt.event.KeyEvent; 9 | 10 | import static org.junit.jupiter.api.Assertions.*; 11 | 12 | /** 13 | * Unit tests for {@link CollapsibleSectionPanel}. 14 | */ 15 | @ExtendWith(SwingRunnerExtension.class) 16 | class CollapsibleSectionPanelTest { 17 | 18 | private CollapsibleSectionPanel panel; 19 | 20 | @BeforeEach 21 | void setUp() { 22 | panel = new CollapsibleSectionPanel(); 23 | } 24 | 25 | @Test 26 | void testConstructor_noArgs() { 27 | assertDoesNotThrow(() -> new CollapsibleSectionPanel()); 28 | } 29 | 30 | @Test 31 | void testConstructor_withAnimate() { 32 | assertDoesNotThrow(() -> new CollapsibleSectionPanel(true)); 33 | assertDoesNotThrow(() -> new CollapsibleSectionPanel(false)); 34 | } 35 | 36 | @Test 37 | void testAddBottomComponent() { 38 | JComponent comp = new JPanel(); 39 | panel.addBottomComponent(comp); 40 | assertNull(panel.getDisplayedBottomComponent()); 41 | panel.setAnimate(false); 42 | panel.showBottomComponent(comp); 43 | assertEquals(comp, panel.getDisplayedBottomComponent()); 44 | } 45 | 46 | @Test 47 | void testAddBottomComponent_withKeyStroke() { 48 | JComponent comp = new JPanel(); 49 | KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0); 50 | Action action = panel.addBottomComponent(ks, comp); 51 | assertNotNull(action); 52 | assertNull(panel.getDisplayedBottomComponent()); 53 | panel.setAnimate(false); 54 | panel.showBottomComponent(comp); 55 | assertNotNull(panel.getDisplayedBottomComponent()); 56 | } 57 | 58 | @Test 59 | void testGetSetAnimationTime() { 60 | panel.setAnimationTime(200); 61 | assertEquals(200 / 10, panel.getTotalTicks()); 62 | } 63 | 64 | @Test 65 | void testGetDisplayedBottomComponent_animateFalse() { 66 | assertNull(panel.getDisplayedBottomComponent()); 67 | JComponent comp = new JPanel(); 68 | panel.addBottomComponent(comp); 69 | panel.setAnimate(false); 70 | panel.showBottomComponent(comp); 71 | assertEquals(comp, panel.getDisplayedBottomComponent()); 72 | } 73 | 74 | @Test 75 | void testHideBottomComponent_animateFalse() { 76 | JComponent comp = new JPanel(); 77 | panel.addBottomComponent(comp); 78 | panel.setAnimate(false); 79 | panel.showBottomComponent(comp); 80 | panel.hideBottomComponent(); 81 | assertNull(panel.getDisplayedBottomComponent()); 82 | } 83 | 84 | @Test 85 | void testShowBottomComponent_animateFalse() { 86 | JComponent comp = new JPanel(); 87 | panel.addBottomComponent(comp); 88 | panel.setAnimate(false); 89 | panel.showBottomComponent(comp); 90 | assertEquals(comp, panel.getDisplayedBottomComponent()); 91 | } 92 | 93 | @Test 94 | void testShowBottomComponent_animateFalse_alreadyShown() { 95 | JComponent comp = new JPanel(); 96 | panel.addBottomComponent(comp); 97 | panel.setAnimate(false); 98 | panel.showBottomComponent(comp); 99 | panel.showBottomComponent(comp); 100 | } 101 | 102 | @Test 103 | void testShowBottomComponent_animateFalse_differentComponent() { 104 | JComponent comp = new JPanel(); 105 | JPanel comp2 = new JPanel(); 106 | panel.addBottomComponent(comp); 107 | panel.addBottomComponent(comp2); 108 | panel.setAnimate(false); 109 | panel.showBottomComponent(comp); 110 | panel.showBottomComponent(comp2); 111 | } 112 | 113 | @Test 114 | void testUpdateUI_withBottomComponentInfos() { 115 | JComponent comp = new JPanel(); 116 | panel.addBottomComponent(comp); 117 | panel.updateUI(); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /RSTAUI/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-library' 3 | } 4 | 5 | ['base', 'jacoco', 'distribution', 'maven-publish', 'signing'].each { apply plugin: it } 6 | 7 | base { 8 | archivesName = 'rstaui' 9 | } 10 | 11 | dependencies { 12 | api 'com.fifesoft:rsyntaxtextarea:3.5.4' 13 | api 'com.fifesoft:autocomplete:3.3.2' 14 | testImplementation platform('org.junit:junit-bom:5.12.1') 15 | testImplementation 'org.junit.jupiter:junit-jupiter' 16 | testRuntimeOnly 'org.junit.platform:junit-platform-launcher' 17 | testImplementation 'org.mockito:mockito-core:5.15.2' 18 | } 19 | 20 | ext.isReleaseVersion = !project.version.endsWith('SNAPSHOT') 21 | 22 | jacocoTestReport { 23 | reports { 24 | xml.required = true // codecov depends on xml format report 25 | html.required = true 26 | } 27 | } 28 | 29 | java { 30 | withSourcesJar() 31 | withJavadocJar() 32 | } 33 | jar { 34 | manifest { 35 | manifest { 36 | attributes('Class-Path': 'rsyntaxtextarea.jar autocomplete.jar', 37 | 'Specification-Title': 'RSTAUI', 38 | 'Specification-Version': version, 39 | 'Implementation-Title': 'org.fife.ui', 40 | 'Implementation-Version': version) 41 | 42 | } 43 | } 44 | } 45 | 46 | publishing { 47 | repositories { 48 | maven { 49 | def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' 50 | def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' 51 | url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl 52 | credentials { // Credentials usually kept in user's .gradle/gradle.properties 53 | // We must defensively check for these properties so Travis CI build works 54 | username = project.hasProperty('ossrhUsername') ? ossrhUsername : 'unknown' 55 | password = project.hasProperty('ossrhPassword') ? ossrhPassword : 'unknown' 56 | } 57 | } 58 | } 59 | publications { 60 | maven(MavenPublication) { 61 | 62 | groupId = 'com.fifesoft' 63 | artifactId = 'rstaui' 64 | version = version 65 | 66 | from components.java 67 | 68 | pom { 69 | name = 'rstaui' 70 | description = 'RSTAUI is an add-on library for RSyntaxTextArea that provides pre-build dialog boxes commonly needed in text editing applications.' 71 | url = 'https://bobbylight.github.io/RSyntaxTextArea/' 72 | inceptionYear = '2003' 73 | packaging = 'jar' 74 | licenses { 75 | license { 76 | name = 'BSD-3-Clause' 77 | url = 'https://github.com/bobbylight/RSTAUI/blob/master/RSTAUI/src/main/dist/RSTAUI.License.txt' 78 | } 79 | } 80 | developers { 81 | developer { 82 | name = 'Robert Futrell' 83 | } 84 | } 85 | scm { 86 | url = 'https://github.com/bobbylight/RSTAUI' 87 | connection = 'scm:git:git://github.com/bobbylight/RSTAUI' 88 | developerConnection = 'scm:git:git@github.com:bobbylight/RSTAUI' 89 | if (isReleaseVersion) { 90 | tag = project.version 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | 98 | signing { 99 | // Don't require signing for e.g. ./gradlew install 100 | required = { gradle.taskGraph.hasTask('publish') && isReleaseVersion } 101 | sign publishing.publications.maven 102 | } 103 | tasks.withType(Sign) { 104 | onlyIf { isReleaseVersion } 105 | } 106 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/EscapableDialogTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.junit.jupiter.api.extension.ExtendWith; 5 | 6 | import javax.swing.*; 7 | import java.awt.*; 8 | import java.awt.event.KeyEvent; 9 | 10 | import static org.junit.jupiter.api.Assertions.*; 11 | 12 | /** 13 | * Unit tests for {@link EscapableDialog}. 14 | */ 15 | @ExtendWith(SwingRunnerExtension.class) 16 | public class EscapableDialogTest { 17 | 18 | @Test 19 | void testConstructor_zeroArg() { 20 | assertDoesNotThrow(() -> new EscapableDialog() {}); 21 | } 22 | 23 | @Test 24 | void testConstructor_dialog_nonNull() { 25 | Dialog parent = new JDialog(); 26 | assertDoesNotThrow(() -> new EscapableDialog(parent) {}); 27 | } 28 | 29 | @Test 30 | void testConstructor_dialog_null() { 31 | assertDoesNotThrow(() -> new EscapableDialog((Dialog) null) {}); 32 | } 33 | 34 | @Test 35 | void testConstructor_frame_nonNull() { 36 | Frame parent = new JFrame(); 37 | assertDoesNotThrow(() -> new EscapableDialog(parent) {}); 38 | } 39 | 40 | @Test 41 | void testConstructor_frame_null() { 42 | assertDoesNotThrow(() -> new EscapableDialog((Frame) null) {}); 43 | } 44 | 45 | @Test 46 | void testConstructor_2arg_modal_dialog() { 47 | Dialog parent = new JDialog(); 48 | EscapableDialog dialog = new EscapableDialog(parent, true) {}; 49 | assertTrue(dialog.isModal()); 50 | } 51 | 52 | @Test 53 | void testConstructor_2arg_modal_frame() { 54 | Frame parent = new JFrame(); 55 | EscapableDialog dialog = new EscapableDialog(parent, true) {}; 56 | assertTrue(dialog.isModal()); 57 | } 58 | 59 | @Test 60 | void testConstructor_2arg_frame_dialog() { 61 | Frame parent = new JFrame(); 62 | EscapableDialog dialog = new EscapableDialog(parent, "title") {}; 63 | assertFalse(dialog.isModal()); 64 | assertEquals("title", dialog.getTitle()); 65 | } 66 | 67 | @Test 68 | void testConstructor_2arg_title_dialog() { 69 | Dialog parent = new JDialog(); 70 | EscapableDialog dialog = new EscapableDialog(parent, "title") {}; 71 | assertFalse(dialog.isModal()); 72 | assertEquals("title", dialog.getTitle()); 73 | } 74 | 75 | @Test 76 | void testConstructor_3arg_modal_dialog() { 77 | Dialog parent = new JDialog(); 78 | EscapableDialog dialog = new EscapableDialog(parent, "title", true) {}; 79 | assertTrue(dialog.isModal()); 80 | assertEquals("title", dialog.getTitle()); 81 | } 82 | 83 | @Test 84 | void testConstructor_3arg_modal_frame() { 85 | Frame parent = new JFrame(); 86 | EscapableDialog dialog = new EscapableDialog(parent, "title", true) {}; 87 | assertTrue(dialog.isModal()); 88 | assertEquals("title", dialog.getTitle()); 89 | } 90 | 91 | @Test 92 | void testEscapePressed_hidesDialog() { 93 | EscapableDialog dialog = new EscapableDialog((Frame) null) {}; 94 | dialog.escapePressed(); 95 | assertFalse(dialog.isVisible()); 96 | } 97 | 98 | @Test 99 | void testSetEscapeClosesDialog_true() { 100 | EscapableDialog dialog = new EscapableDialog((Frame) null) {}; 101 | dialog.setEscapeClosesDialog(true); 102 | JRootPane rootPane = dialog.getRootPane(); 103 | InputMap im = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); 104 | ActionMap am = rootPane.getActionMap(); 105 | KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); 106 | assertNotNull(im.get(ks)); 107 | assertNotNull(am.get("OnEsc")); 108 | } 109 | 110 | @Test 111 | void testSetEscapeClosesDialog_false() { 112 | EscapableDialog dialog = new EscapableDialog((Frame) null) {}; 113 | dialog.setEscapeClosesDialog(false); 114 | JRootPane rootPane = dialog.getRootPane(); 115 | InputMap im = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); 116 | ActionMap am = rootPane.getActionMap(); 117 | KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); 118 | assertNull(im.get(ks)); 119 | assertNull(am.get("OnEsc")); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/RComboBoxModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 01/15/2004 3 | * 4 | * RComboBoxModel.java - A combo box model that limits the number of items 5 | * the combo box wil remember. It also won't add an item to the combo box 6 | * if it is already there. 7 | * This library is distributed under a modified BSD license. See the included 8 | * RSTAUI.License.txt file for details. 9 | */ 10 | package org.fife.rsta.ui; 11 | 12 | import java.util.Vector; 13 | 14 | import javax.swing.DefaultComboBoxModel; 15 | 16 | 17 | /** 18 | * A combo box model that limits the number of items the combo box will 19 | * "remember." You can use it like so: 20 | *
21 | * RComboBoxModel model = new RComboBoxModel();
22 | * model.setMaxNumElements(10);
23 | * JComboBox comboBox = new JComboBox(model);

24 | * It also won't let you add an item to the combo box twice (i.e., no 25 | * duplicates), and it adds new items to the beginning of the list, not 26 | * the end (as JComboBox's do by default).

27 | * It defaults to 8 elements remembered. 28 | * 29 | * @author Robert Futrell 30 | * @version 0.8 31 | * @param The type of item in the combo box. 32 | */ 33 | public class RComboBoxModel extends DefaultComboBoxModel { 34 | 35 | private static final long serialVersionUID = 1L; 36 | 37 | /** 38 | * The number of items the combo box will remember. 39 | */ 40 | private int maxNumElements; 41 | 42 | 43 | /** 44 | * Creates a new combo box model with a maximum element count of 45 | * 8. 46 | */ 47 | public RComboBoxModel() { 48 | setMaxNumElements(8); 49 | } 50 | 51 | 52 | /** 53 | * Creates a new combo box model with a maximum element count of 54 | * 8. 55 | * 56 | * @param items The initial items to use to populate the combo box. 57 | */ 58 | public RComboBoxModel(E[] items) { 59 | super(items); 60 | setMaxNumElements(8); 61 | } 62 | 63 | 64 | /** 65 | * Creates a new combo box model with a maximum element count of 66 | * 8. 67 | * 68 | * @param v The initial items to use to populate the combo box. 69 | */ 70 | public RComboBoxModel(Vector v) { 71 | super(v); 72 | setMaxNumElements(8); 73 | } 74 | 75 | 76 | /** 77 | * Adds the object (if it's not already in the list) to the front of 78 | * the list. If it's already in the list, move it to the top. 79 | * 80 | * @param anObject The object to add. 81 | */ 82 | @Override 83 | public void addElement(E anObject) { 84 | insertElementAt(anObject, 0); 85 | } 86 | 87 | 88 | /** 89 | * Ensures the number if items remembered by this combo box is valid. 90 | */ 91 | private void ensureValidItemCount() { 92 | while (getSize()>maxNumElements) { 93 | removeElementAt(getSize() - 1); 94 | } 95 | } 96 | 97 | 98 | /** 99 | * Returns the maximum number of items this combo box can hold. 100 | * 101 | * @return The maximum number of items this combo box can hold. 102 | */ 103 | public int getMaxNumElements() { 104 | return maxNumElements; 105 | } 106 | 107 | 108 | /** 109 | * Adds an item at a specified index. The implementation of this method 110 | * should notify all registered ListDataListeners that the 111 | * item has been added. 112 | * 113 | * @param anObject The Object to be added. 114 | * @param index Location to add the object. 115 | */ 116 | @Override 117 | public void insertElementAt(E anObject, int index) { 118 | 119 | int oldPos = getIndexOf(anObject); 120 | if (oldPos==index) { // Already at the desired location. 121 | return; 122 | } 123 | if (oldPos>-1) { // Remove it first if it's somewhere else. 124 | removeElement(anObject); 125 | } 126 | 127 | super.insertElementAt(anObject, index); 128 | ensureValidItemCount(); 129 | 130 | } 131 | 132 | 133 | /** 134 | * Sets the maximum number of items this combo box can hold. 135 | * 136 | * @param numElements The maximum number of items this combo box can hold. 137 | * If numElements <= 0, then the capacity 138 | * of this combo box is set to 4. 139 | */ 140 | public void setMaxNumElements(int numElements) { 141 | maxNumElements = numElements<=0 ? 4 : numElements; 142 | ensureValidItemCount(); 143 | } 144 | 145 | 146 | } 147 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/search/SearchComboBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 09/20/2013 3 | * 4 | * SearchComboBox - The combo box used for "find" and "replace" dropdowns. 5 | * 6 | * This library is distributed under a modified BSD license. See the included 7 | * RSTAUI.license.txt file for details. 8 | */ 9 | package org.fife.rsta.ui.search; 10 | 11 | import java.util.Vector; 12 | 13 | import javax.swing.InputMap; 14 | import javax.swing.KeyStroke; 15 | import javax.swing.text.JTextComponent; 16 | 17 | import org.fife.rsta.ui.UIUtil; 18 | 19 | 20 | /** 21 | * The combo box used for entering text to "find" and "replace" in both the 22 | * Find/Replace dialogs and toolbars. 23 | * 24 | * @author Robert Futrell 25 | * @version 1.0 26 | */ 27 | // NOTE: This class is public to facilitate applications creating other 28 | // subclasses, such as a FindInFilesDialog. 29 | public class SearchComboBox extends RegexAwareComboBox { 30 | 31 | private FindToolBar toolBar; 32 | 33 | 34 | /** 35 | * Constructor. 36 | * 37 | * @param toolBar The toolbar that owns this combo box, or {@code null} 38 | * if it is not in a toolbar. 39 | * @param replace Whether this combo box is for "replace" text (as opposed 40 | * to "find" text). 41 | */ 42 | public SearchComboBox(FindToolBar toolBar, boolean replace) { 43 | super(replace); 44 | this.toolBar = toolBar; 45 | UIUtil.fixComboOrientation(this); 46 | updateTextFieldKeyMap(); 47 | } 48 | 49 | 50 | /** 51 | * Overridden to always select the newly-added item. If the item is 52 | * already in the list of choices, it is moved to the top before being 53 | * selected. 54 | * 55 | * @param item The item to add. 56 | */ 57 | @Override 58 | public void addItem(String item) { 59 | 60 | // If they just searched for an item that's already in the list 61 | // other than the first, move it to the first position. 62 | int curIndex = getIndexOf(item); 63 | if (curIndex==-1) { 64 | super.addItem(item); 65 | } 66 | else if (curIndex>0) { 67 | removeItem(item); 68 | insertItemAt(item, 0); 69 | } 70 | 71 | // Always leave with the new item selected 72 | setSelectedIndex(0); 73 | } 74 | 75 | 76 | private int getIndexOf(String item) { 77 | for (int i=0; iStrings contained in this combo box. 99 | * 100 | * @return A java.util.Vector of strings found in this 101 | * combo box. If that combo box is empty, then a zero-length 102 | * Vector is returned. 103 | */ 104 | public Vector getSearchStrings() { 105 | 106 | // First, ensure that the item in the editor component is indeed in the 107 | // combo box. 108 | int selectedIndex = getSelectedIndex(); 109 | if (selectedIndex==-1) { 110 | addItem(getSelectedString()); 111 | } 112 | 113 | // If they just searched for an item that's already in the list other 114 | // than the first, move it to the first position. 115 | else if (selectedIndex>0) { 116 | String item = (String)getSelectedItem(); 117 | removeItem(item); 118 | insertItemAt(item, 0); 119 | setSelectedIndex(0); 120 | } 121 | 122 | int itemCount = getItemCount(); 123 | Vector vector = new Vector<>(itemCount); 124 | for (int i=0; iInputMap for the Escape key action. 36 | */ 37 | private static final String ESCAPE_KEY = "OnEsc"; 38 | 39 | 40 | /** 41 | * Constructor. 42 | */ 43 | public EscapableDialog() { 44 | init(); 45 | } 46 | 47 | 48 | /** 49 | * Constructor. 50 | * 51 | * @param owner The parent dialog. 52 | */ 53 | public EscapableDialog(Dialog owner) { 54 | super(owner); 55 | init(); 56 | } 57 | 58 | 59 | /** 60 | * Constructor. 61 | * 62 | * @param owner The parent dialog. 63 | * @param modal Whether this dialog is modal. 64 | */ 65 | public EscapableDialog(Dialog owner, boolean modal) { 66 | super(owner, modal); 67 | init(); 68 | } 69 | 70 | 71 | /** 72 | * Constructor. 73 | * 74 | * @param owner The parent dialog. 75 | * @param title The title of this dialog. 76 | */ 77 | public EscapableDialog(Dialog owner, String title) { 78 | super(owner, title); 79 | init(); 80 | } 81 | 82 | 83 | /** 84 | * Constructor. 85 | * 86 | * @param owner The parent dialog. 87 | * @param title The title of this dialog. 88 | * @param modal Whether this dialog is modal. 89 | */ 90 | public EscapableDialog(Dialog owner, String title, boolean modal) { 91 | super(owner, title, modal); 92 | init(); 93 | } 94 | 95 | 96 | /** 97 | * Constructor. 98 | * 99 | * @param owner The parent frame. 100 | */ 101 | public EscapableDialog(Frame owner) { 102 | super(owner); 103 | init(); 104 | } 105 | 106 | 107 | /** 108 | * Constructor. 109 | * 110 | * @param owner The parent frame. 111 | * @param modal Whether this dialog is modal. 112 | */ 113 | public EscapableDialog(Frame owner, boolean modal) { 114 | super(owner, modal); 115 | init(); 116 | } 117 | 118 | 119 | /** 120 | * Constructor. 121 | * 122 | * @param owner The parent frame. 123 | * @param title The title of this dialog. 124 | */ 125 | public EscapableDialog(Frame owner, String title) { 126 | super(owner, title); 127 | init(); 128 | } 129 | 130 | 131 | /** 132 | * Constructor. 133 | * 134 | * @param owner The parent frame. 135 | * @param title The title of this dialog. 136 | * @param modal Whether this dialog is modal. 137 | */ 138 | public EscapableDialog(Frame owner, String title, boolean modal) { 139 | super(owner, title, modal); 140 | init(); 141 | } 142 | 143 | 144 | /** 145 | * Called when the Escape key is pressed in this dialog. Subclasses 146 | * can override to handle any custom "Cancel" logic. The default 147 | * implementation hides the dialog (via setVisible(false);). 148 | */ 149 | protected void escapePressed() { 150 | setVisible(false); 151 | } 152 | 153 | 154 | /** 155 | * Initializes this dialog. 156 | */ 157 | private void init() { 158 | setEscapeClosesDialog(true); 159 | } 160 | 161 | 162 | /** 163 | * Toggles whether the Escape key closes this dialog. 164 | * 165 | * @param closes Whether Escape should close this dialog (actually, 166 | * whether {@link #escapePressed()} should be called when Escape 167 | * is pressed). 168 | */ 169 | public void setEscapeClosesDialog(boolean closes) { 170 | 171 | JRootPane rootPane = getRootPane(); 172 | InputMap im = rootPane.getInputMap( 173 | JComponent.WHEN_IN_FOCUSED_WINDOW); 174 | ActionMap actionMap = rootPane.getActionMap(); 175 | KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); 176 | 177 | if (closes) { 178 | im.put(ks, ESCAPE_KEY); 179 | actionMap.put(ESCAPE_KEY, new AbstractAction() { 180 | @Override 181 | public void actionPerformed(ActionEvent e) { 182 | escapePressed(); 183 | } 184 | }); 185 | } 186 | else { 187 | im.remove(ks); 188 | actionMap.remove(ESCAPE_KEY); 189 | } 190 | 191 | } 192 | 193 | 194 | } -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/RComboBoxModelTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import java.util.Vector; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | /** 10 | * Unit tests for {@link RComboBoxModel}. 11 | */ 12 | public class RComboBoxModelTest { 13 | 14 | @Test 15 | public void testConstructor_noArgs() { 16 | RComboBoxModel model = new RComboBoxModel<>(); 17 | assertEquals(8, model.getMaxNumElements()); 18 | } 19 | 20 | @Test 21 | public void testConstructor_withArray() { 22 | String[] items = {"item1", "item2"}; 23 | RComboBoxModel model = new RComboBoxModel<>(items); 24 | assertEquals(2, model.getSize()); 25 | assertEquals("item1", model.getElementAt(0)); 26 | assertEquals("item2", model.getElementAt(1)); 27 | } 28 | 29 | @Test 30 | public void testConstructor_withArray_overDefaultSize() { 31 | String[] items = {"1", "2", "3", "4", "5", "6", "7", "8", "9"}; 32 | RComboBoxModel model = new RComboBoxModel<>(items); 33 | assertEquals(8, model.getSize()); 34 | for (int i = 0; i < 8; i++) { 35 | assertEquals(Integer.toString(i + 1), model.getElementAt(i)); 36 | } 37 | } 38 | 39 | @Test 40 | public void testConstructor_withVector() { 41 | Vector items = new Vector<>(); 42 | items.add("item1"); 43 | items.add("item2"); 44 | RComboBoxModel modelWithVector = new RComboBoxModel<>(items); 45 | assertEquals(2, modelWithVector.getSize()); 46 | assertEquals("item1", modelWithVector.getElementAt(0)); 47 | assertEquals("item2", modelWithVector.getElementAt(1)); 48 | } 49 | 50 | @Test 51 | public void testConstructor_withVector_overDefaultSize() { 52 | Vector items = new Vector<>(); 53 | for (int i = 1; i <= 9; i++) { 54 | items.add(Integer.toString(i)); 55 | } 56 | RComboBoxModel model = new RComboBoxModel<>(items); 57 | assertEquals(8, model.getSize()); 58 | for (int i = 0; i < 8; i++) { 59 | assertEquals(Integer.toString(i + 1), model.getElementAt(i)); 60 | } 61 | } 62 | 63 | @Test 64 | public void testAddElement() { 65 | RComboBoxModel model = new RComboBoxModel<>(); 66 | model.addElement("item1"); 67 | assertEquals(1, model.getSize()); 68 | assertEquals("item1", model.getElementAt(0)); 69 | } 70 | 71 | @Test 72 | public void testAddElement_noDuplicates() { 73 | RComboBoxModel model = new RComboBoxModel<>(); 74 | model.addElement("item1"); 75 | model.addElement("item1"); 76 | assertEquals(1, model.getSize()); 77 | } 78 | 79 | @Test 80 | public void testAddElement_movesToTop() { 81 | RComboBoxModel model = new RComboBoxModel<>(); 82 | model.addElement("item1"); 83 | model.addElement("item2"); 84 | model.addElement("item3"); 85 | assertEquals(3, model.getSize()); 86 | assertEquals("item3", model.getElementAt(0)); 87 | assertEquals("item2", model.getElementAt(1)); 88 | assertEquals("item1", model.getElementAt(2)); 89 | } 90 | 91 | @Test 92 | public void testGetMaxNumElements() { 93 | RComboBoxModel model = new RComboBoxModel<>(); 94 | assertEquals(8, model.getMaxNumElements()); 95 | model.setMaxNumElements(5); 96 | assertEquals(5, model.getMaxNumElements()); 97 | } 98 | 99 | @Test 100 | public void testInsertElementAt_newElement_newPosition() { 101 | RComboBoxModel model = new RComboBoxModel<>(); 102 | model.addElement("item1"); 103 | model.insertElementAt("item2", 0); 104 | assertEquals(2, model.getSize()); 105 | assertEquals("item2", model.getElementAt(0)); 106 | assertEquals("item1", model.getElementAt(1)); 107 | } 108 | 109 | @Test 110 | public void testInsertElementAt_insertingSameElementIntoSamePosition() { 111 | RComboBoxModel model = new RComboBoxModel<>(new String[] { "item1", "item2" }); 112 | model.insertElementAt("item1", 0); 113 | assertEquals(2, model.getSize()); 114 | assertEquals("item1", model.getElementAt(0)); 115 | assertEquals("item2", model.getElementAt(1)); 116 | } 117 | 118 | @Test 119 | public void testInsertElementAt_insertingExistingElementIntoNewPosition() { 120 | RComboBoxModel model = new RComboBoxModel<>(new String[] { "item1", "item2" }); 121 | model.insertElementAt("item2", 0); 122 | assertEquals(2, model.getSize()); 123 | assertEquals("item2", model.getElementAt(0)); 124 | assertEquals("item1", model.getElementAt(1)); 125 | } 126 | 127 | @Test 128 | public void testSetMaxNumElements() { 129 | RComboBoxModel model = new RComboBoxModel<>(); 130 | model.setMaxNumElements(1); 131 | model.addElement("item1"); 132 | model.addElement("item2"); 133 | assertEquals(1, model.getSize()); 134 | assertEquals("item2", model.getElementAt(0)); 135 | } 136 | 137 | @Test 138 | public void testSetMaxNumElements_negativeValue() { 139 | RComboBoxModel model = new RComboBoxModel<>(); 140 | model.setMaxNumElements(-1); 141 | assertEquals(4, model.getMaxNumElements()); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/DecorativeIconPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 07/30/2011 3 | * 4 | * DecorativeIconPanel.java - Displays a small decorative icon beside some 5 | * other component. 6 | * This library is distributed under a modified BSD license. See the included 7 | * RSTAUI.License.txt file for details. 8 | */ 9 | package org.fife.rsta.ui; 10 | 11 | import java.awt.BorderLayout; 12 | import java.awt.Graphics; 13 | import java.awt.event.MouseEvent; 14 | import javax.swing.Icon; 15 | import javax.swing.JLabel; 16 | import javax.swing.JPanel; 17 | import javax.swing.SwingConstants; 18 | import javax.swing.ToolTipManager; 19 | 20 | import org.fife.ui.autocomplete.EmptyIcon; 21 | 22 | 23 | /** 24 | * A panel that displays an 8x8 decorative icon for a component, such as a 25 | * text field or combo box. This can be used to display error icons, warning 26 | * icons, etc. 27 | * 28 | * @author Robert Futrell 29 | * @version 1.1 30 | * @see AssistanceIconPanel 31 | */ 32 | public class DecorativeIconPanel extends JPanel { 33 | 34 | /** 35 | * The width of this icon panel, to help align the components we're 36 | * listening to with other combo boxes or text fields without a 37 | * DecorativeIconPanel. 38 | */ 39 | public static final int DEFAULT_WIDTH = 8; 40 | 41 | private JLabel iconLabel; 42 | private boolean showIcon; 43 | private String tip; 44 | private EmptyIcon emptyIcon; 45 | 46 | 47 | /** 48 | * Constructor. 49 | */ 50 | public DecorativeIconPanel() { 51 | this(DEFAULT_WIDTH); 52 | } 53 | 54 | 55 | /** 56 | * Constructor. 57 | * 58 | * @param iconWidth The with of decorative icons that will be added to 59 | * this panel. This is used to ensure the proper amount of padding 60 | * when no icon is being shown. 61 | */ 62 | public DecorativeIconPanel(int iconWidth) { 63 | 64 | setLayout(new BorderLayout()); 65 | emptyIcon = new EmptyIcon(iconWidth); 66 | 67 | iconLabel = new JLabel(emptyIcon) { 68 | @Override 69 | public String getToolTipText(MouseEvent e) { 70 | return showIcon ? tip : null; 71 | } 72 | }; 73 | iconLabel.setVerticalAlignment(SwingConstants.TOP); 74 | ToolTipManager.sharedInstance().registerComponent(iconLabel); 75 | add(iconLabel, BorderLayout.NORTH); 76 | } 77 | 78 | 79 | /** 80 | * Returns the icon being displayed. 81 | * 82 | * @return The icon. 83 | * @see #setIcon(Icon) 84 | */ 85 | public Icon getIcon() { 86 | return iconLabel.getIcon(); 87 | } 88 | 89 | 90 | /** 91 | * Returns whether the icon (if any) is being rendered. 92 | * 93 | * @return Whether the icon is being rendered. 94 | * @see #setShowIcon(boolean) 95 | */ 96 | public boolean getShowIcon() { 97 | return showIcon; 98 | } 99 | 100 | 101 | /** 102 | * Returns the tool tip displayed when the mouse hovers over the icon. 103 | * If the icon is not being displayed, this parameter is ignored. 104 | * 105 | * @return The tool tip text. 106 | * @see #setToolTipText(String) 107 | */ 108 | @Override 109 | public String getToolTipText() { 110 | return tip; 111 | } 112 | 113 | 114 | /** 115 | * Paints any child components. Overridden so the user can explicitly 116 | * hide the icon. 117 | * 118 | * @param g The graphics context. 119 | * @see #setShowIcon(boolean) 120 | */ 121 | @Override 122 | protected void paintChildren(Graphics g) { 123 | if (showIcon) { 124 | super.paintChildren(g); 125 | } 126 | } 127 | 128 | 129 | /** 130 | * Sets the icon to display. 131 | * 132 | * @param icon The new icon to display. 133 | * @see #getIcon() 134 | */ 135 | public void setIcon(Icon icon) { 136 | if (icon==null) { 137 | icon = emptyIcon; 138 | } 139 | iconLabel.setIcon(icon); 140 | } 141 | 142 | 143 | /** 144 | * Sets the size of the icon to display. This only needs to be 145 | * called if the icon set being used changes at runtime. 146 | * 147 | * @param iconWidth The new icon size. 148 | */ 149 | public void setIconWidth(int iconWidth) { 150 | if (iconWidth != emptyIcon.getIconWidth()) { 151 | emptyIcon.setSize(iconWidth); 152 | revalidate(); 153 | repaint(); 154 | } 155 | } 156 | 157 | 158 | /** 159 | * Toggles whether the icon should be shown. 160 | * 161 | * @param show Whether to show the icon. 162 | * @see #getShowIcon() 163 | */ 164 | public void setShowIcon(boolean show) { 165 | if (show!=showIcon) { 166 | showIcon = show; 167 | repaint(); 168 | } 169 | } 170 | 171 | 172 | /** 173 | * Sets the tool tip text to display when the mouse is over the icon. 174 | * This parameter is ignored if the icon is not being displayed. 175 | * 176 | * @param tip The tool tip text to display. 177 | * @see #getToolTipText() 178 | */ 179 | @Override 180 | public void setToolTipText(String tip) { 181 | this.tip = tip; 182 | } 183 | 184 | 185 | } 186 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui; 2 | 3 | import org.fife.ui.rsyntaxtextarea.FileLocation; 4 | import org.fife.ui.rsyntaxtextarea.TextEditorPane; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | import org.junit.jupiter.params.ParameterizedTest; 9 | import org.junit.jupiter.params.provider.ValueSource; 10 | 11 | import javax.swing.*; 12 | import java.awt.*; 13 | import java.awt.event.ActionEvent; 14 | import java.io.IOException; 15 | import java.nio.charset.StandardCharsets; 16 | import java.nio.file.Files; 17 | import java.nio.file.Path; 18 | import java.util.Locale; 19 | 20 | import static org.junit.jupiter.api.Assertions.*; 21 | 22 | /** 23 | * Unit tests for {@link TextFilePropertiesDialog}. 24 | */ 25 | @ExtendWith(SwingRunnerExtension.class) 26 | class TextFilePropertiesDialogTest { 27 | 28 | private TextFilePropertiesDialog dialog; 29 | private TextEditorPane textArea; 30 | 31 | private static String createContent(int size) { 32 | StringBuilder sb = new StringBuilder(); 33 | sb.append("a".repeat(Math.max(0, size))); 34 | return sb.toString(); 35 | } 36 | 37 | @BeforeEach 38 | void setUp() { 39 | textArea = new TextEditorPane(); 40 | dialog = new TextFilePropertiesDialog((Frame) null, textArea); 41 | } 42 | 43 | @Test 44 | void testConstructor_dialog_nonNull() { 45 | JDialog parent = new JDialog(); 46 | assertDoesNotThrow(() -> new TextFilePropertiesDialog(parent, textArea)); 47 | } 48 | 49 | @Test 50 | void testConstructor_dialog_null() { 51 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Dialog) null, textArea)); 52 | } 53 | 54 | @Test 55 | void testConstructor_frame_nonNull() { 56 | JFrame parent = new JFrame(); 57 | assertDoesNotThrow(() -> new TextFilePropertiesDialog(parent, textArea)); 58 | } 59 | 60 | @Test 61 | void testConstructor_frame_null() { 62 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea)); 63 | } 64 | 65 | @Test 66 | void testConstructor_readOnlyEditor() { 67 | textArea.setReadOnly(true); 68 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea)); 69 | } 70 | 71 | @Test 72 | void testConstructor_rtl() { 73 | Locale origDefault = Locale.getDefault(); 74 | try { 75 | Locale.setDefault(new Locale("ar", "SA")); 76 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea)); 77 | } finally { 78 | Locale.setDefault(origDefault); 79 | } 80 | } 81 | 82 | @Test 83 | void testConstructor_contentInTextArea() { 84 | textArea.setText("one two 333 fff%$$#$\nfive six"); 85 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea)); 86 | } 87 | 88 | @Test 89 | void testConstructor_lastSaveOrLoadTime() throws IOException{ 90 | Path path = Files.createTempFile("test", ".txt"); 91 | String content = createContent(4096); 92 | Files.writeString(path, content, StandardCharsets.UTF_8); 93 | path.toFile().deleteOnExit(); 94 | textArea.load(FileLocation.create(path.toFile())); 95 | textArea.save(); 96 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea)); 97 | } 98 | 99 | @ParameterizedTest 100 | @ValueSource(ints = { 0, 1024, 1024 * 1024 }) 101 | void testConstructor_filePassedIn_variousSizes(int size) throws IOException { 102 | Path path = Files.createTempFile("test", ".txt"); 103 | String content = createContent(size); 104 | Files.writeString(path, content, StandardCharsets.UTF_8); 105 | path.toFile().deleteOnExit(); 106 | textArea.load(FileLocation.create(path.toFile())); 107 | assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea)); 108 | } 109 | 110 | @Test 111 | void testActionPerformed_cancelButton() { 112 | dialog.actionPerformed(new ActionEvent("source", ActionEvent.ACTION_PERFORMED, "CancelButton")); 113 | assertFalse(dialog.isVisible()); 114 | } 115 | 116 | @Test 117 | void testActionPerformed_encodingComboBox() { 118 | assertFalse(dialog.isCloseable()); 119 | dialog.actionPerformed(new ActionEvent("source", ActionEvent.ACTION_PERFORMED, "encodingCombo")); 120 | assertTrue(dialog.isCloseable()); 121 | } 122 | 123 | @Test 124 | void testActionPerformed_okButton_everythingChanged() { 125 | assertFalse(dialog.isCloseable()); 126 | dialog.setSelectedLineTerminator("\r"); 127 | dialog.setEncoding(StandardCharsets.UTF_16.name()); 128 | assertTrue(dialog.isCloseable()); 129 | dialog.actionPerformed(new ActionEvent("source", ActionEvent.ACTION_PERFORMED, "OKButton")); 130 | assertFalse(dialog.isVisible()); 131 | } 132 | 133 | @Test 134 | void testActionPerformed_okButton_nothingChanged() { 135 | dialog.actionPerformed(new ActionEvent("source", ActionEvent.ACTION_PERFORMED, "OKButton")); 136 | assertFalse(dialog.isVisible()); 137 | } 138 | 139 | @Test 140 | void testActionPerformed_terminatorComboBox() { 141 | assertFalse(dialog.isCloseable()); 142 | dialog.actionPerformed(new ActionEvent("source", ActionEvent.ACTION_PERFORMED, "TerminatorComboBox")); 143 | assertTrue(dialog.isCloseable()); 144 | } 145 | 146 | @Test 147 | void testCreateButtonFooter() { 148 | JButton okButton = new JButton("OK"); 149 | JButton cancelButton = new JButton("Cancel"); 150 | Container buttonPanel = dialog.createButtonFooter(okButton, cancelButton); 151 | assertNotNull(buttonPanel); 152 | assertEquals(2, ((JPanel) buttonPanel.getComponent(0)).getComponentCount()); 153 | } 154 | 155 | @Test 156 | void testSetVisible_false() { 157 | dialog.setVisible(false); 158 | assertFalse(dialog.isVisible()); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/search/FindToolBarTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui.search; 2 | 3 | import org.fife.rsta.ui.SwingRunnerExtension; 4 | import org.fife.ui.rtextarea.SearchContext; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import javax.swing.*; 10 | import java.awt.*; 11 | import java.awt.event.ActionEvent; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | import static org.junit.jupiter.api.Assertions.*; 16 | 17 | /** 18 | * Unit tests for {@link FindToolBar}. 19 | */ 20 | @ExtendWith(SwingRunnerExtension.class) 21 | class FindToolBarTest { 22 | 23 | private FindToolBar toolBar; 24 | private TestSearchListener listener; 25 | 26 | @BeforeEach 27 | void setUp() { 28 | listener = new TestSearchListener(); 29 | toolBar = new FindToolBar(listener); 30 | } 31 | 32 | @Test 33 | void testConstructor() { 34 | assertNotNull(toolBar); 35 | } 36 | 37 | @Test 38 | void testAddSearchListener() { 39 | SearchListener newListener = new TestSearchListener(); 40 | toolBar.addSearchListener(newListener); 41 | } 42 | 43 | @Test 44 | void testRemoveSearchListener() { 45 | toolBar.removeSearchListener(listener); 46 | } 47 | 48 | @Test 49 | void testDoMarkAll_delay() { 50 | toolBar.doMarkAll(true); 51 | assertEquals(0, listener.events.size());; 52 | } 53 | 54 | @Test 55 | void testDoMarkAll_noDelay() { 56 | toolBar.doMarkAll(false); 57 | assertEquals(1, listener.events.size());; 58 | } 59 | 60 | @Test 61 | void testDoSearch_backward() { 62 | toolBar.doSearch(false); 63 | } 64 | 65 | @Test 66 | void testDoSearch_forward() { 67 | toolBar.doSearch(true); 68 | } 69 | 70 | @Test 71 | void testGetSetReplaceText() { 72 | assertNull(toolBar.getReplaceText()); 73 | toolBar.setReplaceText("Replace text"); 74 | // Ignored since this is a FindToolBar (no replace combo) 75 | assertNull(toolBar.getReplaceText()); 76 | } 77 | 78 | @Test 79 | void testGetSetMarkAllDelay() { 80 | toolBar.setMarkAllDelay(500); 81 | assertEquals(500, toolBar.getMarkAllDelay()); 82 | } 83 | 84 | @Test 85 | void testGetSetSearchContext() { 86 | SearchContext context = new SearchContext(); 87 | toolBar.setSearchContext(context); 88 | assertEquals(context, toolBar.getSearchContext()); 89 | } 90 | 91 | @Test 92 | void testHandleToggleButtons_plainText_empty() { 93 | toolBar.getSearchContext().setSearchFor(""); 94 | FindReplaceButtonsEnableResult result = toolBar.handleToggleButtons(); 95 | assertFalse(result.getEnable()); 96 | } 97 | 98 | @Test 99 | void testHandleToggleButtons_plainText_nonEmpty() { 100 | toolBar.getSearchContext().setSearchFor("foo"); 101 | FindReplaceButtonsEnableResult result = toolBar.handleToggleButtons(); 102 | assertTrue(result.getEnable()); 103 | } 104 | 105 | @Test 106 | void testHandleToggleButtons_regex_invalid() { 107 | toolBar.getSearchContext().setSearchFor("invalid(regex"); 108 | toolBar.getSearchContext().setRegularExpression(true); 109 | FindReplaceButtonsEnableResult result = toolBar.handleToggleButtons(); 110 | assertFalse(result.getEnable()); 111 | } 112 | 113 | @Test 114 | void testHandleToggleButtons_regex_valid() { 115 | toolBar.getSearchContext().setSearchFor("valid(regex)"); 116 | toolBar.getSearchContext().setRegularExpression(true); 117 | FindReplaceButtonsEnableResult result = toolBar.handleToggleButtons(); 118 | assertTrue(result.getEnable()); 119 | } 120 | 121 | @Test 122 | void testSetContentAssistImage() { 123 | Image img = new ImageIcon(new byte[0]).getImage(); 124 | toolBar.setContentAssistImage(img); 125 | assertNotNull(toolBar.findCombo.getContentAssistImage()); 126 | } 127 | 128 | @Test 129 | void testHandleRegExCheckBoxClicked() { 130 | toolBar.handleRegExCheckBoxClicked(); 131 | } 132 | 133 | @Test 134 | void testRequestFocusInWindow() { 135 | assertDoesNotThrow(() -> toolBar.requestFocusInWindow()); 136 | } 137 | 138 | @Test 139 | void testHandleSearchAction_findNext() { 140 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindNext"); 141 | toolBar.handleSearchAction(event); 142 | assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); 143 | } 144 | 145 | @Test 146 | void testHandleSearchAction_findPrevious() { 147 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindPrevious"); 148 | toolBar.handleSearchAction(event); 149 | assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); 150 | } 151 | 152 | @Test 153 | void testSearchContextUpdated_markAll() { 154 | assertDoesNotThrow(() -> toolBar.getSearchContext().setMarkAll(false)); 155 | } 156 | 157 | @Test 158 | void testSearchContextUpdated_matchCase() { 159 | assertDoesNotThrow(() -> toolBar.getSearchContext().setMatchCase(true)); 160 | } 161 | 162 | @Test 163 | void testSearchContextUpdated_regex() { 164 | assertDoesNotThrow(() -> toolBar.getSearchContext().setRegularExpression(true)); 165 | } 166 | 167 | @Test 168 | void testSearchContextUpdated_replaceWith() { 169 | assertDoesNotThrow(() -> toolBar.getSearchContext().setReplaceWith("newText")); 170 | } 171 | 172 | @Test 173 | void testSearchContextUpdated_wholeWord() { 174 | assertDoesNotThrow(() -> toolBar.getSearchContext().setWholeWord(true)); 175 | } 176 | 177 | @Test 178 | void testSearchContextUpdated_wrapSearch() { 179 | assertDoesNotThrow(() -> toolBar.getSearchContext().setSearchWrap(true)); 180 | } 181 | 182 | private static class TestSearchListener implements SearchListener { 183 | 184 | private List events = new ArrayList<>(); 185 | 186 | @Override 187 | public void searchEvent(SearchEvent e) { 188 | events.add(e); 189 | } 190 | 191 | @Override 192 | public String getSelectedText() { 193 | return ""; 194 | } 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/AssistanceIconPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 06/13/2009 3 | * 4 | * AssistanceIconPanel.java - A panel that sits alongside a text component, 5 | * that can display assistance icons for that component. 6 | * This library is distributed under a modified BSD license. See the included 7 | * RSTAUI.License.txt file for details. 8 | */ 9 | package org.fife.rsta.ui; 10 | 11 | import java.awt.Component; 12 | import java.awt.Image; 13 | import java.awt.event.FocusEvent; 14 | import java.awt.event.FocusListener; 15 | import java.beans.PropertyChangeEvent; 16 | import java.beans.PropertyChangeListener; 17 | import javax.swing.ImageIcon; 18 | import javax.swing.JComboBox; 19 | import javax.swing.JComponent; 20 | import javax.swing.text.JTextComponent; 21 | 22 | import org.fife.rsta.ui.search.AbstractSearchDialog; 23 | 24 | 25 | /** 26 | * A panel meant to be displayed alongside a text component, that can display 27 | * assistance icons for that text component. 28 | * 29 | * @author Robert Futrell 30 | * @version 1.0 31 | */ 32 | public class AssistanceIconPanel extends DecorativeIconPanel 33 | implements PropertyChangeListener { 34 | 35 | private ComponentListener listener; 36 | private JComponent listenedToComponent; 37 | 38 | /** 39 | * The tool tip text for the light bulb icon. It is assumed that access 40 | * to this field is single-threaded (on the EDT). 41 | */ 42 | private static String assistanceAvailable; 43 | 44 | 45 | /** 46 | * Constructor. 47 | * 48 | * @param comp The component to listen to. This can be null 49 | * to create a "filler" icon panel for alignment purposes. 50 | */ 51 | public AssistanceIconPanel(JComponent comp) { 52 | init(comp); 53 | } 54 | 55 | 56 | /** 57 | * Constructor. 58 | * 59 | * @param comp The component to listen to. This can be null 60 | * to create a "filler" icon panel for alignment purposes. 61 | * @param iconWidth The with of decorative icons that will be added to 62 | * this panel. This is used to ensure the proper amount of padding 63 | * when no icon is being shown. 64 | */ 65 | public AssistanceIconPanel(JComponent comp, int iconWidth) { 66 | super(iconWidth); 67 | init(comp); 68 | } 69 | 70 | private void init(JComponent comp) { 71 | 72 | listenedToComponent = comp; 73 | 74 | // null can be passed to make a "filler" icon panel for alignment 75 | // purposes. 76 | if (listenedToComponent != null) { 77 | 78 | listener = new ComponentListener(); 79 | 80 | if (listenedToComponent instanceof JComboBox) { 81 | JComboBox combo = (JComboBox)listenedToComponent; 82 | Component c = combo.getEditor().getEditorComponent(); 83 | if (c instanceof JTextComponent) { // Always true 84 | JTextComponent tc = (JTextComponent)c; 85 | tc.addFocusListener(listener); 86 | } 87 | } 88 | else { // Usually a JTextComponent 89 | listenedToComponent.addFocusListener(listener); 90 | } 91 | 92 | listenedToComponent.addPropertyChangeListener( 93 | ContentAssistable.ASSISTANCE_IMAGE, this); 94 | 95 | } 96 | 97 | } 98 | 99 | 100 | /** 101 | * Returns the "Content Assist Available" tool tip text for the light bulb 102 | * icon. It is assumed that this method is only called on the EDT. 103 | * 104 | * @return The text. 105 | */ 106 | static String getAssistanceAvailableText() { 107 | if (assistanceAvailable ==null) { 108 | assistanceAvailable = AbstractSearchDialog.getString("ContentAssistAvailable"); 109 | } 110 | return assistanceAvailable; 111 | } 112 | 113 | 114 | /** 115 | * Called when the property 116 | * {@link ContentAssistable#ASSISTANCE_IMAGE} is fired by the component 117 | * we are listening to. 118 | * 119 | * @param e The change event. 120 | */ 121 | @Override 122 | public void propertyChange(PropertyChangeEvent e) { 123 | Image img = (Image)e.getNewValue(); 124 | setAssistanceEnabled(img); 125 | } 126 | 127 | 128 | /** 129 | * A hook for applications to initialize this panel, if the component 130 | * we're listening to already has content assist enabled. 131 | * 132 | * @param img The image to display, or null if content assist 133 | * is not currently available. 134 | */ 135 | public void setAssistanceEnabled(Image img) { 136 | if (img==null) { 137 | setIcon(null); 138 | setToolTipText(null); 139 | } 140 | else { 141 | setIcon(new ImageIcon(img)); 142 | setToolTipText(getAssistanceAvailableText()); 143 | } 144 | } 145 | 146 | 147 | @Override 148 | public void updateUI() { 149 | 150 | // Since we actually listen to a child component of combo boxes, 151 | // we must stop listening to the prior child component... 152 | if (listenedToComponent instanceof JComboBox) { 153 | JComboBox combo = (JComboBox)listenedToComponent; 154 | Component c = combo.getEditor().getEditorComponent(); 155 | if (c instanceof JTextComponent) { // Always true 156 | JTextComponent tc = (JTextComponent)c; 157 | tc.removeFocusListener(listener); 158 | } 159 | } 160 | 161 | super.updateUI(); 162 | 163 | // And start listening to the new one, since this might have 164 | // changed because of the UI change. 165 | if (listenedToComponent instanceof JComboBox) { 166 | JComboBox combo = (JComboBox)listenedToComponent; 167 | Component c = combo.getEditor().getEditorComponent(); 168 | if (c instanceof JTextComponent) { // Always true 169 | JTextComponent tc = (JTextComponent)c; 170 | tc.addFocusListener(listener); 171 | } 172 | } 173 | } 174 | 175 | 176 | /** 177 | * Listens for events in the text component we're annotating. 178 | */ 179 | private final class ComponentListener implements FocusListener { 180 | 181 | /** 182 | * Called when the combo box or text component gains focus. 183 | * 184 | * @param e The focus event. 185 | */ 186 | @Override 187 | public void focusGained(FocusEvent e) { 188 | setShowIcon(true); 189 | } 190 | 191 | /** 192 | * Called when the combo box or text component loses focus. 193 | * 194 | * @param e The focus event. 195 | */ 196 | @Override 197 | public void focusLost(FocusEvent e) { 198 | setShowIcon(false); 199 | } 200 | 201 | } 202 | 203 | 204 | } 205 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceToolBarTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui.search; 2 | 3 | import org.fife.rsta.ui.SwingRunnerExtension; 4 | import org.fife.ui.rtextarea.SearchContext; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import javax.swing.*; 10 | import java.awt.*; 11 | import java.awt.event.ActionEvent; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import java.util.Locale; 15 | 16 | import static org.junit.jupiter.api.Assertions.*; 17 | 18 | /** 19 | * Unit tests for {@link ReplaceToolBar}. 20 | */ 21 | @ExtendWith(SwingRunnerExtension.class) 22 | class ReplaceToolBarTest { 23 | 24 | private ReplaceToolBar toolBar; 25 | private TestSearchListener listener; 26 | 27 | @BeforeEach 28 | void setUp() { 29 | listener = new TestSearchListener(); 30 | toolBar = new ReplaceToolBar(listener); 31 | } 32 | 33 | @Test 34 | void testConstructor() { 35 | assertNotNull(toolBar); 36 | } 37 | 38 | @Test 39 | void testConstructor_rtl() { 40 | Locale orig = Locale.getDefault(); 41 | try { 42 | Locale.setDefault(Locale.forLanguageTag("ar")); 43 | assertDoesNotThrow(() -> new ReplaceToolBar(listener)); 44 | } finally { 45 | Locale.setDefault(orig); 46 | } 47 | } 48 | 49 | @Test 50 | void testAddNotify() { 51 | toolBar.addNotify(); 52 | } 53 | 54 | @Test 55 | void testAddSearchListener() { 56 | SearchListener newListener = new TestSearchListener(); 57 | toolBar.addSearchListener(newListener); 58 | } 59 | 60 | @Test 61 | void testRemoveSearchListener() { 62 | toolBar.removeSearchListener(listener); 63 | } 64 | 65 | @Test 66 | void testGetSetMarkAllDelay() { 67 | toolBar.setMarkAllDelay(500); 68 | assertEquals(500, toolBar.getMarkAllDelay()); 69 | } 70 | 71 | @Test 72 | void testGetSetSearchContext() { 73 | SearchContext context = new SearchContext(); 74 | toolBar.setSearchContext(context); 75 | assertEquals(context, toolBar.getSearchContext()); 76 | } 77 | 78 | @Test 79 | void testGetSetReplaceText() { 80 | assertEquals("", toolBar.getReplaceText()); 81 | toolBar.setReplaceText("Replace text"); 82 | assertEquals("Replace text", toolBar.getReplaceText()); 83 | } 84 | 85 | @Test 86 | void testHandleSearchAction_findNext() { 87 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindNext"); 88 | toolBar.handleSearchAction(event); 89 | assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); 90 | } 91 | 92 | @Test 93 | void testHandleSearchAction_findPrevious() { 94 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindPrevious"); 95 | toolBar.handleSearchAction(event); 96 | assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); 97 | } 98 | 99 | @Test 100 | void testHandleSearchAction_replace() { 101 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "Replace"); 102 | toolBar.handleSearchAction(event); 103 | assertEquals(SearchEvent.Type.REPLACE, listener.events.get(0).getType()); 104 | } 105 | 106 | @Test 107 | void testHandleSearchAction_replaceAll() { 108 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "ReplaceAll"); 109 | toolBar.handleSearchAction(event); 110 | assertEquals(SearchEvent.Type.REPLACE_ALL, listener.events.get(0).getType()); 111 | } 112 | 113 | @Test 114 | void testSetContentAssistImage() { 115 | Image img = new ImageIcon(new byte[0]).getImage(); 116 | toolBar.setContentAssistImage(img); 117 | assertNotNull(toolBar.replaceCombo.getContentAssistImage()); 118 | } 119 | 120 | @Test 121 | void testRequestFocusInWindow() { 122 | assertDoesNotThrow(() -> toolBar.requestFocusInWindow()); 123 | } 124 | 125 | @Test 126 | void testHandleRegExCheckBoxClicked() { 127 | toolBar.regexCheckBox.setSelected(true); 128 | toolBar.handleRegExCheckBoxClicked(); 129 | assertTrue(toolBar.regexCheckBox.isSelected()); 130 | } 131 | 132 | @Test 133 | void testHandleSearchAction() { 134 | ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindNext"); 135 | toolBar.handleSearchAction(event); 136 | assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); 137 | } 138 | 139 | @Test 140 | void testMatchesSearchFor_emptySearchFor() { 141 | toolBar.getSearchContext().setSearchFor(""); 142 | assertFalse(toolBar.matchesSearchFor("xxx")); 143 | } 144 | 145 | @Test 146 | void testMatchesSearchFor_emptyString() { 147 | toolBar.getSearchContext().setSearchFor("foo"); 148 | assertFalse(toolBar.matchesSearchFor("")); 149 | } 150 | 151 | @Test 152 | void testMatchesSearchFor_null() { 153 | toolBar.getSearchContext().setSearchFor("foo"); 154 | assertFalse(toolBar.matchesSearchFor(null)); 155 | } 156 | 157 | @Test 158 | void testMatchesSearchFor_plainText_ignoreCase_match() { 159 | toolBar.getSearchContext().setSearchFor("foo"); 160 | assertTrue(toolBar.matchesSearchFor("foo")); 161 | } 162 | 163 | @Test 164 | void testMatchesSearchFor_plainText_ignoreCase_noMatch() { 165 | toolBar.getSearchContext().setSearchFor("foo"); 166 | assertFalse(toolBar.matchesSearchFor("fob")); 167 | } 168 | 169 | @Test 170 | void testMatchesSearchFor_plainText_matchCase_match() { 171 | toolBar.getSearchContext().setSearchFor("foo"); 172 | toolBar.getSearchContext().setMatchCase(true); 173 | assertTrue(toolBar.matchesSearchFor("foo")); 174 | } 175 | 176 | @Test 177 | void testMatchesSearchFor_plainText_match_noMatch() { 178 | toolBar.getSearchContext().setSearchFor("foo"); 179 | toolBar.getSearchContext().setMatchCase(true); 180 | assertFalse(toolBar.matchesSearchFor("foO")); 181 | } 182 | 183 | @Test 184 | void testMatchesSearchFor_regex_match() { 185 | toolBar.getSearchContext().setSearchFor("fo[ox]"); 186 | toolBar.getSearchContext().setRegularExpression(true); 187 | assertTrue(toolBar.matchesSearchFor("fox")); 188 | } 189 | 190 | @Test 191 | void testMatchesSearchFor_regex_invalidRegex() { 192 | toolBar.getSearchContext().setSearchFor("fo[ox"); 193 | toolBar.getSearchContext().setRegularExpression(true); 194 | assertFalse(toolBar.matchesSearchFor("fob")); 195 | } 196 | 197 | @Test 198 | void testMatchesSearchFor_regex_noMatch() { 199 | toolBar.getSearchContext().setSearchFor("fo[ox]"); 200 | toolBar.getSearchContext().setRegularExpression(true); 201 | assertFalse(toolBar.matchesSearchFor("fob")); 202 | } 203 | 204 | private static class TestSearchListener implements SearchListener { 205 | 206 | private List events = new ArrayList<>(); 207 | 208 | @Override 209 | public void searchEvent(SearchEvent e) { 210 | events.add(e); 211 | } 212 | 213 | @Override 214 | public String getSelectedText() { 215 | return ""; 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /RSTAUI/src/test/java/org/fife/rsta/ui/search/FindDialogTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.rsta.ui.search; 2 | 3 | import org.fife.rsta.ui.SwingRunnerExtension; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Disabled; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import javax.swing.*; 10 | import java.awt.*; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Locale; 14 | 15 | import static org.junit.jupiter.api.Assertions.*; 16 | 17 | /** 18 | * Unit tests for {@link FindDialog}. 19 | */ 20 | @ExtendWith(SwingRunnerExtension.class) 21 | public class FindDialogTest { 22 | 23 | private FindDialog dialog; 24 | private TestSearchListener listener; 25 | 26 | @BeforeEach 27 | void setUp() { 28 | listener = new TestSearchListener(); 29 | } 30 | 31 | @Test 32 | void testConstructor_dialog_nonNull() { 33 | assertDoesNotThrow(() -> new FindDialog(new JDialog(), listener)); 34 | } 35 | 36 | @Test 37 | void testConstructor_dialog_nonNull_rtl() { 38 | Locale orig = Locale.getDefault(); 39 | try { 40 | Locale.setDefault(Locale.forLanguageTag("ar")); 41 | assertDoesNotThrow(() -> new FindDialog(new JDialog(), listener)); 42 | } finally { 43 | Locale.setDefault(orig); 44 | } 45 | } 46 | 47 | @Test 48 | void testConstructor_dialog_null() { 49 | assertDoesNotThrow(() -> new FindDialog((Dialog)null, listener)); 50 | } 51 | 52 | @Test 53 | void testConstructor_frame_nonNull() { 54 | assertDoesNotThrow(() -> new FindDialog(new JFrame(), listener)); 55 | } 56 | 57 | @Test 58 | void testConstructor_frame_null() { 59 | assertDoesNotThrow(() -> new FindDialog((Frame)null, listener)); 60 | } 61 | 62 | @Test 63 | void testGetSetDownRadioButtonText() { 64 | dialog = new FindDialog(new JDialog(), listener); 65 | assertEquals("Down", dialog.getDownRadioButtonText()); 66 | dialog.setDownRadioButtonText("xxx"); 67 | assertEquals("xxx", dialog.getDownRadioButtonText()); 68 | } 69 | 70 | @Test 71 | void testGetSetFindButtonText() { 72 | dialog = new FindDialog(new JDialog(), listener); 73 | assertEquals("Find", dialog.getFindButtonText()); 74 | dialog.setFindButtonText("xxx"); 75 | assertEquals("xxx", dialog.getFindButtonText()); 76 | } 77 | 78 | @Test 79 | void testGetSetFindWhatLabelText() { 80 | dialog = new FindDialog(new JDialog(), listener); 81 | assertEquals("Find what: ", dialog.getFindWhatLabelText()); 82 | dialog.setFindWhatLabelText("xxx"); 83 | assertEquals("xxx", dialog.getFindWhatLabelText()); 84 | } 85 | 86 | @Test 87 | void testGetSetSearchButtonsBorderText() { 88 | dialog = new FindDialog(new JDialog(), listener); 89 | assertEquals("Direction:", dialog.getSearchButtonsBorderText()); 90 | dialog.setSearchButtonsBorderText("xxx"); 91 | assertEquals("xxx", dialog.getSearchButtonsBorderText()); 92 | } 93 | 94 | @Test 95 | void testGetSetUpRadioButtonText() { 96 | dialog = new FindDialog(new JDialog(), listener); 97 | assertEquals("Up", dialog.getUpRadioButtonText()); 98 | dialog.setUpRadioButtonText("xxx"); 99 | assertEquals("xxx", dialog.getUpRadioButtonText()); 100 | } 101 | 102 | @Test 103 | void testHandleToggleButtons_plainText_empty() { 104 | dialog = new FindDialog(new JDialog(), listener); 105 | dialog.setSearchString(""); 106 | FindReplaceButtonsEnableResult result = dialog.handleToggleButtons(); 107 | assertFalse(result.getEnable()); 108 | } 109 | 110 | @Test 111 | void testHandleToggleButtons_plainText_nonEmpty() { 112 | dialog = new FindDialog(new JDialog(), listener); 113 | dialog.setSearchString("foo"); 114 | FindReplaceButtonsEnableResult result = dialog.handleToggleButtons(); 115 | assertTrue(result.getEnable()); 116 | } 117 | 118 | @Test 119 | void testHandleToggleButtons_regex_invalid() { 120 | dialog = new FindDialog(new JDialog(), listener); 121 | dialog.setSearchString("invalid(regex"); 122 | dialog.getSearchContext().setRegularExpression(true); 123 | FindReplaceButtonsEnableResult result = dialog.handleToggleButtons(); 124 | assertFalse(result.getEnable()); 125 | } 126 | 127 | @Test 128 | void testHandleToggleButtons_regex_valid() { 129 | dialog = new FindDialog(new JDialog(), listener); 130 | dialog.setSearchString("valid(regex)"); 131 | dialog.getSearchContext().setRegularExpression(true); 132 | FindReplaceButtonsEnableResult result = dialog.handleToggleButtons(); 133 | assertTrue(result.getEnable()); 134 | } 135 | 136 | @Test 137 | void testMatchesSearchFor_emptySearchFor() { 138 | dialog = new FindDialog(new JDialog(), listener); 139 | dialog.getSearchContext().setSearchFor(""); 140 | assertFalse(dialog.matchesSearchFor("xxx")); 141 | } 142 | 143 | @Test 144 | void testMatchesSearchFor_emptyString() { 145 | dialog = new FindDialog(new JDialog(), listener); 146 | dialog.getSearchContext().setSearchFor("foo"); 147 | assertFalse(dialog.matchesSearchFor("")); 148 | } 149 | 150 | @Test 151 | void testMatchesSearchFor_null() { 152 | dialog = new FindDialog(new JDialog(), listener); 153 | dialog.getSearchContext().setSearchFor("foo"); 154 | assertFalse(dialog.matchesSearchFor(null)); 155 | } 156 | 157 | @Test 158 | void testMatchesSearchFor_plainText_ignoreCase_match() { 159 | dialog = new FindDialog(new JDialog(), listener); 160 | dialog.getSearchContext().setSearchFor("foo"); 161 | assertTrue(dialog.matchesSearchFor("foo")); 162 | } 163 | 164 | @Test 165 | void testMatchesSearchFor_plainText_ignoreCase_noMatch() { 166 | dialog = new FindDialog(new JDialog(), listener); 167 | dialog.getSearchContext().setSearchFor("foo"); 168 | assertFalse(dialog.matchesSearchFor("fob")); 169 | } 170 | 171 | @Test 172 | void testMatchesSearchFor_plainText_matchCase_match() { 173 | dialog = new FindDialog(new JDialog(), listener); 174 | dialog.getSearchContext().setSearchFor("foo"); 175 | dialog.getSearchContext().setMatchCase(true); 176 | assertTrue(dialog.matchesSearchFor("foo")); 177 | } 178 | 179 | @Test 180 | void testMatchesSearchFor_plainText_match_noMatch() { 181 | dialog = new FindDialog(new JDialog(), listener); 182 | dialog.getSearchContext().setSearchFor("foo"); 183 | dialog.getSearchContext().setMatchCase(true); 184 | assertFalse(dialog.matchesSearchFor("foO")); 185 | } 186 | 187 | @Test 188 | void testMatchesSearchFor_regex_match() { 189 | dialog = new FindDialog(new JDialog(), listener); 190 | dialog.getSearchContext().setSearchFor("fo[ox]"); 191 | dialog.getSearchContext().setRegularExpression(true); 192 | assertTrue(dialog.matchesSearchFor("fox")); 193 | } 194 | 195 | @Test 196 | void testMatchesSearchFor_regex_invalidRegex() { 197 | dialog = new FindDialog(new JDialog(), listener); 198 | dialog.getSearchContext().setSearchFor("fo[ox"); 199 | dialog.getSearchContext().setRegularExpression(true); 200 | assertFalse(dialog.matchesSearchFor("fob")); 201 | } 202 | 203 | @Test 204 | void testMatchesSearchFor_regex_noMatch() { 205 | dialog = new FindDialog(new JDialog(), listener); 206 | dialog.getSearchContext().setSearchFor("fo[ox]"); 207 | dialog.getSearchContext().setRegularExpression(true); 208 | assertFalse(dialog.matchesSearchFor("fob")); 209 | } 210 | 211 | @Test 212 | void testSearchContextUpdated_matchCase() { 213 | dialog = new FindDialog(new JDialog(), listener); 214 | assertDoesNotThrow(() -> dialog.getSearchContext().setMatchCase(true)); 215 | } 216 | 217 | @Test 218 | void testSearchContextUpdated_regex() { 219 | dialog = new FindDialog(new JDialog(), listener); 220 | assertDoesNotThrow(() -> dialog.getSearchContext().setRegularExpression(true)); 221 | } 222 | 223 | @Test 224 | void testSearchContextUpdated_searchFor_nonNull() { 225 | dialog = new FindDialog(new JDialog(), listener); 226 | assertEquals("", dialog.getSearchString()); 227 | dialog.getSearchContext().setSearchFor("newText"); 228 | assertEquals("newText", dialog.getSearchString()); 229 | } 230 | 231 | @Test 232 | void testSearchContextUpdated_searchFor_null() { 233 | dialog = new FindDialog(new JDialog(), listener); 234 | assertEquals("", dialog.getSearchString()); 235 | dialog.getSearchContext().setSearchFor(null); 236 | assertEquals("", dialog.getSearchString()); 237 | } 238 | 239 | @Test 240 | void testSearchContextUpdated_wholeWord() { 241 | dialog = new FindDialog(new JDialog(), listener); 242 | assertDoesNotThrow(() -> dialog.getSearchContext().setWholeWord(true)); 243 | } 244 | 245 | @Test 246 | void testSearchContextUpdated_wrapSearch() { 247 | dialog = new FindDialog(new JDialog(), listener); 248 | assertDoesNotThrow(() -> dialog.getSearchContext().setSearchWrap(true)); 249 | } 250 | 251 | @Test 252 | void testSetVisible_false() { 253 | dialog = new FindDialog(new JDialog(), listener); 254 | dialog.setVisible(false); 255 | assertFalse(dialog.isVisible()); 256 | } 257 | 258 | @Test 259 | @Disabled("Modal must be visible for this methot to be called") 260 | void testUpdateUI() { 261 | dialog = new FindDialog(new JDialog(), listener); 262 | dialog.updateUI(); 263 | } 264 | 265 | private static class TestSearchListener implements SearchListener { 266 | 267 | private List events; 268 | 269 | TestSearchListener() { 270 | events = new ArrayList<>(); 271 | } 272 | 273 | @Override 274 | public void searchEvent(SearchEvent e) { 275 | events.add(e); 276 | } 277 | 278 | @Override 279 | public String getSelectedText() { 280 | return ""; 281 | } 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/search/FindDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/14/2003 3 | * 4 | * FindDialog - Dialog for finding text in a GUI. 5 | * This library is distributed under a modified BSD license. See the included 6 | * RSTAUI.License.txt file for details. 7 | */ 8 | package org.fife.rsta.ui.search; 9 | 10 | import java.awt.BorderLayout; 11 | import java.awt.ComponentOrientation; 12 | import java.awt.Dialog; 13 | import java.awt.Frame; 14 | import java.awt.GridLayout; 15 | import java.awt.event.FocusAdapter; 16 | import java.awt.event.FocusEvent; 17 | import javax.swing.BorderFactory; 18 | import javax.swing.BoxLayout; 19 | import javax.swing.JPanel; 20 | import javax.swing.SwingUtilities; 21 | import javax.swing.text.JTextComponent; 22 | import javax.swing.SpringLayout; 23 | import javax.swing.event.DocumentEvent; 24 | import javax.swing.event.DocumentListener; 25 | 26 | import org.fife.rsta.ui.AssistanceIconPanel; 27 | import org.fife.rsta.ui.ResizableFrameContentPane; 28 | import org.fife.rsta.ui.UIUtil; 29 | import org.fife.ui.rtextarea.SearchContext; 30 | import org.fife.ui.rtextarea.SearchEngine; 31 | 32 | 33 | /** 34 | * A "Find" dialog similar to those found in most Windows text editing 35 | * applications. Contains many search options, including:
36 | *
    37 | *
  • Match Case 38 | *
  • Match Whole Word 39 | *
  • Use Regular Expressions 40 | *
  • Search Forwards or Backwards 41 | *
  • Mark all 42 | *
43 | * The dialog also remembers your previous several selections in a combo box. 44 | *

An application can use a FindDialog as follows. It is 45 | * suggested that you create an Action or something similar to 46 | * facilitate "bringing up" the Find dialog. Have the main application contain 47 | * an object that implements {@link SearchListener}. This object will receive 48 | * {@link SearchEvent}s of the following types from the Find dialog: 49 | *

    50 | *
  • {@link SearchEvent.Type#FIND} action when the user clicks the 51 | * "Find" button. 52 | *
53 | * The application can then call i.e. 54 | * {@link SearchEngine#find(javax.swing.JTextArea, org.fife.ui.rtextarea.SearchContext) SearchEngine.find()} 55 | * to actually execute the search. 56 | * 57 | * @author Robert Futrell 58 | * @version 1.0 59 | * @see FindToolBar 60 | */ 61 | public class FindDialog extends AbstractFindReplaceDialog { 62 | 63 | private static final long serialVersionUID = 1L; 64 | 65 | /** 66 | * Our search listener, cached, so we can grab its selected text easily. 67 | */ 68 | protected SearchListener searchListener; 69 | 70 | 71 | /** 72 | * Creates a new FindDialog. 73 | * 74 | * @param owner The parent dialog. 75 | * @param listener The component that listens for {@link SearchEvent}s. 76 | */ 77 | public FindDialog(Dialog owner, SearchListener listener) { 78 | super(owner); 79 | init(listener); 80 | } 81 | 82 | 83 | /** 84 | * Creates a new FindDialog. 85 | * 86 | * @param owner The main window that owns this dialog. 87 | * @param listener The component that listens for {@link SearchEvent}s. 88 | */ 89 | public FindDialog(Frame owner, SearchListener listener) { 90 | super(owner); 91 | init(listener); 92 | } 93 | 94 | 95 | /** 96 | * Initializes find dialog-specific initialization stuff. 97 | * 98 | * @param listener The component that listens for {@link SearchEvent}s. 99 | */ 100 | private void init(SearchListener listener) { 101 | 102 | this.searchListener = listener; 103 | 104 | ComponentOrientation orientation = ComponentOrientation. 105 | getOrientation(getLocale()); 106 | 107 | // Make a panel containing the "Find" edit box. 108 | JPanel enterTextPane = new JPanel(new SpringLayout()); 109 | enterTextPane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); 110 | JTextComponent textField = UIUtil.getTextComponent(findTextCombo); 111 | textField.addFocusListener(new FindFocusAdapter()); 112 | textField.getDocument().addDocumentListener(new FindDocumentListener()); 113 | JPanel temp = new JPanel(new BorderLayout()); 114 | temp.add(findTextCombo); 115 | AssistanceIconPanel aip = new AssistanceIconPanel(findTextCombo); 116 | temp.add(aip, BorderLayout.LINE_START); 117 | if (orientation.isLeftToRight()) { 118 | enterTextPane.add(findFieldLabel); 119 | enterTextPane.add(temp); 120 | } 121 | else { 122 | enterTextPane.add(temp); 123 | enterTextPane.add(findFieldLabel); 124 | } 125 | 126 | UIUtil.makeSpringCompactGrid(enterTextPane, 1, 2, //rows, cols 127 | 0,0, //initX, initY 128 | 6, 6); //xPad, yPad 129 | 130 | // Make a panel containing the inherited search direction radio 131 | // buttons and the inherited search options. 132 | JPanel bottomPanel = new JPanel(new BorderLayout()); 133 | temp = new JPanel(new BorderLayout()); 134 | bottomPanel.setBorder(UIUtil.getEmpty5Border()); 135 | temp.add(searchConditionsPanel, BorderLayout.LINE_START); 136 | JPanel temp2 = new JPanel(new BorderLayout()); 137 | temp2.add(dirPanel, BorderLayout.NORTH); 138 | temp.add(temp2); 139 | bottomPanel.add(temp, BorderLayout.LINE_START); 140 | 141 | // Now, make a panel containing all the above stuff. 142 | JPanel leftPanel = new JPanel(); 143 | leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); 144 | leftPanel.add(enterTextPane); 145 | leftPanel.add(bottomPanel); 146 | 147 | // Make a panel containing the action buttons. 148 | JPanel buttonPanel = new JPanel(); 149 | buttonPanel.setLayout(new GridLayout(2,1, 5,5)); 150 | buttonPanel.add(findNextButton); 151 | buttonPanel.add(cancelButton); 152 | JPanel rightPanel = new JPanel(); 153 | rightPanel.setLayout(new BorderLayout()); 154 | rightPanel.add(buttonPanel, BorderLayout.NORTH); 155 | 156 | // Put everything into a neat little package. 157 | JPanel contentPane = new JPanel(new BorderLayout()); 158 | if (orientation.isLeftToRight()) { 159 | contentPane.setBorder(BorderFactory.createEmptyBorder(5,0,0,5)); 160 | } 161 | else { 162 | contentPane.setBorder(BorderFactory.createEmptyBorder(5,5,0,0)); 163 | } 164 | contentPane.add(leftPanel); 165 | contentPane.add(rightPanel, BorderLayout.LINE_END); 166 | temp = new ResizableFrameContentPane(new BorderLayout()); 167 | temp.add(contentPane, BorderLayout.NORTH); 168 | setContentPane(temp); 169 | getRootPane().setDefaultButton(findNextButton); 170 | setTitle(getString("FindDialogTitle")); 171 | setResizable(true); 172 | pack(); 173 | setLocationRelativeTo(getParent()); 174 | 175 | setSearchContext(new SearchContext()); 176 | addSearchListener(listener); 177 | 178 | applyComponentOrientation(orientation); 179 | 180 | } 181 | 182 | 183 | /** 184 | * Overrides JDialog's setVisible method; decides 185 | * whether buttons are enabled. 186 | * 187 | * @param visible Whether the dialog should be visible. 188 | */ 189 | @Override 190 | public void setVisible(boolean visible) { 191 | 192 | if (visible) { 193 | 194 | // Select text entered into the UI 195 | String text = searchListener.getSelectedText(); 196 | if (text!=null) { 197 | findTextCombo.addItem(text); 198 | } 199 | 200 | String selectedItem = findTextCombo.getSelectedString(); 201 | boolean nonEmpty = selectedItem!=null && !selectedItem.isEmpty(); 202 | findNextButton.setEnabled(nonEmpty); 203 | super.setVisible(true); 204 | focusFindTextField(); 205 | 206 | } 207 | 208 | else { 209 | super.setVisible(false); 210 | } 211 | 212 | } 213 | 214 | /** 215 | * This method should be called whenever the LookAndFeel of 216 | * the application changes. This calls 217 | * SwingUtilities.updateComponentTreeUI(this) and does 218 | * other necessary things.

219 | * Note that this is not an override, as JDialogs don't have an 220 | * updateUI() method. 221 | */ 222 | public void updateUI() { 223 | SwingUtilities.updateComponentTreeUI(this); 224 | pack(); 225 | JTextComponent textField = UIUtil.getTextComponent(findTextCombo); 226 | textField.addFocusListener(new FindFocusAdapter()); 227 | textField.getDocument().addDocumentListener(new FindDocumentListener()); 228 | } 229 | 230 | 231 | /** 232 | * Listens for changes in the text field (find search field). 233 | */ 234 | private final class FindDocumentListener implements DocumentListener { 235 | 236 | @Override 237 | public void insertUpdate(DocumentEvent e) { 238 | handleToggleButtons(); 239 | } 240 | 241 | @Override 242 | public void removeUpdate(DocumentEvent e) { 243 | JTextComponent comp = UIUtil.getTextComponent(findTextCombo); 244 | if (comp.getDocument().getLength()==0) { 245 | findNextButton.setEnabled(false); 246 | } 247 | else { 248 | handleToggleButtons(); 249 | } 250 | } 251 | 252 | @Override 253 | public void changedUpdate(DocumentEvent e) { 254 | } 255 | 256 | } 257 | 258 | 259 | /** 260 | * Listens for the text field gaining focus. All it does is select all 261 | * text in the combo box's text area. 262 | */ 263 | private final class FindFocusAdapter extends FocusAdapter { 264 | 265 | @Override 266 | public void focusGained(FocusEvent e) { 267 | UIUtil.getTextComponent(findTextCombo).selectAll(); 268 | } 269 | 270 | } 271 | } 272 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | org.gradle.wrapper.GradleWrapperMain \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /RSTAUI/src/main/java/org/fife/rsta/ui/search/ReplaceToolBar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 09/20/2013 3 | * 4 | * ReplaceToolBar - A toolbar for "replace" operations in text areas. 5 | * 6 | * This library is distributed under a modified BSD license. See the included 7 | * RSTAUI.license.txt file for details. 8 | */ 9 | package org.fife.rsta.ui.search; 10 | 11 | import java.awt.*; 12 | import java.awt.event.ActionEvent; 13 | import java.util.regex.Pattern; 14 | import java.util.regex.PatternSyntaxException; 15 | 16 | import javax.swing.Box; 17 | import javax.swing.BoxLayout; 18 | import javax.swing.JButton; 19 | import javax.swing.JLabel; 20 | import javax.swing.JPanel; 21 | import javax.swing.SpringLayout; 22 | import javax.swing.event.DocumentEvent; 23 | import javax.swing.text.JTextComponent; 24 | 25 | import org.fife.rsta.ui.UIUtil; 26 | import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; 27 | 28 | 29 | /** 30 | * A toolbar for replace operations in a text editor application. This provides 31 | * a more seamless experience than using a Find or Replace dialog. 32 | * 33 | * @author Robert Futrell 34 | * @version 0.5 35 | * @see FindToolBar 36 | * @see ReplaceDialog 37 | */ 38 | public class ReplaceToolBar extends FindToolBar { 39 | 40 | private JButton replaceButton; 41 | private JButton replaceAllButton; 42 | 43 | /** 44 | * Our search listener, cached, so we can grab its selected text easily. 45 | */ 46 | protected SearchListener searchListener; 47 | 48 | 49 | /** 50 | * Creates the toolbar. 51 | * 52 | * @param listener An entity listening for search events. 53 | */ 54 | public ReplaceToolBar(SearchListener listener) { 55 | super(listener); 56 | this.searchListener = listener; 57 | } 58 | 59 | 60 | @Override 61 | public void addNotify() { 62 | super.addNotify(); 63 | handleToggleButtons(); 64 | } 65 | 66 | 67 | @Override 68 | protected Container createButtonPanel() { 69 | 70 | Box panel = new Box(BoxLayout.LINE_AXIS); 71 | 72 | JPanel bp = new JPanel(new GridLayout(2,2, 5,5)); 73 | panel.add(bp); 74 | 75 | createFindButtons(); 76 | 77 | Component filler = Box.createRigidArea(new Dimension(5, 5)); 78 | 79 | bp.add(findButton); bp.add(replaceButton); 80 | bp.add(replaceAllButton); bp.add(filler); 81 | panel.add(bp); 82 | 83 | JPanel optionPanel = new JPanel(new SpringLayout()); 84 | matchCaseCheckBox = createCB("MatchCase"); 85 | regexCheckBox = createCB("RegEx"); 86 | wholeWordCheckBox = createCB("WholeWord"); 87 | markAllCheckBox = createCB("MarkAll"); 88 | wrapCheckBox = createCB("Wrap"); 89 | // We use a "spacing" middle row, instead of spacing in the call to 90 | // UIUtil.makeSpringCompactGrid(), as the latter adds trailing 91 | // spacing after the final "row", which screws up our alignment. 92 | Dimension spacing = new Dimension(1, 5); 93 | Component space1 = Box.createRigidArea(spacing); 94 | Component space2 = Box.createRigidArea(spacing); 95 | Component space3 = Box.createRigidArea(spacing); 96 | Component space4 = Box.createRigidArea(spacing); 97 | 98 | ComponentOrientation orientation = ComponentOrientation. 99 | getOrientation(getLocale()); 100 | 101 | if (orientation.isLeftToRight()) { 102 | optionPanel.add(matchCaseCheckBox); optionPanel.add(wholeWordCheckBox); optionPanel.add(wrapCheckBox); 103 | optionPanel.add(space1); optionPanel.add(space2); optionPanel.add(space3); 104 | optionPanel.add(regexCheckBox); optionPanel.add(markAllCheckBox); optionPanel.add(space4); 105 | } 106 | else { 107 | optionPanel.add(wrapCheckBox); optionPanel.add(wholeWordCheckBox); optionPanel.add(matchCaseCheckBox); 108 | optionPanel.add(space3); optionPanel.add(space2); optionPanel.add(space1); 109 | optionPanel.add(space4); optionPanel.add(markAllCheckBox); optionPanel.add(regexCheckBox); 110 | } 111 | UIUtil.makeSpringCompactGrid(optionPanel, 3,3, 0,0, 0,0); 112 | panel.add(optionPanel); 113 | 114 | return panel; 115 | 116 | } 117 | 118 | 119 | @Override 120 | protected Container createFieldPanel() { 121 | 122 | findFieldListener = new ReplaceFindFieldListener(); 123 | 124 | JPanel temp = new JPanel(new SpringLayout()); 125 | 126 | JLabel findLabel = new JLabel(MSG.getString("FindWhat")); 127 | JLabel replaceLabel = new JLabel(MSG.getString("ReplaceWith")); 128 | 129 | findCombo = new SearchComboBox(this, false); 130 | JTextComponent findField = UIUtil.getTextComponent(findCombo); 131 | findFieldListener.install(findField); 132 | Container fcp = createContentAssistablePanel(findCombo); 133 | 134 | replaceCombo = new SearchComboBox(this, true); 135 | JTextComponent replaceField = UIUtil.getTextComponent(replaceCombo); 136 | findFieldListener.install(replaceField); 137 | Container rcp = createContentAssistablePanel(replaceCombo); 138 | 139 | // We use a "spacing" middle row, instead of spacing in the call to 140 | // UIUtil.makeSpringCompactGrid(), as the latter adds trailing 141 | // spacing after the final "row", which screws up our alignment. 142 | Dimension spacing = new Dimension(1, 5); 143 | Component space1 = Box.createRigidArea(spacing); 144 | Component space2 = Box.createRigidArea(spacing); 145 | 146 | if (getComponentOrientation().isLeftToRight()) { 147 | temp.add(findLabel); temp.add(fcp); 148 | temp.add(space1); temp.add(space2); 149 | temp.add(replaceLabel); temp.add(rcp); 150 | } 151 | else { 152 | temp.add(fcp); temp.add(findLabel); 153 | temp.add(space2); temp.add(space1); 154 | temp.add(rcp); temp.add(replaceLabel); 155 | } 156 | UIUtil.makeSpringCompactGrid(temp, 3,2, 0,0, 0,0); 157 | 158 | return temp; 159 | } 160 | 161 | 162 | @Override 163 | protected void createFindButtons() { 164 | 165 | super.createFindButtons(); 166 | 167 | replaceButton = new JButton(SEARCH_MSG.getString("Replace")); 168 | makeEnterActivateButton(replaceButton); 169 | replaceButton.setToolTipText(MSG.getString("Replace.ToolTip")); 170 | replaceButton.setActionCommand("Replace"); 171 | replaceButton.addActionListener(listener); 172 | replaceButton.setEnabled(false); 173 | 174 | replaceAllButton = new JButton(SEARCH_MSG.getString("ReplaceAll")); 175 | makeEnterActivateButton(replaceAllButton); 176 | replaceAllButton.setActionCommand("ReplaceAll"); 177 | replaceAllButton.addActionListener(listener); 178 | replaceAllButton.setEnabled(false); 179 | 180 | } 181 | 182 | 183 | /** 184 | * Called when the regex checkbox is clicked (or its value is modified 185 | * via a change to the search context). Subclasses can override 186 | * to add custom behavior, but should call the super implementation. 187 | */ 188 | @Override 189 | protected void handleRegExCheckBoxClicked() { 190 | super.handleRegExCheckBoxClicked(); 191 | // "Content assist" support 192 | boolean b = regexCheckBox.isSelected(); 193 | replaceCombo.setAutoCompleteEnabled(b); 194 | } 195 | 196 | 197 | @Override 198 | protected void handleSearchAction(ActionEvent e) { 199 | String command = e.getActionCommand(); 200 | super.handleSearchAction(e); 201 | if ("FindNext".equals(command) || "FindPrevious".equals(command)) { 202 | handleToggleButtons(); // Replace button could toggle state 203 | } 204 | } 205 | 206 | 207 | @Override 208 | protected FindReplaceButtonsEnableResult handleToggleButtons() { 209 | 210 | FindReplaceButtonsEnableResult er = super.handleToggleButtons(); 211 | boolean shouldReplace = er.getEnable(); 212 | replaceAllButton.setEnabled(shouldReplace); 213 | 214 | // "Replace" is only enabled if text to search for is selected in 215 | // the UI. 216 | if (shouldReplace) { 217 | String text = searchListener.getSelectedText(); 218 | shouldReplace = matchesSearchFor(text); 219 | } 220 | replaceButton.setEnabled(shouldReplace); 221 | 222 | return er; 223 | } 224 | 225 | 226 | // TODO: Share this code with AbstractSearchDialog 227 | protected boolean matchesSearchFor(String text) { 228 | if (text==null || text.isEmpty()) { 229 | return false; 230 | } 231 | String searchFor = findCombo.getSelectedString(); 232 | if (searchFor!=null && !searchFor.isEmpty()) { 233 | boolean matchCase = matchCaseCheckBox.isSelected(); 234 | if (regexCheckBox.isSelected()) { 235 | int flags = Pattern.MULTILINE; // '^' and '$' are done per line. 236 | flags = RSyntaxUtilities.getPatternFlags(matchCase, flags); 237 | Pattern pattern; 238 | try { 239 | pattern = Pattern.compile(searchFor, flags); 240 | } catch (PatternSyntaxException pse) { 241 | pse.printStackTrace(); // Never happens 242 | return false; 243 | } 244 | return pattern.matcher(text).matches(); 245 | } 246 | else { 247 | if (matchCase) { 248 | return searchFor.equals(text); 249 | } 250 | return searchFor.equalsIgnoreCase(text); 251 | } 252 | } 253 | return false; 254 | } 255 | 256 | 257 | /** 258 | * Overridden to possibly toggle the enabled state of the replace button. 259 | */ 260 | @Override 261 | public boolean requestFocusInWindow() { 262 | boolean result = super.requestFocusInWindow(); 263 | handleToggleButtons(); // Replace button state may change 264 | return result; 265 | } 266 | 267 | @Override 268 | public void setContentAssistImage(Image image) { 269 | super.setContentAssistImage(image); 270 | replaceCombo.setContentAssistImage(image); 271 | } 272 | 273 | 274 | /** 275 | * Listens for the user typing into the search field. 276 | */ 277 | protected class ReplaceFindFieldListener extends FindFieldListener { 278 | 279 | @Override 280 | protected void handleDocumentEvent(DocumentEvent e) { 281 | super.handleDocumentEvent(e); 282 | JTextComponent findField = UIUtil.getTextComponent(findCombo); 283 | JTextComponent replaceField = UIUtil.getTextComponent(replaceCombo); 284 | if (e.getDocument().equals(findField.getDocument())) { 285 | handleToggleButtons(); 286 | } 287 | if (e.getDocument()==replaceField.getDocument()) { 288 | getSearchContext().setReplaceWith(replaceField.getText()); 289 | } 290 | } 291 | 292 | } 293 | 294 | 295 | } 296 | -------------------------------------------------------------------------------- /RSTAUIDemo/src/main/java/org/fife/rsta/ui/demo/RSTAUIDemoApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * RSTAUI.License.txt file for details. 4 | */ 5 | package org.fife.rsta.ui.demo; 6 | 7 | import java.awt.*; 8 | import java.awt.event.*; 9 | 10 | import javax.swing.*; 11 | import javax.swing.UIManager.LookAndFeelInfo; 12 | import javax.swing.text.BadLocationException; 13 | 14 | import org.fife.rsta.ui.CollapsibleSectionPanel; 15 | //import org.fife.rsta.ui.DocumentMap; 16 | import org.fife.rsta.ui.GoToDialog; 17 | import org.fife.rsta.ui.SizeGripIcon; 18 | import org.fife.rsta.ui.search.FindDialog; 19 | import org.fife.rsta.ui.search.ReplaceDialog; 20 | import org.fife.rsta.ui.search.ReplaceToolBar; 21 | import org.fife.rsta.ui.search.SearchEvent; 22 | import org.fife.rsta.ui.search.SearchListener; 23 | import org.fife.rsta.ui.search.FindToolBar; 24 | import org.fife.ui.rsyntaxtextarea.ErrorStrip; 25 | import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; 26 | import org.fife.ui.rsyntaxtextarea.SyntaxConstants; 27 | import org.fife.ui.rtextarea.RTextScrollPane; 28 | import org.fife.ui.rtextarea.SearchContext; 29 | import org.fife.ui.rtextarea.SearchEngine; 30 | import org.fife.ui.rtextarea.SearchResult; 31 | 32 | 33 | /** 34 | * An application that demonstrates use of the RSTAUI project. Please don't 35 | * take this as good application design; it's just a simple example.

36 | * 37 | * Unlike the library itself, this class is public domain. 38 | * 39 | * @author Robert Futrell 40 | * @version 1.0 41 | */ 42 | public final class RSTAUIDemoApp extends JFrame implements SearchListener { 43 | 44 | private CollapsibleSectionPanel csp; 45 | private RSyntaxTextArea textArea; 46 | private FindDialog findDialog; 47 | private ReplaceDialog replaceDialog; 48 | private FindToolBar findToolBar; 49 | private ReplaceToolBar replaceToolBar; 50 | private StatusBar statusBar; 51 | 52 | 53 | private RSTAUIDemoApp() { 54 | 55 | initSearchDialogs(); 56 | 57 | JPanel contentPane = new JPanel(new BorderLayout()); 58 | setContentPane(contentPane); 59 | csp = new CollapsibleSectionPanel(); 60 | contentPane.add(csp); 61 | 62 | setJMenuBar(createMenuBar()); 63 | 64 | textArea = new RSyntaxTextArea(25, 80); 65 | textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); 66 | textArea.setCodeFoldingEnabled(true); 67 | textArea.setMarkOccurrences(true); 68 | RTextScrollPane sp = new RTextScrollPane(textArea); 69 | csp.add(sp); 70 | 71 | ErrorStrip errorStrip = new ErrorStrip(textArea); 72 | contentPane.add(errorStrip, BorderLayout.LINE_END); 73 | //org.fife.rsta.ui.DocumentMap docMap = new org.fife.rsta.ui.DocumentMap(textArea); 74 | //contentPane.add(docMap, BorderLayout.LINE_END); 75 | 76 | statusBar = new StatusBar(); 77 | contentPane.add(statusBar, BorderLayout.SOUTH); 78 | 79 | setTitle("RSTAUI Demo Application"); 80 | setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 81 | pack(); 82 | setLocationRelativeTo(null); 83 | 84 | } 85 | 86 | 87 | private void addItem(Action a, ButtonGroup bg, JMenu menu) { 88 | JRadioButtonMenuItem item = new JRadioButtonMenuItem(a); 89 | bg.add(item); 90 | menu.add(item); 91 | } 92 | 93 | 94 | private JMenuBar createMenuBar() { 95 | 96 | JMenuBar mb = new JMenuBar(); 97 | JMenu menu = new JMenu("Search"); 98 | menu.add(new JMenuItem(new ShowFindDialogAction())); 99 | menu.add(new JMenuItem(new ShowReplaceDialogAction())); 100 | menu.add(new JMenuItem(new GoToLineAction())); 101 | menu.addSeparator(); 102 | 103 | int ctrl = getToolkit().getMenuShortcutKeyMask(); 104 | int shift = InputEvent.SHIFT_MASK; 105 | KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F, ctrl|shift); 106 | Action a = csp.addBottomComponent(ks, findToolBar); 107 | a.putValue(Action.NAME, "Show Find Search Bar"); 108 | menu.add(new JMenuItem(a)); 109 | ks = KeyStroke.getKeyStroke(KeyEvent.VK_H, ctrl|shift); 110 | a = csp.addBottomComponent(ks, replaceToolBar); 111 | a.putValue(Action.NAME, "Show Replace Search Bar"); 112 | menu.add(new JMenuItem(a)); 113 | 114 | mb.add(menu); 115 | 116 | menu = new JMenu("LookAndFeel"); 117 | ButtonGroup bg = new ButtonGroup(); 118 | LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels(); 119 | for (LookAndFeelInfo info : infos) { 120 | addItem(new LookAndFeelAction(info), bg, menu); 121 | } 122 | mb.add(menu); 123 | 124 | return mb; 125 | 126 | } 127 | 128 | 129 | @Override 130 | public String getSelectedText() { 131 | return textArea.getSelectedText(); 132 | } 133 | 134 | 135 | /** 136 | * Creates our Find and Replace dialogs. 137 | */ 138 | private void initSearchDialogs() { 139 | 140 | findDialog = new FindDialog(this, this); 141 | replaceDialog = new ReplaceDialog(this, this); 142 | 143 | // This ties the properties of the two dialogs together (match case, 144 | // regex, etc.). 145 | SearchContext context = findDialog.getSearchContext(); 146 | replaceDialog.setSearchContext(context); 147 | 148 | // Create toolbars and tie their search contexts together also. 149 | findToolBar = new FindToolBar(this); 150 | findToolBar.setSearchContext(context); 151 | replaceToolBar = new ReplaceToolBar(this); 152 | replaceToolBar.setSearchContext(context); 153 | 154 | } 155 | 156 | 157 | /** 158 | * Listens for events from our search dialogs and actually does the dirty 159 | * work. 160 | */ 161 | @Override 162 | public void searchEvent(SearchEvent e) { 163 | 164 | SearchEvent.Type type = e.getType(); 165 | SearchContext context = e.getSearchContext(); 166 | SearchResult result; 167 | 168 | switch (type) { 169 | default: // Prevent FindBugs warning later 170 | case MARK_ALL: 171 | result = SearchEngine.markAll(textArea, context); 172 | break; 173 | case FIND: 174 | result = SearchEngine.find(textArea, context); 175 | if (!result.wasFound() || result.isWrapped()) { 176 | UIManager.getLookAndFeel().provideErrorFeedback(textArea); 177 | } 178 | break; 179 | case REPLACE: 180 | result = SearchEngine.replace(textArea, context); 181 | if (!result.wasFound() || result.isWrapped()) { 182 | UIManager.getLookAndFeel().provideErrorFeedback(textArea); 183 | } 184 | break; 185 | case REPLACE_ALL: 186 | result = SearchEngine.replaceAll(textArea, context); 187 | JOptionPane.showMessageDialog(null, result.getCount() + 188 | " occurrences replaced."); 189 | break; 190 | } 191 | 192 | String text; 193 | if (result.wasFound()) { 194 | text = "Text found; occurrences marked: " + result.getMarkedCount(); 195 | } 196 | else if (type==SearchEvent.Type.MARK_ALL) { 197 | if (result.getMarkedCount()>0) { 198 | text = "Occurrences marked: " + result.getMarkedCount(); 199 | } 200 | else { 201 | text = ""; 202 | } 203 | } 204 | else { 205 | text = "Text not found"; 206 | } 207 | statusBar.setLabel(text); 208 | 209 | } 210 | 211 | 212 | /** 213 | * Demo application entry point. 214 | * 215 | * @param args The command line arguments. 216 | */ 217 | public static void main(String[] args) { 218 | SwingUtilities.invokeLater(() -> { 219 | try { 220 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 221 | //UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel"); 222 | } catch (Exception e) { 223 | e.printStackTrace(); 224 | } 225 | new RSTAUIDemoApp().setVisible(true); 226 | }); 227 | } 228 | 229 | 230 | /** 231 | * Opens the "Go to Line" dialog. 232 | */ 233 | private class GoToLineAction extends AbstractAction { 234 | 235 | GoToLineAction() { 236 | super("Go To Line..."); 237 | int c = getToolkit().getMenuShortcutKeyMask(); 238 | putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_L, c)); 239 | } 240 | 241 | @Override 242 | public void actionPerformed(ActionEvent e) { 243 | if (findDialog.isVisible()) { 244 | findDialog.setVisible(false); 245 | } 246 | if (replaceDialog.isVisible()) { 247 | replaceDialog.setVisible(false); 248 | } 249 | GoToDialog dialog = new GoToDialog(RSTAUIDemoApp.this); 250 | dialog.setMaxLineNumberAllowed(textArea.getLineCount()); 251 | dialog.setVisible(true); 252 | int line = dialog.getLineNumber(); 253 | if (line>0) { 254 | try { 255 | textArea.setCaretPosition(textArea.getLineStartOffset(line-1)); 256 | } catch (BadLocationException ble) { // Never happens 257 | UIManager.getLookAndFeel().provideErrorFeedback(textArea); 258 | ble.printStackTrace(); 259 | } 260 | } 261 | } 262 | 263 | } 264 | 265 | 266 | /** 267 | * Changes the Look and Feel. 268 | */ 269 | private class LookAndFeelAction extends AbstractAction { 270 | 271 | private LookAndFeelInfo info; 272 | 273 | LookAndFeelAction(LookAndFeelInfo info) { 274 | putValue(NAME, info.getName()); 275 | this.info = info; 276 | } 277 | 278 | @Override 279 | public void actionPerformed(ActionEvent e) { 280 | try { 281 | UIManager.setLookAndFeel(info.getClassName()); 282 | SwingUtilities.updateComponentTreeUI(RSTAUIDemoApp.this); 283 | if (findDialog!=null) { 284 | findDialog.updateUI(); 285 | replaceDialog.updateUI(); 286 | } 287 | pack(); 288 | } catch (RuntimeException re) { 289 | throw re; // FindBugs 290 | } catch (Exception ex) { 291 | ex.printStackTrace(); 292 | } 293 | } 294 | } 295 | 296 | 297 | /** 298 | * Shows the Find dialog. 299 | */ 300 | private class ShowFindDialogAction extends AbstractAction { 301 | 302 | ShowFindDialogAction() { 303 | super("Find..."); 304 | int c = getToolkit().getMenuShortcutKeyMask(); 305 | putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, c)); 306 | } 307 | 308 | @Override 309 | public void actionPerformed(ActionEvent e) { 310 | if (replaceDialog.isVisible()) { 311 | replaceDialog.setVisible(false); 312 | } 313 | findDialog.setVisible(true); 314 | } 315 | 316 | } 317 | 318 | 319 | /** 320 | * Shows the Replace dialog. 321 | */ 322 | private class ShowReplaceDialogAction extends AbstractAction { 323 | 324 | ShowReplaceDialogAction() { 325 | super("Replace..."); 326 | int c = getToolkit().getMenuShortcutKeyMask(); 327 | putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_H, c)); 328 | } 329 | 330 | @Override 331 | public void actionPerformed(ActionEvent e) { 332 | if (findDialog.isVisible()) { 333 | findDialog.setVisible(false); 334 | } 335 | replaceDialog.setVisible(true); 336 | } 337 | 338 | } 339 | 340 | 341 | /** 342 | * The status bar for this application. 343 | */ 344 | private static class StatusBar extends JPanel { 345 | 346 | private JLabel label; 347 | 348 | StatusBar() { 349 | label = new JLabel("Ready"); 350 | setLayout(new BorderLayout()); 351 | add(label, BorderLayout.LINE_START); 352 | add(new JLabel(new SizeGripIcon()), BorderLayout.LINE_END); 353 | } 354 | 355 | void setLabel(String label) { 356 | this.label.setText(label); 357 | } 358 | 359 | } 360 | 361 | 362 | } 363 | --------------------------------------------------------------------------------