generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new project, and new files support, fix executable flag
- Loading branch information
Showing
18 changed files
with
249 additions
and
24 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/caretdev/plugins/idea/InterSystemsLanguage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.caretdev.plugins.idea | ||
|
||
import com.intellij.lang.Language | ||
|
||
object InterSystemsLanguage : Language("objectscript") { | ||
override fun isCaseSensitive() = false | ||
|
||
override fun getDisplayName() = "ObjectScript" | ||
} |
15 changes: 12 additions & 3 deletions
15
src/main/kotlin/com/caretdev/plugins/idea/InterSystemsModuleBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
package com.caretdev.plugins.idea | ||
|
||
import com.intellij.ide.util.projectWizard.ModuleBuilder | ||
import com.intellij.openapi.module.Module | ||
import com.intellij.openapi.module.ModuleType | ||
import com.intellij.openapi.roots.ModifiableRootModel | ||
import com.intellij.openapi.vfs.LocalFileSystem | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
import java.nio.file.Paths | ||
|
||
class InterSystemsModuleBuilder : ModuleBuilder() { | ||
override fun getModuleType(): ModuleType<*> { | ||
return InterSystemsModuleType.getInstance() | ||
} | ||
|
||
override fun setupModule(module: Module?) { | ||
super.setupModule(module) | ||
override fun setupRootModel(modifiableRootModel: ModifiableRootModel) { | ||
val entry = doAddContentEntry(modifiableRootModel) ?: return | ||
val path: Path = Paths.get(contentEntryPath!!) | ||
val src = path.resolve("src") | ||
Files.createDirectory(src) | ||
val srcPath = LocalFileSystem.getInstance().refreshAndFindFileByNioFile(src) ?: return | ||
entry.addSourceFolder(srcPath, false) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/caretdev/plugins/idea/files/CLSCreateFileAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.caretdev.plugins.idea.files | ||
|
||
import com.caretdev.plugins.idea.InterSystemsIcons | ||
import com.intellij.ide.actions.CreateFileFromTemplateAction | ||
import com.intellij.ide.actions.CreateFileFromTemplateDialog | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiDirectory | ||
|
||
class CLSCreateFileAction : CreateFileFromTemplateAction(CAPTION, "", InterSystemsIcons.ICON) { | ||
private companion object { | ||
private const val CAPTION = "ObjectScript Class" | ||
} | ||
|
||
override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) { | ||
builder.setTitle(CAPTION) | ||
.addKind("Empty file", InterSystemsIcons.ICON, "ObjectScript Class") | ||
} | ||
|
||
override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String = CAPTION | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/caretdev/plugins/idea/files/CLSFileType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.caretdev.plugins.idea.files | ||
|
||
import com.caretdev.plugins.idea.InterSystemsIcons | ||
import com.intellij.openapi.fileTypes.LanguageFileType | ||
import org.jetbrains.plugins.textmate.TextMateLanguage | ||
import javax.swing.Icon | ||
|
||
object CLSFileType : LanguageFileType(TextMateLanguage.LANGUAGE) { | ||
|
||
override fun getName(): String = "ObjectScript Class" | ||
|
||
override fun getDescription(): String = "ObjectScript class" | ||
|
||
override fun getDefaultExtension(): String = "cls" | ||
|
||
override fun getIcon(): Icon = InterSystemsIcons.ICON | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/caretdev/plugins/idea/files/MACCreateFileAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.caretdev.plugins.idea.files | ||
|
||
import com.caretdev.plugins.idea.InterSystemsIcons | ||
import com.intellij.ide.actions.CreateFileFromTemplateAction | ||
import com.intellij.ide.actions.CreateFileFromTemplateDialog | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiDirectory | ||
|
||
class MACCreateFileAction : CreateFileFromTemplateAction(CAPTION, "", InterSystemsIcons.ICON) { | ||
private companion object { | ||
private const val CAPTION = "ObjectScript MAC Routine" | ||
} | ||
|
||
override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) { | ||
builder.setTitle(CAPTION) | ||
.addKind("Empty file", InterSystemsIcons.ICON, "ObjectScript MAC") | ||
} | ||
|
||
override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String = CAPTION | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/caretdev/plugins/idea/files/MACFileType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.caretdev.plugins.idea.files | ||
|
||
import com.caretdev.plugins.idea.InterSystemsIcons | ||
import com.intellij.openapi.fileTypes.LanguageFileType | ||
import org.jetbrains.plugins.textmate.TextMateLanguage | ||
import javax.swing.Icon | ||
|
||
object MACFileType : LanguageFileType(TextMateLanguage.LANGUAGE) { | ||
|
||
override fun getName(): String = "ObjectScript Routine" | ||
|
||
override fun getDescription(): String = "ObjectScript routine" | ||
|
||
override fun getDefaultExtension(): String = "mac" | ||
|
||
override fun getIcon(): Icon = InterSystemsIcons.ICON | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/caretdev/plugins/idea/project/InterSystemsProjectExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.caretdev.plugins.idea.project | ||
|
||
import com.intellij.openapi.roots.ProjectExtension | ||
import org.jdom.Element | ||
|
||
class InterSystemsProjectExtension : ProjectExtension() { | ||
override fun readExternal(element: Element) { | ||
// not needed at the moment | ||
} | ||
|
||
override fun writeExternal(element: Element) { | ||
// not needed at the moment | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/com/caretdev/plugins/idea/project/InterSystemsSourceRootEditHandler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.caretdev.plugins.idea.project | ||
|
||
import com.caretdev.plugins.idea.InterSystemsIcons | ||
import com.intellij.openapi.actionSystem.CustomShortcutSet | ||
import com.intellij.openapi.roots.ui.configuration.ModuleSourceRootEditHandler | ||
import java.awt.Color | ||
import javax.swing.Icon | ||
|
||
class InterSystemsSourceRootEditHandler : | ||
ModuleSourceRootEditHandler<InterSystemsSourceRootProperties>(InterSystemsSourceRootType.SOURCE) { | ||
|
||
override fun getRootTypeName(): String = "Sources" | ||
|
||
override fun getRootIcon(): Icon = InterSystemsIcons.ICON | ||
|
||
override fun getFolderUnderRootIcon(): Icon = InterSystemsIcons.ICON | ||
|
||
override fun getMarkRootShortcutSet(): CustomShortcutSet? = null | ||
|
||
override fun getRootsGroupTitle(): String = "Sources" | ||
|
||
override fun getRootsGroupColor(): Color = Color.LIGHT_GRAY | ||
|
||
override fun getUnmarkRootButtonText(): String = "Unmark" | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/com/caretdev/plugins/idea/project/InterSystemsSourceRootProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.caretdev.plugins.idea.project | ||
|
||
import org.jetbrains.jps.model.JpsSimpleElement | ||
import org.jetbrains.jps.model.ex.JpsElementBase | ||
|
||
class InterSystemsSourceRootProperties : | ||
JpsElementBase<InterSystemsSourceRootProperties>(), | ||
JpsSimpleElement<InterSystemsSourceRootProperties> { | ||
override fun createCopy(): InterSystemsSourceRootProperties = | ||
com.caretdev.plugins.idea.project.InterSystemsSourceRootProperties() | ||
|
||
override fun applyChanges(modified: InterSystemsSourceRootProperties) { | ||
// noting to apply, yet | ||
} | ||
|
||
override fun getData(): InterSystemsSourceRootProperties = this | ||
|
||
override fun setData(data: InterSystemsSourceRootProperties) { | ||
this.applyChanges(data) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/caretdev/plugins/idea/project/InterSystemsSourceRootType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.caretdev.plugins.idea.project | ||
|
||
import org.jetbrains.jps.model.ex.JpsElementTypeBase | ||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType | ||
|
||
class InterSystemsSourceRootType : | ||
JpsElementTypeBase<InterSystemsSourceRootProperties>(), | ||
JpsModuleSourceRootType<InterSystemsSourceRootProperties> { | ||
|
||
companion object { | ||
val SOURCE: InterSystemsSourceRootType = InterSystemsSourceRootType() | ||
val TEST_SOURCE: InterSystemsSourceRootType = InterSystemsSourceRootType() | ||
} | ||
|
||
override fun createDefaultProperties(): InterSystemsSourceRootProperties = | ||
InterSystemsSourceRootProperties() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/resources/fileTemplates/internal/ObjectScript Class.cls.ft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Class ${PACKAGE_NAME}.${NAME} | ||
{ | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/fileTemplates/internal/ObjectScript Class.cls.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
Empty Class file. | ||
</body> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
src/main/resources/fileTemplates/internal/ObjectScript MAC.mac.ft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "") | ||
ROUTINE ${PACKAGE_NAME}.${NAME} | ||
#else | ||
ROUTINE ${NAME} | ||
#end |
5 changes: 5 additions & 0 deletions
5
src/main/resources/fileTemplates/internal/ObjectScript MAC.mac.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
Empty MAC Routine. | ||
</body> | ||
</html> |