aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--resources/META-INF/plugin.xml7
-rw-r--r--src/me/laria/code/idea_caseconv/TitleCaseAction.java10
3 files changed, 18 insertions, 2 deletions
diff --git a/README.md b/README.md
index d7cc58b..19dd6af 100644
--- a/README.md
+++ b/README.md
@@ -13,5 +13,6 @@ The plugin provides actions to convert to these cases:
- `UPPER CASE`
- `lower case`
- `fLIP cASE`
+- `Title Case`
-The Plugin was inspired by the [Case Conversion Plugin for SublimeText](https://packagecontrol.io/packages/Case%20Conversion). \ No newline at end of file
+The Plugin was inspired by the [Case Conversion Plugin for SublimeText](https://packagecontrol.io/packages/Case%20Conversion).
diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml
index c532213..9ab02a7 100644
--- a/resources/META-INF/plugin.xml
+++ b/resources/META-INF/plugin.xml
@@ -1,7 +1,7 @@
<idea-plugin>
<id>me.laria.code.idea_caseconv</id>
<name>Case conversion</name>
- <version>0.5</version>
+ <version>0.5.1</version>
<vendor email="laria@laria.me" url="https://code.laria.me">Laria Chabowski</vendor>
<description><![CDATA[<html>
@@ -16,6 +16,7 @@
<li>UPPER CASE</li>
<li>lower case</li>
<li>fLIP cASE</li>
+ <li>Title Case</li>
</ul>
</html>]]></description>
@@ -71,6 +72,10 @@
text="Convert Case: fLIP cASE">
<add-to-group group-id="EditMenu" anchor="first"/>
</action>
+ <action id="me.laria.code.idea_caseconv.TitleCaseAction" class="me.laria.code.idea_caseconv.TitleCaseAction"
+ text="Convert Case: Title Case">
+ <add-to-group group-id="EditMenu" anchor="first"/>
+ </action>
</actions>
</idea-plugin> \ No newline at end of file
diff --git a/src/me/laria/code/idea_caseconv/TitleCaseAction.java b/src/me/laria/code/idea_caseconv/TitleCaseAction.java
new file mode 100644
index 0000000..70024c3
--- /dev/null
+++ b/src/me/laria/code/idea_caseconv/TitleCaseAction.java
@@ -0,0 +1,10 @@
+package me.laria.code.idea_caseconv;
+
+import java.util.Optional;
+
+public class TitleCaseAction extends SelectionReplacerAction {
+ @Override
+ protected String replace(String s) {
+ return WordSplitConverter.convert(s, " ", (i, part) -> Optional.of(CamelCaseAction.ucfirst(part)));
+ }
+}