diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 16eecd2..bcd4247 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -8,21 +8,30 @@ | Issues

一键调用一个对象的所有的set方法,get方法等

在方法上生成两个对象的转换

-

generate call to class all setter method by alt+enter on the variable class

-

generate a converter two object when they have same field

-

generate default value when returnType is List Set Map

-

generate call to assertThat on all getter method

-

generate call to getter method

-

like a user class has setName, setPassword methods

-

generate converter between two class like aa.setHello(bb.getHello()) on method

-

User user = new User();

-

then alt+enter on User

-

will generate following

-

user.setName("");

-

user.setPassword("");

-

support all your class set method including super class

-

support kotlin -

view more on https://github.com/gejun123456/intellij-generateAllSetMethod

+
+

Features

+ + +

Usage

+

Let some class User has setName and setPassword methods and you have a declaration:
+

+ User user = new User(); +
+ Set the caret to the word User and press Alt+Enter key. The plugin will produce the code:

+
+ + user.setName("");
+ user.setPassword("");
+
+
+ +

Works with Java and Kotlin programming languages.

+

View more on https://github.com/gejun123456/intellij-generateAllSetMethod

]]> - - - + + + diff --git a/src/test/java/html/HtmlViewer.java b/src/test/java/html/HtmlViewer.java new file mode 100644 index 0000000..c061e90 --- /dev/null +++ b/src/test/java/html/HtmlViewer.java @@ -0,0 +1,53 @@ +package html; + +import com.intellij.ui.components.JBScrollPane; + +import javax.swing.*; +import javax.swing.text.Document; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.StyleSheet; +import java.awt.*; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class HtmlViewer { + public static void main(String[] args) { + SwingUtilities.invokeLater(() -> { + try { + new HtmlViewer().show(); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + } + + public void show() throws Exception { + JEditorPane jEditorPane = new JEditorPane(); + jEditorPane.setEditable(false); + JScrollPane scrollPane = new JBScrollPane(jEditorPane); + HTMLEditorKit kit = new HTMLEditorKit(); + jEditorPane.setEditorKit(kit); + StyleSheet styleSheet = kit.getStyleSheet(); + styleSheet.addRule("body { color:#000; margin: 4px; font-size: 10px; }"); + + String xml = new String(Files.readAllBytes(Paths.get("src/main/resources/META-INF/plugin.xml"))); + Pattern pattern = Pattern.compile(".*)]]>", + Pattern.MULTILINE | Pattern.DOTALL); + Matcher matcher = pattern.matcher(xml); + String html = matcher.find() ? matcher.group("html") : "fail"; + + Document document = kit.createDefaultDocument(); + jEditorPane.setDocument(document); + jEditorPane.setText(html); + + JFrame frame = new JFrame("Html Viewer"); + frame.getContentPane().add(scrollPane, BorderLayout.CENTER); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(new Dimension(400, 600)); + //frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +}