timfel commented on a change in pull request #1011: Enhanced wrapper for 
Scripting API 
URL: 
https://github.com/apache/incubator-netbeans/pull/1011#discussion_r239107152
 
 

 ##########
 File path: 
platform/api.scripting/src/org/netbeans/modules/scripting/GraalEngineFactory.java
 ##########
 @@ -0,0 +1,105 @@
+/*
+ * 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.scripting;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import org.graalvm.polyglot.Language;
+
+final class GraalEngineFactory implements ScriptEngineFactory {
+
+    final String id;
+    final Language language;
+    final GraalContext ctx;
+
+    GraalEngineFactory(GraalContext ctx, String id, Language language) {
+        this.id = id;
+        this.language = language;
+        this.ctx = ctx;
+    }
+
+    @Override
+    public String getEngineName() {
+        return "GraalVM:" + language.getId();
+    }
+
+    @Override
+    public String getEngineVersion() {
+        return language.getVersion();
+    }
+
+    @Override
+    public List<String> getExtensions() {
+        return Collections.singletonList(id);
+    }
+
+    @Override
+    public List<String> getMimeTypes() {
+        return new ArrayList<>(language.getMimeTypes());
+    }
+
+    @Override
+    public List<String> getNames() {
+        return Arrays.asList(language.getName());
+    }
+
+    @Override
+    public String getLanguageName() {
+        return language.getName();
+    }
+
+    @Override
+    public String getLanguageVersion() {
+        return language.getVersion();
+    }
+
+    @Override
+    public Object getParameter(String arg0) {
+        return null;
+    }
+
+    @Override
+    public String getMethodCallSyntax(String arg0, String arg1, String... 
arg2) {
+        return null;
 
 Review comment:
   What exactly do you need here? We're in the process 
(https://github.com/oracle/graal/pull/764) of adding API facilities for getting 
"completion characters" (`.` in many languages, sometimes `->`) and "signature 
characters" (`(` in many languages) to get autocomplete and signature 
completion working. Maybe it would make sense to consider this use case in the 
PR as well, but we'd need to know what kind of "syntax" you need to create here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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