Skip to content

Commit 3b77400

Browse files
committed
div.
1 parent 1d8ba87 commit 3b77400

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

README.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This unofficial plugin adds a number of [LibGDX](https://libgdx.badlogicgames.co
1313
- __[Atlas file support](#atlas-file-support)__
1414
- __[Bitmap Font file support](#bitmap-font-file-support)__
1515
- __[Skin resources and Atlas region names in Java and Kotlin code](#skin-resources-and-atlas-region-names-in-java-and-kotlin-code)__
16+
- __[@GDXTag and short names in Skins](#gdxtag-and-short-names-in-skins)__
1617
<!-- /toc -->
1718

1819
# Installation
@@ -43,7 +44,7 @@ The following inspections are included:
4344
* Missing OpenGL declaration in AndroidManifest.xml \[1]
4445
* Invalid property keys for I18NBundle.get() and I18NBundle.format()
4546
* Missing WRITE_EXTERNAL_STORAGE permission in AndroidManifest.xml when using external files
46-
* Using outdated versions of LibGDX and related libraries \[1] \[2]
47+
* Using outdated versions of LibGDX and related libraries \[1]
4748
* Declaring a combination of minSdkVersion, maxSdkVersion, targetSdkVersion and &lt;support-screens&gt; which excludes the App from being listed as "Designed for Tablets" in the Google Play Store \[1]
4849

4950
\[1]: These inspections assume the project uses a fairly standard setup, like those created by `gdx-setup` and [`gdx-setup`](https://github.com/czyzby/gdx-setup).
@@ -79,6 +80,9 @@ given class or using malformed color strings
7980
* (Un)commenting blocks of code with *Ctrl-/*
8081
* [Smart Enter](https://www.jetbrains.com/help/idea/2016.3/completing-statements.html)
8182
* With *Shift* pressed, hover over a Drawable/Texture name to view a preview of the Drawable
83+
* Use *Code* -> *Generate* or *Alt-Ins* (*Cmd-N*) to create a new color using a color pick dialog
84+
* QuickFixes to create missing resources and convert colors between hex and floats
85+
* Several inspections to highlight problems and possible issues
8286

8387
\[1]: Usages of the resource in Java/Kotlin code are not automatically renamed, expect when using the `@GDXAssets`
8488
annotation (see below)
@@ -104,7 +108,7 @@ Files with a `.fnt` extension are treated as Bitmap Font Files, with:
104108

105109
## Skin resources and Atlas region names in Java and Kotlin code
106110

107-
To get code completion, Go to Definition, Find Usages, Rename Refactoring, Diagnostics and Image previews (with *Shift* pressed, hover over a Drawable name to get a preview) for:
111+
To get code completion, Go to Definition, Find Usages, Rename Refactoring, Diagnostics and Image previews for:
108112
* Skin resource names
109113
* Region names from Atlas files in Skin.get*() and TextureAtlas.get*()
110114
* Property keys in I18NBundle.get() and I18NBundle.format()
@@ -122,12 +126,12 @@ repositories {
122126
123127
dependencies {
124128
// ...
125-
compile 'com.gmail.blueboxware:libgdxpluginannotations:1.13'
129+
compile 'com.gmail.blueboxware:libgdxpluginannotations:1.16'
126130
}
127131
128132
```
129133

130-
Then annotate Java fields and Kotlin properties where appropriate. Specify file names **relative to the Project Root**!
134+
Then annotate Java fields and Kotlin properties where appropriate. Specify file names **relative to the Project Root**.
131135

132136
**Java:**
133137
```java
@@ -171,10 +175,37 @@ Then annotate Java fields and Kotlin properties where appropriate. Specify file
171175
```
172176

173177
**NOTES**
174-
* Specify file names **relative to the Project Root**!
178+
* Specify file names relative to the Project Root
175179
* Multiple files can be specified for both the `skinFiles`, `atlasFiles` and `propertiesFiles` parameters
176180
* When *no* atlasFiles are specified and a file with the same name as the specified Skin file and the
177181
".atlas" extension exist, that file is used as Atlas file (just like the Skin class itself does). This also
178182
works if you specify multiple Skin files.
179183
* Go To Definition and Find Usages are only available if the specified files are registered as Skin or Atlas file, not
180-
when they are registered as JSON or Plain Text files.
184+
when they are registered as JSON or Plain Text files.
185+
186+
### @GDXTag and short names in Skins
187+
Since version 1.9.9 LibGDX Skins support tagged classes: the ability to use short names for names of classes
188+
in Skin files. In addition to the standard, "built-in" short class names it is also possible to define custom
189+
short names for your own classes by overriding `Skin.getJsonLoader()` and calling `Json.addClassTag()`.
190+
191+
LibGDXPlugin understands the default short names. It also tries to determine any custom short names by looking
192+
for calls to `addClassTag()`, but there is only so much it can do.
193+
194+
To explicitly tell the plugin to recognize one (or more) short names for one of your own classes, you can
195+
use the `@GDXTag` annotation on that class.
196+
197+
```java
198+
package com.something.ui;
199+
200+
@GDXTag({"Widget"})
201+
class MyCustomWidget {
202+
// ...
203+
}
204+
```
205+
206+
After this, the plugin will recognize `Widget` as a short name for `com.something.ui.MyCustomWidget` in
207+
Skin files. It is off course still up to you to make LibGDX recognize this short name by subclassing Skin or
208+
by some other means.
209+
210+
Note that at the moment there is no way to tell the plugin a short name is only valid in specific Skin files,
211+
instead of all Skin files.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ publishing {
144144
version pluginVersion
145145
pom.withXml {
146146
def root = asNode()
147-
root.appendNode('description', 'An annotation for use with LibGDXPlugin for IntelliJ')
147+
root.appendNode('description', 'Annotations for use with LibGDXPlugin for IntelliJ')
148148
root.appendNode('name', tasks.getByName("annotationsJar").property('baseName'))
149149
root.appendNode('url', 'https://github.com/BlueBoxWare/LibGDXPlugin')
150150
root.children().last() + pomConfig

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/actions/MarkAsSkinAction.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import icons.Icons
3131
*/
3232
class MarkAsSkinAction : AnAction() {
3333

34-
override fun update(event: AnActionEvent?) {
34+
override fun update(event: AnActionEvent) {
3535

3636
if (event == null) return
3737

@@ -71,7 +71,7 @@ class MarkAsSkinAction : AnAction() {
7171

7272
}
7373

74-
override fun actionPerformed(event: AnActionEvent?) {
74+
override fun actionPerformed(event: AnActionEvent) {
7575

7676
if (event == null) return
7777

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/filetypes/skin/actions/CreateColorAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CreateColorAction: SimpleCodeInsightAction() {
3535

3636
override fun startInWriteAction(): Boolean = false
3737

38-
override fun update(e: AnActionEvent?) {
38+
override fun update(e: AnActionEvent) {
3939
super.update(e)
4040

4141
templatePresentation.icon = AllIcons.Gutter.Colors

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/filetypes/skin/annotators/SkinColorAnnotator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SkinColorAnnotator : Annotator {
5454
val annotation = createAnnotation(color, element, holder, createIcon = false)
5555
annotation.gutterIconRenderer = object : GutterColorRenderer(color) {
5656
override fun getClickAction() = object : AnAction() {
57-
override fun actionPerformed(e: AnActionEvent?) {
57+
override fun actionPerformed(e: AnActionEvent) {
5858
if (!element.isWritable) return
5959

6060
val editor = PsiUtilBase.findEditor(element) ?: return

0 commit comments

Comments
 (0)