Skip to content

The GFT plugin may be useful: Developers who often create groups of files with - similar structure. Development teams who want to unify the style and formatting of their projects. Anyone who wants to increase their productivity when working with an IDE

Notifications You must be signed in to change notification settings

Louco11/Group-File-Template-GFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Group File Template (GFT) IDEA Plugin

Version Version License

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

ARTICLES

Medium

Habr

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
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
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
insertInFile Insert in file structure list object InsertInFile

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
  • [-low] - lowercase

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

InsertInFile it has a structure

Key Value Comment
line Position line insert
path Path to the file where to paste the code Path in project to file. You can use Param in the name.
fileTemplatePath The name of the template from insert the code It must be specified with the extension .tm and you can specify the directory where this file is located

if line == 0, insert code at the beginning of the file if line == -1, code insert in end file if count line > size line in file, insert the code at the end of the file

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

Add new line insert in Template

  • In the file in which we want to insert, right-click on the line we need.
  • Select in the context menu Add Insert From Template
  • Select the template from which the insert will be made
  • In fileTemplatePath we specify the template from which the insertion will be made
  • When creating new files, an insertion will be made into the file we selected

drawing

drawing

drawing

Move template in IDE

In the project tool window, a new field is GFTemplate.

drawing

Having selected we will be shown all our templates in the project and in the IDE

drawing

You can move templates from a project to an IDE and back. ide/templates or project/templates

To move or copy a template in a view or into a project. Right-click on the template and select Copy Template or Move Template

drawing

drawing

After this we can rename the template.

drawing

License

Copyright 2021 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

The GFT plugin may be useful: Developers who often create groups of files with - similar structure. Development teams who want to unify the style and formatting of their projects. Anyone who wants to increase their productivity when working with an IDE

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published