Compare commits

...

17 Commits
v1.2 ... master

Author SHA1 Message Date
49b94aae69 Make plugin compatible with idea version 2024.1 2024-04-04 07:14:25 +02:00
86c2723df2 Make plugin compatible with idea version 2023.3 2023-12-07 11:16:28 +01:00
060c21d9b9 Make plugin compatible with idea version 2023.2 2023-08-09 09:21:23 +02:00
d2f18c3bf5 Make plugin compatible with idea version 2023.1 2023-04-15 07:48:32 +02:00
bb6e5398a6 Make plugin compatible with idea version 2022.3 2023-03-18 06:21:10 +01:00
558e565606 Make plugin compatible with idea version 2022.2 2022-08-01 14:37:51 +02:00
ed602312de Make plugin compatible with idea version 2022.1 2022-04-14 00:46:15 +02:00
4fc3b1a11a Provide publish plugin token 2021-12-11 23:51:21 +01:00
7cec2bc5a7 Upgrade Java language level to 11 2021-12-11 23:33:18 +01:00
fa105a2919 Combine gradle project tasks 2021-12-11 23:17:20 +01:00
c31ea9a1fa Upgrade Gradle Wrapper to 7.3 2021-12-11 22:57:19 +01:00
f5f2317286 Suppress unused property inspection 2021-12-11 22:48:53 +01:00
c3b9203eab Use kotlin stdlib from platform 2021-12-11 22:48:26 +01:00
379cf0ee16 Get build properties from gradle.properties 2021-12-11 22:34:49 +01:00
54731f658e Upgrade gradle plugins 2021-12-11 22:14:57 +01:00
5e3a782ecb Make plugin compatible with idea version 2021.3 2021-12-11 05:47:31 +01:00
75cf64185a Make plugin compatible with idea version 2021.2 2021-08-07 09:48:04 +02:00
13 changed files with 336 additions and 154 deletions

View File

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

102
.idea/icon.svg Normal file
View File

@ -0,0 +1,102 @@
<?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>

After

Width:  |  Height:  |  Size: 5.9 KiB

6
.idea/kotlinc.xml Normal file
View File

@ -0,0 +1,6 @@
<?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">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="openjdk-14" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?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

@ -1,28 +1,46 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun properties(key: String) = project.findProperty(key).toString()
plugins {
id("org.jetbrains.intellij") version "0.6.5"
kotlin("jvm") version "1.4.10"
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.kotlin.jvm") version "1.9.21"
}
val pluginVersion: String by project
val platformVersion: String by project
group = "de.idetools"
version = pluginVersion
group = properties("pluginGroup")
version = properties("pluginVersion")
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version = platformVersion
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
}
tasks.getByName<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
changeNotes("""
tasks {
// Set the JVM compatibility versions
properties("javaVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = it
}
}
}
wrapper {
gradleVersion = properties("gradleVersion")
}
patchPluginXml {
changeNotes.set(
"""
<h3>[1.2]</h3>
<ul>
@ -43,11 +61,11 @@ tasks.getByName<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml
<ul>
<li>Initial release</li>
</ul>
""")
}
"""
)
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}

View File

@ -1,4 +1,18 @@
# suppress inspection "UnusedProperty"
kotlin.code.style=official
pluginVersion = 1.2.0-211
platformVersion = 2021.1
pluginGroup = de.idetools
pluginName = filename_template
pluginVersion = 1.2.0-241
platformVersion = 2024.1
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
javaVersion = 17
org.gradle.jvmargs=-Xmx2048m
gradleVersion = 8.2.1
# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
# suppress inspection "UnusedProperty"
kotlin.stdlib.default.dependency = false

Binary file not shown.

View File

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

269
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,67 +17,101 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@ -106,80 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

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

View File

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

View File

@ -1,7 +1,7 @@
package de.idetools.filename_template.settings
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.util.xmlb.XmlSerializerUtil
@ -23,6 +23,6 @@ class FilenameTemplateSettingsState : PersistentStateComponent<FilenameTemplateS
companion object {
val instance: FilenameTemplateSettingsState
get() = ServiceManager.getService(FilenameTemplateSettingsState::class.java)
get() = ApplicationManager.getApplication().getService(FilenameTemplateSettingsState::class.java)
}
}