diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/README.md" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/README.md"
new file mode 100644
index 0000000000000000000000000000000000000000..698094017a54bd1f4403a15a343dcc2f865b0745
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/README.md"
@@ -0,0 +1,12 @@
+# JavaEncodeTool
+Java项目编码转换工具
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/001.png" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/001.png"
new file mode 100644
index 0000000000000000000000000000000000000000..7678d194205bbcbea02d21faa507238ee0a5226e
Binary files /dev/null and "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/001.png" differ
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/002.png" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/002.png"
new file mode 100644
index 0000000000000000000000000000000000000000..c3a77e5834cea4e46f0088fba7d1b50370337c95
Binary files /dev/null and "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/002.png" differ
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/003.png" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/003.png"
new file mode 100644
index 0000000000000000000000000000000000000000..fa1c43cce1c1544b6369a8d8655fffafc7bedba3
Binary files /dev/null and "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/003.png" differ
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/004.png" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/004.png"
new file mode 100644
index 0000000000000000000000000000000000000000..0db93b5d4a25fdb13b792017d47f1f46a910cc7b
Binary files /dev/null and "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/images/004.png" differ
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/pom.xml" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..cb0e0b5720940caa15b79268c484db26790a6848
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/pom.xml"
@@ -0,0 +1,75 @@
+
+
+ 4.0.0
+ com.fly
+ java-encode-tool
+ 0.0.1
+ java-encode-tool
+ http://maven.apache.org
+ jar
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ log4j
+ log4j
+ 1.2.17
+
+
+
+ commons-io
+ commons-io
+ 2.4
+
+
+ org.apache.commons
+ commons-lang3
+ 3.5
+
+
+
+ ${project.artifactId}
+
+
+ maven-compiler-plugin
+ 3.7.0
+
+ 1.8
+ 1.8
+
+
+
+ maven-assembly-plugin
+ 3.5.0
+
+ false
+
+
+ com.fly.code.ToolMain
+
+
+
+
+ jar-with-dependencies
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/ToolMain.java" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/ToolMain.java"
new file mode 100644
index 0000000000000000000000000000000000000000..4f80f9f1ce301ce847df5c62fb07b352202a6d72
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/ToolMain.java"
@@ -0,0 +1,204 @@
+package com.fly.code;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Image;
+import java.net.URL;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import com.fly.code.panel.ClearPanel;
+import com.fly.code.panel.EncodePanel;
+import com.fly.code.panel.ToFtlPanel;
+import com.fly.code.panel.ToUnixPanel;
+
+/**
+ *
+ * 项目编码,空行清除工具
+ *
+ * @author 00fly
+ * @version [版本号, 2018年8月29日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class ToolMain extends JFrame
+{
+ private static final long serialVersionUID = 965289280779529771L;
+
+ // 设置窗口风格的菜单
+ JCheckBoxMenuItem windows = new JCheckBoxMenuItem("Windows", true);
+
+ JCheckBoxMenuItem metal = new JCheckBoxMenuItem("Metal");
+
+ // 构造
+ public ToolMain()
+ {
+ // 加载图标
+ URL imgURL = this.getClass().getResource("/icon.gif");
+ if (imgURL != null)
+ {
+ Image image = getToolkit().createImage(imgURL);
+ setIconImage(image);
+ }
+ setTitle("Java项目工具 V1.0");
+ // 设置宽高
+ setSize(560, 600);
+ // 得到当前系统screenSize
+ Dimension screenSize = getToolkit().getScreenSize();
+ // 得到当前frameSize
+ Dimension frameSize = this.getSize();
+ // 自适应处理
+ frameSize.height = Math.min(screenSize.height, frameSize.height);
+ frameSize.width = Math.min(screenSize.width, frameSize.width);
+
+ setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
+ addMenu();
+ add(new TabPanel());
+ setWindowStyle("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ setResizable(false);
+ setVisible(true);
+ setDefaultCloseOperation(EXIT_ON_CLOSE);
+ }
+
+ // Menu set
+ private void addMenu()
+ {
+ JMenuBar mb = new JMenuBar();
+ JMenu windowStyle = new JMenu("窗口风格");
+ windows.addActionListener((actionevent) -> {
+ String plaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
+ setWindowStyle(plaf);
+ windows.setState(true);
+ metal.setState(false);
+ });
+
+ metal.addActionListener((actionevent) -> {
+ String plaf = "javax.swing.plaf.metal.MetalLookAndFeel";
+ setWindowStyle(plaf);
+ windows.setState(false);
+ metal.setState(true);
+ });
+ JMenuItem exit = new JMenuItem("退出");
+ exit.addActionListener(event -> System.exit(0));
+
+ windowStyle.add(windows);
+ windowStyle.add(metal);
+ windowStyle.addSeparator();
+ windowStyle.add(exit);
+ mb.add(windowStyle);
+
+ // 菜单2
+ JMenu help = new JMenu("帮助");
+ JMenuItem use = new JMenuItem("使用指南");
+ use.addActionListener(event -> JOptionPane.showMessageDialog(null, "请按以下顺序操作:\n 1. 选择项目源代码目录。\n 2. 选择编码转换后保存目录。\n 3. 选择需要转换的文件类型。\n 4. 选择项目编码。\n 5. 开始转换。", "使用指南", JOptionPane.INFORMATION_MESSAGE));
+
+ JMenuItem about = new JMenuItem("关于工具");
+ about.addActionListener(event -> JOptionPane.showMessageDialog(null, "Java项目编码转换工具,00fly 于2014年11月。", "关于本工具", JOptionPane.INFORMATION_MESSAGE));
+ help.add(use);
+ help.addSeparator();
+ help.add(about);
+ mb.add(help);
+ setJMenuBar(mb);
+ }
+
+ // 根据字串设置窗口外观
+ private void setWindowStyle(String plaf)
+ {
+ try
+ {
+ // 设定用户界面的外观
+ UIManager.setLookAndFeel(plaf);
+ // 将用户界面改成当前设定的外观
+ SwingUtilities.updateComponentTreeUI(this);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ // 卡片
+ class TabPanel extends JPanel implements ChangeListener
+ {
+ private static final long serialVersionUID = 7226393795721621635L;
+
+ JTabbedPane jtp = new JTabbedPane();
+
+ EncodePanel encodePanel = new EncodePanel();
+
+ ClearPanel clearPanel = new ClearPanel();
+
+ ToFtlPanel toFtlPanel = new ToFtlPanel();
+
+ ToUnixPanel toUnixPanel = new ToUnixPanel();
+
+ TabPanel()
+ {
+ encodePanel.setVisible(true);
+ clearPanel.setVisible(true);
+ toFtlPanel.setVisible(true);
+ toUnixPanel.setVisible(true);
+ jtp.addTab(" 编码转换 ", encodePanel);
+ jtp.addTab(" 清除空白行 ", clearPanel);
+ jtp.addTab(" 转换为FTL ", toFtlPanel);
+ jtp.addTab(" 转换为unix换行符", toUnixPanel);
+ jtp.addChangeListener(this);
+ setLayout(new BorderLayout());
+ add(jtp, BorderLayout.CENTER);
+ }
+
+ @Override
+ public void stateChanged(ChangeEvent e)
+ {
+ if (e.getSource() == jtp)
+ {
+ int i = ((JTabbedPane)e.getSource()).getSelectedIndex();
+ if (i == 0)
+ {
+ encodePanel.setVisible(true);
+ clearPanel.setVisible(false);
+ toFtlPanel.setVisible(false);
+ toUnixPanel.setVisible(false);
+ }
+ else if (i == 1)
+ {
+ encodePanel.setVisible(false);
+ clearPanel.setVisible(true);
+ toFtlPanel.setVisible(false);
+ toUnixPanel.setVisible(false);
+ }
+ else if (i == 2)
+ {
+ encodePanel.setVisible(false);
+ clearPanel.setVisible(false);
+ toFtlPanel.setVisible(true);
+ toUnixPanel.setVisible(false);
+ }
+ else
+ {
+ encodePanel.setVisible(false);
+ clearPanel.setVisible(false);
+ toFtlPanel.setVisible(false);
+ toUnixPanel.setVisible(true);
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater(() -> {
+ new ToolMain();
+ });
+ }
+}
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ClearPanel.java" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ClearPanel.java"
new file mode 100644
index 0000000000000000000000000000000000000000..a68d69879fb236938abc0597ff963f35b9a6783c
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ClearPanel.java"
@@ -0,0 +1,300 @@
+package com.fly.code.panel;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.commons.io.filefilter.FileFilterUtils;
+
+/**
+ *
+ * 移除空白行
+ *
+ * @author 00fly
+ * @version [版本号, 2018年10月1日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class ClearPanel extends JPanel
+{
+ private static final long serialVersionUID = 4050369107824321460L;
+
+ // 界面组件
+ JLabel sourceLabel = new JLabel("项目源代码目录:");
+
+ JTextField tsourcePath = new JTextField(null, 45);
+
+ JButton sourceBrowse = new JButton("选择");
+
+ JButton bakBrowse = new JButton("选择");
+
+ JLabel fileTypeLabel = new JLabel("转换文件类型:");
+
+ JCheckBox jb1 = new JCheckBox(".java", true);
+
+ JCheckBox jb2 = new JCheckBox(".jsp");
+
+ JCheckBox jb3 = new JCheckBox(".xml");
+
+ JCheckBox jb4 = new JCheckBox(".css");
+
+ JCheckBox jb5 = new JCheckBox(".js");
+
+ JCheckBox jb6 = new JCheckBox(".properties");
+
+ JCheckBox jb7 = new JCheckBox(".sql");
+
+ JCheckBox jb8 = new JCheckBox(".htm");
+
+ JCheckBox jb9 = new JCheckBox(".html");
+
+ JCheckBox jb10 = new JCheckBox(".vm");
+
+ JButton runButton = new JButton("开 始 处 理");
+
+ JTextArea view = new JTextArea();
+
+ public ClearPanel()
+ {
+ super();
+ setLayout(null);
+ setBackground(Color.WHITE);
+ // 项目源文件路径
+ sourceLabel.setBounds(20, 10, 120, 18);
+ add(sourceLabel);
+ tsourcePath.setFocusable(false);
+ tsourcePath.setBounds(120, 10, 300, 20);
+ add(tsourcePath);
+ sourceBrowse.setBounds(430, 10, 70, 20);
+
+ sourceBrowse.addActionListener(event -> {
+ String text = tsourcePath.getText();
+ if (text.length() == 0)
+ {
+ text = new File(" ").getAbsolutePath().trim();
+ }
+ JFileChooser fc = new JFileChooser(text);
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fc.setVisible(true);
+ if (fc.showOpenDialog(null) == 1)
+ {
+ return;
+ }
+ File f = fc.getSelectedFile();
+ if (f.getPath().endsWith("\\"))
+ {
+ tsourcePath.setText(f.getAbsolutePath());
+ }
+ else
+ {
+ tsourcePath.setText(f.getAbsolutePath() + "\\");
+ }
+ });
+ add(sourceBrowse);
+
+ // 文件类型
+ fileTypeLabel.setBounds(20, 80, 120, 18);
+ add(fileTypeLabel);
+
+ jb1.setBounds(100, 80, 100, 18);
+ jb1.setBackground(Color.WHITE);
+ jb2.setBounds(200, 80, 80, 18);
+ jb2.setBackground(Color.WHITE);
+ jb3.setBounds(280, 80, 80, 18);
+ jb3.setBackground(Color.WHITE);
+ jb4.setBounds(360, 80, 80, 18);
+ jb4.setBackground(Color.WHITE);
+ jb5.setBounds(440, 80, 80, 18);
+ jb5.setBackground(Color.WHITE);
+
+ jb6.setBounds(100, 100, 100, 18);
+ jb6.setBackground(Color.WHITE);
+ jb7.setBounds(200, 100, 80, 18);
+ jb7.setBackground(Color.WHITE);
+ jb8.setBounds(280, 100, 80, 18);
+ jb8.setBackground(Color.WHITE);
+ jb9.setBounds(360, 100, 80, 18);
+ jb9.setBackground(Color.WHITE);
+ jb10.setBounds(440, 100, 80, 18);
+ jb10.setBackground(Color.WHITE);
+ add(jb1);
+ add(jb2);
+ add(jb3);
+ add(jb4);
+ add(jb5);
+ add(jb6);
+ add(jb7);
+ add(jb8);
+ add(jb9);
+ add(jb10);
+
+ runButton.setBounds(360, 130, 120, 25);
+ runButton.addActionListener(event -> {
+ final String sourcePath = tsourcePath.getText();
+ if ("".equals(sourcePath))
+ {
+ JOptionPane.showMessageDialog(null, "项目源代码目录不可为空!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ final List suffixList = new ArrayList<>();
+ if (jb1.isSelected())
+ {
+ suffixList.add("java");
+ }
+ if (jb2.isSelected())
+ {
+ suffixList.add("jsp");
+ }
+ if (jb3.isSelected())
+ {
+ suffixList.add("xml");
+ }
+ if (jb4.isSelected())
+ {
+ suffixList.add("css");
+ }
+ if (jb5.isSelected())
+ {
+ suffixList.add("js");
+ }
+ if (jb6.isSelected())
+ {
+ suffixList.add("properties");
+ }
+ if (jb7.isSelected())
+ {
+ suffixList.add("sql");
+ }
+ if (jb8.isSelected())
+ {
+ suffixList.add("htm");
+ }
+ if (jb9.isSelected())
+ {
+ suffixList.add("html");
+ }
+ if (jb10.isSelected())
+ {
+ suffixList.add("vm");
+ }
+ if (suffixList.isEmpty())
+ {
+ JOptionPane.showMessageDialog(null, "请选择转换文件类型!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ try
+ {
+ view.setText(null);
+ runButton.setText("处理中。。。");
+ runButton.setEnabled(false);
+ Thread worker = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ String path = sourcePath;
+ for (String suffix : suffixList)
+ {
+ Collection> listFiles = FileUtils.listFiles(new File(path), FileFilterUtils.suffixFileFilter(suffix), DirectoryFileFilter.INSTANCE);
+ for (Object object : listFiles)
+ {
+ if (object instanceof File)
+ {
+ File file = (File)object;
+ try
+ {
+ String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
+
+ // 去除空白行
+ content = content.replaceAll("((\r\n)|\n)[\\s\t ]*(\\1)+", "$1");
+ // .replaceAll("\\d{4}年\\d{1,2}月\\d{1,2}日", "2018-09-10")
+ FileUtils.writeStringToFile(file, content, StandardCharsets.UTF_8);
+ view.setText(file.getAbsolutePath() + " 处理完成 \n" + view.getText());
+ }
+ catch (IOException e)
+ {
+ view.setText(file.getAbsolutePath() + "------ 处理失败 ---- \n" + view.getText());
+ }
+ }
+ }
+ }
+ SwingUtilities.invokeLater(() -> {
+ runButton.setText("开 始 处 理");
+ runButton.setEnabled(true);
+ if (JOptionPane.showConfirmDialog(null, "处理完成,是否查看?", "查看项目代码", 0) == 0)
+ {
+ try
+ {
+ java.awt.Desktop.getDesktop().open(new File(sourcePath));
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ });
+ }
+ };
+ worker.start();
+ }
+ catch (Exception e)
+ {
+ JOptionPane.showMessageDialog(null, "Java项目代码处理失败!", "错误", JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ add(runButton);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 170, 526, 320);
+ add(scrollPane);
+
+ view.setEditable(false);
+ scrollPane.setViewportView(view);
+
+ JLabel label = new JLabel();
+ label.setText("Java项目编码转换工具 By 00fly");
+ label.setBounds(348, 500, 200, 18);
+ add(label);
+
+ JLabel httpLabel = new JLabel();
+ httpLabel.setText("http://00fly.online");
+ httpLabel.setToolTipText("单击直达主页~~");
+ httpLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ httpLabel.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ try
+ {
+ Runtime.getRuntime().exec("cmd.exe /c start http://00fly.online");
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ });
+ httpLabel.setBounds(10, 500, 146, 18);
+ add(httpLabel);
+ }
+}
\ No newline at end of file
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/EncodePanel.java" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/EncodePanel.java"
new file mode 100644
index 0000000000000000000000000000000000000000..c06d4a773df716a26275bf2b14f31325a9aff184
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/EncodePanel.java"
@@ -0,0 +1,365 @@
+package com.fly.code.panel;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.io.FileUtils;
+
+/**
+ *
+ * 编码转换
+ *
+ * @author 00fly
+ * @version [版本号, 2018年10月1日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class EncodePanel extends JPanel
+{
+ private static final long serialVersionUID = 4050369107824321460L;
+
+ // 界面组件
+ JLabel sourceLabel = new JLabel("项目源代码目录:");
+
+ JTextField tsourcePath = new JTextField(null, 45);
+
+ JButton sourceBrowse = new JButton("选择");
+
+ JLabel bakeLabel = new JLabel("转换后保存目录:");
+
+ JTextField tbakPath = new JTextField(null, 45);
+
+ JButton bakBrowse = new JButton("选择");
+
+ JLabel fileTypeLabel = new JLabel("转换文件类型:");
+
+ JCheckBox jb1 = new JCheckBox(".java", true);
+
+ JCheckBox jb2 = new JCheckBox(".jsp", true);
+
+ JCheckBox jb3 = new JCheckBox(".xml", true);
+
+ JCheckBox jb4 = new JCheckBox(".css", true);
+
+ JCheckBox jb5 = new JCheckBox(".js", true);
+
+ JCheckBox jb6 = new JCheckBox(".properties");
+
+ JCheckBox jb7 = new JCheckBox(".sql");
+
+ JCheckBox jb8 = new JCheckBox(".htm");
+
+ JCheckBox jb9 = new JCheckBox(".html");
+
+ JCheckBox jb10 = new JCheckBox(".vm");
+
+ JLabel encodeLabel = new JLabel("将项目编码: 从");
+
+ JComboBox oldEncode = new JComboBox<>();
+
+ JLabel newLabel = new JLabel("转换到");
+
+ JComboBox newEncode = new JComboBox<>();
+
+ JButton runButton = new JButton("开 始 转 换");
+
+ JTextArea view = new JTextArea();
+
+ public EncodePanel()
+ {
+ super();
+ setLayout(null);
+ setBackground(Color.WHITE);
+ // 项目源文件路径
+ sourceLabel.setBounds(20, 10, 120, 18);
+ add(sourceLabel);
+ tsourcePath.setFocusable(false);
+ tsourcePath.setBounds(120, 10, 300, 20);
+ add(tsourcePath);
+ sourceBrowse.setBounds(430, 10, 70, 20);
+
+ sourceBrowse.addActionListener(event -> {
+ String text = tsourcePath.getText();
+ if (text.length() == 0)
+ {
+ text = new File(" ").getAbsolutePath().trim();
+ }
+ JFileChooser fc = new JFileChooser(text);
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fc.setVisible(true);
+ if (fc.showOpenDialog(null) == 1)
+ {
+ return;
+ }
+ File f = fc.getSelectedFile();
+ if (f.getPath().endsWith("\\"))
+ {
+ tsourcePath.setText(f.getAbsolutePath());
+ }
+ else
+ {
+ tsourcePath.setText(f.getAbsolutePath() + "\\");
+ }
+ });
+ add(sourceBrowse);
+
+ // 备份目录
+ bakeLabel.setBounds(20, 45, 120, 18);
+ add(bakeLabel);
+ tbakPath.setBounds(120, 45, 300, 20);
+ tbakPath.setFocusable(false);
+ tbakPath.setText(new File(" ").getAbsolutePath().trim());
+ add(tbakPath);
+ bakBrowse.setBounds(430, 45, 70, 20);
+ bakBrowse.addActionListener(event -> {
+ String text = tbakPath.getText();
+ if (text.length() == 0)
+ {
+ text = new File(" ").getAbsolutePath().trim();
+ }
+ JFileChooser fc = new JFileChooser(text);
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fc.setVisible(true);
+ if (fc.showOpenDialog(null) == 1)
+ {
+ return;
+ }
+ File f = fc.getSelectedFile();
+ if (f.getPath().endsWith("\\"))
+ {
+ tbakPath.setText(f.getAbsolutePath());
+ }
+ else
+ {
+ tbakPath.setText(f.getAbsolutePath() + "\\");
+ }
+ });
+ add(bakBrowse);
+
+ // 文件类型
+ fileTypeLabel.setBounds(20, 80, 120, 18);
+ add(fileTypeLabel);
+
+ jb1.setBounds(100, 80, 100, 18);
+ jb1.setBackground(Color.WHITE);
+ jb2.setBounds(200, 80, 80, 18);
+ jb2.setBackground(Color.WHITE);
+ jb3.setBounds(280, 80, 80, 18);
+ jb3.setBackground(Color.WHITE);
+ jb4.setBounds(360, 80, 80, 18);
+ jb4.setBackground(Color.WHITE);
+ jb5.setBounds(440, 80, 80, 18);
+ jb5.setBackground(Color.WHITE);
+
+ jb6.setBounds(100, 100, 100, 18);
+ jb6.setBackground(Color.WHITE);
+ jb7.setBounds(200, 100, 80, 18);
+ jb7.setBackground(Color.WHITE);
+ jb8.setBounds(280, 100, 80, 18);
+ jb8.setBackground(Color.WHITE);
+ jb9.setBounds(360, 100, 80, 18);
+ jb9.setBackground(Color.WHITE);
+ jb10.setBounds(440, 100, 80, 18);
+ jb10.setBackground(Color.WHITE);
+ add(jb1);
+ add(jb2);
+ add(jb3);
+ add(jb4);
+ add(jb5);
+ add(jb6);
+ add(jb7);
+ add(jb8);
+ add(jb9);
+ add(jb10);
+
+ // 项目编码
+ encodeLabel.setBounds(20, 130, 120, 18);
+ add(encodeLabel);
+ oldEncode.setBounds(120, 130, 70, 20);
+ oldEncode.addItem("UTF-8");
+ oldEncode.addItem("GB2312");
+ oldEncode.addItem("GBK");
+ add(oldEncode);
+
+ newLabel.setBounds(200, 130, 120, 18);
+ add(newLabel);
+ newEncode.setBounds(250, 130, 70, 20);
+ newEncode.addItem("UTF-8");
+ newEncode.addItem("GB2312");
+ newEncode.addItem("GBK");
+ newEncode.setSelectedIndex(2);
+ add(newEncode);
+
+ runButton.setBounds(360, 130, 120, 25);
+ runButton.addActionListener(event -> {
+ final String sourcePath = tsourcePath.getText();
+ if ("".equals(sourcePath))
+ {
+ JOptionPane.showMessageDialog(null, "项目源代码目录不可为空!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ final String bakPath = tbakPath.getText();
+ if ("".equals(bakPath))
+ {
+ JOptionPane.showMessageDialog(null, "转换后保存目录不可为空!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ final List list = new ArrayList<>();
+ if (jb1.isSelected())
+ {
+ list.add("java");
+ }
+ if (jb2.isSelected())
+ {
+ list.add("jsp");
+ }
+ if (jb3.isSelected())
+ {
+ list.add("xml");
+ }
+ if (jb4.isSelected())
+ {
+ list.add("css");
+ }
+ if (jb5.isSelected())
+ {
+ list.add("js");
+ }
+ if (jb6.isSelected())
+ {
+ list.add("properties");
+ }
+ if (jb7.isSelected())
+ {
+ list.add("sql");
+ }
+ if (jb8.isSelected())
+ {
+ list.add("htm");
+ }
+ if (jb9.isSelected())
+ {
+ list.add("html");
+ }
+ if (jb10.isSelected())
+ {
+ list.add("vm");
+ }
+ if (list.isEmpty())
+ {
+ JOptionPane.showMessageDialog(null, "请选择转换文件类型!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ final String oldE = (String)oldEncode.getSelectedItem();
+ final String newE = (String)newEncode.getSelectedItem();
+ if (oldE.equals(newE))
+ {
+ JOptionPane.showMessageDialog(null, "请选择不同的编码!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ try
+ {
+ view.setText(null);
+ runButton.setText("转换中。。。");
+ runButton.setEnabled(false);
+ Thread worker = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ Collection files = FileUtils.listFiles(new File(sourcePath), (String[])list.toArray(new String[0]), true);
+ String dirName = new File(sourcePath).getName();
+ String newPath = bakPath + dirName + "\\";
+ for (File file : files)
+ {
+ String srcFilePath = newPath + file.getAbsolutePath().substring(sourcePath.length());
+ try
+ {
+ FileUtils.writeLines(new File(srcFilePath), newE, FileUtils.readLines(file, oldE));
+ }
+ catch (IOException e)
+ {
+ view.setText(file.getAbsolutePath() + "------ 转换失败 ---- \n" + view.getText());
+ }
+ view.setText(file.getAbsolutePath() + " 转换完成 \n" + view.getText());
+ }
+ SwingUtilities.invokeLater(() -> {
+ runButton.setText("开 始 转 换");
+ runButton.setEnabled(true);
+ if (JOptionPane.showConfirmDialog(null, "处理完成,是否直接查看生成的代码?", "查看项目代码", 0) == 0)
+ {
+ try
+ {
+ java.awt.Desktop.getDesktop().open(new File(bakPath));
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ });
+ }
+ };
+ worker.start();
+ }
+ catch (Exception e)
+ {
+ JOptionPane.showMessageDialog(null, "Java项目编码转换失败!", "错误", JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ add(runButton);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 170, 526, 320);
+ add(scrollPane);
+
+ view.setEditable(false);
+ scrollPane.setViewportView(view);
+
+ JLabel label = new JLabel();
+ label.setText("Java项目编码转换工具 By 00fly");
+ label.setBounds(348, 500, 200, 18);
+ add(label);
+
+ JLabel httpLabel = new JLabel();
+ httpLabel.setText("http://00fly.online");
+ httpLabel.setToolTipText("单击直达主页~~");
+ httpLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ httpLabel.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ try
+ {
+ Runtime.getRuntime().exec("cmd.exe /c start http://00fly.online");
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ });
+ httpLabel.setBounds(10, 500, 146, 18);
+ add(httpLabel);
+ }
+}
\ No newline at end of file
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ToFtlPanel.java" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ToFtlPanel.java"
new file mode 100644
index 0000000000000000000000000000000000000000..7d66247859a52430ddac4da38019d82a6b0c4ac0
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ToFtlPanel.java"
@@ -0,0 +1,298 @@
+package com.fly.code.panel;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.commons.io.filefilter.FileFilterUtils;
+
+/**
+ *
+ * 转换为FTL文件
+ *
+ * @author 00fly
+ * @version [版本号, 2018年10月1日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class ToFtlPanel extends JPanel
+{
+ private static final long serialVersionUID = 4050369107824321460L;
+
+ // 界面组件
+ JLabel sourceLabel = new JLabel("项目源代码目录:");
+
+ JTextField tsourcePath = new JTextField(null, 45);
+
+ JButton sourceBrowse = new JButton("选择");
+
+ JButton bakBrowse = new JButton("选择");
+
+ JLabel fileTypeLabel = new JLabel("转换文件类型:");
+
+ JCheckBox jb1 = new JCheckBox(".java", true);
+
+ JCheckBox jb2 = new JCheckBox(".jsp", true);
+
+ JCheckBox jb3 = new JCheckBox(".xml", true);
+
+ JCheckBox jb4 = new JCheckBox(".css");
+
+ JCheckBox jb5 = new JCheckBox(".js");
+
+ JCheckBox jb6 = new JCheckBox(".properties", true);
+
+ JCheckBox jb7 = new JCheckBox(".sql");
+
+ JCheckBox jb8 = new JCheckBox(".htm");
+
+ JCheckBox jb9 = new JCheckBox(".html");
+
+ JCheckBox jb10 = new JCheckBox(".vm");
+
+ JButton runButton = new JButton("开 始 处 理");
+
+ JTextArea view = new JTextArea();
+
+ public ToFtlPanel()
+ {
+ super();
+ setLayout(null);
+ setBackground(Color.WHITE);
+ // 项目源文件路径
+ sourceLabel.setBounds(20, 10, 120, 18);
+ add(sourceLabel);
+ tsourcePath.setFocusable(false);
+ tsourcePath.setBounds(120, 10, 300, 20);
+ add(tsourcePath);
+ sourceBrowse.setBounds(430, 10, 70, 20);
+
+ sourceBrowse.addActionListener(event -> {
+ String text = tsourcePath.getText();
+ if (text.length() == 0)
+ {
+ text = new File(" ").getAbsolutePath().trim();
+ }
+ JFileChooser fc = new JFileChooser(text);
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fc.setVisible(true);
+ if (fc.showOpenDialog(null) == 1)
+ {
+ return;
+ }
+ File f = fc.getSelectedFile();
+ if (f.getPath().endsWith("\\"))
+ {
+ tsourcePath.setText(f.getAbsolutePath());
+ }
+ else
+ {
+ tsourcePath.setText(f.getAbsolutePath() + "\\");
+ }
+ });
+ add(sourceBrowse);
+
+ // 文件类型
+ fileTypeLabel.setBounds(20, 80, 120, 18);
+ add(fileTypeLabel);
+
+ jb1.setBounds(100, 80, 100, 18);
+ jb1.setBackground(Color.WHITE);
+ jb2.setBounds(200, 80, 80, 18);
+ jb2.setBackground(Color.WHITE);
+ jb3.setBounds(280, 80, 80, 18);
+ jb3.setBackground(Color.WHITE);
+ jb4.setBounds(360, 80, 80, 18);
+ jb4.setBackground(Color.WHITE);
+ jb5.setBounds(440, 80, 80, 18);
+ jb5.setBackground(Color.WHITE);
+
+ jb6.setBounds(100, 100, 100, 18);
+ jb6.setBackground(Color.WHITE);
+ jb7.setBounds(200, 100, 80, 18);
+ jb7.setBackground(Color.WHITE);
+ jb8.setBounds(280, 100, 80, 18);
+ jb8.setBackground(Color.WHITE);
+ jb9.setBounds(360, 100, 80, 18);
+ jb9.setBackground(Color.WHITE);
+ jb10.setBounds(440, 100, 80, 18);
+ jb10.setBackground(Color.WHITE);
+ add(jb1);
+ add(jb2);
+ add(jb3);
+ add(jb4);
+ add(jb5);
+ add(jb6);
+ add(jb7);
+ add(jb8);
+ add(jb9);
+ add(jb10);
+
+ runButton.setBounds(360, 130, 120, 25);
+ runButton.addActionListener(event -> {
+ final String sourcePath = tsourcePath.getText();
+ if ("".equals(sourcePath))
+ {
+ JOptionPane.showMessageDialog(null, "项目源代码目录不可为空!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ final List suffixList = new ArrayList<>();
+ if (jb1.isSelected())
+ {
+ suffixList.add("java");
+ }
+ if (jb2.isSelected())
+ {
+ suffixList.add("jsp");
+ }
+ if (jb3.isSelected())
+ {
+ suffixList.add("xml");
+ }
+ if (jb4.isSelected())
+ {
+ suffixList.add("css");
+ }
+ if (jb5.isSelected())
+ {
+ suffixList.add("js");
+ }
+ if (jb6.isSelected())
+ {
+ suffixList.add("properties");
+ }
+ if (jb7.isSelected())
+ {
+ suffixList.add("sql");
+ }
+ if (jb8.isSelected())
+ {
+ suffixList.add("htm");
+ }
+ if (jb9.isSelected())
+ {
+ suffixList.add("html");
+ }
+ if (jb10.isSelected())
+ {
+ suffixList.add("vm");
+ }
+ if (suffixList.isEmpty())
+ {
+ JOptionPane.showMessageDialog(null, "请选择转换文件类型!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ try
+ {
+ view.setText(null);
+ runButton.setText("处理中。。。");
+ runButton.setEnabled(false);
+ Thread worker = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ String path = sourcePath;
+ for (String suffix : suffixList)
+ {
+ Collection> listFiles = FileUtils.listFiles(new File(path), FileFilterUtils.suffixFileFilter(suffix), DirectoryFileFilter.INSTANCE);
+ for (Object object : listFiles)
+ {
+ if (object instanceof File)
+ {
+ File file = (File)object;
+ try
+ {
+ String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
+ content = content.replace("${", "$\\{");
+ File newFile = new File(file.getAbsolutePath() + ".ftl");
+ FileUtils.writeStringToFile(newFile, content, StandardCharsets.UTF_8);
+ view.setText(file.getAbsolutePath() + " 处理完成 \n" + view.getText());
+ }
+ catch (IOException e)
+ {
+ view.setText(file.getAbsolutePath() + "------ 处理失败 ---- \n" + view.getText());
+ }
+ }
+ }
+ }
+ SwingUtilities.invokeLater(() -> {
+ runButton.setText("开 始 处 理");
+ runButton.setEnabled(true);
+ if (JOptionPane.showConfirmDialog(null, "处理完成,是否查看?", "查看项目代码", 0) == 0)
+ {
+ try
+ {
+ java.awt.Desktop.getDesktop().open(new File(sourcePath));
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ });
+ }
+ };
+ worker.start();
+ }
+ catch (Exception e)
+ {
+ JOptionPane.showMessageDialog(null, "Java项目代码处理失败!", "错误", JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ add(runButton);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 170, 526, 320);
+ add(scrollPane);
+
+ view.setEditable(false);
+ scrollPane.setViewportView(view);
+
+ JLabel label = new JLabel();
+ label.setText("Java项目编码转换工具 By 00fly");
+ label.setBounds(348, 500, 200, 18);
+ add(label);
+
+ JLabel httpLabel = new JLabel();
+ httpLabel.setText("http://00fly.online");
+ httpLabel.setToolTipText("单击直达主页~~");
+ httpLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ httpLabel.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ try
+ {
+ Runtime.getRuntime().exec("cmd.exe /c start http://00fly.online");
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ });
+ httpLabel.setBounds(10, 500, 146, 18);
+ add(httpLabel);
+ }
+}
\ No newline at end of file
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ToUnixPanel.java" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ToUnixPanel.java"
new file mode 100644
index 0000000000000000000000000000000000000000..9d388c628f3e69a7f54c9df5a4e8040e84c55038
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/java/com/fly/code/panel/ToUnixPanel.java"
@@ -0,0 +1,236 @@
+package com.fly.code.panel;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.commons.io.filefilter.FileFilterUtils;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ *
+ * 转换为unix换行符
+ *
+ * @author 00fly
+ * @version [版本号, 2022年4月1日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class ToUnixPanel extends JPanel
+{
+ private static final long serialVersionUID = 4050369107824321460L;
+
+ // 界面组件
+ JLabel sourceLabel = new JLabel("项目源代码目录:");
+
+ JTextField tsourcePath = new JTextField(null, 45);
+
+ JButton sourceBrowse = new JButton("选择");
+
+ JButton bakBrowse = new JButton("选择");
+
+ JLabel fileTypeLabel = new JLabel("转换文件类型:");
+
+ JCheckBox sh = new JCheckBox(".sh", true);
+
+ JCheckBox yml = new JCheckBox(".yml", true);
+
+ JCheckBox yaml = new JCheckBox(".yaml", true);
+
+ JButton runButton = new JButton("开 始 处 理");
+
+ JTextArea view = new JTextArea();
+
+ public ToUnixPanel()
+ {
+ super();
+ setLayout(null);
+ setBackground(Color.WHITE);
+ // 项目源文件路径
+ sourceLabel.setBounds(20, 10, 120, 18);
+ add(sourceLabel);
+ tsourcePath.setFocusable(false);
+ tsourcePath.setBounds(120, 10, 300, 20);
+ add(tsourcePath);
+ sourceBrowse.setBounds(430, 10, 70, 20);
+
+ sourceBrowse.addActionListener(event -> {
+ String text = tsourcePath.getText();
+ if (text.length() == 0)
+ {
+ text = new File(" ").getAbsolutePath().trim();
+ }
+ JFileChooser fc = new JFileChooser(text);
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fc.setVisible(true);
+ if (fc.showOpenDialog(null) == 1)
+ {
+ return;
+ }
+ File f = fc.getSelectedFile();
+ if (f.getPath().endsWith("\\"))
+ {
+ tsourcePath.setText(f.getAbsolutePath());
+ }
+ else
+ {
+ tsourcePath.setText(f.getAbsolutePath() + "\\");
+ }
+ });
+ add(sourceBrowse);
+
+ // 文件类型
+ fileTypeLabel.setBounds(20, 80, 120, 18);
+ add(fileTypeLabel);
+
+ sh.setBounds(100, 80, 100, 18);
+ sh.setBackground(Color.WHITE);
+ yml.setBounds(200, 80, 80, 18);
+ yml.setBackground(Color.WHITE);
+ yaml.setBounds(280, 80, 80, 18);
+ yaml.setBackground(Color.WHITE);
+ add(sh);
+ add(yml);
+ add(yaml);
+
+ runButton.setBounds(360, 130, 120, 25);
+ runButton.addActionListener(event -> {
+ final String sourcePath = tsourcePath.getText();
+ if ("".equals(sourcePath))
+ {
+ JOptionPane.showMessageDialog(null, "项目源代码目录不可为空!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ final List suffixList = new ArrayList<>();
+ if (sh.isSelected())
+ {
+ suffixList.add("sh");
+ }
+ if (yml.isSelected())
+ {
+ suffixList.add("yml");
+ }
+ if (yaml.isSelected())
+ {
+ suffixList.add("yaml");
+ }
+ if (suffixList.isEmpty())
+ {
+ JOptionPane.showMessageDialog(null, "请选择转换文件类型!", "警告", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ try
+ {
+ view.setText(null);
+ runButton.setText("处理中。。。");
+ runButton.setEnabled(false);
+ Thread worker = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ String path = sourcePath;
+ for (String suffix : suffixList)
+ {
+ Collection> listFiles = FileUtils.listFiles(new File(path), FileFilterUtils.suffixFileFilter(suffix), DirectoryFileFilter.INSTANCE);
+ for (Object object : listFiles)
+ {
+ if (object instanceof File)
+ {
+ File file = (File)object;
+ try
+ {
+ String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
+ content = StringUtils.trimToEmpty(content);
+ // dos2unix
+ content = content.replaceAll("\\r", "");
+ FileUtils.writeStringToFile(file, content, StandardCharsets.UTF_8);
+ view.setText(file.getAbsolutePath() + " 处理完成 \n" + view.getText());
+ }
+ catch (IOException e)
+ {
+ view.setText(file.getAbsolutePath() + "------ 处理失败 ---- \n" + view.getText());
+ }
+ }
+ }
+ }
+ SwingUtilities.invokeLater(() -> {
+ runButton.setText("开 始 处 理");
+ runButton.setEnabled(true);
+ if (JOptionPane.showConfirmDialog(null, "处理完成,是否查看?", "查看项目代码", 0) == 0)
+ {
+ try
+ {
+ java.awt.Desktop.getDesktop().open(new File(sourcePath));
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ });
+ }
+ };
+ worker.start();
+ }
+ catch (Exception e)
+ {
+ JOptionPane.showMessageDialog(null, "Java项目代码处理失败!", "错误", JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ add(runButton);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 170, 526, 320);
+ add(scrollPane);
+
+ view.setEditable(false);
+ scrollPane.setViewportView(view);
+
+ JLabel label = new JLabel();
+ label.setText("Java项目编码转换工具 By 00fly");
+ label.setBounds(348, 500, 200, 18);
+ add(label);
+
+ JLabel httpLabel = new JLabel();
+ httpLabel.setText("http://00fly.online");
+ httpLabel.setToolTipText("单击直达主页~~");
+ httpLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ httpLabel.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ try
+ {
+ Runtime.getRuntime().exec("cmd.exe /c start http://00fly.online");
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ });
+ httpLabel.setBounds(10, 500, 146, 18);
+ add(httpLabel);
+ }
+}
\ No newline at end of file
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/resources/icon.gif" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/resources/icon.gif"
new file mode 100644
index 0000000000000000000000000000000000000000..b1a689d7272f228f122f6ac7f3628ecc74516a17
Binary files /dev/null and "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/resources/icon.gif" differ
diff --git "a/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/resources/log4j.xml" "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/resources/log4j.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..e75632b786854c91ebc57c835ef09b1cc692e735
--- /dev/null
+++ "b/00fly-Java\351\241\271\347\233\256\347\274\226\347\240\201\350\275\254\346\215\242\345\267\245\345\205\267\345\217\212\345\205\266\344\273\226/src/main/resources/log4j.xml"
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file