Compare commits

..

No commits in common. "master" and "idea-213" have entirely different histories.

10 changed files with 27 additions and 129 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<option name="BUILD_PROCESS_HEAP_SIZE" value="2048" /> <bytecodeTargetLevel target="1.8" />
<bytecodeTargetLevel target="17" />
</component> </component>
</project> </project>

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="40"
height="40"
version="1.1"
id="svg929"
sodipodi:docname="pluginIcon_dark.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<metadata
id="metadata933">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1007"
id="namedview931"
showgrid="false"
inkscape:zoom="17.706014"
inkscape:cx="31.770979"
inkscape:cy="17.766763"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg929"
inkscape:pagecheckerboard="false" />
<defs>
<inkscape:path-effect
effect="powermask"
id="path-effect1102"
is_visible="true"
lpeversion="1"
uri="#mask-powermask-path-effect1102"
invert="false"
hide_mask="false"
background="true"
background_color="#ffffffff" />
<mask
maskUnits="userSpaceOnUse"
id="mask-powermask-path-effect1102">
<path
id="mask-powermask-path-effect1102_box"
style="fill:#ffffff;fill-opacity:1"
d="M 7,3 H 33 V 37 H 7 Z" />
<path
id="path1100"
style="opacity:1;fill:#aaaaaa;fill-opacity:1;stroke:#00a700;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 26.009922,4.0000005 32,10 H 27.763434 C 26.786492,10 26,9.2135087 26,8.2365661 Z"
sodipodi:nodetypes="ccscc" />
</mask>
<filter
id="mask-powermask-path-effect1102_inverse"
inkscape:label="filtermask-powermask-path-effect1102"
style="color-interpolation-filters:sRGB"
height="100"
width="100"
x="-50"
y="-50">
<feColorMatrix
id="mask-powermask-path-effect1102_primitive1"
values="1"
type="saturate"
result="fbSourceGraphic" />
<feColorMatrix
id="mask-powermask-path-effect1102_primitive2"
values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 "
in="fbSourceGraphic" />
</filter>
</defs>
<path
id="rect927"
mask="url(#mask-powermask-path-effect1102)"
style="fill:#b9d6f2;fill-opacity:1"
d="M 9.6210938 4 C 8.7230661 4 8 4.7230663 8 5.6210938 L 8 34.378906 C 8 35.276933 8.7230661 36 9.6210938 36 L 30.378906 36 C 31.276933 36 32 35.276933 32 34.378906 L 32 10 L 26.009766 4 L 9.6210938 4 z M 19.214844 12.783203 L 20.785156 12.783203 L 20.785156 27.216797 L 19.214844 27.216797 L 19.214844 12.783203 z M 16.373047 13.414062 L 16.373047 15.027344 C 15.991713 15.037124 15.68778 15.105313 15.462891 15.232422 C 15.238001 15.359533 15.126953 15.628395 15.126953 16.039062 L 15.126953 18.181641 C 15.126953 19.07142 14.567794 19.599402 13.453125 19.765625 L 13.453125 19.853516 C 14.567794 20.019738 15.126953 20.54772 15.126953 21.4375 L 15.126953 23.578125 C 15.126953 23.988793 15.238001 24.257654 15.462891 24.384766 C 15.68778 24.511877 15.991713 24.580066 16.373047 24.589844 L 16.373047 26.203125 C 15.541934 26.203125 14.897057 26.134936 14.4375 25.998047 C 13.987721 25.861158 13.674047 25.64685 13.498047 25.353516 C 13.322046 25.060182 13.234375 24.678319 13.234375 24.208984 L 13.234375 21.951172 C 13.234375 21.491615 13.078514 21.164306 12.765625 20.96875 C 12.452735 20.773194 11.996836 20.673828 11.400391 20.673828 L 11.400391 18.958984 C 11.996836 18.958984 12.452735 18.861572 12.765625 18.666016 C 13.078514 18.47046 13.234375 18.14315 13.234375 17.683594 L 13.234375 15.410156 C 13.234375 14.940822 13.322046 14.558959 13.498047 14.265625 C 13.674047 13.972291 13.987721 13.75603 14.4375 13.619141 C 14.897057 13.482251 15.541934 13.414062 16.373047 13.414062 z M 23.626953 13.414062 C 24.467844 13.414062 25.112721 13.482251 25.5625 13.619141 C 26.012279 13.75603 26.325953 13.972291 26.501953 14.265625 C 26.677954 14.558959 26.765625 14.940822 26.765625 15.410156 L 26.765625 17.683594 C 26.765625 18.14315 26.921486 18.47046 27.234375 18.666016 C 27.547265 18.861572 28.003164 18.958984 28.599609 18.958984 L 28.599609 20.673828 C 28.003164 20.673828 27.547265 20.773194 27.234375 20.96875 C 26.921486 21.164306 26.765625 21.491615 26.765625 21.951172 L 26.765625 24.208984 C 26.765625 24.678319 26.677954 25.060182 26.501953 25.353516 C 26.325953 25.64685 26.012279 25.861158 25.5625 25.998047 C 25.112721 26.134936 24.467844 26.203125 23.626953 26.203125 L 23.626953 24.589844 C 24.008287 24.580064 24.31222 24.511875 24.537109 24.384766 C 24.761999 24.257654 24.873047 23.988793 24.873047 23.578125 L 24.873047 21.4375 C 24.873047 20.54772 25.432206 20.019738 26.546875 19.853516 L 26.546875 19.765625 C 25.432206 19.599402 24.873047 19.07142 24.873047 18.181641 L 24.873047 16.039062 C 24.873047 15.628395 24.761999 15.359533 24.537109 15.232422 C 24.31222 15.105311 24.008287 15.037122 23.626953 15.027344 L 23.626953 13.414062 z " />
<g
aria-label="{|}"
id="text980"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:14.6667px;line-height:1.25;font-family:'Noto Sans';-inkscape-font-specification:'Noto Sans Bold';letter-spacing:-1px;fill:#000000;fill-opacity:1;stroke:none"
transform="translate(-2.15e-5,1.6039835)" />
</svg>

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.21" />
</component>
</project>

