jkovalsky commented on a change in pull request #2953: URL: https://github.com/apache/netbeans/pull/2953#discussion_r651809486
########## File path: java/java.hints/src/org/netbeans/modules/java/hints/jdk/CheckRegex.java ########## @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.netbeans.modules.java.hints.jdk; + +import com.sun.source.tree.AssignmentTree; +import com.sun.source.tree.BlockTree; +import com.sun.source.tree.ClassTree; +import com.sun.source.tree.ExpressionStatementTree; +import com.sun.source.tree.ExpressionTree; +import com.sun.source.tree.IdentifierTree; +import com.sun.source.tree.LiteralTree; +import com.sun.source.tree.StatementTree; +import com.sun.source.tree.Tree; +import com.sun.source.tree.Tree.Kind; +import com.sun.source.tree.VariableTree; +import com.sun.source.util.TreePath; +import com.sun.tools.javac.tree.JCTree.JCBlock; +import com.sun.tools.javac.tree.JCTree.JCClassDecl; +import java.util.List; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; +import javax.lang.model.element.Name; +import javax.swing.SwingUtilities; +import org.netbeans.api.annotations.common.CheckForNull; +import org.netbeans.api.java.source.CompilationInfo; +import org.netbeans.spi.editor.hints.ErrorDescription; +import org.netbeans.spi.java.hints.ConstraintVariableType; +import org.netbeans.spi.java.hints.ErrorDescriptionFactory; +import org.netbeans.spi.java.hints.Hint; +import org.netbeans.spi.java.hints.HintContext; +import org.netbeans.spi.java.hints.JavaFix; +import org.netbeans.spi.java.hints.TriggerPattern; +import org.netbeans.spi.java.hints.TriggerPatterns; +import org.openide.util.NbBundle.Messages; + +@Hint(displayName = "#DN_CheckRegex", description = "#DESC_CheckRegex", category = "general") +@Messages({ + "DN_CheckRegex=Check Regular Expression", + "DESC_CheckRegex=Check Regular Expression" +}) +public class CheckRegex { + + @TriggerPatterns({ + @TriggerPattern(value = "java.util.regex.Pattern.compile($pattern)", + constraints = { + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String") + }), + @TriggerPattern(value = "java.util.regex.Pattern.compile($pattern, $flags)", + constraints = { + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$flags", type = "int") + }), + @TriggerPattern(value = "java.util.regex.Pattern.matches($pattern, $text)", + constraints = { + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$text", type = "java.lang.CharSequence") + }), + @TriggerPattern(value = "$str.split($pattern)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String") + }), + @TriggerPattern(value = "$str.split($pattern, $limit)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$limit", type = "int") + }), + @TriggerPattern(value = "$str.matches($pattern)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String") + }), + @TriggerPattern(value = "$str.replaceFirst($pattern, $repl)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$repl", type = "java.lang.String") + }), + @TriggerPattern(value = "$str.replaceAll($pattern, $repl)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$repl", type = "java.lang.String") + }) + }) + @CheckForNull + @Messages("ERR_CheckRegex=Check regular expression") + public static ErrorDescription computeWarning(HintContext ctx) { + + String originalString = null; + Tree leaf = ctx.getVariables().get("$pattern").getLeaf(); // NOI18N + + if (leaf.getKind() == Kind.STRING_LITERAL) { + originalString = (String) ((LiteralTree) leaf).getValue(); + } else if (leaf.getKind() == Kind.IDENTIFIER) { + Name name = ((IdentifierTree) leaf).getName(); + TreePath tp = ctx.getPath().getParentPath(); + + Tree statement = tp.getLeaf(); + BlockTree bt = null; + while (originalString == null && tp != null) { + + if (tp.getLeaf() instanceof JCBlock) { + originalString = identifierBlockSearch(tp.getLeaf(), name, statement, bt); + bt = (BlockTree) tp.getLeaf(); + } else if (tp.getLeaf() instanceof JCClassDecl) { + originalString = identifierClassSearch(tp.getLeaf(), name, statement); + } + tp = tp.getParentPath(); + } + } + if (originalString != null) { + try { + Pattern.compile(originalString); + } catch (PatternSyntaxException e) { + return null; + } + } + return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), Bundle.ERR_CheckRegex(), new FixImpl(ctx.getInfo(), ctx.getPath(), originalString).toEditorFix()); + } + + @CheckForNull + private static String identifierBlockSearch(Tree leaf, Name name, Tree statement, BlockTree blocktree) { + String res = null; + try { + BlockTree bt = (BlockTree) leaf; + List<? extends StatementTree> statements = bt.getStatements(); + for (int i = 0; i < statements.size(); i++) { + StatementTree st = statements.get(i); + if (st.equals(statement)) { + return res; + } + if (st.equals(blocktree)) { + return res; + } + if (st instanceof VariableTree) { + VariableTree vt = (VariableTree) st; + if (vt.getType().toString().equalsIgnoreCase("String") && vt.getName().equals(name)) { + LiteralTree lt = (LiteralTree) vt.getInitializer(); + res = (String) lt.getValue(); + } + } else if (st instanceof ExpressionStatementTree) { + ExpressionStatementTree est = (ExpressionStatementTree) st; + ExpressionTree et = est.getExpression(); + if (et instanceof AssignmentTree) { + AssignmentTree at = (AssignmentTree) et; + if (at.getVariable().toString().equals(name.toString())) { + res = (String) ((LiteralTree) ((AssignmentTree) est.getExpression()).getExpression()).getValue(); + } + } + } + } + } catch (Exception e) { + return null; + } + return res; + } + + @CheckForNull + private static String identifierClassSearch(Tree leaf, Name name, Tree statement) { Review comment: What is the _statement_ parameter good for? ########## File path: java/java.hints/src/org/netbeans/modules/java/hints/jdk/CheckRegexTopComponent.java ########## @@ -0,0 +1,241 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.netbeans.modules.java.hints.jdk; + +import java.awt.Color; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Highlighter; +import org.netbeans.api.settings.ConvertAsProperties; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.util.Exceptions; +import org.openide.windows.TopComponent; +import org.openide.util.NbBundle.Messages; +import org.openide.windows.Mode; +import org.openide.windows.WindowManager; + +/** + * Top component which displays something. + */ +@ConvertAsProperties( + dtd = "-//org.netbeans.modules.java.hints.jdk//CheckRegex//EN", + autostore = false +) [email protected]( + preferredID = "CheckRegexTopComponent", + //iconBase="SET/PATH/TO/ICON/HERE", Review comment: Commented out code should be removed. ########## File path: java/java.hints/src/org/netbeans/modules/java/hints/jdk/CheckRegex.java ########## @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.netbeans.modules.java.hints.jdk; + +import com.sun.source.tree.AssignmentTree; +import com.sun.source.tree.BlockTree; +import com.sun.source.tree.ClassTree; +import com.sun.source.tree.ExpressionStatementTree; +import com.sun.source.tree.ExpressionTree; +import com.sun.source.tree.IdentifierTree; +import com.sun.source.tree.LiteralTree; +import com.sun.source.tree.StatementTree; +import com.sun.source.tree.Tree; +import com.sun.source.tree.Tree.Kind; +import com.sun.source.tree.VariableTree; +import com.sun.source.util.TreePath; +import com.sun.tools.javac.tree.JCTree.JCBlock; +import com.sun.tools.javac.tree.JCTree.JCClassDecl; +import java.util.List; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; +import javax.lang.model.element.Name; +import javax.swing.SwingUtilities; +import org.netbeans.api.annotations.common.CheckForNull; +import org.netbeans.api.java.source.CompilationInfo; +import org.netbeans.spi.editor.hints.ErrorDescription; +import org.netbeans.spi.java.hints.ConstraintVariableType; +import org.netbeans.spi.java.hints.ErrorDescriptionFactory; +import org.netbeans.spi.java.hints.Hint; +import org.netbeans.spi.java.hints.HintContext; +import org.netbeans.spi.java.hints.JavaFix; +import org.netbeans.spi.java.hints.TriggerPattern; +import org.netbeans.spi.java.hints.TriggerPatterns; +import org.openide.util.NbBundle.Messages; + +@Hint(displayName = "#DN_CheckRegex", description = "#DESC_CheckRegex", category = "general") +@Messages({ + "DN_CheckRegex=Check Regular Expression", + "DESC_CheckRegex=Check Regular Expression" +}) +public class CheckRegex { + + @TriggerPatterns({ + @TriggerPattern(value = "java.util.regex.Pattern.compile($pattern)", + constraints = { + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String") + }), + @TriggerPattern(value = "java.util.regex.Pattern.compile($pattern, $flags)", + constraints = { + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$flags", type = "int") + }), + @TriggerPattern(value = "java.util.regex.Pattern.matches($pattern, $text)", + constraints = { + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$text", type = "java.lang.CharSequence") + }), + @TriggerPattern(value = "$str.split($pattern)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String") + }), + @TriggerPattern(value = "$str.split($pattern, $limit)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$limit", type = "int") + }), + @TriggerPattern(value = "$str.matches($pattern)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String") + }), + @TriggerPattern(value = "$str.replaceFirst($pattern, $repl)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$repl", type = "java.lang.String") + }), + @TriggerPattern(value = "$str.replaceAll($pattern, $repl)", + constraints = { + @ConstraintVariableType(variable = "$str", type = "java.lang.String"), + @ConstraintVariableType(variable = "$pattern", type = "java.lang.String"), + @ConstraintVariableType(variable = "$repl", type = "java.lang.String") + }) + }) + @CheckForNull + @Messages("ERR_CheckRegex=Check regular expression") + public static ErrorDescription computeWarning(HintContext ctx) { + + String originalString = null; + Tree leaf = ctx.getVariables().get("$pattern").getLeaf(); // NOI18N + + if (leaf.getKind() == Kind.STRING_LITERAL) { + originalString = (String) ((LiteralTree) leaf).getValue(); + } else if (leaf.getKind() == Kind.IDENTIFIER) { + Name name = ((IdentifierTree) leaf).getName(); + TreePath tp = ctx.getPath().getParentPath(); + + Tree statement = tp.getLeaf(); + BlockTree bt = null; + while (originalString == null && tp != null) { + + if (tp.getLeaf() instanceof JCBlock) { + originalString = identifierBlockSearch(tp.getLeaf(), name, statement, bt); + bt = (BlockTree) tp.getLeaf(); + } else if (tp.getLeaf() instanceof JCClassDecl) { + originalString = identifierClassSearch(tp.getLeaf(), name, statement); + } + tp = tp.getParentPath(); + } + } + if (originalString != null) { + try { + Pattern.compile(originalString); + } catch (PatternSyntaxException e) { + return null; + } + } + return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), Bundle.ERR_CheckRegex(), new FixImpl(ctx.getInfo(), ctx.getPath(), originalString).toEditorFix()); + } + + @CheckForNull + private static String identifierBlockSearch(Tree leaf, Name name, Tree statement, BlockTree blocktree) { + String res = null; + try { + BlockTree bt = (BlockTree) leaf; + List<? extends StatementTree> statements = bt.getStatements(); + for (int i = 0; i < statements.size(); i++) { + StatementTree st = statements.get(i); + if (st.equals(statement)) { + return res; + } + if (st.equals(blocktree)) { + return res; + } + if (st instanceof VariableTree) { + VariableTree vt = (VariableTree) st; + if (vt.getType().toString().equalsIgnoreCase("String") && vt.getName().equals(name)) { + LiteralTree lt = (LiteralTree) vt.getInitializer(); + res = (String) lt.getValue(); + } + } else if (st instanceof ExpressionStatementTree) { + ExpressionStatementTree est = (ExpressionStatementTree) st; + ExpressionTree et = est.getExpression(); + if (et instanceof AssignmentTree) { + AssignmentTree at = (AssignmentTree) et; + if (at.getVariable().toString().equals(name.toString())) { + res = (String) ((LiteralTree) ((AssignmentTree) est.getExpression()).getExpression()).getValue(); + } + } + } + } + } catch (Exception e) { + return null; + } + return res; + } + + @CheckForNull + private static String identifierClassSearch(Tree leaf, Name name, Tree statement) { + String res = null; + try { + ClassTree ct = (ClassTree) leaf; + List<? extends Tree> members = ct.getMembers(); + for (int i = 0; i < members.size(); i++) { + Tree t = members.get(i); + if (t instanceof VariableTree) { + VariableTree vt = (VariableTree) t; + if (vt.getType().toString().equalsIgnoreCase("String") && vt.getName().equals(name)) { + LiteralTree lt = (LiteralTree) vt.getInitializer(); + res = lt != null ? (String) lt.getValue() : null; + } + } else if (t instanceof ExpressionStatementTree) { + ExpressionStatementTree est = (ExpressionStatementTree) t; + ExpressionTree et = est.getExpression(); + if (et instanceof AssignmentTree) { + AssignmentTree at = (AssignmentTree) et; + if (at.getVariable().toString().equals(name.toString())) { + res = (String) ((LiteralTree) ((AssignmentTree) est.getExpression()).getExpression()).getValue(); + } + } + } + } + } catch (Exception e) { + return null; + } + return res; + } + + private static final class FixImpl extends JavaFix { + + private String origString; Review comment: _origString_ variable can be final. ########## File path: java/java.hints/src/org/netbeans/modules/java/hints/jdk/CheckRegexTopComponent.java ########## @@ -0,0 +1,241 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.netbeans.modules.java.hints.jdk; + +import java.awt.Color; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Highlighter; +import org.netbeans.api.settings.ConvertAsProperties; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.util.Exceptions; +import org.openide.windows.TopComponent; +import org.openide.util.NbBundle.Messages; +import org.openide.windows.Mode; +import org.openide.windows.WindowManager; + +/** + * Top component which displays something. + */ +@ConvertAsProperties( + dtd = "-//org.netbeans.modules.java.hints.jdk//CheckRegex//EN", + autostore = false +) [email protected]( + preferredID = "CheckRegexTopComponent", + //iconBase="SET/PATH/TO/ICON/HERE", + persistenceType = TopComponent.PERSISTENCE_ALWAYS +) [email protected](mode = "output", openAtStartup = false, position = 13000) +@ActionID(category = "Window", id = "org.netbeans.modules.java.hints.jdk.CheckRegexTopComponent") +@ActionReferences({ + @ActionReference(name="Check Regex",path = "Menu/Window", position = 900), + @ActionReference(path = "Shortcuts", name = "C-8")}) [email protected]( + displayName = "#CTL_CheckRegexAction", + preferredID = "CheckRegexTopComponent" +) +@Messages({ + "CTL_CheckRegexAction=Check Regex", + "CTL_CheckRegexTopComponent=CheckRegex Window", + "HINT_CheckRegexTopComponent=This is a CheckRegex window" +}) +public final class CheckRegexTopComponent extends TopComponent { + + private static CheckRegexTopComponent instance; + + public CheckRegexTopComponent() { + initComponents(); + setName(Bundle.CTL_CheckRegexTopComponent()); + setToolTipText(Bundle.HINT_CheckRegexTopComponent()); + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTextArea1 = new javax.swing.JTextArea(); + jLabel2 = new javax.swing.JLabel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTextArea2 = new javax.swing.JTextArea(); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CheckRegexTopComponent.class, "CheckRegexTopComponent.jLabel1.text")); // NOI18N + + jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + jScrollPane1.setPreferredSize(new java.awt.Dimension(164, 74)); + + jTextArea1.setColumns(20); + jTextArea1.setRows(5); + jScrollPane1.setViewportView(jTextArea1); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CheckRegexTopComponent.class, "CheckRegexTopComponent.jLabel2.text")); // NOI18N + + jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + + jTextArea2.setColumns(20); + jTextArea2.setRows(5); + jTextArea2.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyReleased(java.awt.event.KeyEvent evt) { + jTextArea2KeyReleased(evt); + } + }); + jScrollPane2.setViewportView(jTextArea2); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)) + .addContainerGap(355, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel2) + .addGap(15, 15, 15) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(15, Short.MAX_VALUE)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void jTextArea2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea2KeyReleased + matchPattern(); + }//GEN-LAST:event_jTextArea2KeyReleased + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JTextArea jTextArea1; + private javax.swing.JTextArea jTextArea2; + // End of variables declaration//GEN-END:variables + @Override + public void componentOpened() { + // TODO add custom code on component opening + } + + @Override + public void componentClosed() { + // TODO add custom code on component closing + } + + void writeProperties(java.util.Properties p) { + // better to version settings since initial version as advocated at + // http://wiki.apidesign.org/wiki/PropertyFiles + p.setProperty("version", "1.0"); // NOI18N + // TODO store your settings + } + + void readProperties(java.util.Properties p) { + String version = p.getProperty("version"); // NOI18N Review comment: Why do we read the version property here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
