Skip to content

NikCapko/Group-File-Template-GFT

 
 

Repository files navigation

Group File Template (GFT) IDEA Plugin

Version Version License buymeacoffee

Plugin create a group of files by custom templates from IDEA interface.

Medium

habr

Version 4.7

Quick start

Templates Example

First of all install the Plugin From Marketplace.

Short Template

To create an empty short template, click on the "Tools" -> "GFT Creator" -> "Create New Short Template" menu item

drawing

Add a piece of code to short templates

  • Highlight code
  • Right-click on the highlight code
  • Choose "Add in Template"

drawing

  • If there is more than one template, choose which one to save it to, otherwise the plugin will add it to the only created template
  • Enter the name of the short template

drawing

Use short templates

Right-click or generic menu

drawing

drawing

Structure short templates

The heart of the short template is the Json file main_short

Key Value Comment
name Name Short Template
description Description Short Template
path Path to short Template
addFile Files to create list object File

structure addFile

Key Value comment
name name short template in menu
filePath file with template

Template

To create an empty template, click on the "Tools" -> "GFT Creator"->"Create New Template" menu item

drawing

In the Dialog box enter the name of the template

drawing

The plugin will create an empty template at the root of your project.

All templates are stored in the folder "Your project name"/templates

drawing

The heart of the template is the Json file Main

Inside it has a structure

Key Value Comment
name Name Template
description Description Template
path Path to Template
param Variables to insert into the template list String
selectParam Variables to drop list with values into the template list object SelectParam
addFile Files to create list object File

structure SelectParam

Key Value comment
paramName Variables to insert into the template
paramValue values list String

param

The parameter is an array of strings. It can be in the File Structure in name and path. And also in the template itself. It is declared in brackets {param}.

Options after param:

  • [-S] - SCREAMING_SNAKE_CASE
  • [-s] - snake_case
  • [-C] - CamelCase
  • [-c] - camelCase
  • [-p] - point.between.words
  • [-sl] - slash/between/word
  • [-d] - dash-between-word

example {"NewFeature"}[-s] equals new_feature

Example

drawing

drawing

Default parameter for Java and Kotlin {package} and {pack} for R.class example import {pack}.R

{time} = 10:56

{day} = 04

{month} = 06

{year} = 2022

When creating files from a template, the plugin will correct to fill in the parameter fields.

drawing

drawing

File it has a structure

Key Value Comment
name Name when creating a file You can use Param in the name
path Additional directories for saving You can use Param in the name. Creates a catalog automatically if it does not exist
fileTemplatePath The name of the template from which the file is created It must be specified with the extension .tm and you can specify the directory where this file is located

If file name empty then create only directory

To add resources to android, write the "res/" to the parameter "path" parameter

To add test to android, write the "test/" to the parameter "path" parameter

To add file in path project, write the "~/" to the parameter "path" parameter

Create Template

To create a file from a template, right-click on the path in which we want to create and select the template we need from the list

drawing

Add File In Template

To add a file to the template, right-click on it and select "Add file in template" The plugin will ask you to choose which template you want to add (if there are several of them) and will ask you to rename the file as it will be named in the template.

drawing

drawing

drawing

drawing

drawing

License

Copyright 2022 Doroncov Mihail

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 98.2%
  • Tcl 1.8%