Skip to content

Commit

Permalink
Adding support for creating sbt files #SCL-21374
Browse files Browse the repository at this point in the history
  • Loading branch information
Sa1to committed Apr 12, 2024
1 parent 7880475 commit b1ca3b2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scala/scala-impl/resources/META-INF/scala-plugin-common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
<internalFileTemplate name="Package Object"/>
<internalFileTemplate name="Scala File"/>
<internalFileTemplate name="Scala Enum"/>
<internalFileTemplate name="Sbt File"/>
<defaultTemplatePropertiesProvider implementation="org.jetbrains.plugins.scala.actions.ScalaDefaultTemplatePropertiesProvider"/>

<indexPatternBuilder implementation="org.jetbrains.plugins.scala.editor.todo.ScalaIndexPatternBuilder"/>
Expand Down Expand Up @@ -1982,6 +1983,9 @@
class="org.jetbrains.plugins.scala.components.TypeAwareWidgetFactory$Listener"/>
</projectListeners>
<actions>
<action id="Scala.NewSbtFileAction" class="org.jetbrains.plugins.scala.actions.NewSbtFileAction">
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFromTemplate"/>
</action>
<action id="Scala.NewClass" class="org.jetbrains.plugins.scala.actions.NewScalaFileAction">
<add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewGroup1"/>
</action>
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<body>
<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3">
<font face="verdana" size="-1">
This is a built-in template used by <b>IntelliJ IDEA</b> each time you create a
Sbt File
</font>
</td>
</tr>
</table>
</body>
</html>
3 changes: 3 additions & 0 deletions scala/scala-impl/resources/messages/ScalaBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ newclassorfile.menu.action.description=Creates new Scala Class or File
create.new.scala.class.or.file=Create New Scala Class/File
this.is.not.a.valid.scala.qualified.name=This is not a valid Scala qualified name

newclassorfile.menu.action.sbt.text=Sbt File
newclassorfile.menu.action.sbt.description=Create new Sbt File

### org/jetbrains/plugins/scala/actions/ShowTypeInfoAction.scala
type.info.text=Type Info
type.info.description=Show Type Info
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.jetbrains.plugins.scala.actions

import com.intellij.ide.fileTemplates.actions.CreateFromTemplateActionBase
import com.intellij.ide.fileTemplates.{FileTemplate, FileTemplateManager}
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiDirectory
import org.jetbrains.sbt.icons.Icons
import org.jetbrains.plugins.scala.ScalaBundle

final class NewSbtFileAction extends CreateFromTemplateActionBase(
ScalaBundle.message("newclassorfile.menu.action.sbt.text"),
ScalaBundle.message("newclassorfile.menu.action.sbt.description"),
Icons.SBT_FILE
) {

override def getTemplate(project: Project, dir: PsiDirectory): FileTemplate = FileTemplateManager.getDefaultInstance.getInternalTemplate("Sbt File")

}

0 comments on commit b1ca3b2

Please sign in to comment.