You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/08/09 20:15:32 UTC

[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4485: Add HTML rule and hint+fix for missing alt attribute for tag img, applet and area

Chris2011 commented on code in PR #4485:
URL: https://github.com/apache/netbeans/pull/4485#discussion_r941761102


##########
ide/html.editor/src/org/netbeans/modules/html/editor/hints/other/AddMissingAltAttribute/AddMissingAltAttributeHint.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.html.editor.hints.other.AddMissingAltAttribute;
+
+import java.awt.EventQueue;
+import java.util.Collections;
+import javax.swing.text.BadLocationException;
+import org.netbeans.modules.csl.api.Hint;
+import org.netbeans.modules.csl.api.HintFix;
+import org.netbeans.modules.csl.api.OffsetRange;
+import org.netbeans.modules.csl.api.RuleContext;
+import org.netbeans.modules.html.editor.utils.HtmlTagContextUtils;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author Chris
+ */
+public class AddMissingAltAttributeHint extends Hint {
+
+    public AddMissingAltAttributeHint(RuleContext context, OffsetRange range) {
+        super(AddMissingAltAttributeRule.SINGLETON,
+                AddMissingAltAttributeRule.SINGLETON.getDisplayName(),
+                context.parserResult.getSnapshot().getSource().getFileObject(),
+                range,
+                Collections.<HintFix>singletonList(new AddMissingAltAttributeHintFix(context)),
+                10);
+    }
+
+    private static class AddMissingAltAttributeHintFix implements HintFix {
+
+        RuleContext context;
+
+        public AddMissingAltAttributeHintFix(RuleContext context) {
+            this.context = context;
+        }
+
+        @Override
+        public String getDescription() {
+            return AddMissingAltAttributeRule.SINGLETON.getDisplayName();
+        }
+
+        @Override
+        public void implement() throws Exception {
+            EventQueue.invokeLater(new Runnable() {
+
+                @Override
+                public void run() {

Review Comment:
   did it



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists