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.

View | Details | Raw Unified | Return to bug 248126
Collapse All | Expand All

(-)a/api.intent/arch.xml (+1142 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
3
  <!ENTITY api-questions SYSTEM "../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
4
]>
5
6
<api-answers
7
  question-version="1.29"
8
  author="jhavlin@netbeans.org"
9
>
10
11
  &api-questions;
12
13
    <!--
14
            <question id="arch-overall" when="init">
15
                Describe the overall architecture.
16
                <hint>
17
                What will be API for
18
                <a href="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API">
19
                    clients and what support API</a>?
20
                What parts will be pluggable?
21
                How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
22
                to describe your general APIs and specify their
23
                <a href="http://wiki.netbeans.org/API_Stability#Private">
24
                stability categories</a>.
25
                If possible please provide simple diagrams.
26
                </hint>
27
            </question>
28
    -->
29
    <answer id="arch-overall">
30
        <p>
31
            This module was originally created to provide a way to handle
32
            clicks on hyperlinks in the output window. Some more sophisticated
33
            objects for describing intended operations can be added into this
34
            module in the future.
35
        </p>
36
        <p>
37
            The URI-based actions are useful if the front-end and back-end of
38
            the application is separated, e.g. in network environment. The
39
            actions can be specified on back-end, but handled on front-end,
40
            without any unnecessary communication.
41
        </p>
42
43
        <api
44
            name="Intent"
45
            group="java"
46
            type="export"
47
            category="official"
48
            url="@org-netbeans-api-intent@/org/netbeans/api/intent/package-summary.html"
49
        >
50
            <p>
51
                API for invoking some intended operation, specified by
52
                a URI. For example, for displaying a web page in browser, or for
53
                opening a source file in editor.
54
            </p>
55
        </api>
56
        <api
57
            name="OpenUriSPI"
58
            group="java"
59
            type="export"
60
            category="official"
61
            url="@org-netbeans-api-intent@/org/netbeans/spi/intent/package-summary.html"
62
        >
63
            <p>
64
                SPI for handlers that are able to invoke proper operation for
65
                some URI.
66
            </p>
67
        </api>
68
    </answer>
69
70
71
72
    <!--
73
            <question id="arch-quality" when="init">
74
                How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
75
                of your code be tested and
76
                how are future regressions going to be prevented?
77
                <hint>
78
                What kind of testing do
79
                you want to use? How much functionality, in which areas,
80
                should be covered by the tests? How you find out that your
81
                project was successful?
82
                </hint>
83
            </question>
84
    -->
85
    <answer id="arch-quality">
86
        <p>
87
            The code is checked by unit tests.
88
        </p>
89
    </answer>
90
91
92
93
    <!--
94
            <question id="arch-time" when="init">
95
                What are the time estimates of the work?
96
                <hint>
97
                Please express your estimates of how long the design, implementation,
98
                stabilization are likely to last. How many people will be needed to
99
                implement this and what is the expected milestone by which the work should be
100
                ready?
101
                </hint>
102
            </question>
103
    -->
104
    <answer id="arch-time">
105
        <p>
106
            Done.
107
        </p>
108
    </answer>
109
110
111
112
    <!--
113
        <question id="arch-usecases" when="init">
114
            <hint>
115
                Content of this answer will be displayed as part of page at
116
                http://www.netbeans.org/download/dev/javadoc/usecases.html
117
                You can use tags &lt;usecase name="name&gt; regular html description &lt;/usecase&gt;
118
                and if you want to use an URL you can prefix if with @TOP@ to begin
119
                at the root of your javadoc
120
            </hint>
121
122
                Describe the main <a href="http://wiki.netbeans.org/API_Design#The_Importance_of_Being_Use_Case_Oriented">
123
                use cases</a> of the new API. Who will use it under
124
                what circumstances? What kind of code would typically need to be written
125
                to use the module?
126
            </question>
127
    -->
128
    <answer id="arch-usecases">
129
        <usecase id="openUri" name="Invoke proper operation for a URI">
130
            <pre>
131
    Intent.execute(Intent.forUri(new URI("scheme://path/")));
132
            </pre>
133
        </usecase>
134
135
        <usecase id="handleUri" name="Handle some URI clicked (or somehow invoked) in the application.">
136
            <pre>
137
   &nbsp;&#64;OpenUriHandler.Registration(displayName = "Show my item in MyEditor", position = 800, uriPattern = "myscheme://.*")
138
    public class TestOpenUriHandler implements OpenUriHandler {
139
140
        public Object open(URI uri) {
141
            if (someCondition) {
142
                // perform the operation
143
                return new Object();
144
            } else {
145
                return null;
146
            }
147
        }
148
    }
149
            </pre>
150
        </usecase>
151
    </answer>
152
153
154
155
    <!--
156
            <question id="arch-what" when="init">
157
                What is this project good for?
158
                <hint>
159
                Please provide here a few lines describing the project,
160
                what problem it should solve, provide links to documentation,
161
                specifications, etc.
162
                </hint>
163
            </question>
164
    -->
165
    <answer id="arch-what">
166
        <p>
167
            This module provides a contract between API clients that can express
168
            some intention to invoke an operation (specified e.g. by a URI) and
169
            SPI providers that can handle the URI.
170
        </p>
171
        <p>
172
            This is useful in client-server environments, where the intention
173
            can be constructed on server-side, but handled on client-side. The
174
            objects that describe the intention should be easy to construct,
175
            transfer and interpret.
176
        </p>
177
    </answer>
178
179
180
181
    <!--
182
            <question id="arch-where" when="impl">
183
                Where one can find sources for your module?
184
                <hint>
185
                    Please provide link to the Hg web client at
186
                    http://hg.netbeans.org/
187
                    or just use tag defaultanswer generate='here'
188
                </hint>
189
            </question>
190
    -->
191
    <answer id="arch-where">
192
        <defaultanswer generate='here' />
193
    </answer>
194
195
196
197
    <!--
198
            <question id="compat-deprecation" when="init">
199
                How the introduction of your project influences functionality
200
                provided by previous version of the product?
201
                <hint>
202
                If you are planning to deprecate/remove/change any existing APIs,
203
                list them here accompanied with the reason explaining why you
204
                are doing so.
205
                </hint>
206
            </question>
207
    -->
208
    <answer id="compat-deprecation">
209
        <p>
210
            No deprecation needed.
211
        </p>
212
    </answer>
213
214
215
216
    <!--
217
            <question id="compat-i18n" when="impl">-<replacefilter token="@org-netbeans-modules-masterfs-ui@" value="${javadoc.docs.org-netbeans-modules-masterfs-ui}"/>
218
-<replacefilter token="@org-netbeans-modules-parsing-nb@" value="${javadoc.docs.org-netbeans-modules-parsing-nb}"/>
219
-<replacefilter token="@org-netbeans-modules-project-libraries-ui@" value="${javadoc.docs.org-netbeans-modules-project-libraries-ui}"/>
220
-<replacefilter token="@org-openide-filesystems-nb@" value="${javadoc.docs.org-openide-filesystems-nb}"/>
221
                Is your module correctly internationalized?
222
                <hint>
223
                Correct internationalization means that it obeys instructions
224
                at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html">
225
                NetBeans I18N pages</a>.
226
                </hint>
227
            </question>
228
    -->
229
    <answer id="compat-i18n">
230
        <p>
231
            Yes.
232
        </p>
233
    </answer>
234
235
236
237
    <!--
238
            <question id="compat-standards" when="init">
239
                Does the module implement or define any standards? Is the
240
                implementation exact or does it deviate somehow?
241
            </question>
242
    -->
243
    <answer id="compat-standards">
244
        <p>
245
            No standards.
246
        </p>
247
    </answer>
248
249
250
251
<!--
252
        <question id="compat-version" when="impl">
253
            Can your module coexist with earlier and future
254
            versions of itself? Can you correctly read all old settings? Will future
255
            versions be able to read your current settings? Can you read
256
            or politely ignore settings stored by a future version?
257
258
                <hint>
259
                Very helpful for reading settings is to store version number
260
                there, so future versions can decide whether how to read/convert
261
                the settings and older versions can ignore the new ones.
262
                </hint>