View File

@ -4,7 +4,7 @@
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" /> <file type="web" url="file://$PROJECT_DIR$" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="openjdk-14" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/filename_template-merge.iml" filepath="$PROJECT_DIR$/.idea/filename_template-merge.iml" />
</modules>
</component>
</project>

View File

@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun properties(key: String) = project.findProperty(key).toString() fun properties(key: String) = project.findProperty(key).toString()
plugins { plugins {
id("org.jetbrains.intellij") version "1.17.3" id("org.jetbrains.intellij") version "1.3.0"
id("org.jetbrains.kotlin.jvm") version "1.9.21" id("org.jetbrains.kotlin.jvm") version "1.5.10"
} }
group = properties("pluginGroup") group = properties("pluginGroup")

View File

@ -3,14 +3,13 @@ kotlin.code.style=official
pluginGroup = de.idetools pluginGroup = de.idetools
pluginName = filename_template pluginName = filename_template
pluginVersion = 1.2.0-241 pluginVersion = 1.2.0-213
platformVersion = 2024.1 platformVersion = 2021.3
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3 # Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
javaVersion = 17 javaVersion = 11
org.gradle.jvmargs=-Xmx2048m
gradleVersion = 8.2.1 gradleVersion = 7.3
# Opt-out flag for bundling Kotlin standard library. # Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details. # See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.

View File

@ -1,7 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -4,6 +4,7 @@ import com.intellij.icons.AllIcons
import com.intellij.ide.IdeBundle import com.intellij.ide.IdeBundle
import com.intellij.ide.actions.CreateFileAction import com.intellij.ide.actions.CreateFileAction
import com.intellij.ide.ui.newItemPopup.NewItemPopupUtil import com.intellij.ide.ui.newItemPopup.NewItemPopupUtil
import com.intellij.lang.LangBundle
import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.InputValidatorEx import com.intellij.openapi.ui.InputValidatorEx
@ -14,11 +15,10 @@ import de.idetools.filename_template.placeholders.*
import de.idetools.filename_template.settings.FilenameTemplateSettingsState import de.idetools.filename_template.settings.FilenameTemplateSettingsState
import java.awt.event.InputEvent import java.awt.event.InputEvent
import java.util.function.Consumer import java.util.function.Consumer
import java.util.function.Supplier
import kotlin.math.max import kotlin.math.max
class CreateFileWithFilenameTemplateAction : class CreateFileWithFilenameTemplateAction :
CreateFileAction(Supplier { "Filename Template"}, Supplier { "Create a new file based on template"}, Supplier { AllIcons.Actions.AddFile }) { CreateFileAction("Filename Template", "Create a new file based on template", AllIcons.Actions.AddFile) {
private val placeholders: List<Placeholder> = listOf( private val placeholders: List<Placeholder> = listOf(
EpochPlaceholder(), EpochPlaceholder(),
@ -41,7 +41,7 @@ class CreateFileWithFilenameTemplateAction :
override fun invokeDialog( override fun invokeDialog(
project: Project, project: Project,
directory: PsiDirectory, directory: PsiDirectory,
elementsConsumer: Consumer<in Array<PsiElement>> elementsConsumer: Consumer<Array<PsiElement?>?>
) { ) {
val settings: FilenameTemplateSettingsState = FilenameTemplateSettingsState.instance val settings: FilenameTemplateSettingsState = FilenameTemplateSettingsState.instance
settings.filenameTemplates.forEach { settings.filenameTemplates.forEach {
@ -68,7 +68,11 @@ class CreateFileWithFilenameTemplateAction :
popup.closeOk(event) popup.closeOk(event)
elementsConsumer.accept(validator.createdElements) elementsConsumer.accept(validator.createdElements)
} else { } else {
val errorMessage = (validator as InputValidatorEx).getErrorText(name) val errorMessage =
if (validator is InputValidatorEx)
(validator as InputValidatorEx).getErrorText(name)
else
LangBundle.message("incorrect.name")
contentPanel.setError(errorMessage) contentPanel.setError(errorMessage)
} }
} }

View File

@ -5,9 +5,7 @@ import com.intellij.openapi.util.Trinity
import javax.swing.Icon import javax.swing.Icon
class CreateWithFilenameTemplateDialogPanel(templates: List<Trinity<String, Icon, String>>) : class CreateWithFilenameTemplateDialogPanel(templates: List<Trinity<String, Icon, String>>) :
CreateWithTemplatesDialogPanel(templates.first().first, templates.map { CreateWithTemplatesDialogPanel(templates, templates.first().first) {
trinity -> TemplatePresentation(trinity.first, trinity.second, trinity.third)
}) {
init { init {
updateSelectedText() updateSelectedText()
@ -17,7 +15,7 @@ class CreateWithFilenameTemplateDialogPanel(templates: List<Trinity<String, Icon
private fun updateSelectedText() { private fun updateSelectedText() {
val selectedValue = myTemplatesList.selectedValue val selectedValue = myTemplatesList.selectedValue
if (selectedValue != null) { if (selectedValue != null) {
var filename = selectedValue.templateName var filename = selectedValue.third
val caretPosition = determineCaretPosition(filename) val caretPosition = determineCaretPosition(filename)
filename = filename.replace("{|}", "") filename = filename.replace("{|}", "")