This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248918

Summary: Technology preference to allow co-existence of ko4j & for example angular4j
Product: platform Reporter: tulach
Component: Html4jAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews
Priority: P1 Keywords: API_REVIEW_FAST
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 248418    
Attachments: Introducing @TechnologyId
Final diff to apply tommorow with more documentation and @Contexts.Id

Description tulach 2014-11-26 10:21:24 UTC
If multiple technologies are registered there is no way how to specify which technology should be used. Technology priority is insufficient :(.
Comment 1 Jaroslav Tulach 2014-11-26 18:52:47 UTC
Created attachment 150735 [details]
Introducing @TechnologyId

One way to address such need, is to identify technologies by string name using some annotation:

+    @Contexts.TechnologyId("one")
+    static final class R1 implements Runnable {
+    @Contexts.TechnologyId("two")
+    static final class R2 implements Runnable {

and then the creator of a browser context could specify list of strings to prefer:

+ Contexts.newBuilder("one", "two")

I am attaching patch that does the necessary changes in html4j APIs.
Comment 2 Jaroslav Tulach 2014-11-26 18:54:23 UTC
Similar change would have to be done in NetBeans integration APIs:

diff -r 01b6eff1beb9 api.html4j/src/org/netbeans/api/html4j/OpenHTMLRegistration.java
--- a/api.html4j/src/org/netbeans/api/html4j/OpenHTMLRegistration.java  Wed Nov 19 18:30:18 2014 +0100
+++ b/api.html4j/src/org/netbeans/api/html4j/OpenHTMLRegistration.java  Wed Nov 26 19:53:06 2014 +0100
@@ -117,4 +117,6 @@
      * @return the path to the base 16x16 icon
      */
     String iconBase() default "";
+    
+    String[] context() default {};
 }
diff -r 01b6eff1beb9 api.html4j/test/unit/src/org/netbeans/api/html4j/OpenHTMLRegistrationTest.java
--- a/api.html4j/test/unit/src/org/netbeans/api/html4j/OpenHTMLRegistrationTest.java    Wed Nov 19 18:30:18 2014 +0100
+++ b/api.html4j/test/unit/src/org/netbeans/api/html4j/OpenHTMLRegistrationTest.java    Wed Nov 26 19:53:06 2014 +0100
@@ -60,7 +60,12 @@
     }
 
     @ActionID(category = "Test", id="html.test")
-    @OpenHTMLRegistration(displayName = "Open me!", iconBase = "x.png", url = "empty.html")
+    @OpenHTMLRegistration(
+        displayName = "Open me!", 
+        iconBase = "x.png", 
+        url = "empty.html",
+        context = "ko4j"
+    )
     public static void main() {
         
     }
Comment 3 Jaroslav Tulach 2014-12-03 09:50:03 UTC
Unless there are objections I proceed with integration of the change into html+java API tomorrow and then continue the review with the changes on the NetBeans Platform side.
Comment 4 Jaroslav Tulach 2014-12-03 11:57:55 UTC
Created attachment 150855 [details]
Final diff to apply tommorow with more documentation and @Contexts.Id
Comment 5 tulach 2014-12-03 12:24:32 UTC
Is it possible to use "context" attribute also in @TemplateRegistration?
Comment 6 tulach 2014-12-03 14:16:45 UTC
It works :). Great!
Comment 7 Jaroslav Tulach 2014-12-03 15:37:42 UTC
I'll integrate the patch tomorrow then. Enhancements to @TemplateRegistration are subject of issue 248418 - I'll make sure they get addressed before the issue is integrated.
Comment 8 Jaroslav Tulach 2014-12-04 09:00:47 UTC
http://hg.netbeans.org/html4j/rev/88d62267a0b5