263
            </question>
264
    -->
265
    <answer id="compat-version">
266
        <p>
267
            No settings are read or written.
268
        </p>
269
    </answer>
270
271
272
273
    <!--
274
            <question id="dep-jre" when="final">
275
                Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
276
                <hint>
277
                It is expected that if your module runs on 1.x that it will run
278
                on 1.x+1 if no, state that please. Also describe here cases where
279
                you run different code on different versions of JRE and why.
280
                </hint>
281
            </question>
282
    -->
283
    <answer id="dep-jre">
284
        <p>
285
            1.6
286
        </p>
287
    </answer>
288
289
290
291
    <!--
292
            <question id="dep-jrejdk" when="final">
293
                Do you require the JDK or is the JRE enough?
294
            </question>
295
    -->
296
    <answer id="dep-jrejdk">
297
        <p>
298
            JRE
299
        </p>
300
    </answer>
301
302
303
304
    <!--
305
            <question id="dep-nb" when="init">
306
                What other NetBeans projects and modules does this one depend on?
307
                <hint>
308
                Depending on other NetBeans projects influnces the ability of
309
                users of your work to customize their own branded version of
310
                NetBeans by enabling and disabling some modules. Too
311
                much dependencies restrict this kind of customization. If that
312
                is your case, then you may want to split your functionality into
313
                pieces of autoload, eager and regular modules which can be
314
                enabled independently. Usually the answer to this question
315
                is generated from your <code>project.xml</code> file, but
316
                if it is not guessed correctly, you can suppress it by
317
                specifying &lt;defaultanswer generate="none"/&gt; and
318
                write here your own. Please describe such projects as imported APIs using
319
                the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
320
                By doing this information gets listed in the summary page of your
321
                javadoc.
322
                </hint>
323
            </question>
324
    -->
325
    <answer id="dep-nb">
326
        <defaultanswer generate='here' />
327
    </answer>
328
329
330
331
    <!--
332
        <question id="dep-non-nb" when="init">
333
            What other projects outside NetBeans does this one depend on?
334
335
                <hint>
336
                Depending on 3rd party libraries is always problematic,
337
                especially if they are not open source, as that complicates
338
                the licensing scheme of NetBeans. Please enumerate your
339
                external dependencies here, so it is correctly understood since
340
                the begining what are the legal implications of your project.
341
                Also please note that
342
                some non-NetBeans projects are packaged as NetBeans modules
343
                (see <a href="http://libs.netbeans.org/">libraries</a>) and
344
                it is preferred to use this approach when more modules may
345
                depend and share such third-party libraries.
346
                </hint>
347
            </question>
348
    -->
349
    <answer id="dep-non-nb">
350
        <p>
351
            No non-NB dependencies.
352
        </p>
353
    </answer>
354
355
356
357
    <!--
358
            <question id="dep-platform" when="init">
359
                On which platforms does your module run? Does it run in the same
360
                way on each?
361
                <hint>
362
                If you plan any dependency on OS or any usage of native code,
363
                please describe why you are doing so and describe how you envision
364
                to enforce the portability of your code.
365
                Please note that there is a support for <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-os-specific">OS conditionally
366
                enabled modules</a> which together with autoload/eager modules
367
                can allow you to enable to provide the best OS aware support
368
                on certain OSes while providing compatibility bridge on the not
369
                supported ones.
370
                Also please list the supported
371
                OSes/HW platforms and mentioned the lovest version of JDK required
372
                for your project to run on. Also state whether JRE is enough or
373
                you really need JDK.
374
                </hint>
375
            </question>
376
    -->
377
    <answer id="dep-platform">
378
        <p>
379
            Any platform.
380
        </p>
381
    </answer>
382
383
384
385
    <!--
386
            <question id="deploy-dependencies" when="final">
387
                What do other modules need to do to declare a dependency on this one,
388
                in addition to or instead of the normal module dependency declaration
389
                (e.g. tokens to require)?
390
                <hint>
391
                    Provide a sample of the actual lines you would add to a module manifest
392
                    to declare a dependency, for example OpenIDE-Module-Requires: some.token.
393
                    If other modules should not depend on this module, or should just use a
394
                    simple regular module dependency, you can just answer "nothing". If you
395
                    intentionally expose a semistable API to clients using implementation
396
                    dependencies, you should mention that here (but there is no need to give
397
                    an example of usage).
398
                </hint>
399
            </question>
400
    -->
401
    <answer id="deploy-dependencies">
402
        <p>
403
            Standard module dependency is sufficient.
404
        </p>
405
    </answer>
406
407
408
409
    <!--
410
        <question id="deploy-jar" when="impl">
411
            Do you deploy just module JAR file(s) or other files as well?
412
            <hint>
413
            Usually a module consist of one JAR file (perhaps with Class-Path
414
            extensions) and also a configuration file that enables it. If you
415
            have any other files, use
416
            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
417
            to define the location, name and stability of your files (of course
418
            changing "yourname" and "friend" to suit your needs).
419
420
                If it uses more than one JAR, describe where they are located, how
421
                they refer to each other.
422
                If it consist of module JAR(s) and other files, please describe
423
                what is their purpose, why other files are necessary. Please
424
                make sure that installation/uninstallation leaves the system
425
                in state as it was before installation.
426
                </hint>
427
            </question>
428
    -->
429
    <answer id="deploy-jar">
430
        <p>
431
            Just module JAR.
432
        </p>
433
    </answer>
434
435
436
437
    <!--
438
            <question id="deploy-nbm" when="impl">
439
                Can you deploy an NBM via the Update Center?
440
                <hint>
441
                If not why?
442
                </hint>
443
            </question>
444
    -->
445
    <answer id="deploy-nbm">
446
        <p>
447
            Yes.
448
        </p>
449
    </answer>
450
451
452
453
<!--
454
        <question id="deploy-packages" when="init">
455
            Are packages of your module made inaccessible by not declaring them
456
            public?
457
458
                <hint>
459
                By default NetBeans build harness treats all packages are private.
460
                If you export some of them - either as public or friend packages,
461
                you should have a reason. If the reason is described elsewhere
462
                in this document, you can ignore this question.
463
                </hint>
464
            </question>
465
    -->
466
    <answer id="deploy-packages">
467
        <p>
468
            Only API and SPI packages are public.
469
        </p>
470
    </answer>
471
472
473
474
    <!--
475
            <question id="deploy-shared" when="final">
476
                Do you need to be installed in the shared location only, or in the user directory only,
477
                or can your module be installed anywhere?
478
                <hint>
479
                Installation location shall not matter, if it does explain why.
480
                Consider also whether <code>InstalledFileLocator</code> can help.
481
                </hint>
482
            </question>
483
    -->
484
    <answer id="deploy-shared">
485
        <p>
486
            Installation location does not matter.
487
        </p>
488
    </answer>
489
490
491
492
    <!--
493
        <question id="exec-ant-tasks" when="impl">
494
            Do you define or register any ant tasks that other can use?
495
496
                <hint>
497
                If you provide an ant task that users can use, you need to be very
498
                careful about its syntax and behaviour, as it most likely forms an
499
                      API for end users and as there is a lot of end users, their reaction
500
                when such API gets broken can be pretty strong.
501
                </hint>
502
            </question>
503
    -->
504
    <answer id="exec-ant-tasks">
505
        <p>
506
            No.
507
        </p>
508
    </answer>
509
510
511
512
    <!--
513
            <question id="exec-classloader" when="impl">
514
                Does your code create its own class loader(s)?
515
                <hint>
516
                A bit unusual. Please explain why and what for.
517
                </hint>
518
            </question>
519
    -->
520
    <answer id="exec-classloader">
521
        <p>
522
            No.
523
        </p>
524
    </answer>
525
526
527
528
    <!--
529
        <question id="exec-component" when="impl">
530
            Is execution of your code influenced by any (string) property
531
            of any of your components?
532
533
                <hint>
534
                Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
535
                or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
536
                a behavior of some code. This of course forms an interface that should
537
                be documented. Also if one depends on some interface that an object
538
                implements (<code>component instanceof Runnable</code>) that forms an
539
                API as well.
540
                </hint>
541
            </question>
542
    -->
