-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
211 additions
and
52 deletions.
There are no files selected for viewing
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 +1 @@ | ||
2024-08-17 | ||
2024-08-23 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
salvo.rs快速开发工具 | ||
JB RustRover Rust dev tool | ||
|
||
文档: [https://mdddj.github.io/SalvoRsToolDocument](https://mdddj.github.io/SalvoRsToolDocument) | ||
document: [https://mdddj.github.io/SalvoRsToolDocument](https://mdddj.github.io/SalvoRsToolDocument) | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package shop.itbug.salvorstool.dsl | ||
|
||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.project.guessProjectDir | ||
import com.intellij.openapi.ui.DialogWrapper | ||
import com.intellij.ui.dsl.builder.Align | ||
import com.intellij.ui.dsl.builder.Panel | ||
import com.intellij.ui.dsl.builder.bindText | ||
import com.intellij.ui.layout.ValidationInfoBuilder | ||
import shop.itbug.salvorstool.i18n.MyI18n | ||
import shop.itbug.salvorstool.tool.fileIsExits | ||
import java.io.File | ||
import kotlin.reflect.KMutableProperty0 | ||
|
||
data class SaveToBindModel(var folder: KMutableProperty0<String>, var fileName: KMutableProperty0<String>) | ||
|
||
/** | ||
* 保存文件到目录的基本配置 | ||
*/ | ||
fun Panel.saveTo(project: Project,bind: SaveToBindModel) : Panel { | ||
this.group(MyI18n.saveTo) { | ||
row(MyI18n.selectDir) { | ||
textFieldWithBrowseButton( | ||
project = project, | ||
fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor().withRoots( | ||
project.guessProjectDir() | ||
) | ||
).align(Align.FILL) | ||
.bindText(bind.folder).validationOnInput { | ||
val fullPath = it.text | ||
if(!project.fileIsExits(fullPath)) { | ||
return@validationOnInput ValidationInfoBuilder(it.textField).error(MyI18n.folderIsNotFound) | ||
} | ||
return@validationOnInput null | ||
} | ||
} | ||
row (MyI18n.getMessage("file_name")) { | ||
textField().bindText(bind.fileName).validationOnInput { | ||
var folderPath = bind.folder.get() | ||
if(!folderPath.endsWith(File.separatorChar)){ | ||
folderPath += File.separator | ||
} | ||
val fullPath = folderPath + it.text + ".rs" | ||
if(project.fileIsExits(fullPath)){ | ||
return@validationOnInput ValidationInfoBuilder(it).error(MyI18n.fileIsExist) | ||
} | ||
return@validationOnInput null | ||
} | ||
} | ||
} | ||
return this | ||
} |
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
Oops, something went wrong.