junichi11 commented on code in PR #7618:
URL: https://github.com/apache/netbeans/pull/7618#discussion_r1732064339


##########
php/php.blade/src/org/netbeans/modules/php/blade/editor/completion/BladeCompletionProposal.java:
##########
@@ -0,0 +1,469 @@
+/*
+ * 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.php.blade.editor.completion;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.swing.ImageIcon;
+import org.netbeans.modules.csl.api.CompletionProposal;
+import org.netbeans.modules.csl.api.ElementHandle;
+import org.netbeans.modules.csl.api.ElementKind;
+import org.netbeans.modules.csl.api.HtmlFormatter;
+import org.netbeans.modules.csl.api.Modifier;
+import org.netbeans.modules.php.blade.csl.elements.ClassElement;
+import org.netbeans.modules.php.blade.editor.ResourceUtilities;
+import org.netbeans.modules.php.blade.syntax.annotation.Directive;
+import org.netbeans.modules.php.blade.syntax.annotation.Tag;
+
+import org.openide.filesystems.FileObject;
+import org.openide.util.ImageUtilities;
+
+/**
+ *
+ * @author bogdan
+ */
+public class BladeCompletionProposal implements CompletionProposal {
+
+    //@StaticResource
+    final CompletionRequest request;
+    protected final ElementHandle element;
+    final String previewValue;
+    protected Directive directive;
+
+    public BladeCompletionProposal(ElementHandle element, CompletionRequest 
request, String previewValue) {
+        this.element = element;
+        this.request = request;
+        this.previewValue = previewValue;
+    }
+
+    public BladeCompletionProposal(ElementHandle element, CompletionRequest 
request, Directive directive) {
+        this.element = element;
+        this.request = request;
+        this.previewValue = directive.name();
+        this.directive = directive;
+    }
+
+    @Override
+    public int getAnchorOffset() {
+        return request.anchorOffset;
+    }
+
+    @Override
+    public ElementHandle getElement() {
+        return element;
+    }
+
+    @Override
+    public String getName() {
+        return element.getName();
+    }
+
+    @Override
+    public String getSortText() {
+        return getName();
+    }
+
+    @Override
+    public int getSortPrioOverride() {
+        return 0;
+    }
+
+    @Override
+    public String getLhsHtml(HtmlFormatter formatter) {
+        formatter.name(getKind(), true);
+        formatter.appendHtml("<font>");
+        formatter.appendHtml("<b>");
+        formatter.appendText(previewValue);
+        formatter.appendHtml("</b>");
+        formatter.appendHtml("</font>");
+        formatter.name(getKind(), false);
+        return formatter.getText();
+    }
+
+    @Override
+    public ImageIcon getIcon() {
+        return null;
+    }
+
+    @Override
+    public Set<Modifier> getModifiers() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public String getCustomInsertTemplate() {
+        return null;
+    }
+
+    @Override
+    public String getInsertPrefix() {
+        StringBuilder template = new StringBuilder();
+        template.append(getName());
+        return template.toString();
+
+    }
+
+    @Override
+    public String getRhsHtml(HtmlFormatter formatter) {
+        FileObject file = null;
+        if (element != null) {
+            file = element.getFileObject();
+        }
+        if (file != null) {
+            formatter.reset();
+            formatter.appendText(" ");
+            formatter.appendText(file.getName());
+        }
+        return formatter.getText();
+    }
+
+    @Override
+    public ElementKind getKind() {
+        return ElementKind.CONSTRUCTOR;
+    }
+
+    @Override
+    public boolean isSmart() {
+        return true;
+    }
+
+    public static class PhpElementItem extends BladeCompletionProposal {
+
+        public PhpElementItem(ElementHandle element, CompletionRequest 
request, String previewValue) {
+            super(element, request, previewValue);
+        }
+
+        @Override
+        public String getRhsHtml(HtmlFormatter formatter) {
+            FileObject file = null;
+            if (this.getElement() != null) {
+                file = this.getElement().getFileObject();
+            }
+            if (file != null) {
+                formatter.reset();
+                formatter.appendText(" ");

Review Comment:
   `// NOI18N`



-- 
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: [email protected]

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

Reply via email to