Skip to content

Commit 36b96a5

Browse files
committed
java2kt
1 parent f7363b4 commit 36b96a5

23 files changed

+426
-548
lines changed

src/main/java/com/tang/intellij/lua/comment/LuaCommentUtil.java

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2017. tangzx([email protected])
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.tang.intellij.lua.comment
18+
19+
import com.intellij.psi.util.PsiTreeUtil
20+
import com.tang.intellij.lua.comment.psi.LuaDocPsiElement
21+
import com.tang.intellij.lua.comment.psi.api.LuaComment
22+
import com.tang.intellij.lua.psi.LuaCommentOwner
23+
24+
/**
25+
*
26+
* Created by TangZX on 2016/11/24.
27+
*/
28+
object LuaCommentUtil {
29+
30+
fun findOwner(element: LuaDocPsiElement): LuaCommentOwner? {
31+
val comment = findContainer(element)
32+
return if (comment.parent is LuaCommentOwner) comment.parent as LuaCommentOwner else null
33+
}
34+
35+
fun findContainer(psi: LuaDocPsiElement): LuaComment {
36+
var element = psi
37+
while (true) {
38+
if (element is LuaComment) {
39+
return element
40+
}
41+
element = element.parent as LuaDocPsiElement
42+
}
43+
}
44+
45+
fun findComment(element: LuaCommentOwner): LuaComment? {
46+
return PsiTreeUtil.getChildOfType(element, LuaComment::class.java)
47+
}
48+
}

src/main/java/com/tang/intellij/lua/editor/LuaClassNavigationContributor.java

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2017. tangzx([email protected])
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.tang.intellij.lua.editor
18+
19+
import com.intellij.navigation.GotoClassContributor
20+
import com.intellij.navigation.NavigationItem
21+
import com.intellij.openapi.project.Project
22+
import com.tang.intellij.lua.search.SearchContext
23+
import com.tang.intellij.lua.stubs.index.LuaClassIndex
24+
25+
/**
26+
* Goto Class
27+
* Created by TangZX on 2016/12/12.
28+
*/
29+
class LuaClassNavigationContributor : GotoClassContributor {
30+
override fun getQualifiedName(navigationItem: NavigationItem): String? {
31+
return "test"
32+
}
33+
34+
override fun getQualifiedNameSeparator(): String? {
35+
return "."
36+
}
37+
38+
override fun getNames(project: Project, b: Boolean): Array<String> {
39+
val allClasses = LuaClassIndex.getInstance().getAllKeys(project)
40+
return allClasses.toTypedArray()
41+
}
42+
43+
override fun getItemsByName(s: String, s1: String, project: Project, b: Boolean): Array<NavigationItem> {
44+
val classDef = LuaClassIndex.find(s, SearchContext(project))
45+
return if (classDef == null)
46+
emptyArray()
47+
else
48+
arrayOf(classDef)
49+
}
50+
}

src/main/java/com/tang/intellij/lua/editor/LuaCommenter.java

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2017. tangzx([email protected])
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.tang.intellij.lua.editor
18+
19+
import com.intellij.codeInsight.generation.IndentedCommenter
20+
import com.intellij.lang.Commenter
21+
22+
/**
23+
* Lua Commenter
24+
* Created by TangZX on 2016/12/15.
25+
*/
26+
class LuaCommenter : Commenter, IndentedCommenter {
27+
override fun getLineCommentPrefix(): String? {
28+
return "--"
29+
}
30+
31+
override fun getBlockCommentPrefix(): String? {
32+
return "--[["
33+
}
34+
35+
override fun getBlockCommentSuffix(): String? {
36+
return "]]"
37+
}
38+
39+
override fun getCommentedBlockCommentPrefix(): String? {
40+
return null
41+
}
42+
43+
override fun getCommentedBlockCommentSuffix(): String? {
44+
return null
45+
}
46+
47+
override fun forceIndentedLineComment(): Boolean? {
48+
return true
49+
}
50+
}

src/main/java/com/tang/intellij/lua/editor/LuaIconProvider.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)