543
    <answer id="exec-component">
544
        <p>
545
            No.
546
        </p>
547
    </answer>
548
549
550
551
    <!--
552
            <question id="exec-introspection" when="impl">
553
                Does your module use any kind of runtime type information (<code>instanceof</code>,
554
                work with <code>java.lang.Class</code>, etc.)?
555
                <hint>
556
                Check for cases when you have an object of type A and you also
557
                expect it to (possibly) be of type B and do some special action. That
558
                should be documented. The same applies on operations in meta-level
559
                (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
560
                </hint>
561
            </question>
562
    -->
563
    <answer id="exec-introspection">
564
        <p>
565
            No.
566
        </p>
567
    </answer>
568
569
570
571
    <!--
572
            <question id="exec-privateaccess" when="final">
573
                Are you aware of any other parts of the system calling some of
574
                your methods by reflection?
575
                <hint>
576
                If so, describe the "contract" as an API. Likely private or friend one, but
577
                still API and consider rewrite of it.
578
                </hint>
579
            </question>
580
    -->
581
    <answer id="exec-privateaccess">
582
        <p>
583
            No.
584
        </p>
585
    </answer>
586
587
588
589
    <!--
590
            <question id="exec-process" when="impl">
591
                Do you execute an external process from your module? How do you ensure
592
                that the result is the same on different platforms? Do you parse output?
593
                Do you depend on result code?
594
                <hint>
595
                If you feed an input, parse the output please declare that as an API.
596
                </hint>
597
            </question>
598
    -->
599
    <answer id="exec-process">
600
        <p>
601
            No.
602
        </p>
603
    </answer>
604
605
606
607
    <!--
608
            <question id="exec-property" when="impl">
609
                Is execution of your code influenced by any environment or
610
                Java system (<code>System.getProperty</code>) property?
611
                On a similar note, is there something interesting that you
612
                pass to <code>java.util.logging.Logger</code>? Or do you observe
613
                what others log?
614
                <hint>
615
                If there is a property that can change the behavior of your
616
                code, somebody will likely use it. You should describe what it does
617
                and the <a href="http://wiki.netbeans.org/API_Stability">stability category</a>
618
                of this API. You may use
619
                <pre>
620
                    &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
621
                        description of the property, where it is used, what it influence, etc.
622
                    &lt;/api&gt;
623
                </pre>
624
                </hint>
625
            </question>
626
    -->
627
    <answer id="exec-property">
628
        <p>
629
            No.
630
        </p>
631
    </answer>
632
633
634
635
    <!--
636
            <question id="exec-reflection" when="impl">
637
                Does your code use Java Reflection to execute other code?
638
                <hint>
639
                This usually indicates a missing or insufficient API in the other
640
                part of the system. If the other side is not aware of your dependency
641
                this contract can be easily broken.
642
                </hint>
643
            </question>
644
    -->
645
    <answer id="exec-reflection">
646
        <p>
647
            No.
648
        </p>
649
    </answer>
650
651
652
653
    <!--
654
            <question id="exec-threading" when="init">
655
                What threading models, if any, does your module adhere to? How the
656
                project behaves with respect to threading?
657
                <hint>
658
                    Is your API threadsafe? Can it be accessed from any threads or
659
                    just from some dedicated ones? Any special relation to AWT and
660
                    its Event Dispatch thread? Also
661
                    if your module calls foreign APIs which have a specific threading model,
662
                    indicate how you comply with the requirements for multithreaded access
663
                    (synchronization, mutexes, etc.) applicable to those APIs.
664
                    If your module defines any APIs, or has complex internal structures
665
                    that might be used from multiple threads, declare how you protect
666
                    data against concurrent access, race conditions, deadlocks, etc.,
667
                    and whether such rules are enforced by runtime warnings, errors, assertions, etc.
668
                    Examples: a class might be non-thread-safe (like Java Collections); might
669
                    be fully thread-safe (internal locking); might require access through a mutex
670
                    (and may or may not automatically acquire that mutex on behalf of a client method);
671
                    might be able to run only in the event queue; etc.
672
                    Also describe when any events are fired: synchronously, asynchronously, etc.
673
                    Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
674
                </hint>
675
            </question>
676
    -->
677
    <answer id="exec-threading">
678
        <p>
679
            The API is threadsafe. SPI implementations should ensure proper
680
            synchronization.
681
        </p>
682
    </answer>
683
684
685
686
    <!--
687
        <question id="format-clipboard" when="impl">
688
            Which data flavors (if any) does your code read from or insert to
689
            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
690
691
                <hint>
692
                Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
693
                Check your code for overriding these methods.
694
                </hint>
695
            </question>
696
    -->
697
    <answer id="format-clipboard">
698
        <p>
699
            No clipboard access.
700
        </p>
701
    </answer>
702
703
704
705
    <!--
706
            <question id="format-dnd" when="impl">
707
                Which protocols (if any) does your code understand during Drag &amp; Drop?
708
                <hint>
709
                Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>.
710
                Check your code for overriding these methods. Btw. if they are not overridden, they
711
                by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
712
                </hint>
713
            </question>
714
    -->
715
    <answer id="format-dnd">
716
        <p>
717
            No Drag &amp; Drop support.
718
        </p>
719
    </answer>
720
721
722
723
<!--
724
        <question id="format-types" when="impl">
725
            Which protocols and file formats (if any) does your module read or write on disk,
726
            or transmit or receive over the network? Do you generate an ant build script?
727
            Can it be edited and modified?
728
729
            <hint>
730
                <p>
731
                Files can be read and written by other programs, modules and users. If they influence
732
                your behaviour, make sure you either document the format or claim that it is a private
733
                api (using the &lt;api&gt; tag).
734
                </p>
735
                <p>
736
                If you generate an ant build file, this is very likely going to be seen by end users and
737
                they will be attempted to edit it. You should be ready for that and provide here a link
738
                to documentation that you have for such purposes and also describe how you are going to
739
                understand such files during next release, when you (very likely) slightly change the
740
                format.
741
                </p>
742
                </hint>
743
            </question>
744
    -->
745
    <answer id="format-types">
746
        <p>
747
            No files are read or written by this module.
748
        </p>
749
    </answer>
750
751
752
753
<!--
754
        <question id="lookup-lookup" when="init">
755
            Does your module use <code>org.openide.util.Lookup</code>
756
            or any similar technology to find any components to communicate with? Which ones?
757
758
                <hint>
759
                NetBeans is build around a generic registry of services called
760
                lookup. It is preferable to use it for registration and discovery
761
                if possible. See
762
                <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html">
763
                The Solution to Comunication Between Components
764
                </a>. If you do not plan to use lookup and insist usage
765
                of other solution, then please describe why it is not working for
766
                you.
767
                <br/>
768
                When filling the final version of your arch document, please
769
                describe the interfaces you are searching for, where
770
                are defined, whether you are searching for just one or more of them,
771
                if the order is important, etc. Also classify the stability of such
772
                API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
773
                your information gets listed in the summary page of your javadoc.
774
                </hint>
775
            </question>
776
    -->
777
    <answer id="lookup-lookup">
778
        <p>
779
            No.
780
        </p>
781
    </answer>
782
783
784
785
    <!--
786
            <question id="lookup-register" when="final">
787
                Do you register anything into lookup for other code to find?
788
                <hint>
789
                Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
790
                Who is supposed to find your component?
791
                </hint>
792
            </question>
793
    -->
794
    <answer id="lookup-register">
795
        <p>
796
            The annotation processor is registered using ServiceProvider.
797
        </p>
798
    </answer>
799
800
801
802
    <!--
803
            <question id="lookup-remove" when="final">
804
                Do you remove entries of other modules from lookup?
805
                <hint>
806
                Why? Of course, that is possible, but it can be dangerous. Is the module
807
                your are masking resource from aware of what you are doing?
808
                </hint>
809
            </question>
810
    -->
811
    <answer id="lookup-remove">
812
        <p>
813
            No.
814
        </p>
815
    </answer>
816
817
818
819
    <!--
820
            <question id="perf-exit" when="final">
821
                Does your module run any code on exit?
822
            </question>
823
    -->
824
    <answer id="perf-exit">
825
        <p>
826
            No.
827
        </p>
828
    </answer>
829
830
831
832
    <!--
833
            <question id="perf-huge_dialogs" when="final">
834
                Does your module contain any dialogs or wizards with a large number of
835
                GUI controls such as combo boxes, lists, trees, or text areas?
836
            </question>
837
    -->
838
    <answer id="perf-huge_dialogs">
839
        <p>
840
            No.
841
        </p>
842
    </answer>
843
844
845
846
    <!--
847
            <question id="perf-limit" when="init">
848
                Are there any hard-coded or practical limits in the number or size of
849
                elements your code can handle?
850
                <hint>
851
                    Most of algorithms have increasing memory and speed complexity
852
                    with respect to size of data they operate on. What is the critical
853
                    part of your project that can be seen as a bottleneck with
854
                    respect to speed or required memory? What are the practical
855
                    sizes of data you tested your project with? What is your estimate
856
                    of potential size of data that would cause visible performance
857
                    problems? Is there some kind of check to detect such situation
858
                    and prevent "hard" crashes - for example the CloneableEditorSupport
859
                    checks for size of a file to be opened in editor
860
                    and if it is larger than 1Mb it shows a dialog giving the
861
                    user the right to decide - e.g. to cancel or commit suicide.
862
                </hint>
863
            </question>
864
    -->
865
    <answer id="perf-limit">
866
        <p>
867
            No.
868
        </p>
869
    </answer>
870
871
872
873
    <!--
874
            <question id="perf-mem" when="final">
875
                How much memory does your component consume? Estimate
876
                with a relation to the number of windows, etc.
877
            </question>
878
    -->
879
    <answer id="perf-mem">
880
        <p>
881
            Very little memory consumed.
882
        </p>
883
    </answer>
884
885
886
887
    <!--
888
            <question id="perf-menus" when="final">
889
                Does your module use dynamically updated context menus, or
890
                context-sensitive actions with complicated and slow enablement logic?
891
                <hint>
892
                    If you do a lot of tricks when adding actions to regular or context menus, you can significantly
893
                    slow down display of the menu, even when the user is not using your action. Pay attention to
894
                    actions you add to the main menu bar, and to context menus of foreign nodes or components. If
895
                    the action is conditionally enabled, or changes its display dynamically, you need to check the
896
                    impact on performance. In some cases it may be more appropriate to make a simple action that is
897
                    always enabled but does more detailed checks in a dialog if it is actually run.
898
                </hint>
899
            </question>
900
    -->
901
    <answer id="perf-menus">
902
        <p>
903
            No.
904
        </p>
905
    </answer>
906
907
908
909
    <!--
910
        <question id="perf-progress" when="final">
911
            Does your module execute any long-running tasks?
912
913
                <hint>Long running tasks should never block
914
                AWT thread as it badly hurts the UI
915
                <a href="http://performance.netbeans.org/responsiveness/issues.html">
916
                responsiveness</a>.
917
                Tasks like connecting over
918
                network, computing huge amount of data, compilation
919
                be done asynchronously (for example
920
                using <code>RequestProcessor</code>), definitively it should
921
                not block AWT thread.
922
                </hint>
923
            </question>
924
    -->
925
    <answer id="perf-progress">
926
        <p>
927
            No.
928
        </p>
929
    </answer>
930
931
932
933
    <!--
934
            <question id="perf-scale" when="init">
935
                Which external criteria influence the performance of your
936
                program (size of file in editor, number of files in menu,
937
                in source directory, etc.) and how well your code scales?
938
                <hint>
939
                Please include some estimates, there are other more detailed
940
                questions to answer in later phases of implementation.
941
                </hint>
942
            </question>
943
    -->
944
    <answer id="perf-scale">
945
        <p>
946
            Code in the module is very simple. Performance is incluenced mosly
947
            by SPI implementations, which should run quite quickly.
948
        </p>
949
    </answer>
950
951
952
953
    <!--
954
            <question id="perf-spi" when="init">
955
                How the performance of the plugged in code will be enforced?
956
                <hint>
957
                If you allow foreign code to be plugged into your own module, how
958
                do you enforce that it will behave correctly and quickly and will not
959
                negatively influence the performance of your own module?
960
                </hint>
961
            </question>
962
    -->
963
    <answer id="perf-spi">
964
        <p>
965
            No performance criteria are enforced. The plugged-in code is invoked
966
            by a dedicated executor.
967
        </p>
968
    </answer>
969
970
971
972
    <!--
973
            <question id="perf-startup" when="final">
974
                Does your module run any code on startup?
975
            </question>
976
    -->
977
    <answer id="perf-startup">
978
        <p>
979
            No.
980
        </p>
981
    </answer>
982
983
984
985
    <!--
986
            <question id="perf-wakeup" when="final">
987
                Does any piece of your code wake up periodically and do something
988
                even when the system is otherwise idle (no user interaction)?
989
            </question>
990
    -->
991
    <answer id="perf-wakeup">
992
        <p>
993
            No.
994
        </p>
995
    </answer>
996
997
998
999
    <!--
1000
        <question id="resources-file" when="final">
1001
            Does your module use <code>java.io.File</code> directly?
1002
1003
                <hint>
1004
                NetBeans provide a logical wrapper over plain files called
1005
                <code>org.openide.filesystems.FileObject</code> that
1006
                provides uniform access to such resources and is the preferred
1007
                way that should be used. But of course there can be situations when
1008
                this is not suitable.
1009
                </hint>
1010
            </question>
1011
    -->
1012
    <answer id="resources-file">
1013
        <p>
1014
            No.
1015
        </p>
1016
    </answer>
1017
1018
1019
1020
    <!--
1021
        <question id="resources-layer" when="final">
1022
            Does your module provide own layer? Does it create any files or
1023
            folders in it? What it is trying to communicate by that and with which
1024
            components?
1025
1026
                <hint>
1027
                NetBeans allows automatic and declarative installation of resources
1028
                by module layers. Module register files into appropriate places
1029
                and other components use that information to perform their task
1030
                (build menu, toolbar, window layout, list of templates, set of
1031
                options, etc.).
1032
                </hint>
1033
            </question>
1034
    -->
1035
    <answer id="resources-layer">
1036
        <p>
1037
            No.
1038
        </p>
1039
    </answer>
1040
1041
1042
1043
    <!--
1044
        <question id="resources-mask" when="final">
1045
            Does your module mask/hide/override any resources provided by other modules in
1046
            their layers?
1047
1048
                <hint>
1049
                If you mask a file provided by another module, you probably depend
1050
                on that and do not want the other module to (for example) change
1051
                the file's name. That module shall thus make that file available as an API
1052
                of some stability category.
1053
                </hint>
1054
            </question>
1055
    -->
1056
    <answer id="resources-mask">
1057
        <p>
1058
            No.
1059
        </p>
1060
    </answer>
1061
1062
1063
1064
    <!--
1065
            <question id="resources-preferences" when="final">
1066
                Does your module uses preferences via Preferences API? Does your module use NbPreferences or
1067
                or regular JDK Preferences ? Does it read, write or both ?
1068
                Does it share preferences with other modules ? If so, then why ?
1069
                <hint>
1070
                    You may use
1071
                        &lt;api type="export" group="preferences"
1072
                        name="preference node name" category="private"&gt;
1073
                        description of individual keys, where it is used, what it
1074
                        influences, whether the module reads/write it, etc.
1075
                        &lt;/api&gt;
1076
                    Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
1077
                    Note that if you use NbPreferences this name will then be the same as the code name base of the module.
1078
                </hint>
1079
            </question>
1080
    -->
1081
    <answer id="resources-preferences">
1082
        <p>
1083
            No.
1084
        </p>
1085
    </answer>
1086
1087
1088
1089
    <!--
1090
        <question id="resources-read" when="final">
1091
            Does your module read any resources from layers? For what purpose?
1092
1093
                <hint>
1094
                As this is some kind of intermodule dependency, it is a kind of API.
1095
                Please describe it and classify according to
1096
                <a href="http://wiki.netbeans.org/API_Design#What_is_an_API.3F">
1097
                common stability categories</a>.
1098
                </hint>
1099
            </question>
1100
    -->
1101
    <answer id="resources-read">
1102
        <p>
1103
            No.
1104
        </p>
1105
    </answer>
1106
1107
1108
1109
    <!--
1110
            <question id="security-grant" when="final">
1111
                Does your code grant additional rights to some other code?
1112
                <hint>Avoid using a class loader that adds extra
1113
                permissions to loaded code unless really necessary.
1114
                Also note that your API implementation
1115
                can also expose unneeded permissions to enemy code by
1116
                calling AccessController.doPrivileged().</hint>
1117
            </question>
1118
    -->
1119
    <answer id="security-grant">
1120
        <p>
1121
            No.
1122
        </p>
1123
    </answer>
1124
1125
1126
1127
    <!--
1128
            <question id="security-policy" when="final">
1129
                Does your functionality require modifications to the standard policy file?
1130
                <hint>Your code might pass control to third-party code not
1131
                coming from trusted domains. This could be code downloaded over the
1132
                network or code coming from libraries that are not bundled
1133
                with NetBeans. Which permissions need to be granted to which domains?</hint>
1134
            </question>
1135
    -->
1136
    <answer id="security-policy">
1137
        <p>
1138
            No.
1139
        </p>
1140
    </answer>
1141
1142
</api-answers>
(-)a/api.intent/build.xml (+5 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project basedir="." default="netbeans" name="api.intent">
3
    <description>Builds, tests, and runs the project org.netbeans.api.intent</description>
4
    <import file="../nbbuild/templates/projectized.xml"/>
5
</project>
(-)a/api.intent/manifest.mf (+6 lines)
Line 0 Link Here
1
Manifest-Version: 1.0
2
AutoUpdate-Show-In-Client: true
3
OpenIDE-Module: org.netbeans.api.intent
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/intent/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.0
6
(-)a/api.intent/nbproject/project.properties (+4 lines)
Line 0 Link Here
1
is.autoload=true
2
javac.source=1.7
3
javac.compilerargs=-Xlint -Xlint:-serial
4
javadoc.arch=${basedir}/arch.xml
(-)a/api.intent/nbproject/project.xml (+61 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6
            <code-name-base>org.netbeans.api.intent</code-name-base>
7
            <module-dependencies>
8
                <dependency>
9
                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.25</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
18
                    <code-name-base>org.openide.filesystems</code-name-base>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
21
                    <run-dependency>
22
                        <specification-version>9.1</specification-version>
23
                    </run-dependency>
24
                </dependency>
25
                <dependency>
26
                    <code-name-base>org.openide.util</code-name-base>
27
                    <build-prerequisite/>
28
                    <compile-dependency/>
29
                    <run-dependency>
30
                        <specification-version>9.3</specification-version>
31
                    </run-dependency>
32
                </dependency>
33
                <dependency>
34
                    <code-name-base>org.openide.util.lookup</code-name-base>
35
                    <build-prerequisite/>
36
                    <compile-dependency/>
37
                    <run-dependency>
38
                        <specification-version>8.26</specification-version>
39
                    </run-dependency>
40
                </dependency>
41
            </module-dependencies>
42
            <test-dependencies>
43
                <test-type>
44
                    <name>unit</name>
45
                    <test-dependency>
46
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
47
                        <compile-dependency/>
48
                    </test-dependency>
49
                    <test-dependency>
50
                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
51
                        <compile-dependency/>
52
                    </test-dependency>
53
                </test-type>
54
            </test-dependencies>
55
            <public-packages>
56
                <package>org.netbeans.api.intent</package>
57
                <package>org.netbeans.spi.intent</package>
58
            </public-packages>
59
        </data>
60
    </configuration>
61
</project>
(-)a/api.intent/src/org/netbeans/api/intent/Bundle.properties (+7 lines)
Line 0 Link Here
1
OpenIDE-Module-Display-Category=Infrastructure
2
OpenIDE-Module-Long-Description=\
3
    API for invoking intended operations (described by suitable type of object, e.g. \
4
    URI) by some of registered handlers.\n\
5
    SPI for handlers of possible intended operations.
6
OpenIDE-Module-Name=Intent API
7
OpenIDE-Module-Short-Description=Performing intended operations by suitable handlers
(-)a/api.intent/src/org/netbeans/api/intent/Intent.java (+222 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.api.intent;
43
44
import java.lang.reflect.InvocationTargetException;
45
import java.net.URI;
46
import java.util.Arrays;
47
import java.util.List;
48
import java.util.SortedSet;
49
import java.util.TreeSet;
50
import java.util.concurrent.Callable;
51
import java.util.concurrent.ExecutionException;
52
import java.util.concurrent.Future;
53
import java.util.logging.Level;
54
import java.util.logging.Logger;
55
import java.util.regex.Pattern;
56
import org.netbeans.modules.intent.IntentHandler;
57
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileUtil;
59
60
/**
61
 *
62
 * @author jhavlin
63
 */
64
public final class Intent {
65
66
    private static final Logger LOG = Logger.getLogger(Intent.class.getName());
67
68
    public static final String ACTION_VIEW
69
            = "org.netbeans.api.intent.Intent.ACTION_VIEW";             //NOI18N
70
71
    public static final String ACTION_EDIT
72
            = "org.netbeans.api.intent.Intent.ACTION_EDIT";             //NOI18N
73
74
    private final String action;
75
    private final URI uri;
76
77
    /**
78
     * Constructor for an intended operation.
79
     *
80
     * @param action Action to perform, see {@link #ACTION_EDIT} or
81
     * {@link #ACTION_VIEW}.
82
     * @param uri URI specifying the operation.
83
     */
84
    public Intent(String action, URI uri) {
85
        this.action = action;
86
        this.uri = uri;
87
    }
88
89
    /**
90
     * Get action id as string.
91
     *
92
     * @return The action.
93
     */
94
    public String getAction() {
95
        return action;
96
    }
97
98
    /**
99
     * Get URI specifying this intent.
100
     *
101
     * @return The URI.
102
     */
103
    public URI getUri() {
104
        return uri;
105
    }
106
107
    /**
108
     * Submit an intent to an internal executor.
109
     *
110
     * @return {@link Future} object of the submitted task.
111
     */
112
    public Future<Object> execute() {
113
        return IntentHandler.RP.submit(new Callable<Object>() {
114
115
            @Override
116
            public Object call() throws Exception {
117
                return invoke(Intent.this);
118
            }
119
        });
120
    }
121
122
    /**
123
     * Get all handlers that can execute the passed intent.
124
     *
125
     * @return The set of available handlers, sorted by priority.
126
     */
127
    public SortedSet<IntentAction> getIntentActions() {
128
        SortedSet<IntentHandler> intentHandlers = getIntentHandlers(this);
129
        SortedSet<IntentAction> actions = new TreeSet<>();
130
        for (IntentHandler ih : intentHandlers) {
131
            actions.add(new IntentAction(this, ih));
132
        }
133
        return actions;
134
    }
135
136
    private static SortedSet<IntentHandler> getIntentHandlers(
137
            Intent intent) {
138
139
        FileObject f = FileUtil.getConfigFile("Services/Intent/Handlers");
140
        if (f == null) {
141
            return null;
142
        }
143
        SortedSet<IntentHandler> candidates = new TreeSet<>();
144
        for (FileObject fo : f.getChildren()) {
145
            if ("instance".equals(fo.getExt())) {
146
                Object pattern = fo.getAttribute("uriPattern");
147
                Object displayName = fo.getAttribute("displayName");
148
                Object position = fo.getAttribute("position");
149
                Object actions = fo.getAttribute("actions");
150
                if (pattern instanceof String && displayName instanceof String
151
                        && position instanceof Integer
152
                        && actions instanceof String) {
153
                    if (canSupport((String) pattern, (String) actions, intent)) {
154
                        try {
155
                            IntentHandler ih = FileUtil.getConfigObject(
156
                                    fo.getPath(), IntentHandler.class);
157
                            candidates.add(ih);
158
                        } catch (Exception e) {
159
                            LOG.log(Level.INFO,
160
                                    "Cannot instantiate handler for " //NOI18N
161
                                    + fo.getPath(), e);
162
                        }
163
                    }
164
                } else {
165
                    LOG.log(Level.FINE, "Invalid URI handler {0}", fo.getPath());
166
                }
167
            }
168
        }
169
        return candidates;
170
    }
171
172
    /**
173
     * Check whether an intent is supported by a handler specified by a URI
174
     * pattern and action list.
175
     *
176
     * @param uriPattern Pattern for the URI.
177
     * @param actions Comma-separated actions.
178
     * @param intent Intent to check.
179
     * @return True if the intent matches the URI pattern and action list.
180
     */
181
    private static boolean canSupport(String uriPattern, String actions,
182
            Intent intent) {
183
        Pattern p = Pattern.compile(uriPattern);
184
        if (p.matcher(intent.getUri().toString()).matches()) {
185
            if ("*".equals(actions)) {
186
                return true;
187
            } else {
188
                List<String> actionList = Arrays.asList(actions.split(","));
189
                return actionList.contains(intent.getAction());
190
            }
191
        } else {
192
            return false;
193
        }
194
    }
195
196
    private static Object invoke(Intent intent) {
197
198
        for (IntentHandler h : getIntentHandlers(intent)) {
199
            try {
200
                if (h.returnsFuture()) {
201
                    Object result = h.handle(intent);
202
                    if (result instanceof Future<?>) {
203
                        try {
204
                            return ((Future<?>) result).get();
205
                        } catch (InterruptedException | ExecutionException ex) {
206
                            LOG.log(Level.INFO, null, ex);
207
                        }
208
                    } else {
209
                        LOG.log(Level.WARNING, "Intent handler {0}"     //NOI18N
210
                                + " should return a Future", h);        //NOI18N
211
                    }
212
                } else {
213
                    return h.handle(intent);
214
                }
215
            } catch (ClassNotFoundException | NoSuchMethodException
216
                    | IllegalAccessException | InvocationTargetException ex) {
217
                LOG.log(Level.INFO, null, ex);
218
            }
219
        }
220
        return null;
221
    }
222
}
(-)a/api.intent/src/org/netbeans/api/intent/IntentAction.java (+115 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.api.intent;
43
44
import java.lang.reflect.InvocationTargetException;
45
import java.util.concurrent.Callable;
46
import java.util.concurrent.Future;
47
import org.netbeans.modules.intent.IntentHandler;
48
49
/**
50
 * IntentAction for an Intent.
51
 *
52
 * @see Intent#getIntentActions()
53
 * @author jhavlin
54
 */
55
public final class IntentAction implements Comparable<IntentAction> {
56
57
    private final Intent intent;
58
    private final IntentHandler delegate;
59
60
    IntentAction(Intent intent, IntentHandler delegate) {
61
        this.intent = intent;
62
        this.delegate = delegate;
63
    }
64
65
    int getPosition() {
66
        return delegate.getPosition();
67
    }
68
69
    /**
70
     * Handle the intent with this handler.
71
     *
72
     * @return Some return value, depends on implementation.
73
     */
74
    @SuppressWarnings("unchecked")
75
    public Future<Object> execute() {
76
        if (delegate.returnsFuture()) {
77
            Object result;
78
            try {
79
                result = delegate.handle(intent);
80
            } catch (ClassNotFoundException | NoSuchMethodException
81
                    | IllegalAccessException | InvocationTargetException e) {
82
                throw new RuntimeException("Cannot execute handler "    //NOI18N
83
                        + getDisplayName() + " for " + intent, e);      //NOI18N
84
            }
85
            if (result instanceof Future<?>) {
86
                return (Future<Object>) result;
87
            } else {
88
                throw new IllegalStateException("The Intent handler "   //NOI18N
89
                        + "should return Future object");               //NOI18N
90
            }
91
        } else {
92
            return IntentHandler.RP.submit(new Callable<Object>() {
93
94
                @Override
95
                public Object call() throws Exception {
96
                    return delegate.handle(intent);
97
                }
98
            });
99
        }
100
    }
101
102
    /**
103
     * Get display name of this handler.
104
     *
105
     * @return The localized display name.
106
     */
107
    public String getDisplayName() {
108
        return delegate.getDisplayName();
109
    }
110
111
    @Override
112
    public int compareTo(IntentAction other) {
113
        return getPosition() - other.getPosition();
114
    }
115
}
(-)a/api.intent/src/org/netbeans/modules/intent/IntentHandler.java (+133 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.intent;
43
44
import java.lang.reflect.InvocationTargetException;
45
import java.lang.reflect.Method;
46
import org.netbeans.api.intent.Intent;
47
import org.openide.filesystems.FileObject;
48
import org.openide.util.Lookup;
49
import org.openide.util.RequestProcessor;
50
51
/**
52
 *
53
 * @author jhavlin
54
 */
55
public class IntentHandler implements Comparable<IntentHandler> {
56
57
    public static final RequestProcessor RP = new RequestProcessor(
58
            IntentHandler.class);
59
60
    @Override
61
    public int compareTo(IntentHandler o) {
62
        return this.getPosition() - o.getPosition();
63
    }
64
65
    private enum Type {
66
        OBJECT, FUTURE
67
    }
68
69
    private final String className;
70
    private final String methodName;
71
    private final String displayName;
72
    private final String icon;
73
    private final Type type;
74
    private final int position;
75
76
    public static IntentHandler create(FileObject fo) {
77
        String n = fo.getName();
78
        int lastDash = n.lastIndexOf('-');
79
        if (lastDash <= 0 || lastDash + 1 >= n.length()) {
80
            throw new IllegalArgumentException("Invalid handler file"); //NOI18N
81
        }
82
        String className = n.substring(0, lastDash).replace('-', '.');
83
        String methodName = n.substring(lastDash + 1);
84
        String displayName = (String) fo.getAttribute("displayName");   //NOI18N
85
        String icon = (String) fo.getAttribute("icon");                 //NOI18N
86
        int position = (Integer) fo.getAttribute("position");           //NOI18N
87
        Type type = Type.valueOf((String) fo.getAttribute("type"));     //NOI18N
88
89
        return new IntentHandler(className, methodName, displayName, icon,
90
                type, position);
91
    }
92
93
    private IntentHandler(String className, String methodName,
94
            String displayName, String icon, Type type, int position) {
95
96
        this.className = className;
97
        this.methodName = methodName;
98
        this.displayName = displayName;
99
        this.icon = icon;
100
        this.type = type;
101
        this.position = position;
102
    }
103
104
    public String getDisplayName() {
105
        return displayName;
106
    }
107
108
    public String getIcon() {
109
        return icon;
110
    }
111
112
    public int getPosition() {
113
        return position;
114
    }
115
116
    public boolean returnsFuture() {
117
        return type == Type.FUTURE;
118
    }
119
120
    public Object handle(Intent intent) throws ClassNotFoundException,
121
            NoSuchMethodException, IllegalAccessException,
122
            InvocationTargetException {
123
124
        ClassLoader cls = Lookup.getDefault().lookup(ClassLoader.class);
125
        if (cls == null) {
126
            throw new IllegalStateException("Classloader not found");   //NOI18N
127
        } else {
128
            Class<?> c = Class.forName(className, true, cls);
129
            Method m = c.getDeclaredMethod(methodName, Intent.class);
130
            return m.invoke(null, intent);
131
        }
132
    }
133
}
(-)a/api.intent/src/org/netbeans/modules/intent/OpenUriHandlerProcessor.java (+202 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.intent;
43
44
import java.util.Set;
45
import java.util.concurrent.Future;
46
import javax.annotation.processing.Processor;
47
import javax.annotation.processing.RoundEnvironment;
48
import javax.annotation.processing.SupportedAnnotationTypes;
49
import javax.annotation.processing.SupportedSourceVersion;
50
import javax.lang.model.SourceVersion;
51
import javax.lang.model.element.Element;
52
import javax.lang.model.element.ElementKind;
53
import javax.lang.model.element.ExecutableElement;
54
import javax.lang.model.element.Modifier;
55
import javax.lang.model.element.TypeElement;
56
import javax.lang.model.type.TypeMirror;
57
import org.netbeans.api.intent.Intent;
58
import org.netbeans.spi.intent.IntentHandlerRegistration;
59
import org.openide.filesystems.annotations.LayerBuilder;
60
import org.openide.filesystems.annotations.LayerBuilder.File;
61
import org.openide.filesystems.annotations.LayerGeneratingProcessor;
62
import org.openide.filesystems.annotations.LayerGenerationException;
63
import org.openide.util.lookup.ServiceProvider;
64
65
/**
66
 *
67
 * @author jhavlin
68
 */
69
@ServiceProvider(service = Processor.class)
70
@SupportedSourceVersion(SourceVersion.RELEASE_7)
71
@SupportedAnnotationTypes("org.netbeans.spi.intent.IntentHandlerRegistration")
72
public class OpenUriHandlerProcessor extends LayerGeneratingProcessor {
73
74
    @Override
75
    protected boolean handleProcess(
76
            Set<? extends TypeElement> annotations,
77
            RoundEnvironment roundEnv) throws LayerGenerationException {
78
79
        for (Element e : roundEnv.getElementsAnnotatedWith(
80
                IntentHandlerRegistration.class)) {
81
            IntentHandlerRegistration r = e.getAnnotation(
82
                    IntentHandlerRegistration.class);
83
            registerHandler(e, r);
84
        }
85
        return true;
86
    }
87
88
    private static final String SUFFIX = ".instance";                   //NOI18N
89
90
    private void registerHandler(Element e, IntentHandlerRegistration r)
91
            throws LayerGenerationException {
92
93
        TypeElement intentTypeElement = getTypeElement(Intent.class);
94
        TypeElement objectTypeElement = getTypeElement(Object.class);
95
        TypeElement futureTypeElement = getTypeElement(Future.class);
96
97
        if (!ElementKind.METHOD.equals(e.getKind())) {
98
            throw error(e, "The annotation can be applied only to"      //NOI18N
99
                    + " a method.");//NOI18N
100
        }
101
        if (!e.getModifiers().contains(Modifier.STATIC)) {
102
            throw error(e, "The annotated method must be static.");     //NOI18N
103
        }
104
105
        ExecutableElement ee;
106
        if (e instanceof ExecutableElement) {
107
            ee = (ExecutableElement) e;
108
        } else {
109
            throw error(e, "Annotated element must be an "              //NOI18N
110
                    + "ExecutableElement");                             //NOI18N
111
112
        }
113
114
        if (!(ee.getParameters().size() == 1
115
                && processingEnv.getTypeUtils().asElement(
116
                        ee.getParameters().get(0).asType()).equals(
117
                        intentTypeElement))) {
118
            throw error(e, "The registered handler method must take a " //NOI18N
119
                    + "single argument of type " //NOI18N
120
                    + "org.netbeans.api.intent.Intent.");               //NOI18N
121
122
        }
123
        TypeMirror returnType = ee.getReturnType();
124
        Element returnTypeElement = processingEnv.getTypeUtils().asElement(
125
                returnType);
126
        if (!(returnTypeElement.equals(objectTypeElement)
127
                || returnTypeElement.equals(futureTypeElement))) {
128
129
        }
130
131
        String type;
132
        if (returnTypeElement.equals(objectTypeElement)) {
133
            type = "OBJECT";                                            //NOI18N
134
        } else if (returnTypeElement.equals(futureTypeElement)) {
135
            type = "FUTURE";                                            //NOI18N
136
        } else {
137
            throw error(e, "The registered handler method must return " //NOI18N
138
                    + objectTypeElement + " or "                        //NOI18N
139
                    + futureTypeElement + ".");                         //NOI18N
140
        }
141
142
        boolean takeAll = false;
143
        boolean empty = true;
144
        StringBuilder sb = new StringBuilder();
145
        for (String action: r.actions()) {
146
            if ("*".equals(action)) {
147
                takeAll = true;
148
                break;
149
            } else {
150
                if (!empty) {
151
                    sb.append(',');
152
                }
153
                sb.append(action);
154
                empty = false;
155
            }
156
        }
157
        String actions = takeAll ? "*" : sb.toString();
158
159
        final LayerBuilder b = layer(e);
160
        File f = b.file("Services/Intent/Handlers/" //NOI18N
161
                + getName(e).replace('.', '-') + SUFFIX);
162
        f.position(r.position());
163
        f.stringvalue("instanceClass",                                  //NOI18N
164
                IntentHandler.class.getCanonicalName());
165
        f.methodvalue("instanceCreate", IntentHandler.class.getCanonicalName(),
166
                "create");                                              //NOI18N
167
        f.bundlevalue("displayName", r.displayName());                  //NOI18N
168
        f.stringvalue("uriPattern", r.uriPattern());                    //NOI18N
169
        f.stringvalue("icon", r.icon());                                //NOI18N
170
        f.stringvalue("type", type);                                    //NOI18N
171
        f.stringvalue("actions", actions);                              //NOI18N
172
        f.write();
173
    }
174
175
    private String getName(Element e) {
176
        if (e.getKind().isClass() || e.getKind().isInterface()) {
177
            return processingEnv.getElementUtils().getBinaryName(
178
                    (TypeElement) e).toString();
179
        } else if (e.getKind() == ElementKind.PACKAGE) {
180
            return e.getSimpleName().toString();
181
        } else {
182
            return getName(e.getEnclosingElement()) + '.' + e.getSimpleName();
183
        }
184
    }
185
186
    private TypeElement getTypeElement(Class<?> cls) {
187
        TypeElement typeElement = processingEnv.getElementUtils()
188
                .getTypeElement(cls.getCanonicalName());
189
        return typeElement;
190
    }
191
192
    private IllegalArgumentException error(Element e, String msg) {
193
        StringBuilder sb = new StringBuilder();
194
        sb.append(e.getEnclosingElement().toString());
195
        sb.append("."); //NOI18N
196
        sb.append(e.getSimpleName());
197
        sb.append(":"); //NOI18N
198
        sb.append(System.lineSeparator());
199
        sb.append(msg);
200
        return new IllegalArgumentException(sb.toString());
201
    }
202
}
(-)a/api.intent/src/org/netbeans/spi/intent/IntentHandlerRegistration.java (+86 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.spi.intent;
43
44
import java.util.regex.Pattern;
45
46
/**
47
 * Annotation for registering Intent handlers into the application.
48
 */
49
public @interface IntentHandlerRegistration {
50
51
    /**
52
     * Position of the handler. The lesser value, the bigger priority.
53
     *
54
     * @return The position.
55
     */
56
    int position();
57
58
    /**
59
     * List of supported actions. To support all actions, use "*" wildcard.
60
     *
61
     * @return The URI pattern.
62
     */
63
    String[] actions();
64
65
    /**
66
     * Pattern of supported URIs. See {@link Pattern}. Examples: To handle
67
     * all URIs, use ".*", to handle http adresses, use "http://.*".
68
     *
69
     * @return The URI pattern.
70
     */
71
    String uriPattern();
72
73
    /**
74
     * Display name of this handler. Bundle keys can be used here.
75
     *
76
     * @return The display name.
77
     */
78
    String displayName();
79
80
    /**
81
     * Identifier for an icon, e.g. path or URI.
82
     *
83
     * @return Icon identifier.
84
     */
85
    String icon() default "";
86
}
(-)a/api.intent/test/unit/src/org/netbeans/api/intent/UriIntentTest.java (+161 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.api.intent;
43
44
import java.net.URI;
45
import java.net.URISyntaxException;
46
import java.util.concurrent.ExecutionException;
47
import java.util.concurrent.Future;
48
import org.junit.Test;
49
import static org.junit.Assert.*;
50
import org.junit.Before;
51
import org.netbeans.spi.intent.IntentHandlerRegistration;
52
53
/**
54
 *
55
 * @author jhavlin
56
 */
57
public class UriIntentTest {
58
59
    private static boolean handled = false;
60
61
    @Before
62
    public void setUp() {
63
        handled = false;
64
    }
65
66
    @Test
67
    public void testOpenUri() throws URISyntaxException, InterruptedException,
68
            ExecutionException {
69
70
        assertFalse(handled);
71
        Future<Object> res2 = new Intent(Intent.ACTION_VIEW,
72
                new URI("test://a/b/c/")).execute();
73
        assertNotNull(res2.get());
74
        assertTrue(handled);
75
76
        Future<Object> res3 = new Intent(Intent.ACTION_VIEW,
77
                new URI("other://x/y/z/")).execute();
78
        assertNull(res3.get());
79
    }
80
81
    @Test
82
    public void testSelectAppropriateHandler()
83
            throws URISyntaxException, InterruptedException,
84
            ExecutionException {
85
86
        Future<Object> f0 = new Intent(Intent.ACTION_VIEW,
87
                new URI("unsupported://resource")).execute();
88
        assertNull(f0.get());
89
90
        Future<Object> f1 = new Intent(Intent.ACTION_VIEW,
91
                new URI("netbeans://resource")).execute();
92
        assertEquals(NB_NAME, f1.get());
93
94
        Future<Object> f2 = new Intent(Intent.ACTION_VIEW,
95
                new URI("netbeans://resource?someParam=x")).execute();
96
        assertEquals(NB_NAME, f2.get());
97
98
        Future<Object> f3 = new Intent(Intent.ACTION_VIEW,
99
                new URI("netbeans://resource?x=y&requiredParam=123")).execute();
100
        assertEquals(PARAM_NB_NAME, f3.get());
101
    }
102
103
    /**
104
     * Handler that claims to support all URI patterns, but that actually
105
     * accepts only scheme "test".
106
     *
107
     * @param intent
108
     * @return
109
     */
110
    @SuppressWarnings("PublicInnerClass")
111
    @IntentHandlerRegistration(
112
            displayName = "Test",
113
            position = 999,
114
            uriPattern = ".*",
115
            actions = "*")
116
    public static Object handleIntent(Intent intent) {
117
        URI uri = intent.getUri();
118
        if ("test".equals(uri.getScheme())) {
119
            handled = true;
120
            return new Object();
121
        } else {
122
            return null;
123
        }
124
    }
125
126
    public static final String NB_NAME = "NetBeans Test";
127
128
    /**
129
     * Handler for URIs with scheme "netbeans".
130
     *
131
     * @param intent
132
     * @return
133
     */
134
    @SuppressWarnings("PublicInnerClass")
135
    @IntentHandlerRegistration(
136
            displayName = NB_NAME,
137
            position = 998,
138
            uriPattern = "netbeans://.*",
139
            actions = "*")
140
    public static Object handleNetBeansIntent(Intent intent) {
141
        return NB_NAME;
142
    }
143
144
    public static final String PARAM_NB_NAME = "Parametrized NetBeans Test";
145
146
    /**
147
     * Handler for URIs with scheme "netbeans" and parameter "requiredParam".
148
     *
149
     * @param intent
150
     * @return
151
     */
152
    @SuppressWarnings("PublicInnerClass")
153
    @IntentHandlerRegistration(
154
            displayName = PARAM_NB_NAME,
155
            position = 997,
156
            uriPattern = "netbeans://.*[?&]requiredParam=.+",
157
            actions = "*")
158
    public static Object handleParametrizedNetBeansIntent(Intent intent) {
159
        return PARAM_NB_NAME;
160
    }
161
}
(-)a/nbbuild/build.properties (+1 lines)
Lines 100-105 Link Here
100
config.javadoc.stable=\
100
config.javadoc.stable=\
101
    api.annotations.common,\
101
    api.annotations.common,\
102
    api.html4j,\
102
    api.html4j,\
103
    api.intent,\
103
    api.io,\
104
    api.io,\
104
    api.maven,\
105
    api.maven,\
105
    autoupdate.services,\
106
    autoupdate.services,\
(-)a/nbbuild/cluster.properties (+1 lines)
Lines 195-200 Link Here
195
nb.cluster.platform=\
195
nb.cluster.platform=\
196
        api.annotations.common,\
196
        api.annotations.common,\
197
        api.html4j,\
197
        api.html4j,\
198
        api.intent,\
198
        api.io,\
199
        api.io,\
199
        api.progress,\
200
        api.progress,\
200
        api.progress.compat8,\
201
        api.progress.compat8,\
(-)a/nbbuild/javadoctools/links.xml (+1 lines)
Lines 240-243 Link Here
240
<link href="${javadoc.docs.org-netbeans-modules-parsing-nb}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-parsing-nb"/>
240
<link href="${javadoc.docs.org-netbeans-modules-parsing-nb}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-parsing-nb"/>
241
<link href="${javadoc.docs.org-netbeans-modules-project-libraries-ui}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-project-libraries-ui"/>
241
<link href="${javadoc.docs.org-netbeans-modules-project-libraries-ui}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-netbeans-modules-project-libraries-ui"/>
242
<link href="${javadoc.docs.org-openide-filesystems-nb}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-openide-filesystems-nb"/>
242
<link href="${javadoc.docs.org-openide-filesystems-nb}" offline="true" packagelistloc="${netbeans.javadoc.dir}/org-openide-filesystems-nb"/>
243
<link href="${javadoc.docs.org-netbeans-api-intent}" offline="true" packagelistloc="${netbeans.javadoc.dir}\org-netbeans-api-intent"/>
243
<link href="${javadoc.docs.org-netbeans-api-io}" offline="true" packagelistloc="${netbeans.javadoc.dir}\org-netbeans-api-io"/>
244
<link href="${javadoc.docs.org-netbeans-api-io}" offline="true" packagelistloc="${netbeans.javadoc.dir}\org-netbeans-api-io"/>
(-)a/nbbuild/javadoctools/properties.xml (+1 lines)
Lines 239-242 Link Here
239
<property name="javadoc.docs.org-netbeans-modules-parsing-nb" value="${javadoc.web.root}/org-netbeans-modules-parsing-nb"/>
239
<property name="javadoc.docs.org-netbeans-modules-parsing-nb" value="${javadoc.web.root}/org-netbeans-modules-parsing-nb"/>
240
<property name="javadoc.docs.org-netbeans-modules-project-libraries-ui" value="${javadoc.web.root}/org-netbeans-modules-project-libraries-ui"/>
240
<property name="javadoc.docs.org-netbeans-modules-project-libraries-ui" value="${javadoc.web.root}/org-netbeans-modules-project-libraries-ui"/>
241
<property name="javadoc.docs.org-openide-filesystems-nb" value="${javadoc.web.root}/org-openide-filesystems-nb"/>
241
<property name="javadoc.docs.org-openide-filesystems-nb" value="${javadoc.web.root}/org-openide-filesystems-nb"/>
242
<property name="javadoc.docs.org-netbeans-api-intent" value="${javadoc.web.root}/org-netbeans-api-intent"/>
242
<property name="javadoc.docs.org-netbeans-api-io" value="${javadoc.web.root}/org-netbeans-api-io"/>
243
<property name="javadoc.docs.org-netbeans-api-io" value="${javadoc.web.root}/org-netbeans-api-io"/>
(-)a/nbbuild/javadoctools/replaces.xml (+1 lines)
Lines 239-242 Link Here
239
<replacefilter token="@org-netbeans-modules-parsing-nb@" value="${javadoc.docs.org-netbeans-modules-parsing-nb}"/>
239
<replacefilter token="@org-netbeans-modules-parsing-nb@" value="${javadoc.docs.org-netbeans-modules-parsing-nb}"/>
240
<replacefilter token="@org-netbeans-modules-project-libraries-ui@" value="${javadoc.docs.org-netbeans-modules-project-libraries-ui}"/>
240
<replacefilter token="@org-netbeans-modules-project-libraries-ui@" value="${javadoc.docs.org-netbeans-modules-project-libraries-ui}"/>
241
<replacefilter token="@org-openide-filesystems-nb@" value="${javadoc.docs.org-openide-filesystems-nb}"/>
241
<replacefilter token="@org-openide-filesystems-nb@" value="${javadoc.docs.org-openide-filesystems-nb}"/>
242
<replacefilter token="@org-netbeans-api-intent@" value="${javadoc.docs.org-netbeans-api-intent}"/>
242
<replacefilter token="@org-netbeans-api-io@" value="${javadoc.docs.org-netbeans-api-io}"/>
243
<replacefilter token="@org-netbeans-api-io@" value="${javadoc.docs.org-netbeans-api-io}"/>

Return to bug 248126